Skip to content

Do not set DESTDIR in makeFlags #65718

@jtojnar

Description

@jtojnar

DESTDIR is used by some package managers as a poor man’s sandbox, transparent to the package. Setting DESTDIR=$(out) PREFIX= in makeFlags
will place the files in the correct directory but the program itself will not be aware of the files’ location. For example, if the source code is hardcoding PREFIX "foo", it will try to open foo instead of $out/foo.

This is usually done when make install tries to create a $(DESTDIR)/var directory but as described above, it can have a negative side effect.

With autotools you can set installFlags = [ "localstatedir=${placeholder "out"}/var" ]; or installFlags = [ "sysconfdir=${placeholder "out"}/etc" ]; that should fix most instances of the issue. When the project using hand-written Makefiles, you need to check the files to see how to replace them. In the worst case, especially when the paths are hard-coded in the build files, you will need to patch the build files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md3.skill: sprintableA larger issue which is split into distinct actionable tasks6.topic: best practicesDocumentation and discussion around best practices for Nixpkgs development

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions