ci-build-libsass
4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
set -e
script/bootstrap
# export this path right here (was in script/spec before)
export SASS_LIBSASS_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../ && pwd )"
# use some defaults if not running under travis ci
if [ "x$CONTINUOUS_INTEGRATION" == "x" ]; then export CONTINUOUS_INTEGRATION=true; fi
if [ "x$TRAVIS_BUILD_DIR" == "x" ]; then export TRAVIS_BUILD_DIR=$(pwd); fi
if [ "x$SASS_SASSC_PATH" == "x" ]; then export SASS_SASSC_PATH=$(pwd)/sassc; fi
if [ "x$SASS_SPEC_PATH" == "x" ]; then export SASS_SPEC_PATH=$(pwd)/sass-spec; fi
# try to get the os name from uname (and filter via perl - probably not the most portable way?)
if [ "x$TRAVIS_OS_NAME" == "x" ]; then export TRAVIS_OS_NAME=`uname -s | perl -ne 'print lc \$1 if\(/^([a-zA-Z]+)/'\)`; fi
if [ "x$COVERAGE" == "xyes" ]; then
COVERAGE_OPT="--enable-coverage"
export EXTRA_CFLAGS="-fprofile-arcs -ftest-coverage"
export EXTRA_CXXFLAGS="-fprofile-arcs -ftest-coverage"
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
# osx doesn't seem to know gcov lib?
export EXTRA_LDFLAGS="--coverage"
else
export EXTRA_LDFLAGS="-lgcov --coverage"
fi
else
COVERAGE_OPT="--disable-coverage"
fi
if [ "x$BUILD" == "xstatic" ]; then
SHARED_OPT="--disable-shared --enable-static"
MAKE_TARGET="static"
else
# Makefile of sassc wants to link to static
SHARED_OPT="--enable-shared --enable-static"
MAKE_TARGET="shared"
fi
if [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
MAKE_OPTS="$MAKE_OPTS -j1 V=1"
else
MAKE_OPTS="$MAKE_OPTS -j5 V=1"
fi
if [ "x$PREFIX" == "x" ]; then
if [ "x$TRAVIS_BUILD_DIR" == "x" ]; then
PREFIX=$SASS_LIBSASS_PATH/build
else
PREFIX=$TRAVIS_BUILD_DIR/build
fi
fi
# enable address sanitation
# https://en.wikipedia.org/wiki/AddressSanitizer
if [ "x$CC" == "xclang" ]; then
if [ "x$COVERAGE" != "xyes" ]; then
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
export EXTRA_CFLAGS="$EXTRA_CFLAGS -fsanitize=address"
export EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -fsanitize=address"
export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fsanitize=address"
fi
fi
fi
echo SASS_LIBSASS_PATH: $SASS_LIBSASS_PATH
echo TRAVIS_BUILD_DIR: $TRAVIS_BUILD_DIR
echo SASS_SASSC_PATH: $SASS_SASSC_PATH
echo SASS_SPEC_PATH: $SASS_SPEC_PATH
echo INSTALL_LOCATION: $PREFIX
if [ "x$AUTOTOOLS" == "xyes" ]; then
echo -en 'travis_fold:start:configure\r'
autoreconf --force --install
./configure --enable-tests $COVERAGE_OPT \
--disable-silent-rules \
--with-sassc-dir=$SASS_SASSC_PATH \
--with-sass-spec-dir=$SASS_SPEC_PATH \
--prefix=$PREFIX \
${SHARED_OPT}
echo -en 'travis_fold:end:configure\r'
make $MAKE_OPTS clean
# install to prefix directory
PREFIX="$PREFIX" make $MAKE_OPTS install
else
make $MAKE_OPTS clean
fi
# install to prefix directory
PREFIX="$PREFIX" make $MAKE_OPTS install
ls -la $PREFIX/*
echo successfully compiled libsass
echo AUTOTOOLS=$AUTOTOOLS COVERAGE=$COVERAGE BUILD=$BUILD
if [ "$CONTINUOUS_INTEGRATION" == "true" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "x$TRAVIS_PULL_REQUEST" != "x" ] &&
([ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ] || [ "$TRAVIS_OS_NAME" == "cygwin" ]);
then
echo "Fetching PR $TRAVIS_PULL_REQUEST"
JSON=$(curl -L -sS https://api.github.com/repos/sass/libsass/pulls/$TRAVIS_PULL_REQUEST)
if [[ $JSON =~ "API rate limit exceeded" ]];
then
echo "Travis rate limit on github exceeded"
echo "Retrying via 'special purpose proxy'"
JSON=$(curl -L -sS https://github-api-reverse-proxy.herokuapp.com/repos/sass/libsass/pulls/$TRAVIS_PULL_REQUEST)
fi
RE_SPEC_PR="sass\/sass-spec(#|\/pull\/)([0-9]+)"
if [[ $JSON =~ $RE_SPEC_PR ]];
then
SPEC_PR="${BASH_REMATCH[2]}"
echo "Fetching Sass Spec PR $SPEC_PR"
git -C sass-spec fetch -u origin pull/$SPEC_PR/head:ci-spec-pr-$SPEC_PR
git -C sass-spec checkout --force ci-spec-pr-$SPEC_PR
LD_LIBRARY_PATH="$PREFIX/lib/" make $MAKE_OPTS test_probe
else
LD_LIBRARY_PATH="$PREFIX/lib/" make $MAKE_OPTS test_probe
fi
else
LD_LIBRARY_PATH="$PREFIX/lib/" make $MAKE_OPTS test_probe
fi