Hey all,
How do I properly add compile flags in a PKGBUILD?
I’m trying to install MiKTeX installed from AUR. However due to the the standard compile flag -Werror=format-security set in /etc/makepkg.conf the project fails to compile.
I wanted to try to add the compile flag with -Wno-error=format-security in the PKGBUILD by adding: options=('buildflags=" -Wno-error=format-security")
However, I always get an error saying that the options contains an unknown option… According to man pages of PKGBUILD it is possible, so I assume I just couldn’t figure out the proper syntax.
I can’t find a good example on how to use that opiton and I tried various variations including options=('buildflags="CFLAGS=\" -Wno-error=format-security\"") and many more, but I can’t get it to accept the options.
PS: Unfortunately, Arch Linux and derivatives are not officially supported (yet) by MiKTeX and therefore, the MiKTeX programmers won’t accept bug reports from these distributions. I (and some others) might have to go with that workaround for that reason.
Thank you!
That solved the error of the misformatted PKGBUILD.
Apparently, I misunderstood the manual pages…
Unfortunately, adding -Wno-error=format-security won’t overwrite -Werror=format-security specified in makepkg.conf. However, completely disabling buildflags by adding options=("!buildflags") allows the package to compile sucessfully.
It appears that the presence of -Werrorhas a higher priority than -Wno-error, which makes sense.
I guess, the only way that is left would be to try to use string substitution. I’m not sure if that’s a good solution, but I guess I’ll give it a try on Wednesday.
Interesting, didn’t realize it couldn’t be overridden with either way I proposed. I thought I’ve been able to override build flags before like that. I know I have with Meson projects, but that’s a different animal.
If you find a way to override that flag, let me know.