--- /dev/null
+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
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
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)
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)
#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