[aur-general] cmake does not (necessarily) honor makepkg.conf
I first came across this problem while working on mmug-qq (a project to create updated and upstream packages for various build dependencies of pcsx2) when I found that some cmake packages would not compile in 32bit with any configuration. It took some digging, but I finally determined that I had indeed exhausted every appropriate option. Something was blocking, ignoring, or removing my settings; preventing packages from being built with the parameters I specified in makepkg.conf and in the PKGBUILDs. The problem is cmake, or more specifically it's various layers of macros. Many cmake packages fail to pass CFLAGS, CXXFLAGS, and LDFLAGS through the various macros to make; some packages ignore these variables entirely. This does not appear to be intentional; I did not find code explicitly stripping away or replacing flags. I found that many of the macros just lost them somewhere; failed to transfer them to cmake variables that would be used later; or inexplicably make with no flags at all for no reason. The only way I could convince cmake packages to always use all of the flags specified in makepkg.conf and/or in the PKGBUILD was to deceive it; to force it to use compilers and a linker with the flags built in. So I created three files: gcc-flagged: /usr/bin/gcc $CFLAGS "$@" g++-flagged: /usr/bin/g++ $CXXFLAGS "$@" ld-flagged: /usr/bin/ld $LDFLAGS "$@" and added this to sources(): {gcc,g++,ld}-flagged and this to the cmake call: -DCMAKE_C_COMPILER="$srcdir"/gcc-flagged \ -DCMAKE_CXX_COMPILER="$srcdir"/g++-flagged \ -DCMAKE_LINKER="$srcdir"/ld-flagged For an example, check out my sdl2-hg-multilib packaging: https://github.com/quequotion/mmug-qq/tree/master/sdl2-hg-multilib
participants (1)
-
Que Quotion