aboutsummaryrefslogtreecommitdiff
path: root/core/git/build
blob: eb336bb3cf191d53a41c0f8266d530762a2fd8e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh -e

sed -i '/^\#include.*openssl.*\.h/d' git-compat-util.h

[ "$CPT_CROSS_TRIPLET" ] && CC=$CPT_CROSS_TRIPLET-cc

cat > config.mak <<EOF
NO_GETTEXT=YesPlease
NO_SVN_TESTS=YesPlease
NO_TCLTK=YesPlease
NO_EXPAT=YesPlease
NO_NSEC=YesPlease
NO_PYTHON=YesPlease
NO_PERL=YesPlease
NO_SYS_POLL_H=1
NO_OPENSSL=YesPlease
NO_CROSS_DIRECTORY_HARDLINKS=1
NO_INSTALL_HARDLINKS=1
EOF

export LDFLAGS="$LDFLAGS -static"

cpt-configure \
    --with-curl \
    ac_cv_snprintf_returns_bogus=no \
    ac_cv_fread_reads_directories=yes

make
make DESTDIR="$1" install

for man in man1/*.1 man5/*.5 man7/*.7; do
    install -Dm644 "$man" "$1/usr/share/man/$man"
done


# Build and install remote-http helper. This doesn't happen by default when
# building static git.
set -x
export CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -I$PWD -I$PWD/compat/regex -I$PWD/xdiff -include config.h"
for obj in http http-walker; do
    # shellcheck disable=2086
    "${CC:=cc}" $CFLAGS -c "$obj.c"
done

# shellcheck disable=2086,2046
"$CC" $LDFLAGS $CFLAGS -o "$1/usr/libexec/git-core/git-remote-http" remote-curl.c http.o http-walker.o libgit.a common-main.o xdiff/lib.a $(pkg-config --static --libs zlib libcurl)

for remote in https ftp ftps; do
    ln -sf git-remote-http "$1/usr/libexec/git-core/git-remote-$remote"
done