~alpine/devel

4 3

Using buildtypes that respect our C{,PP,XX}FLAGS in CMake and Meson

Rasmus Thomsen
Details
Message ID
<2896c13070c508a49cbaa72c8fb7f34ea947358b.camel@cogitri.dev>
DKIM signature
missing
Download raw message
Hello list,

due to we've noticed that most aports use the RelWithDebInfo or Release
buildtype for CMake or the meson equivalents debugoptimized or release,
which overwrite the C{,PP,XX}FLAGS set by abuild. E.g. meson can add
-O2 or even -O3 to release builds and many upstreams add additional
flags to their release builds they deem increase performance. As such
we should switch to the None buildtype for CMake and for Meson to the
plain buildtype, so that no additional flags are added to our aports.

To make the impact of this clear, here's a comparison between
CMAKE_BUILD_TYPE=RelWithDebInfo and CMAKE_BUILD_TYPE=None for attica:

attica-5.67.0-r0 installed size:
823296

attica-5.67.0-r1 installed size:
823296

attica-5.67.0-r2 installed size:
589824

-r0 is compiled with RelWithDebInfo and the flags the builders use, -r1
is compiled with None and CFLAGS set to -O2 in abuild.conf and -r2 is
compile with None and the default flags of abuild (-Os -fomit-frame-
pointer).

Similiar (although not as drastic, but maybe that's just on libtracker
vs attica) differences can be seen with meson (using the same flags as
above):

libtracker-2.3.2-r0 installed size:
5718016

libtracker-2.3.2-r1 installed size:
5713920

libtracker-2.3.2-r2 installed size:
4911104

As such I'd suggest multiple steps to be taken:

1) Change existing aports over to the None/plain buildtype to make sure
this doesn't break anything (we'll probably use some performance but
get smaller packages due to our CFLAGS, but that's the goal here, I
suppose)

2) Change Alpine policy to only use the None/plain buildtype.
Additionally, the buildtype _must be_ mentioned, since at least Meson
defaults to 'debug' if no buildtype is specified.

3) Change newapkbuild so that new aports use the correct buildtype (
https://gitlab.alpinelinux.org/alpine/abuild/merge_requests/29)

Thanks,

Rasmus Thomsen
Rasmus Thomsen
Details
Message ID
<41f509627db8d9f5460c723bde73e932e7571be8.camel@cogitri.dev>
In-Reply-To
<2896c13070c508a49cbaa72c8fb7f34ea947358b.camel@cogitri.dev> (view parent)
DKIM signature
missing
Download raw message
Hello,

the MR to switch all packages over is located here: 
https://gitlab.alpinelinux.org/alpine/aports/merge_requests/4317

Thanks,

Rasmus Thomsen
Details
Message ID
<20200220174426.GA1247035@alpha>
In-Reply-To
<2896c13070c508a49cbaa72c8fb7f34ea947358b.camel@cogitri.dev> (view parent)
DKIM signature
missing
Download raw message
On Thu, Feb 20, 2020 at 05:20:45PM +0000, Rasmus Thomsen wrote:
> Hello list,
> 
> [..]
> 
> As such I'd suggest multiple steps to be taken:
> 
> 1) Change existing aports over to the None/plain buildtype to make sure
> this doesn't break anything (we'll probably use some performance but
> get smaller packages due to our CFLAGS, but that's the goal here, I
> suppose)
> 
> 2) Change Alpine policy to only use the None/plain buildtype.
> Additionally, the buildtype _must be_ mentioned, since at least Meson
> defaults to 'debug' if no buildtype is specified.
> 
> 3) Change newapkbuild so that new aports use the correct buildtype (
> https://gitlab.alpinelinux.org/alpine/abuild/merge_requests/29)
> 
> Thanks,
> 
> Rasmus Thomsen
> 

If feasible, we could add a linting check to verify that the proper
buildtype is used as well.
Rasmus Thomsen
Details
Message ID
<d6822514d183531fecd09b40bd02141421c4cf70.camel@cogitri.dev>
In-Reply-To
<20200220174426.GA1247035@alpha> (view parent)
DKIM signature
missing
Download raw message
On Thu, 2020-02-20 at 18:44 +0100, Kevin Daudt wrote:
> On Thu, Feb 20, 2020 at 05:20:45PM +0000, Rasmus Thomsen wrote:
> > Hello list,
> > 
> > [..]
> > 
> > As such I'd suggest multiple steps to be taken:
> > 
> > 1) Change existing aports over to the None/plain buildtype to make
> > sure
> > this doesn't break anything (we'll probably use some performance
> > but
> > get smaller packages due to our CFLAGS, but that's the goal here, I
> > suppose)
> > 
> > 2) Change Alpine policy to only use the None/plain buildtype.
> > Additionally, the buildtype _must be_ mentioned, since at least
> > Meson
> > defaults to 'debug' if no buildtype is specified.
> > 
> > 3) Change newapkbuild so that new aports use the correct buildtype
> > (
> > https://gitlab.alpinelinux.org/alpine/abuild/merge_requests/29)
> > 
> > Thanks,
> > 
> > Rasmus Thomsen
> > 
> 
> If feasible, we could add a linting check to verify that the proper
> buildtype is used as well.

That sounds like a good idea, I guess we could check if cmake is
mentioned in an APKBUILD and if so, if the right CMAKE_BUILD_TYPE is
used (and the same for meson with buildtype).
Sören Tempel
Details
Message ID
<3J7AX76HFKMST.26FCBQAO0RFQ7@8pit.net>
In-Reply-To
<2896c13070c508a49cbaa72c8fb7f34ea947358b.camel@cogitri.dev> (view parent)
DKIM signature
missing
Download raw message
Rasmus Thomsen <oss@cogitri.dev> wrote:
> Hello list,

Hello,

This has just been merged. This makes CMake / meson builds consistent
with the configuration in /etc/abuild.conf. If anyone encounters issues
with any of the rebuild packages let us know.

Cheers,
Sören