| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. -ex |
| 2 | |
| 3 | DIR="$1" |
| 4 | |
| 5 | case $(unamescip-shell system . . uname. -s) in |
| 6 | Darwin) |
| 7 | CURLDIR="$(brew --prefix curl)";; |
| 8 | Linux) |
| 9 | export DEBIAN_FRONTEND=noninteractive |
| 10 | if testscip-shell system . . test. -f /etc/apt/sources.list.d/ubuntu.sourcesscip-shell filesystem . . `/etc/apt/sources.list.d/ubuntu.sources`.; then |
| 11 | # Ubuntu 24.04 |
| 12 | sedscip-shell system . . sed. -e 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sourcesscip-shell filesystem . . `/etc/apt/sources.list.d/ubuntu.sources`. | sudoscip-shell system . . sudo. tee /etc/apt/sources.list.d/ubuntu.sourcesscip-shell filesystem . . `/etc/apt/sources.list.d/ubuntu.sources`. |
| 13 | else |
| 14 | # Ubuntu 22.04 and earlier |
| 15 | sedscip-shell system . . sed. -e 's/^deb/deb-src/' /etc/apt/sources.listscip-shell filesystem . . `/etc/apt/sources.list`. | sudoscip-shell system . . sudo. tee /etc/apt/sources.list.d/src.listscip-shell filesystem . . `/etc/apt/sources.list.d/src.list`. |
| 16 | fi |
| 17 | sudoscip-shell system . . sudo. apt-get update |
| 18 | sudoscip-shell system . . sudo. apt-get install build-essential |
| 19 | sudoscip-shell system . . 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 grepscip-shell system . . grep. -q "CURLOPT_USE_SSL" http.h; then |
| 29 | catscip-shell system . . cat. <<EOF | patchscip-shell system . . 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 | printfscip-shell system . . printf. "%s\n" \ |
| 49 | "NO_GETTEXT=YesPlease" \ |
| 50 | "NO_OPENSSL=YesPlease" \ |
| 51 | "prefix=$GIT_INSTALL_PATH" \ |
| 52 | > config.mak |
| 53 | if testscip-shell system . . test. -n "$CURLDIR"; then |
| 54 | printfscip-shell system . . printf. "%s\n" \ |
| 55 | "CURLDIR=$CURLDIR" \ |
| 56 | >> config.mak |
| 57 | fi |
| 58 | makescip-shell system . . make. -j4 |
| 59 | sudoscip-shell system . . sudo. make install |
| 60 | |
| 61 | echoscip-shell system . . echo. "Git version:" |
| 62 | gitscip-shell system . . git. --version --build-options |
| 63 | |
| 64 | echoscip-shell system . . echo. "Git library dependencies:" |
| 65 | case $(unamescip-shell system . . uname. -s) in |
| 66 | Darwin) |
| 67 | otool -L "$(gitscip-shell system . . git. --exec-path)/git-http-fetch";; |
| 68 | Linux) |
| 69 | lddscip-shell system . . ldd. "$(gitscip-shell system . . git. --exec-path)/git-http-fetch";; |
| 70 | esac |