From dfe82a756699c83367011408a952a6cedfd616be Mon Sep 17 00:00:00 2001 From: Sven 'sleipnir' Rebhan Date: Sun, 28 Feb 2010 21:27:22 +0000 Subject: Add some auto-fu to generate a custom libtool and make lua cross-compile... --- dev-lang/lua/Manifest | 14 +++ .../5.1.4/01_all_boolean_expression.upstream.patch | 48 ++++++++ .../lua/files/5.1.4/02_all_table.upstream.patch | 22 ++++ .../5.1.4/03_all_debug_getfenv.upstream.patch | 10 ++ .../5.1.4/04_all_gc_performance.upstream.patch | 14 +++ dev-lang/lua/files/lua-5.1-make-r1.patch | 66 +++++++++++ dev-lang/lua/files/lua-5.1-make_static-r1.patch | 12 ++ dev-lang/lua/files/lua-5.1-module_paths.patch | 30 +++++ dev-lang/lua/files/lua-5.1-readline.patch | 10 ++ .../files/lua-5.1.4-cross-autotools-libtool.patch | 10 ++ .../files/lua-5.1.4-cross-makefile-libtool.patch | 22 ++++ dev-lang/lua/files/lua-5.1.4-deprecated.patch | 46 ++++++++ dev-lang/lua/files/lua-5.1.4-test.patch | 11 ++ dev-lang/lua/lua-5.1.4-r5.ebuild | 125 +++++++++++++++++++++ 14 files changed, 440 insertions(+) create mode 100644 dev-lang/lua/Manifest create mode 100644 dev-lang/lua/files/5.1.4/01_all_boolean_expression.upstream.patch create mode 100644 dev-lang/lua/files/5.1.4/02_all_table.upstream.patch create mode 100644 dev-lang/lua/files/5.1.4/03_all_debug_getfenv.upstream.patch create mode 100644 dev-lang/lua/files/5.1.4/04_all_gc_performance.upstream.patch create mode 100644 dev-lang/lua/files/lua-5.1-make-r1.patch create mode 100644 dev-lang/lua/files/lua-5.1-make_static-r1.patch create mode 100644 dev-lang/lua/files/lua-5.1-module_paths.patch create mode 100644 dev-lang/lua/files/lua-5.1-readline.patch create mode 100644 dev-lang/lua/files/lua-5.1.4-cross-autotools-libtool.patch create mode 100644 dev-lang/lua/files/lua-5.1.4-cross-makefile-libtool.patch create mode 100644 dev-lang/lua/files/lua-5.1.4-deprecated.patch create mode 100644 dev-lang/lua/files/lua-5.1.4-test.patch create mode 100644 dev-lang/lua/lua-5.1.4-r5.ebuild diff --git a/dev-lang/lua/Manifest b/dev-lang/lua/Manifest new file mode 100644 index 0000000..fe194e1 --- /dev/null +++ b/dev-lang/lua/Manifest @@ -0,0 +1,14 @@ +AUX 5.1.4/01_all_boolean_expression.upstream.patch 1064 RMD160 7c10f8cf7aa842cdfd43fd8f8db5d6fbdf76459b SHA1 4cc7050fe4d5f16b4103b7b83ecd54c087f46396 SHA256 9506fa6932454abe735b9d620ca0b322b4e2eb03b38a5d3d717823508110620e +AUX 5.1.4/02_all_table.upstream.patch 643 RMD160 340ccc72f65cf6a82e76b3f641e0dcf5d97d3db0 SHA1 7a91ffb6258e59c1e2a1f150e73a639bc46e3d59 SHA256 e55930ccbfadf384b2b981da3454b0dfd8544ffcb29e10ad07c7404142447b09 +AUX 5.1.4/03_all_debug_getfenv.upstream.patch 232 RMD160 1c3a0bdeff3ab07bcaa185079d19bf90e83de0c5 SHA1 c9d685ab40f5964082927cb245373ca717b2823f SHA256 a6aa45a96ba44f04fd516851fc4188d89ad0c6d2b927d3be9faf84808c4a138d +AUX 5.1.4/04_all_gc_performance.upstream.patch 414 RMD160 1dacd5f58d96a053cbea3041d1f2f87b134a2232 SHA1 8e735c8a03ad630ea1bde735f6cab2821b0ef690 SHA256 cba9899e1f940b21c1a25f65279004ee64d78a4c48db3501677c106266bc23dd +AUX lua-5.1-make-r1.patch 2229 RMD160 9dfd3494f93a673e724e642f10543b80466dd547 SHA1 0896a440ad823c55f0a7a3354a09f4e29bceccf7 SHA256 bf691afd2480a496bfa9b2c46fcbb396e7034ea58e94399788e05ab7872ae46f +AUX lua-5.1-make_static-r1.patch 644 RMD160 fc1d837228066f987c09a7bf7c536de31f25685a SHA1 814a3429fabc12836b4520918df6b04bb68cfcf8 SHA256 077f5da55b9b354b8b901d8a769c92aad104d79ba0a6acee0096c9a5d94b259a +AUX lua-5.1-module_paths.patch 1078 RMD160 31a3f13af427bdcae784e21a9456f9197c59379e SHA1 50cb1438b7c50536ebf712d16d153eac40599562 SHA256 1115b6aa00eb4e918156ae70c763534bd2f603ba888da75e4908c19c2ac3e5f7 +AUX lua-5.1-readline.patch 360 RMD160 29e6f8193592ec6e551e46f953563113a72d2de2 SHA1 25baabcb1d3449c3c38726fc7de6c4abb34667a6 SHA256 1f0f90eb8103e338f1188cc884c0c59cc6afd023828c11d86b8145b2a8d1efc2 +AUX lua-5.1.4-cross-autotools-libtool.patch 220 RMD160 c0df6142ab253f582d8aa42705ee3cc7a54749fe SHA1 b65ed90dfe7a0ca850e8def7624cf4b3ddf37be1 SHA256 dc8fd664bc74b50d9871d097e5d7c53d6929a832f445b39b1112f728abd57122 +AUX lua-5.1.4-cross-makefile-libtool.patch 672 RMD160 b0267d16c72b250a2ab6b95cc4c4711afec3eb6b SHA1 5e0b8375f20386fb87b823e8d9bd143571dc5bd7 SHA256 f9ed40cd79ec2ce5cad4f5ff01c391636a6048ea5c26048bc5306903c197758d +AUX lua-5.1.4-deprecated.patch 1417 RMD160 c2f51932850ca7deb6a0df41e4fe67764e48608c SHA1 f003694a532f6cb4bb629918d8c2db8c52696723 SHA256 8d4d3c35d9cfb65f6caa360c09d1fa0c5dc1ee0de3389c1e73602fef86cd0e9f +AUX lua-5.1.4-test.patch 340 RMD160 5ab1fdfaf1c18d26c66096ade8944223c21ce9ca SHA1 9e1fc7b770f2586dd386bea60717962f650a1923 SHA256 cdbb06f6fc5e75512c912360e1efc12e1e62ac7079972ff1c9c9273898bf9e31 +DIST lua-5.1.4.tar.gz 216679 RMD160 c867c8364295d3e4fb4e4d8ebb27fa2b2312cdef SHA1 2b11c8e60306efb7f0734b747588f57995493db7 SHA256 b038e225eaf2a5b57c9bcc35cd13aa8c6c8288ef493d52970c9545074098af3a +EBUILD lua-5.1.4-r5.ebuild 3364 RMD160 186175b5c4907b7136b1bdfbae4bd7501e15d0a4 SHA1 6bf8fb02b0423edd27823a527005f9a223dccd81 SHA256 c6721f7af58e936cc8d1155a560c038bf23b5568e1b53deabcb5cfab90a312cb diff --git a/dev-lang/lua/files/5.1.4/01_all_boolean_expression.upstream.patch b/dev-lang/lua/files/5.1.4/01_all_boolean_expression.upstream.patch new file mode 100644 index 0000000..f04eb85 --- /dev/null +++ b/dev-lang/lua/files/5.1.4/01_all_boolean_expression.upstream.patch @@ -0,0 +1,48 @@ +--- lua-5.1.4.orig/src/lcode.c 2007/12/28 15:32:23 2.25.1.3 ++++ lua-5.1.4/src/lcode.c 2009/06/15 14:07:34 +@@ -544,15 +544,18 @@ + pc = NO_JUMP; /* always true; do nothing */ + break; + } +- case VFALSE: { +- pc = luaK_jump(fs); /* always jump */ +- break; +- } + case VJMP: { + invertjump(fs, e); + pc = e->u.s.info; + break; + } ++ case VFALSE: { ++ if (!hasjumps(e)) { ++ pc = luaK_jump(fs); /* always jump */ ++ break; ++ } ++ /* else go through */ ++ } + default: { + pc = jumponcond(fs, e, 0); + break; +@@ -572,14 +575,17 @@ + pc = NO_JUMP; /* always false; do nothing */ + break; + } +- case VTRUE: { +- pc = luaK_jump(fs); /* always jump */ +- break; +- } + case VJMP: { + pc = e->u.s.info; + break; + } ++ case VTRUE: { ++ if (!hasjumps(e)) { ++ pc = luaK_jump(fs); /* always jump */ ++ break; ++ } ++ /* else go through */ ++ } + default: { + pc = jumponcond(fs, e, 1); + break; + diff --git a/dev-lang/lua/files/5.1.4/02_all_table.upstream.patch b/dev-lang/lua/files/5.1.4/02_all_table.upstream.patch new file mode 100644 index 0000000..9ffc1bb --- /dev/null +++ b/dev-lang/lua/files/5.1.4/02_all_table.upstream.patch @@ -0,0 +1,22 @@ +--- lua-5.1.4.orig/src/lvm.c 2007/12/28 15:32:23 2.63.1.3 ++++ lua-5.1.4/src/lvm.c 2009/07/01 20:36:59 +@@ -133,6 +133,7 @@ + + void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; ++ TValue temp; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ +@@ -152,7 +153,9 @@ + callTM(L, tm, t, key, val); + return; + } +- t = tm; /* else repeat with `tm' */ ++ /* else repeat with `tm' */ ++ setobj(L, &temp, tm); /* avoid pointing inside table (may rehash) */ ++ t = &temp; + } + luaG_runerror(L, "loop in settable"); + } + diff --git a/dev-lang/lua/files/5.1.4/03_all_debug_getfenv.upstream.patch b/dev-lang/lua/files/5.1.4/03_all_debug_getfenv.upstream.patch new file mode 100644 index 0000000..fce4d47 --- /dev/null +++ b/dev-lang/lua/files/5.1.4/03_all_debug_getfenv.upstream.patch @@ -0,0 +1,10 @@ +--- lua-5.1.4.orig/src/ldblib.c 2007/12/28 15:32:23 2.63.1.3 ++++ lua-5.1.4/src/ldblib.c 2010/02/23 12:36:59 +@@ -45,6 +45,7 @@ + + + static int db_getfenv (lua_State *L) { ++ luaL_checkany(L, 1); + lua_getfenv(L, 1); + return 1; + } diff --git a/dev-lang/lua/files/5.1.4/04_all_gc_performance.upstream.patch b/dev-lang/lua/files/5.1.4/04_all_gc_performance.upstream.patch new file mode 100644 index 0000000..3c78525 --- /dev/null +++ b/dev-lang/lua/files/5.1.4/04_all_gc_performance.upstream.patch @@ -0,0 +1,14 @@ +--- lua-5.1.4.orig/src/llex.c 2007/12/28 15:32:23 2.63.1.3 ++++ lua-5.1.4/src/llex.c 2010/02/23 12:36:59 +@@ -118,8 +118,10 @@ + lua_State *L = ls->L; + TString *ts = luaS_newlstr(L, str, l); + TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ +- if (ttisnil(o)) ++ if (ttisnil(o)) { + setbvalue(o, 1); /* make sure `str' will not be collected */ ++ luaC_checkGC(L); ++ } + return ts; + } + diff --git a/dev-lang/lua/files/lua-5.1-make-r1.patch b/dev-lang/lua/files/lua-5.1-make-r1.patch new file mode 100644 index 0000000..8eecbdd --- /dev/null +++ b/dev-lang/lua/files/lua-5.1-make-r1.patch @@ -0,0 +1,66 @@ +--- lua-5.1.1.orig/Makefile 2006-06-02 12:53:38.000000000 +0200 ++++ lua-5.1.1/Makefile 2006-11-16 02:16:53.000000000 +0100 +@@ -127,3 +127,21 @@ + .PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho newer + + # (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 ++ ++gentoo_clean: ++ cd src; $(MAKE) $@ ++ ++gentoo_test: gentoo_linux ++ test/lua.static test/hello.lua ++ ++gentoo_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) +--- lua-5.1.1.orig/src/Makefile 2006-03-22 01:41:49.000000000 +0100 ++++ lua-5.1.1/src/Makefile 2006-11-16 02:10:27.000000000 +0100 +@@ -54,1 +54,1 @@ +-$(LUA_T): $(LUA_O) $(LUA_A) ++origin$(LUA_T): $(LUA_O) $(LUA_A) +@@ -57,1 +57,1 @@ +-$(LUAC_T): $(LUAC_O) $(LUA_A) ++origin$(LUAC_T): $(LUAC_O) $(LUA_A) +@@ -176,3 +176,33 @@ + ltm.h lzio.h lmem.h lopcodes.h lundump.h + + # (end of Makefile) ++ ++export LIBTOOL = libtool --quiet --tag=CC ++export LIB_VERSION = 6:1:1 ++ ++# 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) \ ++ -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) ++ ++lua_test: $(LUA_O:.o=.lo) $(LIB_NAME) ++ $(LIBTOOL) --mode=link $(CC) -static -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) ++ ++gentoo_clean: ++ $(LIBTOOL) --mode=clean $(RM) $(ALL_O:.o=.lo) $(LIB_NAME) lua luac ++ ++gentoo_all: $(LIB_NAME) $(LUA_T) lua_test $(LUAC_T) diff --git a/dev-lang/lua/files/lua-5.1-make_static-r1.patch b/dev-lang/lua/files/lua-5.1-make_static-r1.patch new file mode 100644 index 0000000..e5fdc3a --- /dev/null +++ b/dev-lang/lua/files/lua-5.1-make_static-r1.patch @@ -0,0 +1,12 @@ +diff -ru lua-5.1.1.orig/src/Makefile lua-5.1.1/src/Makefile +--- lua-5.1.1.orig/src/Makefile 2006-11-21 07:19:31 +0000 ++++ lua-5.1.1/src/Makefile 2006-11-21 07:19:52 +0000 +@@ -196,7 +196,7 @@ + -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) ++ $(LIBTOOL) --mode=link $(CC) -static -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 -o $@ $(LUAC_O:.o=.lo) $(LIB_NAME) diff --git a/dev-lang/lua/files/lua-5.1-module_paths.patch b/dev-lang/lua/files/lua-5.1-module_paths.patch new file mode 100644 index 0000000..29ac4c3 --- /dev/null +++ b/dev-lang/lua/files/lua-5.1-module_paths.patch @@ -0,0 +1,30 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## src_luaconf.h.dpatch by John V. Belmonte +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Set Lua's default PATH and CPATH. + +@DPATCH@ +diff -urNad trunk~/src/luaconf.h trunk/src/luaconf.h +--- trunk~/src/luaconf.h 2006-02-10 12:44:06.000000000 -0500 ++++ trunk/src/luaconf.h 2006-02-17 21:32:55.000000000 -0500 +@@ -83,13 +83,17 @@ + + #else + #define LUA_ROOT "/usr/local/" ++#define LUA_ROOT2 "/usr/" + #define LUA_LDIR LUA_ROOT "share/lua/5.1/" ++#define LUA_LDIR2 LUA_ROOT2 "share/lua/5.1/" + #define LUA_CDIR LUA_ROOT "lib/lua/5.1/" ++#define LUA_CDIR2 LUA_ROOT2 "lib/lua/5.1/" + #define LUA_PATH_DEFAULT \ + "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ +- LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" ++ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ ++ LUA_LDIR2"?.lua;" LUA_LDIR2"?/init.lua" + #define LUA_CPATH_DEFAULT \ +- "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" ++ "./?.so;" LUA_CDIR"?.so;" LUA_CDIR2"?.so;" LUA_CDIR"loadall.so" + #endif + + diff --git a/dev-lang/lua/files/lua-5.1-readline.patch b/dev-lang/lua/files/lua-5.1-readline.patch new file mode 100644 index 0000000..f144861 --- /dev/null +++ b/dev-lang/lua/files/lua-5.1-readline.patch @@ -0,0 +1,10 @@ +--- lua-5.1.1.orig/src/luaconf.h 2006-04-10 20:27:23.000000000 +0200 ++++ lua-5.1.1/src/luaconf.h 2006-11-15 14:53:07.000000000 +0100 +@@ -36,7 +36,6 @@ + #if defined(LUA_USE_LINUX) + #define LUA_USE_POSIX + #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +-#define LUA_USE_READLINE /* needs some extra libraries */ + #endif + + #if defined(LUA_USE_MACOSX) diff --git a/dev-lang/lua/files/lua-5.1.4-cross-autotools-libtool.patch b/dev-lang/lua/files/lua-5.1.4-cross-autotools-libtool.patch new file mode 100644 index 0000000..e4d7195 --- /dev/null +++ b/dev-lang/lua/files/lua-5.1.4-cross-autotools-libtool.patch @@ -0,0 +1,10 @@ +--- /dev/null 2010-02-28 20:48:14.548282796 +0100 ++++ configure.in 2010-02-28 21:47:15.000000000 +0100 +@@ -0,0 +1,7 @@ ++AC_INIT([lua]) ++ ++AC_CONFIG_SRCDIR([configure.in]) ++AC_CONFIG_MACRO_DIR([m4]) ++ ++LT_INIT ++LT_OUTPUT diff --git a/dev-lang/lua/files/lua-5.1.4-cross-makefile-libtool.patch b/dev-lang/lua/files/lua-5.1.4-cross-makefile-libtool.patch new file mode 100644 index 0000000..9fdffde --- /dev/null +++ b/dev-lang/lua/files/lua-5.1.4-cross-makefile-libtool.patch @@ -0,0 +1,22 @@ +--- Makefile 2010-02-26 08:31:55.000000000 +0100 ++++ Makefile.new 2010-02-28 22:00:05.000000000 +0100 +@@ -130,7 +130,7 @@ + # Use libtool for binary installs, etc. + + export V +-export LIBTOOL = libtool --quiet --tag=CC ++export LIBTOOL = ../libtool --quiet --tag=CC + # See libtool manual about how to set this + + gentoo_clean: +--- src/Makefile 2010-02-26 08:31:55.000000000 +0100 ++++ src/Makefile.new 2010-02-28 22:01:18.000000000 +0100 +@@ -181,7 +181,7 @@ + + # (end of Makefile) + +-export LIBTOOL = libtool --quiet --tag=CC ++export LIBTOOL = ../libtool --quiet --tag=CC + export LIB_VERSION = 6:4:1 + + # The following rules use libtool for compiling and linking in order to diff --git a/dev-lang/lua/files/lua-5.1.4-deprecated.patch b/dev-lang/lua/files/lua-5.1.4-deprecated.patch new file mode 100644 index 0000000..a88a991 --- /dev/null +++ b/dev-lang/lua/files/lua-5.1.4-deprecated.patch @@ -0,0 +1,46 @@ +diff -rdu lua-5.1.3.orig/src/luaconf.h lua-5.1.3/src/luaconf.h +--- lua-5.1.3.orig/src/luaconf.h 2008-02-12 17:00:03.000000000 +0000 ++++ lua-5.1.3/src/luaconf.h 2008-02-12 17:07:55.000000000 +0000 +@@ -340,14 +340,14 @@ + ** CHANGE it to undefined as soon as your programs use only '...' to + ** access vararg parameters (instead of the old 'arg' table). + */ +-#define LUA_COMPAT_VARARG ++#undef LUA_COMPAT_VARARG + + /* + @@ LUA_COMPAT_MOD controls compatibility with old math.mod function. + ** CHANGE it to undefined as soon as your programs use 'math.fmod' or + ** the new '%' operator instead of 'math.mod'. + */ +-#define LUA_COMPAT_MOD ++#undef LUA_COMPAT_MOD + + /* + @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting +@@ -355,14 +355,14 @@ + ** CHANGE it to 2 if you want the old behaviour, or undefine it to turn + ** off the advisory error when nesting [[...]]. + */ +-#define LUA_COMPAT_LSTR 1 ++#undef LUA_COMPAT_LSTR + + /* + @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. + ** CHANGE it to undefined as soon as you rename 'string.gfind' to + ** 'string.gmatch'. + */ +-#define LUA_COMPAT_GFIND ++#undef LUA_COMPAT_GFIND + + /* + @@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' +@@ -370,7 +370,7 @@ + ** CHANGE it to undefined as soon as you replace to 'luaL_register' + ** your uses of 'luaL_openlib' + */ +-#define LUA_COMPAT_OPENLIB ++#undef LUA_COMPAT_OPENLIB + + + diff --git a/dev-lang/lua/files/lua-5.1.4-test.patch b/dev-lang/lua/files/lua-5.1.4-test.patch new file mode 100644 index 0000000..99b4ad6 --- /dev/null +++ b/dev-lang/lua/files/lua-5.1.4-test.patch @@ -0,0 +1,11 @@ +--- test/sieve.lua~ 2002-10-31 03:52:58.000000000 +0100 ++++ test/sieve.lua 2008-02-20 17:44:22.468281121 +0100 +@@ -14,7 +14,7 @@ + while 1 do + local n = g() + if n == nil then return end +- if math.mod(n, p) ~= 0 then coroutine.yield(n) end ++ if math.fmod(n, p) ~= 0 then coroutine.yield(n) end + end + end) + end diff --git a/dev-lang/lua/lua-5.1.4-r5.ebuild b/dev-lang/lua/lua-5.1.4-r5.ebuild new file mode 100644 index 0000000..de8b56e --- /dev/null +++ b/dev-lang/lua/lua-5.1.4-r5.ebuild @@ -0,0 +1,125 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/lua/lua-5.1.4-r5.ebuild,v 1.1 2010/02/23 12:19:34 mabi Exp $ + +EAPI="1" + +inherit autotools eutils multilib portability toolchain-funcs versionator + +DESCRIPTION="A powerful light-weight programming language designed for extending applications" +HOMEPAGE="http://www.lua.org/" +SRC_URI="http://www.lua.org/ftp/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="+deprecated emacs readline static" + +DEPEND="readline? ( sys-libs/readline )" +RDEPEND="${DEPEND}" +PDEPEND="emacs? ( app-emacs/lua-mode )" + +src_unpack() { + local PATCH_PV=$(get_version_component_range 1-2) + unpack ${A} + cd "${S}" + + epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make-r1.patch + epatch "${FILESDIR}"/${PN}-${PATCH_PV}-module_paths.patch + + EPATCH_SOURCE="${FILESDIR}/${PV}" EPATCH_SUFFIX="upstream.patch" epatch + + # correct lua versioning + sed -i -e 's/\(LIB_VERSION = \)6:1:1/\16:4:1/' src/Makefile + + sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc/readme.html + + if ! use deprecated ; then + epatch "${FILESDIR}"/${P}-deprecated.patch + epatch "${FILESDIR}"/${P}-test.patch + fi + + if ! use readline ; then + epatch "${FILESDIR}"/${PN}-${PATCH_PV}-readline.patch + fi + + # Using dynamic linked lua is not recommended upstream for performance + # reasons. http://article.gmane.org/gmane.comp.lang.lua.general/18519 + # Mainly, this is of concern if your arch is poor with GPRs, like x86 + # Not that this only affects the interpreter binary (named lua), not the lua + # compiler (built statically) nor the lua libraries (both shared and static + # are installed) + if use static ; then + epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make_static-r1.patch + fi + + # We want packages to find our things... + sed -i \ + -e 's:/usr/local:/usr:' \ + -e "s:/\:/$(get_libdir):g" \ + etc/lua.pc + + # Add the minimal auto-fu to generate a custom libtool. + epatch "${FILESDIR}/${P}-cross-autotools-libtool.patch" + epatch "${FILESDIR}/${P}-cross-makefile-libtool.patch" + eautoreconf +} + +src_compile() { + tc-export CC + myflags= + # what to link to liblua + liblibs="-lm" + liblibs="${liblibs} $(dlopen_lib)" + + # what to link to the executables + mylibs= + if use readline; then + mylibs="-lreadline" + fi + + # Generate the custom libtool. + econf + + cd src + emake CC="${CC}" CFLAGS="-DLUA_USE_LINUX ${CFLAGS}" \ + RPATH="${ROOT}/usr/$(get_libdir)/" \ + LUA_LIBS="${mylibs}" \ + LIB_LIBS="${liblibs}" \ + V=${PV} \ + gentoo_all || die "emake failed" + + mv lua_test ../test/lua.static +} + +src_install() { + emake INSTALL_TOP="${D}/usr/" INSTALL_LIB="${D}/usr/$(get_libdir)/" \ + V=${PV} gentoo_install \ + || die "emake install gentoo_install failed" + + dodoc HISTORY README + dohtml doc/*.html doc/*.gif + + insinto /usr/share/pixmaps + doins etc/lua.ico + insinto /usr/$(get_libdir)/pkgconfig + doins etc/lua.pc + + doman doc/lua.1 doc/luac.1 +} + +src_test() { + local positive="bisect cf echo env factorial fib fibfor hello printf sieve + sort trace-calls trace-globals" + local negative="readonly" + local test + + cd "${S}" + for test in ${positive}; do + test/lua.static test/${test}.lua || die "test $test failed" + done + + for test in ${negative}; do + test/lua.static test/${test}.lua && die "test $test failed" + done +} -- cgit v1.2.3-65-gdbad