When building extensions, a very handy trick the
DESTDIR=/tmp/dest argument to
make install (where /tmp/dest is simply an empty directory).
Rarely, DESTDIR doesn't work, which can make it difficult to build an extension.
The wiki gives a workaround for when DESTDIR fails
here, but the workaround has a caveat (see the "Be careful..." part), which requires its own workaround.
I recently discovered a little utility called
inotifywait (part of the inotify-tools.tcz extension) which provides a much cleaner workaround for when DESTDIR fails:
$ inotifywait --quiet --monitor --recursive -e create --format '%w%f' /usr/local >new.txt &
-> install the package (e.g., sudo make install, sudo cmake --install build, etc.)
$ pkill inotifywait
$ cat new.txt | sort | uniq >list.txt
$ tar -cvf dest.tar -T list.txt
$ mkdir /tmp/dest
$ tar -xvf dest.tar -C /tmp/dest
After the above, /tmp/dest will contain exactly what you would expect
P.S. Regarding some of the options to inotifywait: The tool is quite chatty by default. The
--quiet flag tells it not to introduce itself when it starts running. The
-e create option quiets it down further by telling it that we are only interested in new directories and files, nothing else. The
--format '%w%f' option quiets it down more by saying that we want it to merely output the path of new directories and files, without any commentary. Even after all this there are still some duplicate lines in the output, which is why the
sort | uniq step is needed later on.
P.P.S. I would add this tip the appropriate place in the wiki, but the wiki will not allow me to log in no matter what I do.