Update installation folder
Update installation folder to /usr/local instead of /usr in Makefile (MacOS doesn't allow user writing to /usr/bin anymore)
On FreeBSD prefix for non-base packages is also /usr/local the same as on macOS BSD mentioned by @valentinpy.
This hardcoded /usr prefix is really problematic, because even though you select make prefix=/usr/local files are installed into /usr/local/usr/bin and /usr/local/usr/man not the /usr/local/bin nor /usr/local/man/ :-(
What is more make does not respect envitonment PREFIX as it should.
Also if you look at install-man:
58 if [ -f $(PREFIX)$(binndir)/man8 ]; then \
59 rm -f $(PREFIX)$(bindir)/man8; \
60 fi
THIS IS A DISASTER!!!
- There is an error in variables:
$(bindir)in place of$(mandir)! - When run as root and mess up the prefix it will delete your system files without asking!!!!!
Here are fixes: https://github.com/chexum/genromfs/pull/3
Also if you look at
install-man:58 if [ -f $(PREFIX)$(binndir)/man8 ]; then \ 59 rm -f $(PREFIX)$(bindir)/man8; \ 60 fiTHIS IS A DISASTER!!!
* There is an error in variables: `$(bindir)` in place of `$(mandir)`! * When run as root and mess up the prefix it will delete your system files without asking!!!!!
Thank you for the reported concerns! However, maybe you are missing that rm -f will only ever remove a file - and this is even protected by the condition to ensure a single file exists with this name. If you have a file named /usr/local/bin/man8, yes, it will be removed, but no such file should be normally part of a sane system - if you have information on a system that does, I'd be happy to reconsider. This fragment is a workaround to clean up a mistake in the installation script in a previous release, when the manual was installed under this name incorrectly. No other file will be removed, and this should not have adverse effect on any running system.
However, this is not really useful, nowadays people don't generally install packages from source, even less so installing obsolete versions, then installing later versions to upgrade the packages, so in a later release this should indeed be removed.
On FreeBSD prefix for non-base packages is also
/usr/localthe same as on macOS BSD mentioned by @valentinpy.This hardcoded
/usrprefix is really problematic, because even though you selectmake prefix=/usr/localfiles are installed into/usr/local/usr/binand/usr/local/usr/mannot the/usr/local/binnor/usr/local/man/:-(What is more
makedoes not respect envitonmentPREFIXas it should.
The makefile is indeed predates best practices for simple builds. PREFIX is roughly covering the functionality of DESTDIR, but that's roughly the only confusing part.
The expected usage is something like: make prefix=/usr/local PREFIX=/mnt/mychroot
The defaults would be indeed better to install into /usr/local by default, to make sure accidental make && make install don't disturb the files provided by the operating system under /usr. I'll try to have some time later to consider this and a few other issues that still bug me.
Thanks @chexum :-) My fixes are provided in https://github.com/chexum/genromfs/pull/3. In addition to prefix is also fixes cc vs gcc. We use automation called Port to build on FreeBSD and provide binary package to the users, still users can build it on their own using that automation :-)