Search code examples
gitautoconf

Is it possible to build `git` such that the install directory and the deployment prefix is not the same?


I am attempting to build git from source, and I would like make install to put the binaries into a directory called dist in my source directory, so I use the following configure line.

./configure --prefix=`pwd`/dist

Unfortunately, this also causes the build output to assume that this is the final install location for git, and therefore hardcode the path into various scripts and binaries such as libexec/git-core/git-difftool.

Is there a way to specify during either configure or make that I want a different path for actual deployment, such as /usr/bin/local, but still have make install go into the directory pwd/dist?


Solution

  • Since this question has been unanswered for a few days, I emailed the git developers, and received the following answer, indicating that I should set prefix to the actual install path, and use the DESTDIR environmental variable to control where make install puts files.

    ./configure --prefix=/usr/local
    make
    DESTDIR=$(PWD)/dist make install
    

    Thus, the deployment prefix should be set with --prefix during ./configure while the install destination should be specified by DESTDIR.

    Update: I have tested this solution and confirmed that it works correctly.