Browse Source

Let luajit replace lua completely

android-5
Fredrik Fornwall 8 years ago
parent
commit
5e8d636790
  1. 31
      packages/libluajit/build.sh
  2. 18
      packages/libluajit/etc-luajit.pc.patch
  3. 2
      packages/libluajit/luajit.subpackage.sh
  4. 13
      packages/libluajit/src-Makefile.patch
  5. 17
      packages/lua/Makefile.patch
  6. 13
      packages/lua/build.sh
  7. 18
      packages/lua/src-Makefile.patch
  8. 12
      packages/lua/src-luaconf.h.patch
  9. 12
      packages/luarocks/Makefile.patch
  10. 10
      packages/luarocks/build.sh

31
packages/libluajit/build.sh

@ -1,9 +1,12 @@
TERMUX_PKG_HOMEPAGE=http://luajit.org/
TERMUX_PKG_HOMEPAGE=https://luajit.org/
TERMUX_PKG_DESCRIPTION="Just-In-Time Compiler for Lua"
TERMUX_PKG_VERSION=2.1.0~beta2
TERMUX_PKG_SRCURL=http://luajit.org/download/LuaJIT-2.1.0-beta2.tar.gz
TERMUX_PKG_BUILD_REVISION=1
TERMUX_PKG_SRCURL=https://luajit.org/download/LuaJIT-2.1.0-beta2.tar.gz
TERMUX_PKG_EXTRA_MAKE_ARGS="amalg PREFIX=$TERMUX_PREFIX"
TERMUX_PKG_BUILD_IN_SRC=yes
TERMUX_PKG_CONFLICTS="lua,lua-dev"
TERMUX_PKG_REPLACES="lua,lua-dev"
termux_step_post_extract_package() {
# luajit wants same pointer size for host and target build
@ -27,19 +30,21 @@ termux_step_post_extract_package() {
}
termux_step_make_install () {
mkdir -p $TERMUX_PREFIX/include/luajit-2.0
cp $TERMUX_PKG_SRCDIR/src/{lauxlib.h,lua.h,lua.hpp,luaconf.h,luajit.h,lualib.h} $TERMUX_PREFIX/include/luajit-2.0/
cp $TERMUX_PKG_SRCDIR/src/libluajit.so $TERMUX_PREFIX/lib/libluajit-5.1.so.2
(cd $TERMUX_PREFIX/lib; rm -f libluajit-5.1.so; ln -s libluajit-5.1.so.2 libluajit-5.1.so)
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/
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/
perl -p -i -e "s|^prefix=.*|prefix=${TERMUX_PREFIX}|" $TERMUX_PREFIX/lib/pkgconfig/luajit.pc
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/
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.
@ -49,5 +54,5 @@ termux_step_make_install () {
mkdir -p $TERMUX_LUAJIT_JIT_FOLDER
cp $TERMUX_PKG_SRCDIR/src/jit/*lua $TERMUX_LUAJIT_JIT_FOLDER
STRIP=$ORIG_STRIP
STRIP=$ORIG_STRIP
}

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

@ -0,0 +1,18 @@
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}

2
packages/libluajit/luajit.subpackage.sh

@ -1,3 +1,3 @@
TERMUX_SUBPKG_INCLUDE="bin/luajit share/man/man1 $TERMUX_LUAJIT_JIT_FOLDER_RELATIVE"
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"

13
packages/libluajit/Makefile.patch → packages/libluajit/src-Makefile.patch

@ -1,6 +1,6 @@
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 2016-06-11 00:59:21.000000000 +0200
--- ../LuaJIT-2.1.0-beta2/src/Makefile 2016-03-03 06:40:00.000000000 -0500
+++ ./src/Makefile 2016-11-25 17:40:27.794487169 -0500
@@ -71,14 +71,14 @@
# as dynamic mode.
#
@ -29,3 +29,12 @@ diff -u -r ../LuaJIT-2.1.0-beta2/src/Makefile ./src/Makefile
endif
##############################################################################
@@ -214,7 +210,7 @@
TARGET_STRIP= $(CROSS)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

17
packages/lua/Makefile.patch

@ -1,17 +0,0 @@
diff -u -r ../lua-5.3.0/Makefile ./Makefile
--- ../lua-5.3.0/Makefile 2014-10-29 19:14:41.000000000 -0400
+++ ./Makefile 2015-05-24 18:05:30.039061174 -0400
@@ -10,11 +10,11 @@
# 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= @TERMUX_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

13
packages/lua/build.sh

@ -1,13 +0,0 @@
TERMUX_PKG_HOMEPAGE=http://www.lua.org/
TERMUX_PKG_DESCRIPTION="Powerful, fast, lightweight, embeddable scripting language"
TERMUX_PKG_VERSION=5.3.3
TERMUX_PKG_BUILD_REVISION=3
TERMUX_PKG_SRCURL=http://www.lua.org/ftp/lua-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_DEPENDS="readline"
TERMUX_PKG_EXTRA_MAKE_ARGS=linux
TERMUX_PKG_BUILD_IN_SRC=yes
termux_step_pre_configure () {
AR="$AR rcu"
LDFLAGS="$LDFLAGS -lm"
}

18
packages/lua/src-Makefile.patch

@ -1,18 +0,0 @@
diff -u -r ../lua-5.3.0/src/Makefile ./src/Makefile
--- ../lua-5.3.0/src/Makefile 2015-01-05 11:04:52.000000000 -0500
+++ ./src/Makefile 2015-05-24 18:06:15.958404755 -0400
@@ -6,13 +6,8 @@
# Your platform. See PLATS for possible values.
PLAT= none
-CC= gcc -std=gnu99
-CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
+CFLAGS+= $(SYSCFLAGS)
-LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS)
-
-AR= ar rcu
-RANLIB= ranlib
RM= rm -f
SYSCFLAGS=

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

@ -1,12 +0,0 @@
diff -u -r ../lua-5.3.0/src/luaconf.h ./src/luaconf.h
--- ../lua-5.3.0/src/luaconf.h 2014-12-29 08:27:55.000000000 -0500
+++ ./src/luaconf.h 2015-05-24 18:07:15.413550950 -0400
@@ -175,7 +175,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 \

12
packages/luarocks/Makefile.patch

@ -1,12 +0,0 @@
diff -u -r ../luarocks-2.4.0/Makefile ./Makefile
--- ../luarocks-2.4.0/Makefile 2016-09-08 14:39:09.000000000 -0400
+++ ./Makefile 2016-09-26 09:15:45.364036927 -0400
@@ -116,7 +116,7 @@
for f in $(BIN_FILES) ;\
do \
mv src/bin/$$f src/bin/$$f.bak ;\
- sed "s,^#!.*lua.*,#!/usr/bin/env lua,;/^package.path/d" < src/bin/$$f.bak > src/bin/$$f ;\
+ sed "s,^#!.*lua.*,#!/usr/bin/env luajit,;/^package.path/d" < src/bin/$$f.bak > src/bin/$$f ;\
chmod +rx src/bin/$$f ;\
rm -f src/bin/$$f.bak ;\
done

10
packages/luarocks/build.sh

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

Loading…
Cancel
Save