Blame script/ci-build-libsass

Packit Service 7770af
#!/bin/bash
Packit Service 7770af
Packit Service 7770af
set -e
Packit Service 7770af
Packit Service 7770af
script/bootstrap
Packit Service 7770af
Packit Service 7770af
# export this path right here (was in script/spec before)
Packit Service 7770af
export SASS_LIBSASS_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../ && pwd )"
Packit Service 7770af
Packit Service 7770af
# use some defaults if not running under travis ci
Packit Service 7770af
if [ "x$CONTINUOUS_INTEGRATION" == "x" ]; then export CONTINUOUS_INTEGRATION=true; fi
Packit Service 7770af
if [ "x$TRAVIS_BUILD_DIR" == "x" ]; then export TRAVIS_BUILD_DIR=$(pwd); fi
Packit Service 7770af
if [ "x$SASS_SASSC_PATH" == "x" ]; then export SASS_SASSC_PATH=$(pwd)/sassc; fi
Packit Service 7770af
if [ "x$SASS_SPEC_PATH" == "x" ]; then export SASS_SPEC_PATH=$(pwd)/sass-spec; fi
Packit Service 7770af
Packit Service 7770af
# try to get the os name from uname (and filter via perl - probably not the most portable way?)
Packit Service 7770af
if [ "x$TRAVIS_OS_NAME" == "x" ]; then export TRAVIS_OS_NAME=`uname -s | perl -ne 'print lc \$1 if\(/^([a-zA-Z]+)/'\)`; fi
Packit Service 7770af
Packit Service 7770af
if [ "x$COVERAGE" == "xyes" ]; then
Packit Service 7770af
  COVERAGE_OPT="--enable-coverage"
Packit Service 7770af
  export EXTRA_CFLAGS="-fprofile-arcs -ftest-coverage"
Packit Service 7770af
  export EXTRA_CXXFLAGS="-fprofile-arcs -ftest-coverage"
Packit Service 7770af
  if [ "$TRAVIS_OS_NAME" == "osx" ]; then
Packit Service 7770af
    # osx doesn't seem to know gcov lib?
Packit Service 7770af
    export EXTRA_LDFLAGS="--coverage"
Packit Service 7770af
  else
Packit Service 7770af
    export EXTRA_LDFLAGS="-lgcov --coverage"
Packit Service 7770af
  fi
Packit Service 7770af
else
Packit Service 7770af
  COVERAGE_OPT="--disable-coverage"
Packit Service 7770af
fi
Packit Service 7770af
Packit Service 7770af
if [ "x$BUILD" == "xstatic" ]; then
Packit Service 7770af
  SHARED_OPT="--disable-shared --enable-static"
Packit Service 7770af
  MAKE_TARGET="static"
Packit Service 7770af
else
Packit Service 7770af
  # Makefile of sassc wants to link to static
Packit Service 7770af
  SHARED_OPT="--enable-shared --enable-static"
Packit Service 7770af
  MAKE_TARGET="shared"
Packit Service 7770af
fi
Packit Service 7770af
Packit Service 7770af
if [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
Packit Service 7770af
  MAKE_OPTS="$MAKE_OPTS -j1 V=1"
Packit Service 7770af
else
Packit Service 7770af
  MAKE_OPTS="$MAKE_OPTS -j5 V=1"
Packit Service 7770af
fi
Packit Service 7770af
Packit Service 7770af
if [ "x$PREFIX" == "x" ]; then
Packit Service 7770af
  if [ "x$TRAVIS_BUILD_DIR" == "x" ]; then
Packit Service 7770af
    PREFIX=$SASS_LIBSASS_PATH/build
Packit Service 7770af
  else
Packit Service 7770af
    PREFIX=$TRAVIS_BUILD_DIR/build
Packit Service 7770af
  fi
Packit Service 7770af
fi
Packit Service 7770af
Packit Service 7770af
# enable address sanitation
Packit Service 7770af
# https://en.wikipedia.org/wiki/AddressSanitizer
Packit Service 7770af
if [ "x$CC" == "xclang" ]; then
Packit Service 7770af
  if [ "x$COVERAGE" != "xyes" ]; then
Packit Service 7770af
    if [ "$TRAVIS_OS_NAME" == "linux" ]; then
Packit Service 7770af
      export EXTRA_CFLAGS="$EXTRA_CFLAGS -fsanitize=address"
Packit Service 7770af
      export EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -fsanitize=address"
Packit Service 7770af
      export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fsanitize=address"
Packit Service 7770af
    fi
Packit Service 7770af
  fi
Packit Service 7770af
fi
Packit Service 7770af
Packit Service 7770af
echo SASS_LIBSASS_PATH: $SASS_LIBSASS_PATH
Packit Service 7770af
echo TRAVIS_BUILD_DIR: $TRAVIS_BUILD_DIR
Packit Service 7770af
echo SASS_SASSC_PATH: $SASS_SASSC_PATH
Packit Service 7770af
echo SASS_SPEC_PATH: $SASS_SPEC_PATH
Packit Service 7770af
echo INSTALL_LOCATION: $PREFIX
Packit Service 7770af
Packit Service 7770af
if [ "x$AUTOTOOLS" == "xyes" ]; then
Packit Service 7770af
Packit Service 7770af
  echo -en 'travis_fold:start:configure\r'
Packit Service 7770af
  autoreconf --force --install
Packit Service 7770af
  ./configure --enable-tests $COVERAGE_OPT \
Packit Service 7770af
    --disable-silent-rules \
Packit Service 7770af
    --with-sassc-dir=$SASS_SASSC_PATH \
Packit Service 7770af
    --with-sass-spec-dir=$SASS_SPEC_PATH \
Packit Service 7770af
    --prefix=$PREFIX \
Packit Service 7770af
    ${SHARED_OPT}
Packit Service 7770af
  echo -en 'travis_fold:end:configure\r'
Packit Service 7770af
Packit Service 7770af
  make $MAKE_OPTS clean
Packit Service 7770af
Packit Service 7770af
  # install to prefix directory
Packit Service 7770af
  PREFIX="$PREFIX" make $MAKE_OPTS install
Packit Service 7770af
Packit Service 7770af
else
Packit Service 7770af
Packit Service 7770af
  make $MAKE_OPTS clean
Packit Service 7770af
Packit Service 7770af
fi
Packit Service 7770af
Packit Service 7770af
# install to prefix directory
Packit Service 7770af
PREFIX="$PREFIX" make $MAKE_OPTS install
Packit Service 7770af
Packit Service 7770af
ls -la $PREFIX/*
Packit Service 7770af
Packit Service 7770af
echo successfully compiled libsass
Packit Service 7770af
echo AUTOTOOLS=$AUTOTOOLS COVERAGE=$COVERAGE BUILD=$BUILD
Packit Service 7770af
Packit Service 7770af
if [ "$CONTINUOUS_INTEGRATION" == "true" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "x$TRAVIS_PULL_REQUEST" != "x" ] &&
Packit Service 7770af
   ([ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ] || [ "$TRAVIS_OS_NAME" == "cygwin" ]);
Packit Service 7770af
then
Packit Service 7770af
Packit Service 7770af
  echo "Fetching PR $TRAVIS_PULL_REQUEST"
Packit Service 7770af
Packit Service 7770af
  JSON=$(curl -L -sS https://api.github.com/repos/sass/libsass/pulls/$TRAVIS_PULL_REQUEST)
Packit Service 7770af
Packit Service 7770af
  if [[ $JSON =~ "API rate limit exceeded" ]];
Packit Service 7770af
  then
Packit Service 7770af
    echo "Travis rate limit on github exceeded"
Packit Service 7770af
    echo "Retrying via 'special purpose proxy'"
Packit Service 7770af
    JSON=$(curl -L -sS http://libsass.ocbnet.ch/libsass-spec-pr.psgi/$TRAVIS_PULL_REQUEST)
Packit Service 7770af
  fi
Packit Service 7770af
Packit Service 7770af
  RE_SPEC_PR="sass\/sass-spec(#|\/pull\/)([0-9]+)"
Packit Service 7770af
Packit Service 7770af
  if [[ $JSON =~ $RE_SPEC_PR ]];
Packit Service 7770af
  then
Packit Service 7770af
    SPEC_PR="${BASH_REMATCH[2]}"
Packit Service 7770af
    echo "Fetching Sass Spec PR $SPEC_PR"
Packit Service 7770af
    git -C sass-spec fetch -u origin pull/$SPEC_PR/head:ci-spec-pr-$SPEC_PR
Packit Service 7770af
    git -C sass-spec checkout --force ci-spec-pr-$SPEC_PR
Packit Service 7770af
    LD_LIBRARY_PATH="$PREFIX/lib/" make $MAKE_OPTS test_probe
Packit Service 7770af
  else
Packit Service 7770af
    LD_LIBRARY_PATH="$PREFIX/lib/" make $MAKE_OPTS test_probe
Packit Service 7770af
  fi
Packit Service 7770af
else
Packit Service 7770af
  LD_LIBRARY_PATH="$PREFIX/lib/" make $MAKE_OPTS test_probe
Packit Service 7770af
fi