aboutsummaryrefslogblamecommitdiffstats
path: root/community/fennel/APKBUILD
blob: 33cd66fa694cdd24bc218c4b398007125a9021a7 (plain) (tree)
1
2
3
4
5
6
7
8
9


                                                 
            
        

                             
                                                          
             
             
                                                                                            


















                                                                               
 
         






                                                                                                 

 
         





                                           
 
 
           










                                                     
                                      
                                                          
 
                                      
                                                                 
 
                                      












                                                            

 
            
                                                                                                                                                     
 
# Contributor: Will Sinatra <wpsinatra@gmail.com>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=fennel
pkgver=1.0.0
pkgrel=1
pkgdesc="A Lua Lisp Language"
url="https://fennel-lang.org"
arch="all" #detects noarch, but contains compiled binaries
license="MIT"
options="net"
source="fennel-$pkgver.tar.gz::https://git.sr.ht/~technomancy/fennel/archive/$pkgver.tar.gz"
depends=""
makedepends=""
subpackages=""
replaces="fennel"

_lua_versions="5.3 5.4"
for _v in $_lua_versions; do
	makedepends="$makedepends lua$_v lua$_v-dev lua$_v-libs"
	subpackages="$subpackages $pkgname$_v:_subpackage $pkgname$_v-doc:_doc"
done
_builddir="$srcdir/fennel-$pkgver"

prepare() {
	default_prepare

	for _v in $_lua_versions; do
		  cp -r "$builddir" "$builddir-$_v"
	done
}

build() {
	for _v in $_lua_versions; do
		msg "Building for lua$_v..."
		cd "$builddir-$_v"

		make fennel.lua fennel-bin LUA=lua$_v NATIVE_LUA_LIB=/usr/lib/liblua-$_v.so.0.0.0
		./fennel-bin --compile src/fennel/binary.fnl > binary.lua
	done
}

check() {
	for _v in $_lua_versions; do
		msg "Testing for lua$_v..."
		cd "$builddir-$_v"

		make test LUA=lua$_v
	done
}

package() {
	mkdir -p "$pkgdir"
}

_subpackage() {
	local _v="${subpkgname#"$pkgname"}"
	pkgdesc="A Lua Lisp Language for Lua $_v"
	install_if="lua$_v $pkgname=$pkgver-r$pkgrel"
	depends="$depends lua$_v"

	cd "$builddir-$_v"

	install -Dm0644 "fennel.lua" \
			-t "$subpkgdir/usr/share/lua/$_v/"

	install -Dm0644 "binary.lua" \
			-t "$subpkgdir/usr/share/lua/$_v/fennel/"

	install -Dm0755 "fennel-bin" \
			"$subpkgdir/usr/bin/fennel$_v"
}

_doc() {
	local _ver=${subpkgname#"$pkgname"}
	local _v=$(printf '%s' "$_ver" | sed 's|-doc||')
	pkgdesc="Documentation for Fennel built with Lua$_v"

	cd "$builddir-$_v"

	gzip -9 fennel.1
	install -Dm0644 "fennel.1.gz" \
			-t "$subpkgdir/usr/share/man/man1/"
}

sha512sums="
4ad1635807d244297fdc7bf7c06568ae708ae805dcaac2bb190fad412da21c9e3c3b86a6afa223e343488c725afea94682f213332fb22ba66eb5190e97f18415  fennel-1.0.0.tar.gz
"