APKBUILD examples:Lua: Difference between revisions
(Improve pkgdesc) |
(Switch order in $install_if) |
||
Line 34: | Line 34: | ||
arch="all" | arch="all" | ||
depends="lua$lver" | depends="lua$lver" | ||
install_if=" | install_if="$pkgname=$pkgver-r$pkgrel lua$lver" | ||
cd "$builddir" | cd "$builddir" | ||
Line 82: | Line 82: | ||
arch="all" | arch="all" | ||
depends="lua$lver" | depends="lua$lver" | ||
install_if=" | install_if="$pkgname=$pkgver-r$pkgrel lua$lver" | ||
cd "$builddir-$lver" | cd "$builddir-$lver" |
Revision as of 10:27, 2 October 2016
Module with Makefile supporting multiple Lua versions
pkgname=lua-foo ... arch="noarch" depends="" makedepends="" subpackages="" ... _luaversions="5.1 5.2 5.3" for _v in $_luaversions; do makedepends="$makedepends lua$_v-dev" subpackages="$subpackages lua$_v-${pkgname#lua-}:_package" done build() { cd "$builddir" local lver; for lver in $_luaversions; do msg "Building for Lua $lver..." make all$lver || return 1 done } package() { mkdir -p "$pkgdir" } _package() { local lver="${subpkgname:3:3}" pkgdesc="$pkgdesc (for Lua $lver)" arch="all" depends="lua$lver" install_if="$pkgname=$pkgver-r$pkgrel lua$lver" cd "$builddir" make PREFIX="/usr" DESTDIR="$subpkgdir" install$lver }
Module with simple Makefile
pkgname=lua-foo ... arch="noarch" depends="" makedepends="" subpackages="" ... _luaversions="5.1 5.2 5.3" for _v in $_luaversions; do makedepends="$makedepends lua$_v-dev" subpackages="$subpackages lua$_v-${pkgname#lua-}:_package" done prepare() { default_prepare || return 1 local lver; for lver in $_luaversions; do cp -r "$builddir" "$builddir-$lver" || return 1 done } build() { local lver; for lver in $_luaversions; do msg "Building for Lua $lver..." make -C "$builddir-$lver" || return 1 done } package() { mkdir -p "$pkgdir" } _package() { local lver="${subpkgname:3:3}" pkgdesc="$pkgdesc (for Lua $lver)" arch="all" depends="lua$lver" install_if="$pkgname=$pkgver-r$pkgrel lua$lver" cd "$builddir-$lver" make PREFIX="/usr" DESTDIR="$subpkgdir" install }
Module with rockspec
pkgname=lua-foo ... arch="noarch" depends="" makedepends="" subpackages="" ... _luaversions="5.1 5.2 5.3" for _v in $_luaversions; do makedepends="$makedepends lua$_v-dev luarocks$_v" subpackages="$subpackages lua$_v-${pkgname#lua-}:_package" done build() { cd "$builddir" local lver; for lver in $_luaversions; do msg "Building for Lua $lver..." luarocks-$lver \ CC="$CC" \ CFLAGS="$CFLAGS -fPIC" \ LUA_INCDIR="$(pkg-config --variable=includedir lua$lver)" \ LUA_LIBDIR="$(pkg-config --variable=libdir lua$lver)" \ make --tree=./build rockspecs/compat53-scm-0.rockspec done } package() { mkdir -p "$pkgdir" } _package() { local lver="${subpkgname:3:3}" pkgdesc="$pkgdesc (for Lua $lver)" arch="all" depends="lua$lver" install_if="$pkgname=$pkgver-r$pkgrel lua$lver" local path; for path in lib/lua/$lver share/lua/$lver; do mkdir -p "$subpkgdir"/usr/${path%/*} mv "$builddir"/build/$path "$subpkgdir"/usr/$path/ || return 1 done }