ci: convert "install-dependencies.sh" to use "/bin/sh"
[alt-git.git] / ci / install-dependencies.sh
blob2d6af876d64675dfef54c197d103a32144db87f0
1 #!/bin/sh
3 # Install dependencies required to build and test Git on Linux and macOS
6 . ${0%/*}/lib.sh
8 P4WHENCE=https://cdist2.perforce.com/perforce/r21.2
9 LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION
11 # Make sudo a no-op and execute the command directly when running as root.
12 # While using sudo would be fine on most platforms when we are root already,
13 # some platforms like e.g. Alpine Linux do not have sudo available by default
14 # and would thus break.
15 if test "$(id -u)" -eq 0
16 then
17 sudo () {
18 "$@"
22 case "$distro" in
23 ubuntu-*)
24 sudo apt-get -q update
25 sudo apt-get -q -y install \
26 language-pack-is libsvn-perl apache2 \
27 make libssl-dev libcurl4-openssl-dev libexpat-dev \
28 tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
29 libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl \
30 $CC_PACKAGE $PYTHON_PACKAGE
32 mkdir --parents "$P4_PATH"
33 wget --quiet --directory-prefix="$P4_PATH" \
34 "$P4WHENCE/bin.linux26x86_64/p4d" "$P4WHENCE/bin.linux26x86_64/p4"
35 chmod u+x "$P4_PATH/p4d" "$P4_PATH/p4"
37 mkdir --parents "$GIT_LFS_PATH"
38 wget --quiet "$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
39 tar -xzf "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz" \
40 -C "$GIT_LFS_PATH" --strip-components=1 "git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs"
41 rm "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
43 macos-*)
44 export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
45 # Uncomment this if you want to run perf tests:
46 # brew install gnu-time
47 test -z "$BREW_INSTALL_PACKAGES" ||
48 brew install $BREW_INSTALL_PACKAGES
49 brew link --force gettext
51 mkdir -p "$P4_PATH"
52 wget -q "$P4WHENCE/bin.macosx1015x86_64/helix-core-server.tgz" &&
53 tar -xf helix-core-server.tgz -C "$P4_PATH" p4 p4d &&
54 sudo xattr -d com.apple.quarantine "$P4_PATH/p4" "$P4_PATH/p4d" 2>/dev/null || true
55 rm helix-core-server.tgz
57 if test -n "$CC_PACKAGE"
58 then
59 BREW_PACKAGE=${CC_PACKAGE/-/@}
60 brew install "$BREW_PACKAGE"
61 brew link "$BREW_PACKAGE"
64 esac
66 case "$jobname" in
67 StaticAnalysis)
68 sudo apt-get -q update
69 sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \
70 libexpat-dev gettext make
72 sparse)
73 sudo apt-get -q update -q
74 sudo apt-get -q -y install libssl-dev libcurl4-openssl-dev \
75 libexpat-dev gettext zlib1g-dev
77 Documentation)
78 sudo apt-get -q update
79 sudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make
81 test -n "$ALREADY_HAVE_ASCIIDOCTOR" ||
82 sudo gem install --version 1.5.8 asciidoctor
84 esac
86 if type p4d >/dev/null 2>&1 && type p4 >/dev/null 2>&1
87 then
88 echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)"
89 p4d -V
90 echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)"
91 p4 -V
92 else
93 echo >&2 "WARNING: perforce wasn't installed, see above for clues why"
95 if type git-lfs >/dev/null 2>&1
96 then
97 echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)"
98 git-lfs version
99 else
100 echo >&2 "WARNING: git-lfs wasn't installed, see above for clues why"