refs/files: fix NULL pointer deref when releasing ref store
[git/gitster.git] / ci / install-dependencies.sh
blob2e7688ae8b8d26f6b333453cfa071a9041d14f78
1 #!/bin/sh
3 # Install dependencies required to build and test Git on Linux and macOS
6 . ${0%/*}/lib.sh
8 begin_group "Install dependencies"
10 P4WHENCE=https://cdist2.perforce.com/perforce/r21.2
11 LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION
12 JGITWHENCE=https://repo.eclipse.org/content/groups/releases//org/eclipse/jgit/org.eclipse.jgit.pgm/6.8.0.202311291450-r/org.eclipse.jgit.pgm-6.8.0.202311291450-r.sh
14 # Make sudo a no-op and execute the command directly when running as root.
15 # While using sudo would be fine on most platforms when we are root already,
16 # some platforms like e.g. Alpine Linux do not have sudo available by default
17 # and would thus break.
18 if test "$(id -u)" -eq 0
19 then
20 sudo () {
21 "$@"
25 case "$distro" in
26 alpine-*)
27 apk add --update shadow sudo build-base curl-dev openssl-dev expat-dev gettext \
28 pcre2-dev python3 musl-libintl perl-utils ncurses \
29 apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
30 bash cvs gnupg perl-cgi perl-dbd-sqlite >/dev/null
32 fedora-*)
33 dnf -yq update >/dev/null &&
34 dnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null
36 ubuntu-*)
37 # Required so that apt doesn't wait for user input on certain packages.
38 export DEBIAN_FRONTEND=noninteractive
40 sudo apt-get -q update
41 sudo apt-get -q -y install \
42 language-pack-is libsvn-perl apache2 cvs cvsps git gnupg subversion \
43 make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
44 tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
45 libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
46 ${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
48 mkdir --parents "$CUSTOM_PATH"
49 wget --quiet --directory-prefix="$CUSTOM_PATH" \
50 "$P4WHENCE/bin.linux26x86_64/p4d" "$P4WHENCE/bin.linux26x86_64/p4"
51 chmod a+x "$CUSTOM_PATH/p4d" "$CUSTOM_PATH/p4"
53 wget --quiet "$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
54 tar -xzf "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz" \
55 -C "$CUSTOM_PATH" --strip-components=1 "git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs"
56 rm "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
58 wget --quiet "$JGITWHENCE" --output-document="$CUSTOM_PATH/jgit"
59 chmod a+x "$CUSTOM_PATH/jgit"
61 ubuntu32-*)
62 sudo linux32 --32bit i386 sh -c '
63 apt update >/dev/null &&
64 apt install -y build-essential libcurl4-openssl-dev \
65 libssl-dev libexpat-dev gettext python >/dev/null
68 macos-*)
69 export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
70 # Uncomment this if you want to run perf tests:
71 # brew install gnu-time
72 brew link --force gettext
74 mkdir -p "$CUSTOM_PATH"
75 wget -q "$P4WHENCE/bin.macosx1015x86_64/helix-core-server.tgz" &&
76 tar -xf helix-core-server.tgz -C "$CUSTOM_PATH" p4 p4d &&
77 sudo xattr -d com.apple.quarantine "$CUSTOM_PATH/p4" "$CUSTOM_PATH/p4d" 2>/dev/null || true
78 rm helix-core-server.tgz
80 if test -n "$CC_PACKAGE"
81 then
82 BREW_PACKAGE=${CC_PACKAGE/-/@}
83 brew install "$BREW_PACKAGE"
84 brew link "$BREW_PACKAGE"
87 esac
89 case "$jobname" in
90 StaticAnalysis)
91 sudo apt-get -q update
92 sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \
93 libexpat-dev gettext make
95 sparse)
96 sudo apt-get -q update -q
97 sudo apt-get -q -y install libssl-dev libcurl4-openssl-dev \
98 libexpat-dev gettext zlib1g-dev
100 Documentation)
101 sudo apt-get -q update
102 sudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make
104 test -n "$ALREADY_HAVE_ASCIIDOCTOR" ||
105 sudo gem install --version 1.5.8 asciidoctor
107 esac
109 if type p4d >/dev/null 2>&1 && type p4 >/dev/null 2>&1
110 then
111 echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)"
112 p4d -V
113 echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)"
114 p4 -V
115 else
116 echo >&2 "WARNING: perforce wasn't installed, see above for clues why"
119 if type git-lfs >/dev/null 2>&1
120 then
121 echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)"
122 git-lfs version
123 else
124 echo >&2 "WARNING: git-lfs wasn't installed, see above for clues why"
127 if type jgit >/dev/null 2>&1
128 then
129 echo "$(tput setaf 6)JGit Version$(tput sgr0)"
130 jgit version
131 else
132 echo >&2 "WARNING: JGit wasn't installed, see above for clues why"
135 end_group "Install dependencies"