ci: install JGit dependency
[alt-git.git] / ci / install-dependencies.sh
blobc196e56762011a344ee42bef679e106cc97b8801
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 test -z "$BREW_INSTALL_PACKAGES" ||
73 brew install $BREW_INSTALL_PACKAGES
74 brew link --force gettext
76 mkdir -p "$CUSTOM_PATH"
77 wget -q "$P4WHENCE/bin.macosx1015x86_64/helix-core-server.tgz" &&
78 tar -xf helix-core-server.tgz -C "$CUSTOM_PATH" p4 p4d &&
79 sudo xattr -d com.apple.quarantine "$CUSTOM_PATH/p4" "$CUSTOM_PATH/p4d" 2>/dev/null || true
80 rm helix-core-server.tgz
82 if test -n "$CC_PACKAGE"
83 then
84 BREW_PACKAGE=${CC_PACKAGE/-/@}
85 brew install "$BREW_PACKAGE"
86 brew link "$BREW_PACKAGE"
89 esac
91 case "$jobname" in
92 StaticAnalysis)
93 sudo apt-get -q update
94 sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \
95 libexpat-dev gettext make
97 sparse)
98 sudo apt-get -q update -q
99 sudo apt-get -q -y install libssl-dev libcurl4-openssl-dev \
100 libexpat-dev gettext zlib1g-dev
102 Documentation)
103 sudo apt-get -q update
104 sudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make
106 test -n "$ALREADY_HAVE_ASCIIDOCTOR" ||
107 sudo gem install --version 1.5.8 asciidoctor
109 esac
111 if type p4d >/dev/null 2>&1 && type p4 >/dev/null 2>&1
112 then
113 echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)"
114 p4d -V
115 echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)"
116 p4 -V
117 else
118 echo >&2 "WARNING: perforce wasn't installed, see above for clues why"
121 if type git-lfs >/dev/null 2>&1
122 then
123 echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)"
124 git-lfs version
125 else
126 echo >&2 "WARNING: git-lfs wasn't installed, see above for clues why"
129 if type jgit >/dev/null 2>&1
130 then
131 echo "$(tput setaf 6)JGit Version$(tput sgr0)"
132 jgit version
133 else
134 echo >&2 "WARNING: JGit wasn't installed, see above for clues why"
137 end_group "Install dependencies"