Skip to content

Instantly share code, notes, and snippets.

@kbinani
Last active August 29, 2015 14:18
Show Gist options
  • Save kbinani/62c2d448dda5b237d85d to your computer and use it in GitHub Desktop.
Save kbinani/62c2d448dda5b237d85d to your computer and use it in GitHub Desktop.
build_gcc_rpm_package.sh
# git clone https://github.com/ngyuki/checkinstall.git
# cd checkinstall
# make
# sudo make install
# GCC_VERSION=4.9.2
# wget http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.gz || { echo "Failed downloading tarball" && exit 1; }
# tar zxf gcc-$GCC_VERSION.tar.gz
# cd gcc-$GCC_VERSION
which checkinstall >/dev/null 2>&1 || { echo "cehckinstall is not installed" && exit 1; }
sudo mkdir -p /root/rpmbuild/SOURCES
./contrib/download_prerequisites || { echo "Failed downloading prerequisites" && exit 1; }
./configure --disable-multilib --prefix=/usr/local --libdir=/usr/local/lib64 || { echo "Failed configuring" && exit 1; }
make || { echo "Failed 'make'ing" && exit 1; }
sudo make install || { echo "Failed 'sudo make install'" && exit 1; }
sudo $(which checkinstall) --type=rpm --install=no --default --pkgname=gcc
sudo cp $(sudo find /root/rpmbuild/RPMS -name "gcc-$GCC_VERSION*.rpm" | head -1) ./
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment