Make link time optimization flags configurable
We want to use -flto=auto in Arch Linux to speed up building, but we
can't hardcode it in buildenv/lto.sh because other downstreams might
have clang < 13.0.0 which did not recognize -flto=auto as equivalent
to -flto=full.
Introducing an LTOFLAGS variable to makepkg.conf seems the way to go.
Signed-off-by: Allan McRae <allan@archlinux.org>
(cherry picked from commit e1ce2351f5
)
This commit is contained in:
parent
c4a21f333a
commit
51354b7da9
5 changed files with 17 additions and 10 deletions
|
@ -81,6 +81,11 @@ Options
|
||||||
usage resembling ``-Wl,--hash-style=gnu''. Read ld(1) for more details on
|
usage resembling ``-Wl,--hash-style=gnu''. Read ld(1) for more details on
|
||||||
available linker flags.
|
available linker flags.
|
||||||
|
|
||||||
|
**LTOFLAGS=**"ltoflags"::
|
||||||
|
Additional compiler and linker flags appended to `CFLAGS`, `CXXFLAGS`
|
||||||
|
and `LDFLAGS` when building with link time optimization. If empty,
|
||||||
|
``-flto'' is used.
|
||||||
|
|
||||||
**MAKEFLAGS=**"makeflags"::
|
**MAKEFLAGS=**"makeflags"::
|
||||||
This is often used to set the number of jobs used; for example, `-j2`.
|
This is often used to set the number of jobs used; for example, `-j2`.
|
||||||
Other flags that make accepts can also be passed.
|
Other flags that make accepts can also be passed.
|
||||||
|
@ -190,8 +195,9 @@ Options
|
||||||
package containing the debug symbols when used with `strip'.
|
package containing the debug symbols when used with `strip'.
|
||||||
|
|
||||||
*lto*;;
|
*lto*;;
|
||||||
Enable building packages using link time optimization. Adds '-flto'
|
Enable building packages using link time optimization. Adds the
|
||||||
to both CFLAGS and CXXFLAGS.
|
flags specified in LTOFLAGS to CFLAGS, CXXFLAGS and LDFLAGS (or
|
||||||
|
``-flto'' if LTOFLAGS is empty).
|
||||||
|
|
||||||
**INTEGRITY_CHECK=(**check1 ...**)**::
|
**INTEGRITY_CHECK=(**check1 ...**)**::
|
||||||
File integrity checks to use. Multiple checks may be specified; this
|
File integrity checks to use. Multiple checks may be specified; this
|
||||||
|
|
|
@ -41,6 +41,7 @@ CHOST="@CHOST@"
|
||||||
#CFLAGS="-O2 -pipe"
|
#CFLAGS="-O2 -pipe"
|
||||||
#CXXFLAGS="-O2 -pipe"
|
#CXXFLAGS="-O2 -pipe"
|
||||||
#LDFLAGS=""
|
#LDFLAGS=""
|
||||||
|
#LTOFLAGS="-flto"
|
||||||
#RUSTFLAGS="-C opt-level=2"
|
#RUSTFLAGS="-C opt-level=2"
|
||||||
#-- Make Flags: change this for DistCC/SMP systems
|
#-- Make Flags: change this for DistCC/SMP systems
|
||||||
#MAKEFLAGS="-j2"
|
#MAKEFLAGS="-j2"
|
||||||
|
|
|
@ -30,6 +30,6 @@ buildenv_functions+=('buildenv_buildflags')
|
||||||
|
|
||||||
buildenv_buildflags() {
|
buildenv_buildflags() {
|
||||||
if check_option "buildflags" "n"; then
|
if check_option "buildflags" "n"; then
|
||||||
unset CPPFLAGS CFLAGS DEBUG_CFLAGS CXXFLAGS DEBUG_CXXFLAGS LDFLAGS RUSTFLAGS DEBUG_RUSTFLAGS
|
unset CPPFLAGS CFLAGS DEBUG_CFLAGS CXXFLAGS DEBUG_CXXFLAGS LDFLAGS LTOFLAGS RUSTFLAGS DEBUG_RUSTFLAGS
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,8 @@ buildenv_functions+=('buildenv_lto')
|
||||||
|
|
||||||
buildenv_lto() {
|
buildenv_lto() {
|
||||||
if check_option "lto" "y" && ! check_option "buildflags" "n"; then
|
if check_option "lto" "y" && ! check_option "buildflags" "n"; then
|
||||||
CFLAGS+=" -flto"
|
CFLAGS+=" ${LTOFLAGS:--flto}"
|
||||||
CXXFLAGS+=" -flto"
|
CXXFLAGS+=" ${LTOFLAGS:--flto}"
|
||||||
LDFLAGS+=" -flto"
|
LDFLAGS+=" ${LTOFLAGS:--flto}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,10 @@ lint_config_variables() {
|
||||||
local array=(DLAGENTS VCSCLIENTS BUILDENV OPTIONS INTEGRITY_CHECK MAN_DIRS
|
local array=(DLAGENTS VCSCLIENTS BUILDENV OPTIONS INTEGRITY_CHECK MAN_DIRS
|
||||||
DOC_DIRS PURGE_TARGETS COMPRESSGZ COMPRESSBZ2 COMPRESSXZ
|
DOC_DIRS PURGE_TARGETS COMPRESSGZ COMPRESSBZ2 COMPRESSXZ
|
||||||
COMPRESSLRZ COMPRESSLZO COMPRESSZ)
|
COMPRESSLRZ COMPRESSLZO COMPRESSZ)
|
||||||
local string=(CARCH CHOST CPPFLAGS CFLAGS CXXFLAGS RUSTFLAGS LDFLAGS DEBUG_CFLAGS
|
local string=(CARCH CHOST CPPFLAGS CFLAGS CXXFLAGS RUSTFLAGS LDFLAGS LTOFLAGS
|
||||||
DEBUG_CXXFLAGS DEBUG_RUSTFLAGS DISTCC_HOSTS BUILDDIR STRIP_BINARIES
|
DEBUG_CFLAGS DEBUG_CXXFLAGS DEBUG_RUSTFLAGS DISTCC_HOSTS BUILDDIR
|
||||||
STRIP_SHARED STRIP_STATIC PKGDEST SRCDEST SRCPKGDEST LOGDEST PACKAGER
|
STRIP_BINARIES STRIP_SHARED STRIP_STATIC PKGDEST SRCDEST SRCPKGDEST
|
||||||
GPGKEY PKGEXT SRCEXT)
|
LOGDEST PACKAGER GPGKEY PKGEXT SRCEXT)
|
||||||
|
|
||||||
local i keys ret=0
|
local i keys ret=0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue