summaryrefslogtreecommitdiff
path: root/devel/lua/MAKEPKG
diff options
context:
space:
mode:
Diffstat (limited to 'devel/lua/MAKEPKG')
-rw-r--r--devel/lua/MAKEPKG83
1 files changed, 83 insertions, 0 deletions
diff --git a/devel/lua/MAKEPKG b/devel/lua/MAKEPKG
new file mode 100644
index 0000000..940faeb
--- /dev/null
+++ b/devel/lua/MAKEPKG
@@ -0,0 +1,83 @@
+#!/bin/mkpkg
+# description: Lightweight embeddable scripting language
+# url: https://www.lua.org
+
+name=lua
+version=5.5.1
+release=1
+_basever=5.5
+depends=()
+source=(https://www.lua.org/ftp/$name-$version.tar.gz)
+
+sha256sums=(
+ "1c4b4068d67061f2a2231ad2b5422e77acea1487ea9890f6320af614f4373dce"
+)
+
+build() {
+ cd $name-$version
+
+ # patch Makefile for shared library and our flags
+ sed -i src/Makefile \
+ -e "s|^CC=.*|CC= ${CC:-cc}|" \
+ -e "s|^CFLAGS=.*|CFLAGS= $CFLAGS -DLUA_COMPAT_5_3 -fPIC|" \
+ -e "s|^MYCFLAGS=.*|MYCFLAGS=|" \
+ -e "s|^MYLDFLAGS=.*|MYLDFLAGS= $LDFLAGS|"
+
+ # build static lib and objects
+ make -C src \
+ SYSCFLAGS="-DLUA_USE_LINUX" \
+ SYSLIBS="-ldl" \
+ all
+
+ # build shared library from objects (exclude lua.o and luac.o — binaries)
+ objs=""
+ for o in src/*.o; do
+ case $o in */lua.o|*/luac.o) continue ;; esac
+ objs="$objs $o"
+ done
+ ${CC:-cc} -shared -Wl,-soname,liblua.so.$_basever \
+ -o src/liblua.so.$version $objs -lm -ldl
+
+ make \
+ INSTALL_TOP=$PKG/usr \
+ INSTALL_MAN=$PKG/usr/share/man/man1 \
+ install
+
+ # shared library
+ install -m 755 src/liblua.so.$version $PKG/usr/lib/liblua.so.$version
+ ln -sf liblua.so.$version $PKG/usr/lib/liblua.so.$_basever
+ ln -sf liblua.so.$version $PKG/usr/lib/liblua.so
+
+ # pkg-config
+ install -d $PKG/usr/lib/pkgconfig
+ printf '%s\n' \
+ "V=$_basever" \
+ "R=$version" \
+ '' \
+ 'prefix=/usr' \
+ 'exec_prefix=${prefix}' \
+ 'libdir=${exec_prefix}/lib' \
+ 'includedir=${prefix}/include' \
+ '' \
+ 'Name: Lua' \
+ 'Description: An Extensible Extension Language' \
+ 'Version: ${R}' \
+ 'Libs: -L${libdir} -llua -lm -ldl' \
+ 'Cflags: -I${includedir}' \
+ > $PKG/usr/lib/pkgconfig/lua.pc
+ ln -sf lua.pc $PKG/usr/lib/pkgconfig/lua-$_basever.pc
+ ln -sf lua.pc $PKG/usr/lib/pkgconfig/lua${_basever}.pc
+
+ # remove static lib
+ rm -f $PKG/usr/lib/liblua.a
+
+ # remove html docs
+ rm -rf $PKG/usr/share/doc
+}
+
+signify() {
+ untrusted comment: public key
+ RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
+}
+
+# vim: filetype=sh