interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / ci / install-dependencies.sh

176 lines · 5522 bytes Raw Blame History
1#!/bin/sh
2#
3# Install dependencies required to build and test Git on Linux and macOS
4#
5
6. ${0%/*}/lib.sh
7
8begin_group "Install dependencies"
9
10P4WHENCE=https://cdist2.perforce.com/perforce/r23.2
11LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION
12JGITWHENCE=https://repo1.maven.org/maven2/org/eclipse/jgit/org.eclipse.jgit.pgm/6.8.0.202311291450-r/org.eclipse.jgit.pgm-6.8.0.202311291450-r.sh
13CARGO_MSRV_VERSION=0.18.4
14CARGO_MSRV_WHENCE=https://github.com/foresterre/cargo-msrv/releases/download/v$CARGO_MSRV_VERSION/cargo-msrv-x86_64-unknown-linux-musl-v$CARGO_MSRV_VERSION.tgz
15
16# Make sudo a no-op and execute the command directly when running as root.
17# While using sudo would be fine on most platforms when we are root already,
18# some platforms like e.g. Alpine Linux do not have sudo available by default
19# and would thus break.
20if test "$(id -u)" -eq 0
21then
22 sudo () {
23 "$@"
24 }
25fi
26
27case "$distro" in
28alpine-*)
29 apk add --update shadow sudo meson ninja-build gcc libc-dev curl-dev openssl-dev expat-dev gettext \
30 zlib-ng-dev pcre2-dev python3 musl-libintl perl-utils ncurses \
31 apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
32 bash cvs gnupg perl-cgi perl-dbd-sqlite perl-io-tty cargo >/dev/null
33 ;;
34fedora-*|almalinux-*)
35 case "$jobname" in
36 *-meson)
37 MESON_DEPS="meson ninja";;
38 esac
39 dnf -yq update >/dev/null &&
40 dnf -yq install shadow-utils sudo make pkg-config gcc findutils diffutils perl python3 gawk gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel $MESON_DEPS cargo >/dev/null
41 ;;
42ubuntu-*|i386/debian-*|debian-*)
43 # Required so that apt doesn't wait for user input on certain packages.
44 export DEBIAN_FRONTEND=noninteractive
45
46 case "$distro" in
47 ubuntu-*)
48 SVN='libsvn-perl subversion'
49 LANGUAGES='language-pack-is'
50 ;;
51 *)
52 SVN='libsvn-perl subversion'
53 LANGUAGES='locales-all'
54 ;;
55 esac
56
57 sudo apt-get -q update
58 sudo apt-get -q -y install \
59 $LANGUAGES apache2 cvs cvsps git gnupg $SVN \
60 make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
61 tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
62 libemail-valid-perl libio-pty-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
63 libsecret-1-dev libpcre2-dev meson ninja-build pkg-config cargo \
64 ${CC_PACKAGE:-${CC:-gcc}} python3
65
66 # Starting with Ubuntu 25.10, sudo can now be provided via either
67 # sudo(1) or sudo-rs(1), with the latter being the default. The problem
68 # is that it does not support `--preserve-env` though, which we rely on
69 # in our CI. We thus revert back to the C implementation.
70 if test -f /etc/alternatives/sudo
71 then
72 sudo update-alternatives --set sudo /usr/bin/sudo.ws
73 fi
74
75 # on uutils v0.2.2 from rust-coreutils,
76 # dirname "foo/."
77 # outputs "." instead of "foo" like it should.
78 # Use GNU coreutils to provide dirname instead.
79 #
80 # See <https://github.com/uutils/coreutils/issues/10508>.
81 if test -x /usr/bin/gnudirname
82 then
83 ln -sfT /usr/bin/gnudirname /usr/bin/dirname
84 fi
85
86 case "$distro" in
87 ubuntu-*)
88 mkdir --parents "$CUSTOM_PATH"
89
90 wget --quiet --directory-prefix="$CUSTOM_PATH" \
91 "$P4WHENCE/bin.linux26x86_64/p4d" \
92 "$P4WHENCE/bin.linux26x86_64/p4"
93 chmod a+x "$CUSTOM_PATH/p4d" "$CUSTOM_PATH/p4"
94 echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)"
95 p4d -V
96 echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)"
97 p4 -V
98
99 wget --quiet \
100 "$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
101 tar -xzf "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz" \
102 -C "$CUSTOM_PATH" --strip-components=1 \
103 "git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs"
104 rm "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
105 echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)"
106 git-lfs version
107
108 wget --quiet "$JGITWHENCE" --output-document="$CUSTOM_PATH/jgit"
109 chmod a+x "$CUSTOM_PATH/jgit"
110 echo "$(tput setaf 6)JGit Version$(tput sgr0)"
111 jgit version
112 ;;
113 esac
114 ;;
115macos-*)
116 export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
117 # Uncomment this if you want to run perf tests:
118 # brew install gnu-time
119 brew link --force gettext
120
121 mkdir -p "$CUSTOM_PATH"
122 wget -q "$P4WHENCE/bin.macosx12arm64/helix-core-server.tgz"
123 tar -xf helix-core-server.tgz -C "$CUSTOM_PATH" p4 p4d
124 rm helix-core-server.tgz
125 echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)"
126 p4d -V
127 echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)"
128 p4 -V
129
130 case "$jobname" in
131 osx-meson)
132 brew install meson ninja pcre2
133 ;;
134 esac
135
136 if test -n "$CC_PACKAGE"
137 then
138 BREW_PACKAGE=${CC_PACKAGE/-/@}
139 brew install "$BREW_PACKAGE"
140 brew link "$BREW_PACKAGE"
141 fi
142 ;;
143esac
144
145case "$jobname" in
146ClangFormat)
147 sudo apt-get -q -y install clang-format
148 ;;
149StaticAnalysis)
150 sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \
151 libexpat-dev gettext make
152 ;;
153RustAnalysis)
154 sudo apt-get -q -y install rustup
155 rustup default stable
156 rustup component add clippy rustfmt
157
158 wget -q "$CARGO_MSRV_WHENCE" -O "cargo-msvc.tgz"
159 sudo mkdir -p "$CUSTOM_PATH"
160 sudo tar -xf "cargo-msvc.tgz" --strip-components=1 \
161 --directory "$CUSTOM_PATH" --wildcards "*/cargo-msrv"
162 sudo chmod a+x "$CUSTOM_PATH/cargo-msrv"
163 ;;
164sparse)
165 sudo apt-get -q -y install libssl-dev libcurl4-openssl-dev \
166 libexpat-dev gettext zlib1g-dev sparse
167 ;;
168Documentation)
169 sudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make ruby \
170 asciidoctor
171
172 sudo gem install concurrent-ruby
173 ;;
174esac
175
176end_group "Install dependencies"