Debian Codegraph @

script/build-git

raw symbols SCIP
1 #!/bin/sh -ex
2
3 DIR="$1"
4
5 case $(uname -s) in
6 Darwin)
7 CURLDIR="$(brew --prefix curl)";;
8 Linux)
9 export DEBIAN_FRONTEND=noninteractive
10 if test -f /etc/apt/sources.list.d/ubuntu.sources; then
11 # Ubuntu 24.04
12 sed -e 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources | sudo tee /etc/apt/sources.list.d/ubuntu.sources
13 else
14 # Ubuntu 22.04 and earlier
15 sed -e 's/^deb/deb-src/' /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/src.list
16 fi
17 sudo apt-get update
18 sudo apt-get install build-essential
19 sudo apt-get -y build-dep git;;
20 esac
21
22 GIT_INSTALL_PATH="${GIT_INSTALL_DIR:-"/usr/local"}"
23
24 cd "$DIR"
25
26 # Hide macros defined in Git v2.33.x and earlier which now conflict with
27 # macros defined by curl since v8.13.0.
28 if grep -q "CURLOPT_USE_SSL" http.h; then
29 cat <<EOF | patch -p1
30 --- a/http.h
31 +++ b/http.h
32 @@ -45,10 +45,12 @@
33 * CURLOPT_USE_SSL was known as CURLOPT_FTP_SSL up to 7.16.4,
34 * and the constants were known as CURLFTPSSL_*
35 */
36 +/*
37 #if !defined(CURLOPT_USE_SSL) && defined(CURLOPT_FTP_SSL)
38 #define CURLOPT_USE_SSL CURLOPT_FTP_SSL
39 #define CURLUSESSL_TRY CURLFTPSSL_TRY
40 #endif
41 +*/
42
43 struct slot_results {
44 CURLcode curl_result;
45 EOF
46 fi
47
48 printf "%s\n" \
49 "NO_GETTEXT=YesPlease" \
50 "NO_OPENSSL=YesPlease" \
51 "prefix=$GIT_INSTALL_PATH" \
52 > config.mak
53 if test -n "$CURLDIR"; then
54 printf "%s\n" \
55 "CURLDIR=$CURLDIR" \
56 >> config.mak
57 fi
58 make -j4
59 sudo make install
60
61 echo "Git version:"
62 git --version --build-options
63
64 echo "Git library dependencies:"
65 case $(uname -s) in
66 Darwin)
67 otool -L "$(git --exec-path)/git-http-fetch";;
68 Linux)
69 ldd "$(git --exec-path)/git-http-fetch";;
70 esac