From 490b6b283512c645bdca7a9f8cb6591f215d8b2c Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 5 Nov 2012 11:04:08 -0800 Subject: [PATCH] Rebase for lua 5.1.5 Change-Id: Ia13c14d09ce5bc4ff80a5dd4b077f1a1200b2c67 Signed-off-by: DongHun Kwak --- Makefile | 3 +- etc/lua.pc | 4 +- packaging/baselibs.conf | 2 + packaging/lua.changes | 10 ++++ packaging/lua.manifest | 5 ++ packaging/lua.spec | 145 ++++++++++++++++++++++++++++++++++++++++++++++++ packaging/macros.lua | 10 ++++ src/Makefile | 12 +++- src/luaconf.h | 10 +++- 9 files changed, 192 insertions(+), 9 deletions(-) create mode 100644 packaging/baselibs.conf create mode 100644 packaging/lua.changes create mode 100644 packaging/lua.manifest create mode 100644 packaging/lua.spec create mode 100644 packaging/macros.lua diff --git a/Makefile b/Makefile index 209a132..11afb16 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris # What to install. TO_BIN= lua luac TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp -TO_LIB= liblua.a +TO_LIB= liblua.a liblua.so.$(V) TO_MAN= lua.1 luac.1 # Lua version and release. @@ -62,6 +62,7 @@ install: dummy cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) + ln -s liblua.so.$(V) $(INSTALL_LIB)/liblua.so cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) diff --git a/etc/lua.pc b/etc/lua.pc index 07e2852..0b67387 100644 --- a/etc/lua.pc +++ b/etc/lua.pc @@ -8,7 +8,7 @@ V= 5.1 R= 5.1.5 # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' -prefix= /usr/local +prefix= /usr INSTALL_BIN= ${prefix}/bin INSTALL_INC= ${prefix}/include INSTALL_LIB= ${prefix}/lib @@ -25,7 +25,7 @@ Name: Lua Description: An Extensible Extension Language Version: ${R} Requires: -Libs: -L${libdir} -llua -lm +Libs: -llua -lm Cflags: -I${includedir} # (end of lua.pc) diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf new file mode 100644 index 0000000..9860296 --- /dev/null +++ b/packaging/baselibs.conf @@ -0,0 +1,2 @@ +liblua + targetarch ia64 block! diff --git a/packaging/lua.changes b/packaging/lua.changes new file mode 100644 index 0000000..909bd2f --- /dev/null +++ b/packaging/lua.changes @@ -0,0 +1,10 @@ +* Fri Mar 22 2013 Anas Nashif submit/trunk/20121215.004706@978b56f +- Fixed package groups + +* Thu Feb 21 2013 Patrick McCarty 8fc91fd +- Resolve rpmlint warnings +- Install a /usr/bin/lua symlink + +* Fri Dec 14 2012 Anas Nashif upstream/5.1.4@c9e8879 +- Update to version 5.1.4 + diff --git a/packaging/lua.manifest b/packaging/lua.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/lua.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/lua.spec b/packaging/lua.spec new file mode 100644 index 0000000..25ff572 --- /dev/null +++ b/packaging/lua.spec @@ -0,0 +1,145 @@ +Name: lua +Version: 5.1.4 +Release: 0 +License: MIT +Summary: Small Embeddable Language with Simple Procedural Syntax +Url: http://www.lua.org +Group: Base/Libraries +Source: %{name}-%{version}.tar.gz +Source1: macros.lua +Source2: baselibs.conf +Source1001: lua.manifest +%define major_version 5.1 +BuildRequires: pkg-config +BuildRequires: readline-devel + +%description +Lua is a programming language originally designed for extending +applications, but also frequently used as a general-purpose, +stand-alone language. + +Lua combines simple procedural syntax (similar to Pascal) with powerful +data description constructs based on associative arrays and extensible +semantics. Lua is dynamically typed, interpreted from byte codes, and +has automatic memory management, making it ideal for configuration, +scripting, and rapid prototyping. Lua is implemented as a small library +of C functions, written in ANSI C, and the implementation goals are +simplicity, efficiency, portability, and low embedding cost. + +%package devel +Summary: Development files for lua +Group: Development/Libraries +Requires: %{name} = %{version} + +%description devel +Lua is a programming language originally designed for extending +applications, but also frequently used as a general-purpose, +stand-alone language. + +This package contains files needed for embedding lua into your +application. + +%package -n liblua +Summary: Small Embeddable Language with Simple Procedural Syntax +Group: Base/Libraries + +%description -n liblua +Lua is a programming language originally designed for extending +applications, but also frequently used as a general-purpose, +stand-alone language. + +Lua combines simple procedural syntax (similar to Pascal) with powerful +data description constructs based on associative arrays and extensible +semantics. Lua is dynamically typed, interpreted from byte codes, and +has automatic memory management, making it ideal for configuration, +scripting, and rapid prototyping. Lua is implemented as a small library +of C functions, written in ANSI C, and the implementation goals are +simplicity, efficiency, portability, and low embedding cost. + +%package doc +Summary: Small Embeddable Language with Simple Procedural Syntax +Group: Documentation +BuildArch: noarch + +%description doc +Lua is a programming language originally designed for extending +applications, but also frequently used as a general-purpose, +stand-alone language. + +Lua combines simple procedural syntax (similar to Pascal) with powerful +data description constructs based on associative arrays and extensible +semantics. Lua is dynamically typed, interpreted from byte codes, and +has automatic memory management, making it ideal for configuration, +scripting, and rapid prototyping. Lua is implemented as a small library +of C functions, written in ANSI C, and the implementation goals are +simplicity, efficiency, portability, and low embedding cost. + +%prep +%setup -q -n lua-%{version} +cp %{SOURCE1001} . + +%build +export CFLAGS+=" -fPIC -DLUA_USE_LINUX" +export LDFLAGS+=" -Wl,-z,relro -Wl,-E -ldl -lreadline -lhistory -lncurses" +sed -i -e "s@/usr/local/@/usr/@g" src/luaconf.h +%{__make} %{?_smp_mflags} -C src CC="%{__cc}" MYCFLAGS="$CFLAGS" MYLIBS="$LDFLAGS" V=%{major_version} all + +%check +%{__make} test || exit 0 + +%install +make install INSTALL_TOP="%{buildroot}%{_prefix}" INSTALL_LIB="%{buildroot}%{_libdir}" INSTALL_CMOD=%{buildroot}%{_libdir}/lua/%{major_version} INSTALL_MAN="%{buildroot}%{_mandir}/man1" +install -D -m644 etc/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc +for file in lua luac ; do + mv "%{buildroot}%{_bindir}/${file}" "%{buildroot}%{_bindir}/${file}%{major_version}" + mv "%{buildroot}%{_mandir}/man1/${file}.1" "%{buildroot}%{_mandir}/man1/${file}%{major_version}.1" +done +install -d -m 0755 %{buildroot}%{_libdir}/lua/%{major_version} +install -d -m 0755 %{buildroot}%{_datadir}/lua/%{major_version} +install -D -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.lua + +chmod +x %{buildroot}/%{_libdir}/liblua.so.%{major_version} + +ln -s lua%{major_version} %{buildroot}%{_bindir}/lua + +%post -n liblua -p /sbin/ldconfig + +%postun -n liblua -p /sbin/ldconfig + +%files +%manifest %{name}.manifest +%defattr(-,root,root) +%license COPYRIGHT +%{_bindir}/lua +%{_bindir}/lua%{major_version} +%{_bindir}/luac%{major_version} +%dir %{_libdir}/lua +%dir %{_libdir}/lua/%{major_version} +%dir %{_datadir}/lua +%dir %{_datadir}/lua/%{major_version} +%{_sysconfdir}/rpm/macros.lua + +%files -n liblua +%manifest %{name}.manifest +%defattr(-,root,root) +%license COPYRIGHT +%{_libdir}/liblua.so.%{major_version} + +%files devel +%manifest %{name}.manifest +%defattr(-,root,root) +%{_includedir}/lauxlib.h +%{_includedir}/lua.h +%{_includedir}/lua.hpp +%{_includedir}/luaconf.h +%{_includedir}/lualib.h +%{_libdir}/pkgconfig/lua.pc +%{_libdir}/liblua.a +%{_libdir}/liblua.so + +%files doc +%manifest %{name}.manifest +%defattr(-,root,root) +%doc doc/* + +%changelog diff --git a/packaging/macros.lua b/packaging/macros.lua new file mode 100644 index 0000000..d5e06dc --- /dev/null +++ b/packaging/macros.lua @@ -0,0 +1,10 @@ +# RPM macros for Lua + +# The major.minor version of Lua +%lua_version %(lua -e 'print(_VERSION)' | cut -d ' ' -f 2) + +# compiled modules should go here +%lua_archdir %{_libdir}/lua/%{lua_version} + +# pure Lua modules should go here +%lua_noarchdir %{_datadir}/lua/%{lua_version} diff --git a/src/Makefile b/src/Makefile index e0d4c9f..aa7f468 100644 --- a/src/Makefile +++ b/src/Makefile @@ -23,6 +23,7 @@ MYLIBS= PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris LUA_A= liblua.a +LUA_SO= liblua.so CORE_O= lapi.o lcode.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 @@ -36,7 +37,7 @@ LUAC_T= luac LUAC_O= luac.o print.o ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) +ALL_T= $(LUA_SO) $(LUA_A) $(LUA_T) $(LUAC_T) ALL_A= $(LUA_A) default: $(PLAT) @@ -47,15 +48,20 @@ o: $(ALL_O) a: $(ALL_A) +# shared libraries (for Linux) +$(LUA_SO): $(CORE_O) $(LIB_O) + $(CC) -o $(LUA_SO).$V -shared -Wl,-z,relro -Wl,-soname,$(LUA_SO).$V $(CORE_O) $(LIB_O) -lm -ldl + ln -fs $(LUA_SO).$(V) $(LUA_SO) + $(LUA_A): $(CORE_O) $(LIB_O) $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files $(RANLIB) $@ $(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) + $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) -L. -llua -pie $(LIBS) $(LUAC_T): $(LUAC_O) $(LUA_A) - $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) + $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) -L. -llua -pie $(LIBS) clean: $(RM) $(ALL_T) $(ALL_O) diff --git a/src/luaconf.h b/src/luaconf.h index e2cb261..1dbb554 100644 --- a/src/luaconf.h +++ b/src/luaconf.h @@ -95,13 +95,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 "LIBDIR/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 @@ -184,7 +188,7 @@ #elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ defined(__ELF__) -#define LUAI_FUNC __attribute__((visibility("hidden"))) extern +#define LUAI_FUNC extern #define LUAI_DATA LUAI_FUNC #else -- 2.7.4