Files
dockcross/imagefiles/build-and-install-git.sh
Julian Oes 7264bf7768 Build git without gettext to avoid missing msgfmt
The pypa manylinux_2_34 base image does not provide the msgfmt binary,
causing the git source build to fail. Git translations are not needed
in a build container.
2026-04-10 09:32:01 +12:00

45 lines
1008 B
Bash
Executable File

#!/usr/bin/env bash
set -ex
# Get script directory
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
# Get build utilities
source $SCRIPT_DIR/utils.sh
if ! command -v tar &> /dev/null; then
echo >&2 'error: "tar" not found!'
exit 1
fi
if [[ -z "${GIT_VERSION}" ]]; then
echo >&2 'error: GIT_VERSION env. variable must be set to a non-empty value'
exit 1
fi
(cat /etc/ld.so.conf.d/usr-local.conf 2> /dev/null | grep -q "^/usr/local/lib$") ||
echo '/usr/local/lib' >> /etc/ld.so.conf.d/usr-local.conf
ldconfig
cd /usr/src
GIT_ROOT="git-${GIT_VERSION}"
GIT_DOWNLOAD_URL="https://mirrors.edge.kernel.org/pub/software/scm/git"
fetch_source "${GIT_ROOT}.tar.gz" "${GIT_DOWNLOAD_URL}"
tar xvzf "${GIT_ROOT}.tar.gz" --no-same-owner
pushd "${GIT_ROOT}"
./configure --prefix=/usr/local --with-curl
make -j"$(nproc)" NO_GETTEXT=YesPlease
make NO_GETTEXT=YesPlease install
popd
rm -rf "${GIT_ROOT}" "${GIT_ROOT}.tar.gz"
ldconfig
# turn the detached message off
git config --global advice.detachedHead false