build-gcc-sixgill-plugin-linux.sh (2231B)
1 #!/bin/bash 2 3 set -e 4 set -x 5 6 # This script is for building the sixgill GCC plugin for Linux. It relies on 7 # the gcc checkout because it needs to recompile gmp and the gcc build script 8 # determines the version of gmp to download. 9 10 root_dir=$MOZ_FETCHES_DIR 11 build_dir=$GECKO_PATH/build 12 data_dir=$GECKO_PATH/build/unix/build-gcc 13 14 sixgill_rev=a84b31ab04ee 15 sixgill_repo=https://hg.mozilla.org/users/sfink_mozilla.com/sixgill 16 17 . $data_dir/build-gcc.sh 18 19 mkdir $root_dir/gcc-source || true 20 pushd $root_dir/gcc-source 21 ln -sf ../gmp-source gmp 22 ln -sf ../isl-source isl 23 ln -sf ../mpc-source mpc 24 ln -sf ../mpfr-source mpfr 25 popd 26 27 export TMPDIR=${TMPDIR:-/tmp/} 28 export gcc_bindir=$MOZ_FETCHES_DIR/gcc/bin 29 export gmp_prefix=/tools/gmp 30 export gmp_dir=$root_dir$gmp_prefix 31 32 prepare_sixgill() {( 33 cd $root_dir 34 hg clone -r $sixgill_rev $sixgill_repo || ( cd sixgill && hg update -r $sixgill_rev ) 35 )} 36 37 build_gmp() { 38 if ! [ -x $gcc_bindir/gcc ]; then 39 echo "GCC not found in $gcc_bindir/gcc" >&2 40 exit 1 41 fi 42 43 # The sixgill plugin uses some gmp symbols, including some not exported by 44 # cc1/cc1plus. So link the plugin statically to libgmp. Except that the 45 # default static build does not have -fPIC, and will result in a relocation 46 # error, so build our own. This requires the gcc and related source to be 47 # in $root_dir/gcc-source. 48 49 mkdir $root_dir/gmp-objdir || true 50 ( 51 cd $root_dir/gmp-objdir 52 $root_dir/gcc-source/gmp/configure --disable-shared --with-pic --prefix=$gmp_prefix 53 make -j8 54 make install DESTDIR=$root_dir 55 ) 56 } 57 58 build_sixgill() {( 59 cd $root_dir/sixgill 60 export CC=$gcc_bindir/gcc 61 export CXX=$gcc_bindir/g++ 62 export PATH="$gcc_bindir:$PATH" 63 export LD_LIBRARY_PATH="${gcc_bindir%/bin}/lib64" 64 export TARGET_CC=$CC 65 export CPPFLAGS=-I$gmp_dir/include 66 export EXTRA_LDFLAGS=-L$gmp_dir/lib 67 export HOST_CFLAGS=$CPPFLAGS 68 69 ./release.sh --build-and-package --with-gmp=$gmp_dir 70 tarball=$(ls -td *-sixgill | head -1)/sixgill.tar.xz 71 cp $tarball $root_dir/sixgill.tar.xz 72 )} 73 74 prepare_sixgill 75 build_gmp 76 build_sixgill 77 78 # Put a tarball in the artifacts dir 79 mkdir -p $UPLOAD_DIR 80 cp $MOZ_FETCHES_DIR/sixgill.tar.* $UPLOAD_DIR