libk  PKGBUILD at [c231d33808]

File dist/PKGBUILD artifact 7b18c1e325 part of check-in c231d33808


pkgname=libk
pkgver=live
pkgrel=1
pkgdesc='a modern base library for C to replace libc'
url='https://c.comint.su/libk'
license=(AGPL)
source=('https://c.comint.su/libk/tarball/trunk/libk.tar.gz')
md5sums=(SKIP)
arch=(i686 x86_64 aarch64 armv7l)
depends=()
makedepends=(binutils bash yasm)

build() {
	export os=lin library=both
	case $(uname -m) in
		# i have no idea why, but the "arch" environment variable name
		# appears tainted somehow, and gets blanked between here and
		# the call to the build script. ugly hack but it works
		i386|i686) kind=x86; export bits=32;;
		   x86_64) kind=x86; export bits=64;;
		   armv7l) kind=arm; export bits=32;;
		  aarch64) kind=arm; export bits=64;;

		*) echo "(error) your architecture is currently not supported by the libk project"
		   return 1;;
	esac
	if pacman -T cmark; then
		export doc=yes
	else
		echo "(warning) cmark not installed; docs will not be built"
		export doc=no
	fi

	cd "$srcdir/libk"
	arch=$kind ./build.sh
}

package() {
	if test "$doc" = yes; then
		install -D "$srcdir/$pkgname/out/doc/html/"* -t "$pkgdir/usr/share/doc/libk/pdf/" 
		install -D "$srcdir/$pkgname/out/doc/pdf/"* -t "$pkgdir/usr/share/doc/libk/html/" 
		install -D "$srcdir/$pkgname/out/doc/man/"* -t "$pkgdir/usr/share/man/man3/" 
	fi

	install -D "$srcdir/$pkgname"/out/{libk.{so,a},kboot.o} -t "$pkgdir/usr/lib/" 
	install -D "$srcdir/$pkgname/out/k/"* -t "$pkgdir/usr/include/k/" 
}