Enhance Makefile for library and program installation on Linux #69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello everyone!
I am a maintainer of the ALT Linux distribution (https://www.basealt.ru/en) and the maintainer of your project, Varnam (https://packages.altlinux.org/en/search/?branch=sisyphus&q=varnam).
I received a bug report regarding libgovarnam (https://bugzilla.altlinux.org/54897) (unfortunately, it's in Russian), which made me realize that I should use my experience to help your project achieve a correct Makefile. This will significantly simplify the maintenance of the package and speed up its availability in the repositories of other Linux distributions.
Currently, to build your project, I have to perform the following steps:
As you can see, this is not ideal. The issue arises because you are using a shell script with sudo for installation instead of a Makefile. This is problematic since many build environments in various distributions do not have sudo, which makes your script unusable. Additionally, many users who want to build your project from source may not have sudo configured to avoid password prompts for every command. Personally, I would have to enter my password dozens of times to install your program. Moreover, elevating privileges for users is very unsafe, as compromising a less privileged user can compromise the entire system if they can escalate privileges.
Furthermore, many build environments in different distributions do not have git, so your project should not rely on fetching the version from git, as this breaks the build process. Additionally, your Makefile is heavily tied to predefined installation paths, which is not ideal. Different distributions may have different hierarchies; for example, libraries may be installed in /usr/lib or /usr/lib64, and so on.
I have added more flexibility to the Makefile using macros like DESTDIR, BINDIR, LIBDIR, etc. This is a common practice, as outlined in the GNU Coding Standards and RPM macros. I also fixed the packaging issue with the libraries; libgovarnam.so should be a symbolic link to libgovarnam.X.Y.Z, which is the standard practice across all distributions.
After my modifications, the Makefile and govarnam.pc allow the package build process to look like this:
This is much better, isn't it?