Browse Source

lua: Add and replace luajit

luajit is rather complex and lacking upstream maintenance.
android-5
Fredrik Fornwall 8 years ago
parent
commit
154bc46225
  1. 61
      packages/liblua/Makefile.patch
  2. 25
      packages/liblua/build.sh
  3. 3
      packages/liblua/lua.subpackage.sh
  4. 60
      packages/liblua/src-Makefile.patch
  5. 12
      packages/liblua/src-luaconf.h.patch
  6. 52
      packages/libluajit/build.sh
  7. 18
      packages/libluajit/etc-luajit.pc.patch
  8. 3
      packages/libluajit/luajit.subpackage.sh
  9. 62
      packages/libluajit/src-Makefile.patch
  10. 6
      packages/luarocks/build.sh
  11. 1
      packages/neovim/build.sh
  12. 12
      packages/weechat/cmake-FindRuby.cmake.patch
  13. 2
      packages/weechat/weechat-lua-plugin.subpackage.sh
  14. 1
      scripts/setup-ubuntu.sh

61
packages/liblua/Makefile.patch

@ -0,0 +1,61 @@
diff -r -u ../lua-5.3.3/Makefile ./Makefile
--- ../lua-5.3.3/Makefile 2016-01-14 02:13:47.000000000 +0100
+++ ./Makefile 2017-01-18 00:40:05.179293935 +0100
@@ -4,17 +4,17 @@
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
# Your platform. See PLATS for possible values.
-PLAT= none
+PLAT= linux
# Where to install. The installation starts in the src and doc directories,
# so take care if INSTALL_TOP is not an absolute path. See the local target.
# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with
# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
-INSTALL_TOP= /usr/local
+INSTALL_TOP= $(PREFIX)
INSTALL_BIN= $(INSTALL_TOP)/bin
INSTALL_INC= $(INSTALL_TOP)/include
INSTALL_LIB= $(INSTALL_TOP)/lib
-INSTALL_MAN= $(INSTALL_TOP)/man/man1
+INSTALL_MAN= $(INSTALL_TOP)/share/man/man1
INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
@@ -38,21 +38,21 @@
# Convenience platforms targets.
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
+# Lua version and release.
+V= 5.3
+R= $V.3
+
# What to install.
TO_BIN= lua luac
TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
-TO_LIB= liblua.a
+TO_LIB= liblua.a liblua.so.$(R)
TO_MAN= lua.1 luac.1
-# Lua version and release.
-V= 5.3
-R= $V.3
-
# Targets start here.
all: $(PLAT)
$(PLATS) clean:
- cd src && $(MAKE) $@
+ cd src && $(MAKE) $@ V=$(V) R=$(R)
test: dummy
src/lua -v
@@ -63,6 +63,8 @@
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
+ ln -f -s $(INSTALL_LIB)/liblua.so.$(R) $(INSTALL_LIB)/liblua.so.$(V)
+ ln -f -s $(INSTALL_LIB)/liblua.so.$(R) $(INSTALL_LIB)/liblua.so
uninstall:
cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)

25
packages/liblua/build.sh

@ -0,0 +1,25 @@
TERMUX_PKG_HOMEPAGE=https://www.lua.org/
TERMUX_PKG_DESCRIPTION="Shared library for the Lua interpreter"
TERMUX_PKG_VERSION=5.3.3
TERMUX_PKG_REVISION=4
TERMUX_PKG_SRCURL=https://www.lua.org/ftp/lua-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_EXTRA_MAKE_ARGS=linux
TERMUX_PKG_BUILD_IN_SRC=yes
TERMUX_PKG_CONFLICTS=libluajit
TERMUX_PKG_REPLACES=libluajit
termux_step_pre_configure () {
AR+=" rcu"
CFLAGS+=" -fPIC"
}
termux_step_post_make_install() {
# Add a pkg-config file for the system zlib
cat > "$PKG_CONFIG_LIBDIR/lua.pc" <<-HERE
Name: Lua
Description: An Extensible Extension Language
Version: $TERMUX_PKG_VERSION
Requires:
Libs: -llua -lm
HERE
}

3
packages/liblua/lua.subpackage.sh

@ -0,0 +1,3 @@
TERMUX_SUBPKG_INCLUDE="bin/ share/man/man1/"
TERMUX_SUBPKG_DESCRIPTION="Simple, extensible, embeddable programming language"
TERMUX_SUBPKG_DEPENDS="readline"

60
packages/liblua/src-Makefile.patch

@ -0,0 +1,60 @@
diff -r -u ../lua-5.3.3/src/Makefile ./src/Makefile
--- ../lua-5.3.3/src/Makefile 2015-05-27 13:10:11.000000000 +0200
+++ ./src/Makefile 2017-01-18 00:26:04.985042439 +0100
@@ -4,31 +4,20 @@
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
# Your platform. See PLATS for possible values.
-PLAT= none
+PLAT= linux
-CC= gcc -std=gnu99
-CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
+CFLAGS+= $(SYSCFLAGS)
-LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
+LDFLAGS+= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS)
-AR= ar rcu
-RANLIB= ranlib
RM= rm -f
-SYSCFLAGS=
-SYSLDFLAGS=
-SYSLIBS=
-
-MYCFLAGS=
-MYLDFLAGS=
-MYLIBS=
-MYOBJS=
-
# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
LUA_A= liblua.a
+LUA_SO= liblua.so
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
ltm.o lundump.o lvm.o lzio.o
@@ -43,7 +32,7 @@
LUAC_O= luac.o
ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
ALL_A= $(LUA_A)
# Targets start here.
@@ -59,6 +48,11 @@
$(AR) $@ $(BASE_O)
$(RANLIB) $@
+$(LUA_SO): $(CORE_O) $(LIB_O)
+ $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
+ ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
+ ln -sf $(LUA_SO).$(R) $(LUA_SO)
+
$(LUA_T): $(LUA_O) $(LUA_A)
$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)

12
packages/liblua/src-luaconf.h.patch

@ -0,0 +1,12 @@
diff -r -u ../lua-5.3.3/src/luaconf.h ./src/luaconf.h
--- ../lua-5.3.3/src/luaconf.h 2016-05-01 22:06:09.000000000 +0200
+++ ./src/luaconf.h 2017-01-17 23:47:26.867840450 +0100
@@ -188,7 +188,7 @@
#else /* }{ */
-#define LUA_ROOT "/usr/local/"
+#define LUA_ROOT "@TERMUX_PREFIX@"
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
#define LUA_PATH_DEFAULT \

52
packages/libluajit/build.sh

@ -1,52 +0,0 @@
TERMUX_PKG_HOMEPAGE=https://luajit.org/
TERMUX_PKG_DESCRIPTION="Just-In-Time Compiler for Lua"
TERMUX_PKG_VERSION=2.1.0~beta2
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://luajit.org/download/LuaJIT-2.1.0-beta2.tar.gz
TERMUX_PKG_EXTRA_MAKE_ARGS="V=1 amalg PREFIX=$TERMUX_PREFIX"
TERMUX_PKG_BUILD_IN_SRC=yes
TERMUX_PKG_CONFLICTS="lua,lua-dev"
TERMUX_PKG_REPLACES="lua,lua-dev"
termux_step_pre_configure() {
# luajit wants same pointer size for host and target build
export HOST_CC="gcc"
if [ $TERMUX_ARCH_BITS = "32" ]; then
if [ `uname` = "Linux" ]; then
# NOTE: "apt install libc6-dev-i386" for 32-bit headers
export HOST_CFLAGS="-m32" # -arch i386"
export HOST_LDFLAGS="-m32" # arch i386"
elif [ `uname` = "Darwin" ]; then
export HOST_CFLAGS="-m32 -arch i386"
export HOST_LDFLAGS="-arch i386"
fi
fi
export TARGET_FLAGS="$CFLAGS $CPPFLAGS $LDFLAGS"
export TARGET_SYS=Linux
}
termux_step_make_install () {
cp $TERMUX_PKG_SRCDIR/src/{lauxlib.h,lua.h,lua.hpp,luaconf.h,luajit.h,lualib.h} $TERMUX_PREFIX/include/
rm -f $TERMUX_PREFIX/lib/libluajit*
cp $TERMUX_PKG_SRCDIR/src/libluajit.so $TERMUX_PREFIX/lib/libluajit-5.1.so
(cd $TERMUX_PREFIX/include; ln -s -f libluajit-5.1.so libluajit.so; ln -s -f libluajit-5.1.so liblua.so)
mkdir -p $TERMUX_PREFIX/share/man/man1/
cp $TERMUX_PKG_SRCDIR/etc/luajit.1 $TERMUX_PREFIX/share/man/man1/
(cd $TERMUX_PREFIX/share/man/man1/; ln -s -f luajit.1 lua.1)
cp $TERMUX_PKG_SRCDIR/etc/luajit.pc $TERMUX_PREFIX/lib/pkgconfig/
(cd $TERMUX_PREFIX/lib/pkgconfig; ln -s -f luajit.pc lua.pc)
rm -f $TERMUX_PREFIX/bin/luajit
cp $TERMUX_PKG_SRCDIR/src/luajit $TERMUX_PREFIX/bin/luajit
(cd $TERMUX_PREFIX/bin; ln -s -f luajit lua)
# Files needed for the -b option (http://luajit.org/running.html) to work.
# Note that they end up in the 'luajit' subpackage, not the 'libluajit' one.
TERMUX_LUAJIT_JIT_FOLDER_RELATIVE=share/luajit-$TERMUX_PKG_VERSION/jit
local TERMUX_LUAJIT_JIT_FOLDER=$TERMUX_PREFIX/$TERMUX_LUAJIT_JIT_FOLDER_RELATIVE
rm -Rf $TERMUX_LUAJIT_JIT_FOLDER
mkdir -p $TERMUX_LUAJIT_JIT_FOLDER
cp $TERMUX_PKG_SRCDIR/src/jit/*lua $TERMUX_LUAJIT_JIT_FOLDER
}

18
packages/libluajit/etc-luajit.pc.patch

@ -1,18 +0,0 @@
diff -u -r ../LuaJIT-2.1.0-beta2/etc/luajit.pc ./etc/luajit.pc
--- ../LuaJIT-2.1.0-beta2/etc/luajit.pc 2016-03-03 06:40:00.000000000 -0500
+++ ./etc/luajit.pc 2016-11-25 17:58:38.914012186 -0500
@@ -5,12 +5,12 @@
version=${majver}.${minver}.${relver}-beta2
abiver=5.1
-prefix=/usr/local
+prefix=@TERMUX_PREFIX@
multilib=lib
exec_prefix=${prefix}
libdir=${exec_prefix}/${multilib}
libname=luajit-${abiver}
-includedir=${prefix}/include/luajit-${majver}.${minver}
+includedir=${prefix}/include
INSTALL_LMOD=${prefix}/share/lua/${abiver}
INSTALL_CMOD=${prefix}/${multilib}/lua/${abiver}

3
packages/libluajit/luajit.subpackage.sh

@ -1,3 +0,0 @@
TERMUX_SUBPKG_INCLUDE="bin/luajit bin/lua share/man/man1 $TERMUX_LUAJIT_JIT_FOLDER_RELATIVE"
TERMUX_SUBPKG_DESCRIPTION="Just-In-Time compiler for Lua - command line tool"
TERMUX_SUBPKG_DEPENDS="libluajit"

62
packages/libluajit/src-Makefile.patch

@ -1,62 +0,0 @@
diff -u -r ../LuaJIT-2.1.0-beta2/src/Makefile ./src/Makefile
--- ../LuaJIT-2.1.0-beta2/src/Makefile 2016-03-03 12:40:00.000000000 +0100
+++ ./src/Makefile 2017-01-15 17:10:13.854284079 +0100
@@ -27,7 +27,7 @@
DEFAULT_CC = gcc
#
# LuaJIT builds as a native 32 or 64 bit binary by default.
-CC= $(DEFAULT_CC)
+CC?= $(DEFAULT_CC)
#
# Use this if you want to force a 32 bit build on a 64 bit multilib OS.
#CC= $(DEFAULT_CC) -m32
@@ -71,14 +71,14 @@
# as dynamic mode.
#
# Mixed mode creates a static + dynamic library and a statically linked luajit.
-BUILDMODE= mixed
+#BUILDMODE= mixed
#
# Static mode creates a static library and a statically linked luajit.
#BUILDMODE= static
#
# Dynamic mode creates a dynamic library and a dynamically linked luajit.
# Note: this executable will only run when the library is installed!
-#BUILDMODE= dynamic
+BUILDMODE= dynamic
#
##############################################################################
@@ -191,7 +191,7 @@
CCOPTIONS= $(CCDEBUG) $(ASOPTIONS)
LDOPTIONS= $(CCDEBUG) $(LDFLAGS)
-HOST_CC= $(CC)
+HOST_CC?= $(CC)
HOST_RM= rm -f
# If left blank, minilua is built and used. You can supply an installed
# copy of (plain) Lua 5.1 or 5.2, plus Lua BitOp. E.g. with: HOST_LUA=lua
@@ -204,17 +204,17 @@
HOST_ALDFLAGS= $(LDOPTIONS) $(HOST_XLDFLAGS) $(HOST_LDFLAGS)
HOST_ALIBS= $(HOST_XLIBS) $(LIBS) $(HOST_LIBS)
-STATIC_CC = $(CROSS)$(CC)
-DYNAMIC_CC = $(CROSS)$(CC) -fPIC
+STATIC_CC = $(CC)
+DYNAMIC_CC = $(CC) -fPIC
TARGET_CC= $(STATIC_CC)
TARGET_STCC= $(STATIC_CC)
TARGET_DYNCC= $(DYNAMIC_CC)
-TARGET_LD= $(CROSS)$(CC)
-TARGET_AR= $(CROSS)ar rcus
-TARGET_STRIP= $(CROSS)strip
+TARGET_LD= $(CC)
+TARGET_AR= $(AR) rcus
+TARGET_STRIP= $(STRIP)
TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib)
-TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER)
+TARGET_SONAME= libluajit-$(ABIVER).so
TARGET_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).dylib
TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME)
TARGET_DLLNAME= lua$(NODOTABIVER).dll

6
packages/luarocks/build.sh

@ -1,12 +1,12 @@
TERMUX_PKG_HOMEPAGE=https://luarocks.org/
TERMUX_PKG_DESCRIPTION="Deployment and management system for Lua modules"
TERMUX_PKG_VERSION=2.4.1
TERMUX_PKG_VERSION=2.4.2
TERMUX_PKG_SRCURL=https://luarocks.org/releases/luarocks-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_DEPENDS="curl, luajit"
TERMUX_PKG_DEPENDS="curl, lua"
TERMUX_PKG_BUILD_IN_SRC=yes
termux_step_configure () {
./configure --prefix=$TERMUX_PREFIX \
--with-lua=$TERMUX_PREFIX \
--lua-version=5.1
--lua-version=5.3
}

1
packages/neovim/build.sh

@ -7,7 +7,6 @@ TERMUX_PKG_DEPENDS="libuv, libmsgpack, libandroid-support, libvterm, libtermkey,
TERMUX_PKG_FOLDERNAME="neovim-$_COMMIT"
TERMUX_PKG_HOSTBUILD=true
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="-DENABLE_JEMALLOC=OFF -DGPERF_PRG=$TERMUX_PKG_HOSTBUILD_DIR/deps/usr/bin/gperf"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLUA_PRG=$TERMUX_PKG_HOSTBUILD_DIR/deps/usr/bin/luajit"
termux_step_host_build () {
mkdir -p $TERMUX_PKG_HOSTBUILD_DIR/deps

12
packages/weechat/cmake-FindRuby.cmake.patch

@ -0,0 +1,12 @@
diff -u -r ../weechat-1.7/cmake/FindRuby.cmake ./cmake/FindRuby.cmake
--- ../weechat-1.7/cmake/FindRuby.cmake 2017-01-15 07:41:25.000000000 +0100
+++ ./cmake/FindRuby.cmake 2017-01-17 22:41:59.681388711 +0100
@@ -33,7 +33,7 @@
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
- pkg_search_module(RUBY ruby-2.3 ruby-2.2 ruby-2.1 ruby-2.0 ruby-1.9 ruby-1.8)
+ pkg_search_module(RUBY ruby-2.4 ruby-2.3 ruby-2.2 ruby-2.1 ruby-2.0 ruby-1.9 ruby-1.8)
endif()
if(RUBY_FOUND)

2
packages/weechat/weechat-lua-plugin.subpackage.sh

@ -1,3 +1,3 @@
TERMUX_SUBPKG_INCLUDE="lib/weechat/plugins/lua.so"
TERMUX_SUBPKG_DESCRIPTION="WeeChat Lua Plugin"
TERMUX_SUBPKG_DEPENDS="weechat, luajit"
TERMUX_SUBPKG_DEPENDS="weechat, liblua"

1
scripts/setup-ubuntu.sh

@ -12,7 +12,6 @@ PACKAGES="$PACKAGES gettext" # Provides 'msgfmt' which the apt build uses.
PACKAGES="$PACKAGES git" # Used by the neovim build.
PACKAGES="$PACKAGES help2man"
PACKAGES="$PACKAGES intltool" # Used by qalc build.
PACKAGES="$PACKAGES libc6-dev-i386" # Needed by luajit host part of the build for <sys/cdefs.h>.
PACKAGES="$PACKAGES libcurl4-openssl-dev" # XXX: Needed by apt build.
PACKAGES="$PACKAGES libgdk-pixbuf2.0-dev" # Provides 'gkd-pixbuf-query-loaders' which the librsvg build uses.
PACKAGES="$PACKAGES libglib2.0-dev" # Provides 'glib-genmarshal' which the glib build uses.

Loading…
Cancel
Save