Makefile: add support for DESTDIR#366
Conversation
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
This facilitates the creation of software packages for systems staging the installation in a dedicated DESTDIR (e.g., pkgsrc for NetBSD).