Skip to content

Commit 7a1760b

Browse files
committed
RF: refactor CC, CXX setting
1 parent 73453e5 commit 7a1760b

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

install.sh

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ PNG_VERSION="1.6.10"
1010
XQ_BASE_URL=http://xquartz.macosforge.org/downloads/SL
1111
XQUARTZ_VERSION="2.7.4"
1212
# Compiler defaults
13-
CC=clang
14-
CXX=clang++
13+
SYS_CC=clang
14+
SYS_CXX=clang++
1515

1616
function require_success {
1717
STATUS=$?
@@ -23,6 +23,21 @@ function require_success {
2323
}
2424

2525

26+
function cc_cmd {
27+
NEW_CC=$1
28+
shift
29+
NEW_CXX=$1
30+
shift
31+
OLD_CC=$CC
32+
OLD_CXX=$CXX
33+
export CC=$NEW_CC
34+
export CXX=$NEW_CXX
35+
$@
36+
export CC=$OLD_CC
37+
export CXX=$OLD_CXX
38+
}
39+
40+
2641
function install_macports {
2742
PREFIX=/opt/local
2843
MACPORTS="MacPorts-2.2.0"
@@ -32,7 +47,7 @@ function install_macports {
3247
tar -xzf $MACPORTS.tar.gz
3348

3449
cd $MACPORTS
35-
CC=${CC} CXX=${CXX} ./configure --prefix=$PREFIX
50+
cc_cmd $SYS_CC $SYS_CXX ./configure --prefix=$PREFIX
3651
make
3752
sudo make install
3853
cd ..
@@ -51,7 +66,7 @@ function install_matplotlib {
5166

5267
cd matplotlib
5368

54-
$SUDO CC=$MPL_CC CXX=$MPL_CXX $PYTHON setup.py install
69+
cc_cmd $MPL_CC $MPL_CXX $SUDO $PYTHON setup.py install
5570
require_success "Failed to install matplotlib"
5671

5772
cd ..
@@ -137,7 +152,7 @@ function install_freetype {
137152
cd freetype-$FT_VERSION
138153
require_success "Failed to cd to freetype directory"
139154

140-
CC=${CC} CXX=${CXX} ./configure --enable-shared=no --enable-static=true
155+
cc_cmd ${SYS_CC} ${SYS_CXX} ./configure --enable-shared=no --enable-static=true
141156
make
142157
sudo make install
143158
require_success "Failed to install freetype $FT_VERSION"
@@ -153,7 +168,7 @@ function install_libpng {
153168
tar -xzf libpng.tar.gz
154169
cd libpng-$VERSION
155170
require_success "Failed to cd to libpng directory"
156-
./configure --enable-shared=no --enable-static=true
171+
cc_cmd ${SYS_CC} ${SYS_CXX} ./configure --enable-shared=no --enable-static=true
157172
make
158173
sudo make install
159174
require_success "Failed to install libpng $VERSION"
@@ -336,7 +351,9 @@ elif [ "$TEST" == "macpython33_10.9" ] ; then
336351

337352
install_matplotlib $CC $CXX
338353

339-
else
354+
elif [ "$TEST" != "debug" ] ; then
355+
340356
echo "Unknown test setting ($TEST)"
341357
exit -1
358+
342359
fi

0 commit comments

Comments
 (0)