aclements / libelfin

C++11 ELF/DWARF parser
MIT License
314 stars 99 forks source link

DESTDIR support in make install #35

Closed kodo-pp closed 4 years ago

kodo-pp commented 5 years ago

Setting custom install location independent from $PREFIX should be implemented. For example, I want make DESTDIR=/tmp/pkg PREFIX=/usr install to install libraries and headers to /tmp/pkg/usr, but write libdir and includedir entries to pkg-config files based only on $PREFIX (like $PREFIX/lib and $PREFIX/include, but not $DESTDIR/$PREFIX/whatever).

The main reason for it is packaging. When you are creating a package you often need to install the program or library to a temporary directory, which then will be archived and will go to the package. Simply setting PREFIX doesn't help because it will make pkg-config entries to look like this (incorrect): /path/to/pkgdir/usr/include instead of this (correct): /usr/include. You can see it in detail in this terminal transcript: https://gist.github.com/kodo-pp/482bef5afbece8bdb3c01bac461b1e03