Skip to content

Instantly share code, notes, and snippets.

@Skinner927
Created August 16, 2023 20:58
Show Gist options
  • Save Skinner927/274cf2882c653439b663d1e871ef1414 to your computer and use it in GitHub Desktop.
Save Skinner927/274cf2882c653439b663d1e871ef1414 to your computer and use it in GitHub Desktop.
Red Hat RHEL 7 compile git 2.39
#!/bin/bash
# docker run --rm -ti -v /tmp/git-out:/out registry.access.redhat.com/ubi7/ubi bash
# https://ius.io/setup
yum install -y \
https://repo.ius.io/ius-release-el7.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# Build tools
yum install -y make autoconf gcc
# Required libraries
yum install -y curl-devel openssl-devel zlib-devel
# gettext-devel expat-devel
rm -rf /opt/git || true
rm -rf /tmp/git || true
mkdir /tmp/git
cd /tmp/git
curl -Lo git.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.39.3.tar.gz
tar -xzvf git.tar.gz
cd git-*
make configure
CFLAGS='-std=gnu99 -O2' NO_TCLTK=1 ./configure \
--prefix=/opt/git \
--without-expat \
--without-tcltk
# Add V=1 for verbose output
make install NO_GETTEXT=NoThanks NO_EXPAT=NoThanks NO_PERL=NoThanks \
NO_GITWEB=NoThanks NO_TCLTK=NoThanks SKIP_DASHED_BUILT_INS=YesPlease \
NO_INSTALL_HARDLINKS=NoThanks
# LFS
rm -rf /tmp/lfs || true
mkdir /tmp/lfs
cd /tmp/lfs
curl -Lo lfs.tar.gz https://github.com/git-lfs/git-lfs/releases/download/v3.4.0/git-lfs-linux-amd64-v3.4.0.tar.gz
tar -xzvf lfs.tar.gz
cd git-lfs-*
cp ./git-lfs /opt/git/bin/
# Wrap it all up
tar -czvPf /out/git-2.39.3-rhel7.tar.gz /opt/git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment