Advice on distributing a project

Joshua Root jmr at macports.org
Tue Jun 26 21:42:38 UTC 2018


On 2018-6-27 01:07 , Langer, Stephen A. (Fed) wrote:
> That's what I don't understand.   When not using MacPorts, we use install_name_tool to fix the libraries.  They're built in $HOME/project/build/{lib, include, etc} and moved to $PREFIX /{lib, include, etc}, at which point install_name_tool fixes their ids.  With MacPorts, $PREFIX is ${destroot}${prefix}.  Are the files moved again when the port is installed?  Does the destroot phase need to use an install_name that's different from the actual name, anticipating the later move?

The destroot is a temporary staging area, yes. Conceptually (the reality
is a little more complicated), installing a port tars up the contents of
$destroot, and activating the port extracts the tarball into /.

Combining $destroot and $prefix into a single path and using that
everywhere thus won't work right. Where your build system puts the files
is not where they will end up, and thus not where the dylib load
commands should point. It's a similar situation to if you were to
install symbolic links -- the link targets should be ${prefix}/something
even though you're creating the links at ${destroot}${prefix}/somewhere.

The $destroot variable corresponds to $DESTDIR as used by autotools and
other systems, so their documentation may also be helpful in
understanding how it is handled:

<https://www.gnu.org/prep/standards/html_node/DESTDIR.html>
<https://www.gnu.org/software/automake/manual/html_node/DESTDIR.html>
<https://www.freebsd.org/doc/en/books/porters-handbook/porting-prefix.html>

- Josh


More information about the macports-users mailing list