Skip to content

Instantly share code, notes, and snippets.

@jxtx
Last active August 29, 2015 14:06
Show Gist options
  • Save jxtx/cd21044f8ab44e7b3588 to your computer and use it in GitHub Desktop.
Save jxtx/cd21044f8ab44e7b3588 to your computer and use it in GitHub Desktop.
# Mostly based on this:
# https://github.com/Homebrew/linuxbrew/wiki/Standalone-Installation
# But I started with nothing (no ruby, no gcc)
# Ruby and GCC will go here
mkdir bootstrap
# Get GCC 4.4 and install under bootstrap
# We also need libstdc++ when we get to building gcc-4.9 because somebody decided it was a good idea to start writing GCC in C++
wget http://ftp1.scientificlinux.org/linux/scientific/55/x86_64/SL/gcc44-4.4.0-6.el5.x86_64.rpm
wget http://ftp1.scientificlinux.org/linux/scientific/55/x86_64/SL/gcc44-c++-4.4.0-6.el5.x86_64.rpm
wget http://ftp1.scientificlinux.org/linux/scientific/55/x86_64/SL/libstdc++44-devel-4.4.0-6.el5.x86_64.rpm
wget http://ftp1.scientificlinux.org/linux/scientific/55/x86_64/SL/libstdc++-4.1.2-48.el5.x86_64.rpm
wget http://ftp1.scientificlinux.org/linux/scientific/55/x86_64/SL/libgcc-4.1.2-48.el5.x86_64.rpm
( cd bootstrap; rpm2cpio ../gcc44-4.4.0-6.el5.x86_64.rpm | cpio -idmv )
( cd bootstrap; rpm2cpio ../gcc44-c++-4.4.0-6.el5.x86_64.rpm | cpio -idmv )
( cd bootstrap; rpm2cpio ../libstdc++44-devel-4.4.0-6.el5.x86_64.rpm | cpio -idmv )
( cd bootstrap; rpm2cpio ../libstdc++-4.1.2-48.el5.x86_64.rpm | cpio -idmv )
( cd bootstrap; rpm2cpio ../libgcc-4.1.2-48.el5.x86_64.rpm | cpio -idmv )
rm *.rpm
# Install ruby under boostrap
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
tar -xzvf ruby-2.1.2.tar.gz
( cd ruby-2.1.2; ./configure --prefix=../bootstrap; make install )
git clone https://github.com/Homebrew/linuxbrew.git linuxbrew
mkdir linuxbrew/lib
( cd linuxbrew; ln -s lib lib64 )
#ln -s /usr/lib64/libstdc++.so.6 /lib64/libgcc_s.so.1 linuxbrew/lib/
ln -s `pwd`/bootstrap/lib64/libgcc_s.so.1 linuxbrew/lib
ln -s `pwd`/bootstrap/usr/lib64/libstdc++.so.6 linuxbrew/lib
# linuxbrew first, then the bootstrap /usr/bin directory
export PATH=`pwd`/linuxbrew/bin:`pwd`/bootstrap/usr/bin:/usr/bin:/bin
# GCC 4.4 will be the default GCC
( cd linuxbrew/bin; ln -s ../../bootstrap/usr/bin/gcc44 gcc-4.4; ln -s ../../bootstrap/usr/bin/g++44 g++-4.4)
export HOMEBREW_GCC=gcc-4.4
brew install glibc
brew unlink glibc
brew install https://raw.githubusercontent.com/Homebrew/homebrew-dupes/master/zlib.rb
brew reinstall binutils
brew link glibc
brew install gcc --with-glibc -v
# Remove the stuff we stubbed in before (gcc won't link the first time because of it
rm -f linuxbrew/lib/{libstdc++.so.6,libgcc_s.so.1} linuxbrew/bin/g??-4.4
brew link gcc
export HOMEBREW_CC=gcc-4.9
# Now Ruby
brew install ruby
# Now we don't need the boostrap anymore!
export PATH=`pwd`/linuxbrew/bin:/usr/bin:/bin
# The rest of the basic stuff, many dupes
brew install curl expat git
brew tap homebrew/dupes
brew install bzip2 coreutils findutils gawk gnu-sed gnu-which grep libpng libxml2 libxslt make ncurses readline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment