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

PREFIX / DESTDIR handled incorrectly in Makefiles #15

Open
emixa-d opened this issue Jul 26, 2023 · 4 comments · Fixed by #16
Open

PREFIX / DESTDIR handled incorrectly in Makefiles #15

emixa-d opened this issue Jul 26, 2023 · 4 comments · Fixed by #16

Comments

@emixa-d
Copy link

emixa-d commented Jul 26, 2023

The Makefiles use $(DESTDIR) where it should use $(DESTDIR)$(PREFIX) instead. At least, that's the convention that is conventionally expected (*) (**):

(^) $(DESTDIR)$(PREFIX) or $(DESTDIR)/$(PREFIX) varies, but the latter seems safe in all cases (I gues?).
(*) https://people.freebsd.org/~rodrigc/doc/data/doc/en_USa.ISO8859-1/books/porters-handbook/porting-prefix.html
(**) https://www.gnu.org/software/make/manual/html_node/DESTDIR.html

@emixa-d
Copy link
Author

emixa-d commented Apr 25, 2024

the PR #16 does not fix #15! That PR only allows overriding DESTDIR (and STRIP and CFLAGS, but that has nothing to do with #15). It still uses DESTDIR and PREFIX incorrectly. Please reopen, and read the things I linked to (here's an updated link, as one of them appears to be broken):

https://people.freebsd.org/~olivierd/porters-handbook/porting-prefix.html#:~:text=PREFIX%20determines%20where%20the%20port,the%20value%20of%20this%20variable.

@emixa-d
Copy link
Author

emixa-d commented Apr 25, 2024

I notice that link isn't very clear on DESTDIR.

$(DESTDIR)/$(PREFIX): this is the file name prefix where you install stuff

$(PREFIX): this is the file name prefix you use in installed binaries/shell scripts/man pages/...

@mcayland
Copy link
Collaborator

I notice that link isn't very clear on DESTDIR.

(DESTDIR)/(PREFIX): this is the file name prefix where you install stuff

$(PREFIX): this is the file name prefix you use in installed binaries/shell scripts/man pages/...

Sorry that's my mistake - I thought that the DESTDIR change was enough for your use case.

It seems that you already have a good understanding of the change you're looking for, so please raise a PR and I'll ensure it gets reviewed and merged ASAP.

@mcayland mcayland reopened this Apr 25, 2024
@emixa-d
Copy link
Author

emixa-d commented Apr 25, 2024

For this software, it is technically sufficient. It's more a matter of convenience -- adhering to DESTDIR / PREFIX distinction is convenient for package management things.

I don't have git set-up currently, so here are is a manual 'patch':
In each of the Makefiles, replace

DESTDIR ?= /usr/local

by

DESTDIR ?=
PREFIX ?= /usr/local

and replace

mkdir -p $(DESTDIR)
cp $(PROGRAM) $(DESTDIR)/bin/$(PROGRAM)

by

mkdir -p $(DESTDIR)
cp $(PROGRAM) $(DESTDIR)$(PPREFIX)/bin/$(PROGRAM)

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

Successfully merging a pull request may close this issue.

2 participants