Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build system doesn't follow best practises #10

Open
meator opened this issue Sep 17, 2024 · 2 comments
Open

Build system doesn't follow best practises #10

meator opened this issue Sep 17, 2024 · 2 comments

Comments

@meator
Copy link

meator commented Sep 17, 2024

This issue is related to MayaPosch/NymphCast#90. I personally believe that all of the issues below could be easily solved by using an alternative build system such as Meson instead of Make.

NymphRPC's Makefile doesn't follow Makefile best practices defined in the GNU Make manual: https://www.gnu.org/software/make/manual/make.html#Makefile-Conventions

Problems caused by this

  • cross compilation is impossible
  • using custom compilers such as clang++ is impossible
  • NymphRPC cannot build on distributions/build environments which distribute dependencies in nonstandard ways (I have verified that NymphRPC is not buildable under Nix, I assume that it isn't buildable under GNU Guix and other systems too)
  • NymphRPC hardcodes a lot of programs (which can again causes problems on Nix, GNU Guix...)
    • tar is hardcoded, making it impossible to use other compatible archivers (bsdtar etc.)
    • install is hardcoded, which directly violates recommendations of the GNU Make manual
    • and there are more hardcoded utilities
  • CXXFLAGS are ignored even though CFLAGS have special handling, which is peculiar for a C++-only project
  • user supplied CFLAGS aren't placed last in CFLAGS (or even close to the end), which directly violates GNU Make manual's recommendations
  • these and other choices made in the Makefile severely hinder portability of NymphRPC, because a lot of platform dependent assumptions are made and there is no way to externally override them

Recommended course of action

  • use compiler ($CXX) from the environment instead of hardcoding g++
    • some platform dependent code will require further consideration if this change is implemented, like this block
  • follow advice from Variables for Specifying Commands and make tar, install, g++, ar and possibly more configurable from the environment
  • ignore CFLAGS and inherit CXXFLAGS from the environment instead
  • put user defined CXXFLAGS after all hardcoded flags (or at least near the end behind -O0 and -g3)

I could whip up some PR which would fix these problems, but I don't think I have the capacity to fully test the build system, because NymphRPC seems to target many platforms.

@MayaPosch
Copy link
Owner

The Makefile was switched to the use of CXX with preference for an environment variable and the use of CXXFLAGS.

@meator
Copy link
Author

meator commented Nov 9, 2024

Thanks for addressing this issue. I still have my WIP Makefile changes in my local checkout (I kind of forgot about this issue & there were some blockers such as #11), I could make a PR from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants