Skip to content

Makefile: add support for DESTDIR#366

Merged
timg236 merged 1 commit intoraspberrypi:masterfrom
DeforaNetworks:khorben/destdir
Apr 1, 2026
Merged

Makefile: add support for DESTDIR#366
timg236 merged 1 commit intoraspberrypi:masterfrom
DeforaNetworks:khorben/destdir

Conversation

@khorben
Copy link
Copy Markdown
Contributor

@khorben khorben commented Mar 31, 2026

This facilitates the creation of software packages for systems staging the installation in a dedicated DESTDIR (e.g., pkgsrc for NetBSD).

This facilitates the creation of software packages for systems staging
the installation in a dedicated DESTDIR (e.g., pkgsrc for NetBSD).
install -m 644 mass-storage-gadget64/boot.img $(INSTALL_PREFIX)/share/rpiboot/mass-storage-gadget64
install -m 644 mass-storage-gadget64/config.txt $(INSTALL_PREFIX)/share/rpiboot/mass-storage-gadget64
install -m 644 mass-storage-gadget64/bootfiles.bin $(INSTALL_PREFIX)/share/rpiboot/mass-storage-gadget64
install -d $(DESTDIR)$(INSTALL_PREFIX)/bin
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having both DESTDIR and INSTALL_PREFIX looks a bit weird. Would it be clearer to initialize INSTALL_PREFIX if INSTALL_PREFIX is not defined and DESTDIR is defined?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's common practice to have both PREFIX and DESTDIR. PREFIX is used at compile time for the software to know its final destination, and DESTDIR is used at install time for staging before packaging.
It's possible to use a different PREFIX when compiling and installing (or here, INSTALL_PREFIX) but it can be really awkward to handle in packaging frameworks, and even create bugs when packaging: some software re-generates artefacts when installing, and the resulting bugs only surface in specific compilation contexts, making them hard to track (aka heisenbugs).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, seems safe so merging

@timg236 timg236 merged commit b59ab06 into raspberrypi:master Apr 1, 2026
1 check passed
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 this pull request may close these issues.

2 participants