Standardize build system
chedr opened this issue · 4 comments
I want to thank you for your work on this project... I was in desperate need of an EqualizerAPO equivalent for Linux.
If I were to re-write your build system to something more standardized like CMake and have it packaged for Fedora would you be interested in accepting a PR?
Well, I've never used CMake, so i'd have to learn it. What would you expect the benefit to be? I don't really want to change just for the sake of changing...
Using a meta-build system like CMake or autotools (I mentioned CMake because that is what I am most familiar with) allows projects to be compiled and packaged on multiple platform, distributions, and even architectures with minimal effort. It also allows developers to generate build instructions (GNUMake, Code::Blocks, Visual Studio (not that it applies here)) how they see fit, rather than being confined. CMake also has functionality via CPack to generate .deb and .rpm packages (https://cmake.org/Wiki/CMake:CPackPackageGenerators). The developers and evangelicals could probably sell you a little more: https://cmake.org/overview/, https://cmake.org/success/.
To directly answer the question: I believe switching to a meta-build system will allow your software to be built and packaged for more distributions and architectures easily. One could accomplish the same goal with GNUMake, but will require more work.
An example of something that is "wrong" with the current build process is its interaction with RPMBuild. RPMBuild expects ./configure
to accept the following (Fedora 26 via rpm --eval %configure
):
CFLAGS="${CFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic}" ; export CFLAGS ;
CXXFLAGS="${CXXFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic}" ; export CXXFLAGS ;
FFLAGS="${FFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -I/usr/lib64/gfortran/modules}" ; export FFLAGS ;
FCFLAGS="${FCFLAGS:--O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -I/usr/lib64/gfortran/modules}" ; export FCFLAGS ;
LDFLAGS="${LDFLAGS:--Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld}"; export LDFLAGS;
[ "1" = 1 ] && for i in $(find $(dirname ./configure) -name config.guess -o -name config.sub) ; do
[ -f /usr/lib/rpm/redhat/$(basename $i) ] && /usr/bin/rm -f $i && /usr/bin/cp -fv /usr/lib/rpm/redhat/$(basename $i) $i ;
done ;
[ "1" = 1 ] && [ x != "x-specs=/usr/lib/rpm/redhat/redhat-hardened-ld" ] &&
for i in $(find . -name ltmain.sh) ; do
/usr/bin/sed -i.backup -e 's~compiler_flags=$~compiler_flags="-specs=/usr/lib/rpm/redhat/redhat-hardened-ld"~' $i
done ;
./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu \
--program-prefix= \
--disable-dependency-tracking \
\
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--datadir=/usr/share \
--includedir=/usr/include \
--libdir=/usr/lib64 \
--libexecdir=/usr/libexec \
--localstatedir=/var \
--sharedstatedir=/var/lib \
--mandir=/usr/share/man \
--infodir=/usr/share/info
Personally, I find CMake's syntax easy... but that's just my opinion, tell me what you think:
https://cmake.org/cmake-tutorial/
https://github.com/chedr/frandom/blob/master/CMakeLists.txt
I'm perfectly willing to maintain a fork for my own sake, but I figured I'd open a discussion especially if the thought had already surfaced. 😄
Thanks for the info. I'd consider switching, but I'll also mention that Fedora's packaging tools don't seem to be so inflexible that you can't build a package using the current build system; you just can't use the %configure
macro.
Absolutely. The macro is highly encouraged, but ultimately optional, albeit less portable (consistent) compared to other packages with meta-build systems. As mentioned I'll start porting the project over to CMake and let you decide if you think it is worth taking in the PR. You're welcome to close this issue if you don't have any further comments. 😃