# Template file for 'rc23'
pkgname=rc23
version=2.0.7
revision=1
build_style=gnu-makefile
make_build_args="$(vopt_if readline EDIT=readline)
 $(vopt_if libedit EDIT=edit)"
make_install_args="${make_build_args}"
makedepends="$(vopt_if readline readline-devel)
 $(vopt_if libedit libedit-devel)"
short_desc="Alternative implementation of the plan 9 rc shell"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="Zlib"
homepage="https://codeberg.org/rc23/rc23"
distfiles="https://codeberg.org/rc23/rc23/archive/v${version}.tar.gz"
checksum=b16455d3d26522f1669fa347afc9196d5097531f32d748e329f2b9d9e7c160d8
register_shell="/bin/rc23"

build_options="readline libedit static"
build_options_default="readline"

pre_build() {
	# fake .git/index, else version.h gets rebuilt repeatedly
	mkdir -p .git
	touch .git/index

	if [ "$build_option_static" ]; then
		LDFLAGS+=" -static"
	fi

	if [ "$CROSS_BUILD" ]; then
		make CC="$BUILD_CC" CFLAGS="$BUILD_CFLAGS" LIBS= LDFLAGS= \
			sigmsgs.c sigmsgs.h statval.h
	fi
}
