Rebase for lua 5.1.5 39/175739/1
authorAnas Nashif <anas.nashif@intel.com>
Mon, 5 Nov 2012 19:04:08 +0000 (11:04 -0800)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 12 Apr 2018 05:35:19 +0000 (14:35 +0900)
Change-Id: Ia13c14d09ce5bc4ff80a5dd4b077f1a1200b2c67
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Makefile
etc/lua.pc
packaging/baselibs.conf [new file with mode: 0644]
packaging/lua.changes [new file with mode: 0644]
packaging/lua.manifest [new file with mode: 0644]
packaging/lua.spec [new file with mode: 0644]
packaging/macros.lua [new file with mode: 0644]
src/Makefile
src/luaconf.h

index 209a132..11afb16 100644 (file)
--- 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)
 
index 07e2852..0b67387 100644 (file)
@@ -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 (file)
index 0000000..9860296
--- /dev/null
@@ -0,0 +1,2 @@
+liblua
+       targetarch ia64 block!
diff --git a/packaging/lua.changes b/packaging/lua.changes
new file mode 100644 (file)
index 0000000..909bd2f
--- /dev/null
@@ -0,0 +1,10 @@
+* Fri Mar 22 2013 Anas Nashif <anas.nashif@intel.com> submit/trunk/20121215.004706@978b56f
+- Fixed package groups
+
+* Thu Feb 21 2013 Patrick McCarty <patrick.mccarty@linux.intel.com> 8fc91fd
+- Resolve rpmlint warnings
+- Install a /usr/bin/lua symlink
+
+* Fri Dec 14 2012 Anas Nashif <anas.nashif@intel.com> 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 (file)
index 0000000..017d22d
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+    <domain name="_"/>
+ </request>
+</manifest>
diff --git a/packaging/lua.spec b/packaging/lua.spec
new file mode 100644 (file)
index 0000000..25ff572
--- /dev/null
@@ -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 (file)
index 0000000..d5e06dc
--- /dev/null
@@ -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}
index e0d4c9f..aa7f468 100644 (file)
@@ -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)
index e2cb261..1dbb554 100644 (file)
 
 #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
 
 
 
 #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