Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 414571 - dev-lang/lua-5.2 - change the SLOT to install it next to <dev-lang/lua-5.2
Summary: dev-lang/lua-5.2 - change the SLOT to install it next to <dev-lang/lua-5.2
Status: RESOLVED DUPLICATE of bug 190606
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Matti Bickel (RETIRED)
URL:
Whiteboard:
Keywords: EBUILD, PATCH
Depends on:
Blocks:
 
Reported: 2012-05-04 08:05 UTC by Guenther Brunthaler
Modified: 2012-06-20 03:19 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Modified version of lua-5.2.0-r1.ebuild to enable slotting (lua-5.2.0-r2.ebuild,3.61 KB, text/plain)
2012-05-04 08:14 UTC, Guenther Brunthaler
Details
A patch for the existing lua.pc to enable slotting (lua_pc-slotted.patch,723 bytes, patch)
2012-05-04 08:16 UTC, Guenther Brunthaler
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Guenther Brunthaler 2012-05-04 08:05:32 UTC
The current ebuild dev-lang/lua-5.2.0-r1 is hard masked, and for good reason.

The problem is that Lua-5.2 not only breaks the ABI, but the C API and even scripts written in Lua itself as well.

Upstream removed essential functions such as fsetenv() as well as the corresponding C API functions, which will break nearly every existing C library which was written for 5.1.

Even most Lua Scripts which implement objects will have to be rewritten, as they either used the module() function or the fsetenv() function, both gone now with the new Lua 5.2.

Bug 407091 also suggests that those problems are very real.

Reproducible: Always

Steps to Reproduce:
Try to install dev-lang/lua-5.2.0-r1 and then run or recompile any other ebuild which uses Lua for more than just plain extension by the user.
Actual Results:  
As soon as Lua is invoked from the application, it is highly likely to crash, or not even start due to unresolved symbols reported by the dynamic linker.

Expected Results:  
Lua 5.2 should be slotted.

I have created a derived version of dev-lang/lua-5.2.0-r1 which puts Lua 5.2 into its own slot.
Comment 1 Samuli Suominen (RETIRED) gentoo-dev 2012-05-04 08:10:52 UTC
It would need to be slottable by design of upstream and it isn't. Slotting LUA would mean deviating from upstream, and involving doing custom changes on nearly every package using it. So, uh, no thanks :/
Comment 2 Samuli Suominen (RETIRED) gentoo-dev 2012-05-04 08:11:50 UTC
(In reply to comment #1)
> It would need to be slottable by design of upstream and it isn't. Slotting
> LUA would mean deviating from upstream, and involving doing custom changes
> on nearly every package using it. So, uh, no thanks :/

I mean we should just give time for packages to migrate and then handle the rest on our own -- just like we have done for eg. libpng
Comment 3 Guenther Brunthaler 2012-05-04 08:14:45 UTC
Created attachment 310761 [details]
Modified version of lua-5.2.0-r1.ebuild to enable slotting

This version differs from the ebuild it is based on as follows:

The slot is "5.2".

Binaries and man-pages have been extended with the slot name.

Include and library files have been moved into subdirectories "lua-5.2".

The names of the files within the subdirectories have not been changed.

The SONAME has also not been changed (because IMHO that's up to upstream to do), but the RPATH has been changed to load the library from the subdirectory.

The pkg-config file has been updated to take all of this into account, and its name has been changed to lua-5.2.pc in order to avoid a name clash with the unslotted version.

The ebuild uses the same files from the ${FILESDIR} of the original ebuild, so please make sure those are available.

In addition, a new patch has to be placed into ${FILESDIR}. I will post it immediately after this submission.
Comment 4 Guenther Brunthaler 2012-05-04 08:16:53 UTC
Created attachment 310763 [details, diff]
A patch for the existing lua.pc to enable slotting

Put this into ${FILESDIR} before trying to merge dev-lang/lua-5.2.0-r2.
Comment 5 Guenther Brunthaler 2012-05-04 08:50:09 UTC
(In reply to comment #2)

I agree that this is not an ideal solution.

But what else should one do in order to try out Lua-5.2?

Installing the hard masked version is not really an option, as it breaks most installed packages which require Lua.

Also not that I did not change the SONAME - just the RPATH! It's similar in effect, but less intrusive.

And it seems to work just fine.

Of course this approach requires to either use pkg-config or set the -L and -I options manually during a build.

> I mean we should just give time for packages to migrate and then handle the
> rest on our own -- just like we have done for eg. libpng

Yes, this is certainly the long-term solution to go.

But who knows how long it will take upstream to fix all those packages?

Just consider how long it took for all python-2 packages to be migrated to python-3 and it's not even finished yet!

But at least python *is* slotted already, so the problem is less severe.

I consider the -r2 ebuild just as a temporary kludge to enable Gentoo-users "who can't wait" like me to check out Lua-5.2 now, instead of having to wait for months until upstream finally decides to support slotting. (If they are willing to do so at all.)

As for myself, the problem is that I do not want to write new scripts using the Lua-5.1 API, knowing that this is obsolete and existing sources will have to be modified for 5.2.

But due to the various problems with packages based on 5.1 I cannot even install the hardmasked -r1 version without breaking my system.

The modified -r2 at least allows me to install 5.2 and start developing for it *now*.
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2012-05-04 15:10:43 UTC
Comment on attachment 310761 [details]
Modified version of lua-5.2.0-r1.ebuild to enable slotting

--- lua-5.2.0-r1.ebuild 2012-03-17 22:23:08.000000000 +0100
+++ -   2012-05-04 17:10:32.427034482 +0200
@@ -11,9 +11,9 @@
 SRC_URI="http://www.lua.org/ftp/${P}.tar.gz"
 
 LICENSE="MIT"
-SLOT="0"
+SLOT="5.2"
 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
-IUSE="+deprecated emacs readline static"
+IUSE="-deprecated emacs readline static"
 
 RDEPEND="readline? ( sys-libs/readline )"
 DEPEND="${RDEPEND}
@@ -73,9 +73,12 @@
        local legacy=""
        use deprecated && legacy="-DLUA_COMPAT_ALL"

+       local instPV=$(get_version_component_range 1-2)
        emake CC="${CC}" CFLAGS="-DLUA_USE_LINUX ${legacy} ${CFLAGS}" \
                        SYSLDFLAGS="${LDFLAGS}" \
-                       RPATH="${EPREFIX}/usr/$(get_libdir)/" \
+                       includedir="${PREFIX}/usr/include/lua-${instPV}" \
+                       libdir="${EPREFIX}/usr/$(get_libdir)/lua-${instPV}" \
+                       RPATH="${EPREFIX}/usr/$(get_libdir)/lua-${instPV}" \
                        LUA_LIBS="${mylibs}" \
                        LIB_LIBS="${liblibs}" \
                        V=${PV} \
@@ -84,8 +87,11 @@
 
 src_install() {
        local PATCH_PV=$(get_version_component_range 1-2)
+       local instPV=${PATCH_PV}

-       emake INSTALL_TOP="${ED}/usr" INSTALL_LIB="${ED}/usr/$(get_libdir)" \
+       emake INSTALL_TOP="${ED}/usr" \
+                       INSTALL_INC="${D}/usr/include/lua-${instPV}" \
+                       INSTALL_LIB="${ED}/usr/$(get_libdir)/lua-${instPV}" \
                        V=${PV} gentoo_install \
        || die "emake install gentoo_install failed"

@@ -95,7 +101,8 @@
        doman doc/lua.1 doc/luac.1

        # We want packages to find our things...
-       cp "${FILESDIR}/lua.pc" "${WORKDIR}"
+       cp "${FILESDIR}/lua.pc" "${WORKDIR}" || die
+       patch "${WORKDIR}/lua.pc" "${FILESDIR}"/lua_pc-slotted.patch || die
        sed -i \
                -e "s:^V=.*:V= ${PATCH_PV}:" \
                -e "s:^R=.*:R= ${PV}:" \
@@ -103,5 +110,20 @@
                "${WORKDIR}/lua.pc"

        insinto "/usr/$(get_libdir)/pkgconfig"
-       doins "${WORKDIR}/lua.pc"
+       mv "${WORKDIR}/lua.pc" "${WORKDIR}/lua-${instPV}.pc"
+       doins "${WORKDIR}/lua-${instPV}.pc"
+       # Modifications for slotting.
+       cd "$D" || die
+       local instPV=$(get_version_component_range 1-2)
+       (
+               cd usr/share/man/man1 || exit
+               rename .1 "-${instPV}.1" *.1* || exit
+       ) || die
+       (
+               cd usr/bin || exit
+               for f in *
+               do
+                       mv "$f" "$f-${instPV}" || exit
+               done
+       ) || die
 }
Comment 7 Samuli Suominen (RETIRED) gentoo-dev 2012-06-20 03:19:04 UTC

*** This bug has been marked as a duplicate of bug 190606 ***