FS#72024 - [luarocks] Add CFLAGS to env variables passed to builds

Attached to Project: Community Packages
Opened by Caleb Maclennan (alerque) - Saturday, 04 September 2021, 14:46 GMT
Last edited by Caleb Maclennan (alerque) - Thursday, 07 April 2022, 17:34 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Daurnimator (daurnimator)
Caleb Maclennan (alerque)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

As discussed on IRC...

Luarocks should be instructed to pass at least RELRO related flags, but potentially other/all CFLAGS that are set by default in `makepkg`, along to builds.
This task depends upon

Closed by  Caleb Maclennan (alerque)
Thursday, 07 April 2022, 17:34 GMT
Reason for closing:  Upstream
Additional comments about closing:  Upstream dealt with this so we don't need to mess with hacking it into the configs. Just waiting on a release...
Comment by Caleb Maclennan (alerque) - Saturday, 04 September 2021, 14:59 GMT
IRC log since one or both of us may forget before getting around to dealing with this (I'm on another yack shave right now).

2021-09-04 13:56:03⇥alerque⇥daurnimator: Any tips on getting full FULL RELRO on Luarocks builtin builds?
2021-09-04 15:53:25⇥daurnimator⇥alerque: you can pass CFLAGS/LIBFLAGS via either the luarocks command line; or via the luarocks config file
2021-09-04 15:53:56⇥daurnimator⇥so we can either pass them in build() step to luarocks; or we can modify the default luarocks config file as-shipped to include relro
2021-09-04 15:54:22⇥daurnimator⇥I think the latter is the better option; but I recall running into some issue?
2021-09-04 16:31:15⇥alerque⇥daurnimator: Any examples of doing that in build()?
2021-09-04 16:31:41⇥alerque⇥daurnimator: This does seem like something we should pass through by default in the luarocks config.
2021-09-04 16:31:43⇥daurnimator⇥alerque: hmm? my suggestion was that we modify the default luarocks config we ship as part of the luarocks package
2021-09-04 16:40:43⇥daurnimator⇥the question then becomes: do we A) have luarocks config respect env vars? or B) hardcode CPPFLAGS from build() time into the luarocks config
2021-09-04 16:41:15⇥daurnimator⇥alerque: for A) consider this /etc/luarocks/config-5.1.lua : http://sprunge.us/9oEESq
2021-09-04 16:46:59⇥alerque⇥daurnimator: I would have expected it to respect env vars by default. I was surprised to find it wasn't.
2021-09-04 16:47:17⇥daurnimator⇥alerque: even weirder; but default it only respects them on freebsd
2021-09-04 16:47:26⇥alerque⇥Oh lovely.
2021-09-04 16:48:54⇥daurnimator⇥alerque: perhaps worth sending a PR upstream to make the freebsd behaviour the same everywhere?
Comment by Daurnimator (daurnimator) - Monday, 06 September 2021, 00:20 GMT
Note that we already do this today (but in the specific package). see e.g. https://github.com/archlinux/svntogit-community/blob/d25d80dee3b675def5d2d4c8940174c786cfba70/trunk/PKGBUILD#L27-L28

I assume this bug is to make that the default so we don't have to pass it any more?
Comment by Caleb Maclennan (alerque) - Monday, 06 September 2021, 10:24 GMT
Yes, exactly. Passing the obvious flags that the `makepkg` environment already has through shouldn't require manually doing this in every PKGBUILD. This isn't handled on a per project basis anyway, this is `luarocks` at work so *all* packages that build using `luarocks` should benefit evenly.
Comment by Daurnimator (daurnimator) - Monday, 06 September 2021, 23:24 GMT
Perhaps worth talking to the Go folks too? They have to pass the variables in every time too: https://wiki.archlinux.org/title/Go_package_guidelines#Flags_and_build_options
Comment by Caleb Maclennan (alerque) - Thursday, 07 April 2022, 17:34 GMT
This has been addressed upstream in LuaRocks, see:

https://github.com/luarocks/luarocks/commit/7e8058bc399ede42b8eb57d62694015b4c0401e0

It isn't realeased yet, but rather than hacking it into our current packaging lets just hope for an early-ish release. One this lands then we can go through and rebuild packages that need it and remove the manual hacks from where they were used.

Loading...