From 146dbadd4867c64bf5594cd51ee31057dc05b023 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 19 Jun 2018 20:04:21 -0500 Subject: system: pull in lua bull crap for kyua --- system/linenoise/APKBUILD | 31 +++++++ system/linenoise/build-shared-lib.patch | 37 ++++++++ system/lua5.3/APKBUILD | 141 +++++++++++++++++++++++++++++++ system/lua5.3/linenoise.patch | 18 ++++ system/lua5.3/lua-5.3-make.patch | 74 ++++++++++++++++ system/lua5.3/lua-5.3-module_paths.patch | 31 +++++++ system/lutok/APKBUILD | 46 ++++++++++ 7 files changed, 378 insertions(+) create mode 100644 system/linenoise/APKBUILD create mode 100644 system/linenoise/build-shared-lib.patch create mode 100644 system/lua5.3/APKBUILD create mode 100644 system/lua5.3/linenoise.patch create mode 100644 system/lua5.3/lua-5.3-make.patch create mode 100644 system/lua5.3/lua-5.3-module_paths.patch create mode 100644 system/lutok/APKBUILD (limited to 'system') diff --git a/system/linenoise/APKBUILD b/system/linenoise/APKBUILD new file mode 100644 index 000000000..92443594f --- /dev/null +++ b/system/linenoise/APKBUILD @@ -0,0 +1,31 @@ +# Contributor: Natanael Copa +# Maintainer: +pkgname=linenoise +pkgver=1.0 +pkgrel=1 +pkgdesc="Minimal replacement for readline" +url="https://github.com/antirez/linenoise" +arch="all" +options="!check" # No test suite. +license="BSD-2-Clause-NetBSD" +depends="" +depends_dev="" +makedepends="$depends_dev" +install="" +subpackages="$pkgname-dev" +source="linenoise-$pkgver.tar.gz::https://github.com/antirez/linenoise/archive/$pkgver.tar.gz + build-shared-lib.patch + " + +build() { + cd "$builddir" + make +} + +package() { + cd "$builddir" + make DESTDIR="$pkgdir" install +} + +sha512sums="9e68fade8d64d7ba8d5d681e74d0ca6c4ebd9576249bb0e885b1aa708a9af77a43ea6264307ae46fb74e52219387a2c831b570f9601e331837f35294af9883e3 linenoise-1.0.tar.gz +e37fe58f414f48a6a6fcab9925881131d2dbca0c54fe2b17a359d0b5c58ce1e29dad92baa8dc7f7d390af1edace2a75091f20bed5aa381ff2599e734616b2418 build-shared-lib.patch" diff --git a/system/linenoise/build-shared-lib.patch b/system/linenoise/build-shared-lib.patch new file mode 100644 index 000000000..2f9542dcf --- /dev/null +++ b/system/linenoise/build-shared-lib.patch @@ -0,0 +1,37 @@ +--- ./Makefile.orig ++++ ./Makefile +@@ -1,7 +1,33 @@ ++MAJOR_VERSION = 0 ++EXTRA_VERSION = .0.0 ++SONAME = liblinenoise.so.$(MAJOR_VERSION) ++LIB = $(SONAME)$(EXTRA_VERSION) ++ ++export CFLAGS ?= -Os -g ++CFLAGS += -Wall -fpic -DUSE_UTF8 ++LIBDIR ?= /usr/lib ++INCLUDEDIR ?= /usr/include ++ ++.PHONY: all ++all: $(LIB) linenoise_example ++ ++$(LIB): linenoise.o ++ $(CC) $(CFLAGS) -shared -Wl,-soname,$(SONAME) $(LDFLAGS) -o $@ $^ ++ + linenoise_example: linenoise.h linenoise.c + + linenoise_example: linenoise.c example.c + $(CC) -Wall -W -Os -g -o linenoise_example linenoise.c example.c + ++.PHONY: clean + clean: +- rm -f linenoise_example ++ rm -f$(LIB) linenoise_example *.o ++ ++.PHONY: install ++install: $(LIB) ++ install -m 0755 -d $(DESTDIR)$(INCLUDEDIR) ++ install -m 0644 linenoise.h $(DESTDIR)$(INCLUDEDIR) ++ install -m 0755 -d $(DESTDIR)$(LIBDIR) ++ install -m 0755 $(LIB) $(DESTDIR)$(LIBDIR) ++ ldconfig -n $(DESTDIR)$(LIBDIR) ++ ln -s $(LIB) $(DESTDIR)$(LIBDIR)/liblinenoise.so diff --git a/system/lua5.3/APKBUILD b/system/lua5.3/APKBUILD new file mode 100644 index 000000000..34d640721 --- /dev/null +++ b/system/lua5.3/APKBUILD @@ -0,0 +1,141 @@ +# Maintainer: +pkgname=lua5.3 +_pkgname=lua +pkgver=5.3.4 +_luaver=${pkgname#lua} +pkgrel=5 +pkgdesc="Light-weight programming language" +url="https://www.lua.org/" +arch="all" +license="MIT" +ldpath="/usr/lib/$pkgname" +depends_dev="$pkgname" +makedepends="libtool autoconf automake linenoise-dev" +provides="lua" +subpackages="$pkgname-dev $pkgname-doc $pkgname-libs" +source="https://www.lua.org/ftp/$_pkgname-$pkgver.tar.gz + lua-5.3-make.patch + lua-5.3-module_paths.patch + linenoise.patch + " +builddir="$srcdir/$_pkgname-$pkgver" + +prepare() { + default_prepare + cd "$builddir" + + # disable readline + sed -i '/#define LUA_USE_READLINE/d' src/luaconf.h + + # we use libtool + cat > configure.ac <<-EOF + top_buildir=. + + AC_INIT(src/luaconf.h) + AC_PROG_LIBTOOL + AC_OUTPUT() + EOF + libtoolize --force --install && aclocal && autoconf +} + +build() { + cd "$builddir" + + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr + + cd src + make V=${pkgver%.*} \ + CFLAGS="-DLUA_USE_LINUX -DLUA_COMPAT_5_2 -DLUA_USE_LINENOISE" \ + SYSLDFLAGS="$LDFLAGS" \ + RPATH="/usr/lib" \ + LIB_LIBS="-lpthread -lm -ldl -llinenoise" \ + alpine_all +} + +check() { + cd "$builddir" + make test +} + +package() { + local i + cd "$builddir" + + make V=${pkgver%.*} \ + INSTALL_TOP="$pkgdir"/usr \ + INSTALL_INC="$pkgdir"/usr/include/$pkgname \ + INSTALL_LIB="$pkgdir"/usr/lib/$pkgname \ + alpine_install + + for i in "$pkgdir"/usr/bin/* ; do + mv "$i" "$i"$_luaver + done + + for i in "$pkgdir"/usr/lib/$pkgname/*.so.*; do + ln -s $pkgname/${i##*/} "$pkgdir"/usr/lib/${i##*/} + done + + install -D -m 644 doc/lua.1 "$pkgdir"/usr/share/man/man1/lua$_luaver.1 + install -D -m 644 doc/luac.1 "$pkgdir"/usr/share/man/man1/luac$_luaver.1 + + install -d "$pkgdir"/usr/lib/pkgconfig + cat > "$pkgdir"/usr/lib/pkgconfig/lua$_luaver.pc <<-EOF + # lua.pc -- pkg-config data for Lua + + # vars from install Makefile + + # grep '^V=' ../Makefile + V= ${_luaver} + # grep '^R=' ../Makefile + R= ${pkgver} + + # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' + prefix= /usr + INSTALL_BIN= \${prefix}/bin + INSTALL_INC= \${prefix}/include + INSTALL_LIB= \${prefix}/lib + INSTALL_MAN= \${prefix}/man/man1 + INSTALL_LMOD= \${prefix}/share/lua/\${V} + INSTALL_CMOD= \${prefix}/lib/lua/\${V} + + # canonical vars + exec_prefix=\${prefix} + libdir=\${exec_prefix}/lib/$pkgname + includedir=\${prefix}/include/$pkgname + + Name: Lua + Description: An Extensible Extension Language + Version: \${R} + Requires: + Libs: -L\${libdir} -llua -lm + Cflags: -I\${includedir} + + # (end of lua$_luaver.pc) + EOF + +} + +dev() { + default_dev + + mkdir -p "$subpkgdir"/usr/$pkgname "$subpkgdir"/usr/lib/$pkgname + ln -s ../include/$pkgname "$subpkgdir"/usr/$pkgname/include + ln -s ../lib/$pkgname "$subpkgdir"/usr/$pkgname/lib + mv "$pkgdir"/usr/lib/$pkgname/liblua.so "$subpkgdir"/usr/lib/$pkgname/ +} + +libs() { + pkgdesc="Lua dynamic library runtime" + replaces="lua" + + mkdir -p "$subpkgdir"/usr + mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ +} + +sha512sums="739e31f82e6a60fa99910c2005e991b3a1e21339af52847f653cb190b30842054d189ca116ffcfdf9b36e07888c9ce5642b1dd2988cc7eff9f8789f9a2e34997 lua-5.3.4.tar.gz +1bc6c623024c1738155b30ff9c0edcce0f336edc25aa20c3a1400c859421ea2015d75175cce8d515e055ac3e96028426b74812e04022af18a0ed4c4601556027 lua-5.3-make.patch +bc68772390dc8d8940176af0b9fbacc0af61891b5d27de5f1466a4e7f9b3291a1c08ba5add829bc96b789a53fa5ec2dadaa096ca6eabe54ec27724fa2810940f lua-5.3-module_paths.patch +49880d1131b7bd2a3169a26f401769a91d9a6a62cefe68aa5a89097139289588b7ef753535a2d0ba7f45c0369c760554940fd810716b7b1353deace32432fcfe linenoise.patch" diff --git a/system/lua5.3/linenoise.patch b/system/lua5.3/linenoise.patch new file mode 100644 index 000000000..fdca6205a --- /dev/null +++ b/system/lua5.3/linenoise.patch @@ -0,0 +1,18 @@ +--- ./src/lua.c.orig ++++ ./src/lua.c +@@ -85,6 +85,15 @@ + add_history(lua_tostring(L, idx)); /* add it to history */ + #define lua_freeline(L,b) ((void)L, free(b)) + ++#elif defined(LUA_USE_LINENOISE)/* }{ */ ++ ++#include "linenoise.h" ++#define lua_readline(L,b,p) ((void)L, ((b)=linenoise(p)) != NULL) ++#define lua_saveline(L,idx) \ ++ if (lua_rawlen(L,idx) > 0) /* non-empty line? */ \ ++ linenoiseHistoryAdd(lua_tostring(L, idx)); /* add it to history */ ++#define lua_freeline(L,b) ((void)L, free(b)) ++ + #else /* }{ */ + + #define lua_readline(L,b,p) \ diff --git a/system/lua5.3/lua-5.3-make.patch b/system/lua5.3/lua-5.3-make.patch new file mode 100644 index 000000000..349218607 --- /dev/null +++ b/system/lua5.3/lua-5.3-make.patch @@ -0,0 +1,74 @@ +diff --git a/Makefile b/Makefile +index 7fa91c8..c85ede2 100644 +--- a/Makefile ++++ b/Makefile +@@ -112,3 +112,18 @@ pc: + .PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho + + # (end of Makefile) ++ ++# Use libtool for binary installs, etc. ++ ++export V ++export LIBTOOL = ../libtool --quiet --tag=CC ++# See libtool manual about how to set this ++ ++alpine_clean: ++ cd src; $(MAKE) $@ ++ ++alpine_install: ++ mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) ++ cd src; $(LIBTOOL) --mode=install $(INSTALL_EXEC) lua luac $(INSTALL_BIN) ++ cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) ++ cd src; $(LIBTOOL) --mode=install $(INSTALL_DATA) liblua.la $(INSTALL_LIB) +diff --git a/src/Makefile b/src/Makefile +index 2e7a412..a72f342 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -59,10 +59,10 @@ $(LUA_A): $(BASE_O) + $(AR) $@ $(BASE_O) + $(RANLIB) $@ + +-$(LUA_T): $(LUA_O) $(LUA_A) ++origin$(LUA_T): $(LUA_O) $(LUA_A) + $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) + +-$(LUAC_T): $(LUAC_O) $(LUA_A) ++origin$(LUAC_T): $(LUAC_O) $(LUA_A) + $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) + + clean: +@@ -194,4 +194,33 @@ lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ + lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \ + lobject.h ltm.h lzio.h + ++ ++export LIBTOOL = ../libtool --quiet --tag=CC ++export LIB_VERSION = 0:0:0 ++ ++# The following rules use libtool for compiling and linking in order to ++# provide shared library support. ++ ++LIB_NAME = liblua.la ++LIB_OBJS = $(CORE_O:.o=.lo) $(LIB_O:.o=.lo) ++ ++%.lo %.o: %.c ++ $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< ++ ++$(LIB_NAME): $(LIB_OBJS) ++ $(LIBTOOL) --mode=link $(CC) -version-info $(LIB_VERSION) -release $(V) \ ++ -rpath $(RPATH) $(LDFLAGS) -o $(LIB_NAME) $(LIB_OBJS) $(LIB_LIBS) ++ ++$(LUA_T): $(LUA_O:.o=.lo) $(LIB_NAME) ++ $(LIBTOOL) --mode=link $(CC) -export-dynamic $(LDFLAGS) -o $@ \ ++ $(LUA_O:.o=.lo) $(LIB_NAME) $(LUA_LIBS) ++ ++$(LUAC_T): $(LUAC_O:.o=.lo) $(LIB_NAME) ++ $(LIBTOOL) --mode=link $(CC) -static $(LDFLAGS) -o $@ $(LUAC_O:.o=.lo) \ ++ $(LIB_NAME) ++ ++alpine_clean: ++ $(LIBTOOL) --mode=clean $(RM) $(ALL_O:.o=.lo) $(LIB_NAME) lua luac ++ ++alpine_all: $(LIB_NAME) $(LUA_T) $(LUAC_T) + # (end of Makefile) diff --git a/system/lua5.3/lua-5.3-module_paths.patch b/system/lua5.3/lua-5.3-module_paths.patch new file mode 100644 index 000000000..313d9c609 --- /dev/null +++ b/system/lua5.3/lua-5.3-module_paths.patch @@ -0,0 +1,31 @@ +diff --git a/src/luaconf.h b/src/luaconf.h +index fd28d21..4c65295 100644 +--- a/src/luaconf.h ++++ b/src/luaconf.h +@@ -203,12 +201,25 @@ + #define LUA_ROOT "/usr/local/" + #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" + #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" ++ ++#define LUA_VENDOR_ROOT "/usr/" ++/* Path for version-specific Lua modules. */ ++#define LUA_VENDOR_LDIR LUA_VENDOR_ROOT "share/lua/" LUA_VDIR "/" ++/* Path for Lua modules that are compatible with Lua 5.1 and newer. */ ++#define LUA_VENDOR_COMMON_LDIR LUA_VENDOR_ROOT "share/lua/common/" ++#define LUA_VENDOR_CDIR LUA_VENDOR_ROOT "lib/lua/" LUA_VDIR "/" ++ + #define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ ++ LUA_VENDOR_LDIR"?.lua;" LUA_VENDOR_LDIR"?/init.lua;" \ ++ LUA_VENDOR_CDIR"?.lua;" LUA_VENDOR_CDIR"?/init.lua;" \ ++ LUA_VENDOR_COMMON_LDIR"?.lua;" LUA_VENDOR_COMMON_LDIR"?/init.lua;" \ + "./?.lua;" "./?/init.lua" + #define LUA_CPATH_DEFAULT \ +- LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" ++ LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" \ ++ LUA_VENDOR_CDIR"?.so;" LUA_VENDOR_CDIR"loadall.so;" \ ++ "./?.so" + #endif /* } */ + + diff --git a/system/lutok/APKBUILD b/system/lutok/APKBUILD new file mode 100644 index 000000000..61106b7b3 --- /dev/null +++ b/system/lutok/APKBUILD @@ -0,0 +1,46 @@ +# Maintainer: William Pitcock +pkgname=lutok +pkgver=0.4 +pkgrel=2 +pkgdesc="Lightweight C++ API for Lua" +url="https://github.com/jmmv/lutok" +arch="all" +license="BSD" +depends_dev="lua5.3-dev" +makedepends="$depends_dev" +subpackages="$pkgname-dev $pkgname-doc" +source="https://github.com/jmmv/lutok/releases/download/lutok-$pkgver/lutok-$pkgver.tar.gz" +builddir="$srcdir/lutok-$pkgver" + +prepare() { + cd "$builddir" + default_prepare + update_config_sub +} + +build() { + cd "$builddir" + + LUA_CFLAGS=$(pkg-config --cflags lua5.3) \ + LUA_LIBS=$(pkg-config --libs lua5.3) \ + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var + make +} + +check() { + cd "$builddir" + make check +} + +package() { + cd "$builddir" + make -j1 DESTDIR="$pkgdir" install +} + +sha512sums="664f30099bfbb30978e24068a9232a4ff1b5b1839c601bf784f35f6bb1394558067495093a3b0343c94e756d2e4186a32a8227baf5934c15c45905f7c0a5d19c lutok-0.4.tar.gz" -- cgit v1.2.3-60-g2f50