Skip to content

Instantly share code, notes, and snippets.

@dogukancagatay
Last active April 17, 2016 14:53
Show Gist options
  • Save dogukancagatay/206fd7866bab1a28d422 to your computer and use it in GitHub Desktop.
Save dogukancagatay/206fd7866bab1a28d422 to your computer and use it in GitHub Desktop.
Scripts for compiling compilers gcc-4.8.3 and llvm-clang-3.4.
#!/usr/bin/env bash
#####################
## Set build prefix and source code dir
#####################
BUILD_PREFIX="/home/dogukan/local"
SRC_DIR="/home/dogukan/src"
BUILD_DIR="/home/dogukan/src/build"
#####################
## Don't edit below
#####################
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$BUILD_PREFIX"/lib:"$BUILD_PREFIX"/lib64
rm -rf "$SRC_DIR"
mkdir "$SRC_DIR"
mkdir -p "$BUILD_DIR"
cd "$SRC_DIR"
echo '### Downloading and building gmp ###'
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
tar -xjvf gmp-4.3.2.tar.bz2
mkdir -p "$BUILD_DIR"/gmp-4.3.2-build
cd "$BUILD_DIR"/gmp-4.3.2-build
"$SRC_DIR"/gmp-4.3.2/configure --prefix="$BUILD_PREFIX"
make -j12
#make check
make install
cd "$SRC_DIR"
echo '### Downloading and building mpfr ###'
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
tar -xjvf mpfr-2.4.2.tar.bz2
mkdir -p "$BUILD_DIR"/mpfr-2.4.2-build
cd "$BUILD_DIR"/mpfr-2.4.2-build
"$SRC_DIR"/mpfr-2.4.2/configure --prefix="$BUILD_PREFIX" --with-gmp="$BUILD_PREFIX"
make -j12
#make check
make install
cd "$SRC_DIR"
echo '### Downloading and building mpc ###'
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
tar -xzvf mpc-0.8.1.tar.gz
mkdir -p "$BUILD_DIR"/mpc-0.8.1-build
cd "$BUILD_DIR"/mpc-0.8.1-build
"$SRC_DIR"/mpc-0.8.1/configure --prefix="$BUILD_PREFIX" --with-gmp="$BUILD_PREFIX" --with-mpfr="$BUILD_PREFIX"
make -j12
#make check
make install
cd "$SRC_DIR"
echo '### Downloading and building isl ###'
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.12.2.tar.bz2
tar -xjvf isl-0.12.2.tar.bz2
mkdir -p "$BUILD_DIR"/isl-0.12.2-build
cd "$BUILD_DIR"/isl-0.12.2-build
"$SRC_DIR"/isl-0.12.2/configure --prefix="$BUILD_PREFIX" --with-gmp="$BUILD_PREFIX"
make -j12
#make check
make install
cd "$SRC_DIR"
echo '### Downloading and building cloog ###'
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-0.18.1.tar.gz
tar -xzvf cloog-0.18.1.tar.gz
mkdir -p "$BUILD_DIR"/cloog-0.18.1-build
cd "$BUILD_DIR"/cloog-0.18.1-build
"$SRC_DIR"/cloog-0.18.1/configure --prefix="$BUILD_PREFIX" --with-gmp="$BUILD_PREFIX" --with-isl="$BUILD_PREFIX"
make -j12
#make check
make install
cd "$SRC_DIR"
echo '### Downloading and building gcc ###'
wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.8.3/gcc-4.8.3.tar.gz
tar -xzvf gcc-4.8.3.tar.gz
mkdir -p "$BUILD_DIR"/gcc-4.8.3-build
cd "$BUILD_DIR"/gcc-4.8.3-build
# fix for "configure: error: Unable to find a usable ISL." error. Solution : http://comments.gmane.org/gmane.comp.gcc.help/45660
"$SRC_DIR"/gcc-4.8.3/configure --prefix="$BUILD_PREFIX" --with-gmp="$BUILD_PREFIX" --with-mpfr="$BUILD_PREFIX" --with-mpc="$BUILD_PREFIX" --with-isl="$BUILD_PREFIX" --with-cloog="$BUILD_PREFIX" --program-suffix=-4.8.3 --enable-languages=c,c++
make -j12
#make -k check
make install
#!/usr/bin/env bash
#####################
## Set build prefix and source code dir
#####################
BUILD_PREFIX="/home/dogukan/local"
SRC_DIR="/home/dogukan/src"
BUILD_DIR="/home/dogukan/src/build"
#####################
## Don't edit below
#####################
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$BUILD_PREFIX"/lib:"$BUILD_PREFIX"/lib64
export CC="$BUILD_PREFIX"/bin/gcc4.8.3
export CXX="$BUILD_PREFIX"/bin/g++4.8.3
cd "$SRC_DIR"
mkdir -p "$BUILD_DIR"
echo '### Downloading llvm ###'
wget http://llvm.org/releases/3.4.2/llvm-3.4.2.src.tar.gz
tar -xzvf llvm-3.4.2.src.tar.gz
echo '### Downloading clang ###'
wget http://llvm.org/releases/3.4.2/cfe-3.4.2.src.tar.gz
tar -xzvf cfe-3.4.2.src.tar.gz
mv cfe-3.4.2.src llvm-3.4.2.src/tools/clang
cd "$SRC_DIR"
echo '### Downloading extra clang tools ###'
wget http://llvm.org/releases/3.4/clang-tools-extra-3.4.src.tar.gz
tar -xzvf clang-tools-extra-3.4.src.tar.gz
mv clang-tools-extra-3.4 llvm-3.4.2.src/tools/clang/tools/extra
cd "$SRC_DIR"
echo '### Downloading Compiler-RT ###'
wget http://llvm.org/releases/3.4/compiler-rt-3.4.src.tar.gz
tar -xzvf compiler-rt-3.4.src.tar.gz
mv compiler-rt-3.4 llvm-3.4.2.src/projects/compiler-rt
cd "$SRC_DIR"
echo '### Building llvm-clang ###'
mkdir -p "$BUILD_DIR"/llvm-3.4.2-build
cd "$BUILD_DIR"/llvm-3.4.2-build
"$SRC_DIR"/llvm-3.4.2.src/configure --enable-optimized --disable-assertions --disable-doxygen --prefix="$BUILD_PREFIX"
make -j12
#make clang-only -j12
#make check
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment