lua-5.2: added Lua specfile patches for 'peaceful coexistence'.
authorKrisztian Litkey <kli@iki.fi>
Sun, 9 Mar 2014 21:31:46 +0000 (23:31 +0200)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Tue, 11 Mar 2014 10:26:45 +0000 (12:26 +0200)
Added two patches that allow Lua-5.2.x and Lua-5.1.x to co-
exist without conflicts with whichever version you happen to
have installed on your system. To get the additional version
installed, take the Fedora source RPM of the version you want,
patch its specfile with the patch in this commit, then build
and install. So rougly:

    rpm -ivh <uri-of-fedora-lua.src.rpm>
    patch -p0 < <patch-from-this-commit>
    rpm -bb ~/rpmbuild/SPECS/lua.spec
    rpm -ivh ~/rpmbuild/RPMS/<arch>/lua-*.rpm

patches/lua/lua-5.1.4-specfile.patch [new file with mode: 0644]
patches/lua/lua-5.2.2-specfile.patch [new file with mode: 0644]

diff --git a/patches/lua/lua-5.1.4-specfile.patch b/patches/lua/lua-5.1.4-specfile.patch
new file mode 100644 (file)
index 0000000..3b8e35d
--- /dev/null
@@ -0,0 +1,79 @@
+*** rpmbuild/SPECS/lua.spec.orig       2014-03-09 23:16:11.119234628 +0200
+--- rpmbuild/SPECS/lua.spec    2014-03-09 23:16:20.243251349 +0200
+***************
+*** 1,3 ****
+--- 1,6 ----
++ %global lua_version 5.1.4
++ %global _prefix /usr/local/lua-%{lua_version}
++ 
+  Name:           lua
+  Version:        5.1.4
+  Release:        12%{?dist}
+***************
+*** 63,68 ****
+--- 65,72 ----
+  make %{?_smp_mflags} LIBS="-lm -ldl" luac_LDADD="liblua.la -lm -ldl"
+  # also remove readline from lua.pc
+  sed -i 's/-lreadline -lncurses //g' etc/lua.pc
++ # add path to %_libdir to lua.pc
++ sed -i 's#^Libs: #Libs: -L${libdir} #g' etc/lua.pc
+  
+  
+  %install
+***************
+*** 72,81 ****
+--- 76,102 ----
+  mkdir -p $RPM_BUILD_ROOT%{_libdir}/lua/5.1
+  mkdir -p $RPM_BUILD_ROOT%{_datadir}/lua/5.1
+  
++ # construct a config file to help the dynamic linker find us
++ mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
++ echo "%{_libdir}" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/lua-%{lua_version}.conf
++ 
++ # add a version-specific symlink for pkgconfig to find us
++ case %{_libdir} in
++     *lib64*) lib=lib64;;
++           *) lib=lib
++ esac
++ mkdir -p $RPM_BUILD_ROOT/usr/$lib/pkgconfig
++ ln -sf %_libdir/pkgconfig/lua.pc \
++     $RPM_BUILD_ROOT/usr/$lib/pkgconfig/lua-%{lua_version}.pc
+  
+  %clean
+  rm -rf $RPM_BUILD_ROOT
+  
++ %post
++ ldconfig
++ 
++ %postun
++ ldconfig
+  
+  %files
+  %defattr(-,root,root,-)
+***************
+*** 87,93 ****
+  %dir %{_libdir}/lua/5.1
+  %dir %{_datadir}/lua
+  %dir %{_datadir}/lua/5.1
+! 
+  
+  %files devel
+  %defattr(-,root,root,-)
+--- 108,114 ----
+  %dir %{_libdir}/lua/5.1
+  %dir %{_datadir}/lua
+  %dir %{_datadir}/lua/5.1
+! /etc/ld.so.conf.d/lua-%{lua_version}.conf
+  
+  %files devel
+  %defattr(-,root,root,-)
+***************
+*** 95,100 ****
+--- 116,122 ----
+  %{_includedir}/l*.hpp
+  %{_libdir}/liblua.so
+  %{_libdir}/pkgconfig/*.pc
++ /usr/lib*/pkgconfig/lua-*.pc
+  
+  %files static
+  %defattr(-,root,root,-)
diff --git a/patches/lua/lua-5.2.2-specfile.patch b/patches/lua/lua-5.2.2-specfile.patch
new file mode 100644 (file)
index 0000000..0bf3bee
--- /dev/null
@@ -0,0 +1,62 @@
+*** rpmbuild/SPECS/lua.spec.orig       2013-10-23 19:30:44.000000000 +0300
+--- rpmbuild/SPECS/lua.spec    2014-03-09 23:28:23.064213927 +0200
+***************
+*** 1,4 ****
+--- 1,6 ----
+  %global major_version 5.2
++ %global lua_version 5.2.2
++ %global _prefix /usr/local/lua-%{lua_version}
+  
+  Name:           lua
+  Version:        %{major_version}.2
+***************
+*** 65,70 ****
+--- 67,74 ----
+  # hack so that only /usr/bin/lua gets linked with readline as it is the
+  # only one which needs this and otherwise we get License troubles
+  make %{?_smp_mflags} LIBS="-lm -ldl" luac_LDADD="liblua.la -lm -ldl"
++ # add path to %_libdir to lua.pc
++ sed -i 's#^Libs: #Libs: -L${libdir} #g' src/lua.pc
+  
+  
+  %install
+***************
+*** 73,78 ****
+--- 77,102 ----
+  mkdir -p $RPM_BUILD_ROOT%{_libdir}/lua/%{major_version}
+  mkdir -p $RPM_BUILD_ROOT%{_datadir}/lua/%{major_version}
+  
++ # construct a config file to help the dynamic linker find us
++ mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
++ echo "%{_libdir}" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/lua-%{lua_version}.conf
++ 
++ # add a version-specific symlink for pkgconfig to find us
++ case %{_libdir} in
++     *lib64*) lib=lib64;;
++           *) lib=lib
++ esac
++ mkdir -p $RPM_BUILD_ROOT/usr/$lib/pkgconfig
++ ln -sf %_libdir/pkgconfig/lua.pc \
++     $RPM_BUILD_ROOT/usr/$lib/pkgconfig/lua-%{lua_version}.pc
++ 
++ 
++ %post
++ ldconfig
++ 
++ %postun
++ ldconfig
++ 
+  
+  %files
+  %doc README doc/*.html doc/*.css doc/*.gif doc/*.png
+***************
+*** 90,95 ****
+--- 114,121 ----
+  %{_includedir}/l*.hpp
+  %{_libdir}/liblua.so
+  %{_libdir}/pkgconfig/*.pc
++ /usr/lib*/pkgconfig/lua-*.pc
++ /etc/ld.so.conf.d/lua-%{lua_version}.conf
+  
+  %files static
+  %{_libdir}/*.a