Search code examples
linuxgitbuildinstallation

How to build git with static linking?


I downloaded git source from https://github.com/git/git as a zip file.

I extracted it into /home/Desktop/denis/git (using Ubuntu).

Now the tutorial here says that I should run

./configure --prefix=/home/denis/git-static CFLAGS="${CFLAGS} -static"

from the above mentioned folder as a step for building git.

But the git source does not appear to have a configure file in it's root folder which I can run (only configure.ac, which I suspect is not what I'm looking for).

What am I missing here? How to build git manually?

I'm doing this because I'm trying to get git working on a shared hosting server where I'm not able to install git.


Solution

  • Read the INSTALL file in the root folder of the unzipped file, it seems there is some useful instruction in it, what I suspect:

    Alternatively you can use autoconf generated ./configure script to set up install paths (via config.mak.autogen), so you can write instead

        $ make configure ;# as yourself
        $ ./configure --prefix=/usr ;# as yourself
        $ make all doc ;# as yourself
        # make install install-doc install-html;# as root
    

    or just simply:

        $ make prefix=/usr all doc info ;# as yourself
        # make prefix=/usr install install-doc install-html install-info ;# as root