You are not logged in.
I would like to modify a PKGBUILD to redefine both CFLAGS and CXXFLAGS defined in /etc/makepkg,conf and am looking for the most elegant way to do it. I basically want to take the march value from the Arch default and pass a CPU-specific one to it when I build a particular package locally. What seems to work fine is to just unset them and redefine them like the below, but I'm wondering if there is a way I can treat them as an array or the like and simply redefine the march value without the unset stuff. Does that make sense?
...
build() {
unset CFLAGS CXXFLAGS
export CFLAGS="-march=haswell -O2 -pipe -fstack-protector-strong -fdiagnostics-color"
exportCXXFLAGS="${CFLAGS}"
cd "$pkgname-$pkgver"
......perhaps a substitution wherein the target is the source... is that strategically flawed?
CFLAGS=${CFLAGS/x86-64/haswell}Last edited by graysky (2017-05-27 15:42:46)
Offline
Why do you need to remove anything - just append the value(s) you want. Gcc will only use the last march specified:
export CFLAGS+=" -march=whatever""UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I didn't realize the last value is the one honored. Will test to verify and mark when done. Thanks.
Offline