Gentoo Archives: gentoo-dev

From: Jonathan Callen <en.abcd@×××××.com>
To: Gentoo Dev <gentoo-dev@l.g.o>
Subject: [gentoo-dev] Re: Slotted Lua + revdeps to be unmasked on Christmas Eve
Date: Wed, 23 Dec 2020 17:13:55
Message-Id: dad7ae54-99e1-bb72-ae35-210f38a16f0e@gmail.com
In Reply to: Re: [gentoo-dev] Slotted Lua + revdeps to be unmasked on Christmas Eve by Michael Orlitzky
1 On 12/23/20 9:10 AM, Michael Orlitzky wrote:
2 > On 12/23/20 8:35 AM, Jaco Kroon wrote:
3 >> Michael,
4 >>
5 >> I'm busy disecting what Marek has done for asterisk as I need to make
6 >> that work for multiple versions of net-misc/asterisk-16.14.0-r100, not
7 >> merely the one he did it for - perhaps that would be helpful for you as
8 >> well?
9 >>
10 >> I don't know lua at all.
11 >>
12 >> Anyway, I'm on IRC as jkroon if you'd like to exchange notes.  I don't
13 >> particularly like the patch Marek did as I'll NEVER be able to push that
14 >> upstream.  The patch will work for us, but as a policy I highly prefer
15 >> patches which I can get unstreamed such that we don't need to carry them
16 >> more than one or two versions.
17 >
18 > Agreed. This is more of a system library packaging issue than anything
19 > to do with Lua specifically.
20 >
21 >
22 >> I'd prefer to patch upstream to keep it's behaviour of detecting a lua
23 >> version, but have a --with-lua(version)? type argument that can take an
24 >> optional argument which will then be the version, but --with-* generally
25 >> takes a prefix where the include and lib folders can be found ... and
26 >> I'd prefer to depend on pkg-config as primary and fallback to the
27 >> ./configure mess which tries to guess at things ...
28 >>
29 >
30 > This is exactly what I'm trying to get across. Support for multiple
31 > versions of libraries in weird locations is not a new thing. Generally,
32 > you can put CPPFLAGS="-I/foo/bar" and LIBS="-L/baz/quux" before running
33 > ./configure and everything will just work with your header files and
34 > libraries in the non-standard paths /foo/bar and /baz/quux,
35 > respectively. Those paths take precedence over the defaults (if used
36 > correctly...), so you can use them to override the default version of a
37 > library and compile/link against a specific copy if you need to do that.
38 > Likewise, one could prepend a path to PKG_CONFIG_PATH to override the
39 > version that will be detected via pkg-config.
40 >
41 > The problem that we've gotten ourselves into is that we've copied Debian
42 > by not only relocating the library, but renaming it (and its *.pc file)
43 > entirely. There is no good way to tell an autotools build system that
44 > you've renamed a library completely, and that it should prefer the
45 > renamed version over the standard one if the standard one also exists.
46 >
47 > If you want to build against the eselected version of Lua on Gentoo,
48 > then eselect-lua makes everything OK. It creates symlinks from the
49 > standard names to the nonstandard ones, and everything just works. But
50 > if you want to build against a specific, not-eselected version of Lua?
51 > You have to tell the build system what to do. The eselected version
52 > lives in the correct locations (via those symlinks), so the build system
53 > is going to want to find that first. If the eselected version is not the
54 > one you want to build against,.... oops. Then, since the version you
55 > *do* want to link against has the wrong name, you have to tell the build
56 > system to link against it somehow. You can't simply override the
57 > PKG_CONFIG_PATH, because our *.pc files have the wrong names. You can't
58 > just override the library search path, because our libraries have the
59 > wrong names.
60 >
61 > The work I've done so far for OpenDKIM does nothing to address these
62 > larger problems. If lua.pc is on the system, it will get used first,
63 > regardless of the version you actually want to build against. AFAIK
64 > there's no good way around this without patching.
65 >
66 > If the libraries (and pkg-config files?) were installed to
67 > subdirectories instead, then the standard method of overrides could be
68 > used to build against a specific version, rather than requiring every
69 > upstream build system to support our weird layout.
70 >
71 >
72
73 One way this could be done without breaking things might be to create a
74 subdirectory of /usr/$(get_libdir) for each version of Lua and creating
75 a liblua.a and/or liblua.so symlink in that directory pointing to the
76 liblua${VERSION}.* file in /usr/$(get_libdir). Then you could simply
77 point those build systems at that directory and they would still use the
78 correct version. As a hack in an ebuild, you probably could just create
79 such a setup in (subdirectories of) ${T}, pointing liblua.a, liblua.so,
80 and lua.pc at the appropriately-versioned files.
81
82 Jonathan Callen

Replies