forked from pool/lua-toluapp
Accepting request 521082 from home:erikogenvik:branches:devel:languages:lua
Fixes issues with both running the code with Lua 5.1 as well as finding the needed scripts with Lua 5.2 and 5.3. OBS-URL: https://build.opensuse.org/request/show/521082 OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua-toluapp?expand=0&rev=10
This commit is contained in:
parent
ee714c187c
commit
1c32f108a3
@ -93,7 +93,9 @@ This package provides development headers for tolua++.
|
|||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
|
%if "%{flavor}" == "lua52" || "%{flavor}" == "lua53"
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
|
%endif
|
||||||
sed -i "s/@SUFFIX@/%{lua_version}/" SConstruct
|
sed -i "s/@SUFFIX@/%{lua_version}/" SConstruct
|
||||||
|
|
||||||
%build
|
%build
|
||||||
@ -112,7 +114,7 @@ scons %{?_smp_mflags} \
|
|||||||
libdir="%{_libdir}" \
|
libdir="%{_libdir}" \
|
||||||
shared=1 \
|
shared=1 \
|
||||||
lib bin \
|
lib bin \
|
||||||
-Q CCFLAGS="%{optflags} -I%{lua_incdir} -fPIC"
|
-Q CCFLAGS="%{optflags} -I%{lua_incdir} -fPIC -DDATAPATH=\\\"%{_datadir}/%{name}\\\""
|
||||||
|
|
||||||
%install
|
%install
|
||||||
CCFLAGS="%{optflags} -fPIC -I%{lua_incdir}" \
|
CCFLAGS="%{optflags} -fPIC -I%{lua_incdir}" \
|
||||||
@ -122,7 +124,7 @@ scons %{?_smp_mflags} \
|
|||||||
libdir="%{buildroot}%{_libdir}" \
|
libdir="%{buildroot}%{_libdir}" \
|
||||||
shared=1 \
|
shared=1 \
|
||||||
install \
|
install \
|
||||||
-Q CCFLAGS="%{optflags} -I%{lua_incdir} -fPIC"
|
-Q CCFLAGS="%{optflags} -I%{lua_incdir} -fPIC -DDATAPATH=\\\"%{_datadir}/%{name}\\\""
|
||||||
|
|
||||||
# pkgconfig file
|
# pkgconfig file
|
||||||
mkdir -p %{buildroot}%{_libdir}/pkgconfig
|
mkdir -p %{buildroot}%{_libdir}/pkgconfig
|
||||||
@ -141,6 +143,11 @@ Libs: -ltolua++-%{lua_version}
|
|||||||
Cflags: -I%{_includedir}
|
Cflags: -I%{_includedir}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
%if "%{flavor}" == "lua52" || "%{flavor}" == "lua53"
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||||
|
install -p -m 644 src/bin/lua/*.lua $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||||
|
%endif
|
||||||
|
|
||||||
# update-alternatives
|
# update-alternatives
|
||||||
mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
|
mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
|
||||||
touch %{buildroot}%{_sysconfdir}/alternatives/tolua++
|
touch %{buildroot}%{_sysconfdir}/alternatives/tolua++
|
||||||
@ -163,6 +170,9 @@ fi
|
|||||||
%ghost %{_sysconfdir}/alternatives/tolua++
|
%ghost %{_sysconfdir}/alternatives/tolua++
|
||||||
%{_bindir}/tolua++
|
%{_bindir}/tolua++
|
||||||
%{_bindir}/toluapp-%{lua_version}
|
%{_bindir}/toluapp-%{lua_version}
|
||||||
|
%if "%{flavor}" == "lua52" || "%{flavor}" == "lua53"
|
||||||
|
%{_datadir}/%{name}
|
||||||
|
%endif
|
||||||
|
|
||||||
%files -n libtolua++-%{lua_suffix}-devel
|
%files -n libtolua++-%{lua_suffix}-devel
|
||||||
%{_includedir}/tolua++.h
|
%{_includedir}/tolua++.h
|
||||||
|
@ -432,8 +432,8 @@ Index: toluapp-1.0.93/src/bin/tolua.c
|
|||||||
- lua_pushstring(L,path); lua_setglobal(L,"path");
|
- lua_pushstring(L,path); lua_setglobal(L,"path");
|
||||||
- strcat(path,"all.lua");
|
- strcat(path,"all.lua");
|
||||||
- lua_dofile(L,path);
|
- lua_dofile(L,path);
|
||||||
+ lua_pushstring(L, "/usr/share/toluapp/luapp/"); lua_setglobal(L,"path");
|
+ lua_pushstring(L, DATAPATH"/"); lua_setglobal(L,"path");
|
||||||
+ if (luaL_loadfile(L, "/usr/share/toluapp/luapp/all.lua") != 0) {
|
+ if (luaL_loadfile(L, DATAPATH"/all.lua") != 0) {
|
||||||
+ fprintf(stderr, "luaL_loadfile failed\n");
|
+ fprintf(stderr, "luaL_loadfile failed\n");
|
||||||
+ return 1;
|
+ return 1;
|
||||||
+ }
|
+ }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user