2015-01-23 23:04:32 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
#set -eu
|
|
|
|
|
|
|
|
# NOTE: requires at least bash >= 4.0
|
|
|
|
# brew install bash
|
|
|
|
|
|
|
|
: '
|
|
|
|
|
|
|
|
todo
|
|
|
|
|
|
|
|
- gdal shared lib
|
|
|
|
- boost_python_patch
|
|
|
|
- shrink icu data
|
|
|
|
- cairo
|
2015-01-24 08:29:24 +01:00
|
|
|
- benchmarks not linking to chrono
|
2015-01-23 23:04:32 +01:00
|
|
|
'
|
|
|
|
|
|
|
|
TOOLCHAIN="$(pwd)/toolchain"
|
|
|
|
PPA="https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test/+files"
|
2015-01-24 07:57:45 +01:00
|
|
|
LLVM_DIST="http://llvm.org/apt/precise/pool/main/l/llvm-toolchain-3.5"
|
|
|
|
SECURITY="http://security.ubuntu.com/ubuntu/pool/main/e/eglibc/"
|
2015-01-23 23:04:32 +01:00
|
|
|
|
|
|
|
function setup_linux_cpp11_toolchain() {
|
|
|
|
if [[ ! -d ${TOOLCHAIN} ]]; then
|
2015-01-24 08:51:54 +01:00
|
|
|
wget -q ${PPA}/libstdc%2B%2B6_4.8.1-2ubuntu1~12.04_amd64.deb
|
2015-01-23 23:04:32 +01:00
|
|
|
dpkg -x libstdc++6_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN}
|
2015-01-24 08:51:54 +01:00
|
|
|
wget -q ${PPA}/gcc-4.8_4.8.1-2ubuntu1~12.04_amd64.deb
|
2015-01-23 23:04:32 +01:00
|
|
|
dpkg -x gcc-4.8_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN}
|
2015-01-24 08:51:54 +01:00
|
|
|
wget -q ${PPA}/g%2B%2B-4.8_4.8.1-2ubuntu1~12.04_amd64.deb
|
2015-01-23 23:04:32 +01:00
|
|
|
dpkg -x g++-4.8_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN}
|
2015-01-24 08:51:54 +01:00
|
|
|
wget -q ${PPA}/libisl10_0.12.2-2~12.04_amd64.deb
|
2015-01-23 23:04:32 +01:00
|
|
|
dpkg -x libisl10_0.12.2-2~12.04_amd64.deb ${TOOLCHAIN}
|
2015-01-24 08:51:54 +01:00
|
|
|
wget -q ${PPA}/libcloog-isl4_0.18.2-1~12.04_amd64.deb
|
2015-01-23 23:04:32 +01:00
|
|
|
dpkg -x libcloog-isl4_0.18.2-1~12.04_amd64.deb ${TOOLCHAIN}
|
2015-01-24 08:51:54 +01:00
|
|
|
wget -q ${PPA}/libstdc%2B%2B-4.8-dev_4.8.1-2ubuntu1~12.04_amd64.deb
|
2015-01-23 23:04:32 +01:00
|
|
|
dpkg -x libstdc++-4.8-dev_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN}
|
|
|
|
${PPA}/gcc-4.8-base_4.8.1-2ubuntu1~12.04_amd64.deb
|
|
|
|
dpkg -x gcc-4.8-base_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN}
|
2015-01-24 08:51:54 +01:00
|
|
|
wget -q ${PPA}/libgcc-4.8-dev_4.8.1-2ubuntu1~12.04_amd64.deb
|
2015-01-23 23:04:32 +01:00
|
|
|
dpkg -x libgcc-4.8-dev_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN}
|
2015-01-24 08:51:54 +01:00
|
|
|
wget -q ${PPA}/libgcc1_4.8.1-2ubuntu1~12.04_amd64.deb
|
2015-01-23 23:04:32 +01:00
|
|
|
dpkg -x libgcc1_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN}
|
2015-01-24 08:51:54 +01:00
|
|
|
wget -q ${PPA}/cpp-4.8_4.8.1-2ubuntu1~12.04_amd64.deb
|
2015-01-23 23:04:32 +01:00
|
|
|
dpkg -x cpp-4.8_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN}
|
|
|
|
fi
|
2015-01-24 07:57:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function dpack() {
|
2015-01-24 08:51:54 +01:00
|
|
|
wget -q $1/$(echo $2 | sed 's/+/%2B/g')
|
2015-01-24 07:57:45 +01:00
|
|
|
dpkg -x $2 ${TOOLCHAIN}
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_cpp11() {
|
|
|
|
echo '#include <iostream>' > test.cpp
|
|
|
|
echo ' ' >> test.cpp
|
|
|
|
echo 'int main() {' >> test.cpp
|
|
|
|
echo ' ' >> test.cpp
|
|
|
|
echo 'std::move("hello");' >> test.cpp
|
|
|
|
echo 'return 0;' >> test.cpp
|
|
|
|
echo '}' >> test.cpp
|
|
|
|
echo ' ' >> test.cpp
|
|
|
|
./toolchain/usr/bin/clang++-3.5 -o test test.cpp -std=c++11
|
|
|
|
}
|
|
|
|
|
|
|
|
# http://llvm.org/apt/precise/dists/llvm-toolchain-precise-3.5/main/binary-amd64/Packages
|
|
|
|
function setup_clang_toolchain() {
|
|
|
|
dpack ${LLVM_DIST} clang-3.5_3.5~svn217304-1~exp1_amd64.deb
|
|
|
|
dpack ${LLVM_DIST} libllvm3.5_3.5~svn217304-1~exp1_amd64.deb
|
|
|
|
dpack ${LLVM_DIST} libclang-common-3.5-dev_3.5~svn215019-1~exp1_amd64.deb
|
2015-01-24 08:29:24 +01:00
|
|
|
dpack ${PPA} libstdc++6_4.8.1-2ubuntu1~12.04_amd64.deb
|
|
|
|
dpack ${PPA} libstdc++-4.8-dev_4.8.1-2ubuntu1~12.04_amd64.deb
|
2015-01-24 07:57:45 +01:00
|
|
|
#dpack ${LLVM_DIST} libclang1-3.5_3.5~svn215019-1~exp1_amd64.deb
|
|
|
|
#dpack ${LLVM_DIST} libclang-3.5-dev_3.5~svn215019-1~exp1_amd64.deb
|
|
|
|
#dpack ${LLVM_DIST} llvm-3.5-runtime_3.5~svn215019-1~exp1_amd64.deb
|
|
|
|
#dpack ${PPA} libgcc-4.8-dev_4.8.1-2ubuntu1~12.04_amd64.deb
|
|
|
|
#dpack ${PPA} libgcc1_4.8.1-2ubuntu1~12.04_amd64.deb
|
|
|
|
#dpack ${PPA} cpp-4.8_4.8.1-2ubuntu1~12.04_amd64.deb
|
|
|
|
#dpack ${PPA} gcc-4.8-base_4.8.1-2ubuntu1~12.04_amd64.deb
|
|
|
|
#dpack ${PPA} gcc-4.8_4.8.1-2ubuntu1~12.04_amd64.deb
|
|
|
|
#dpack ${PPA} g++-4.8_4.8.1-2ubuntu1~12.04_amd64.deb
|
|
|
|
#dpack ${PPA} libisl10_0.12.2-2~12.04_amd64.deb
|
|
|
|
#dpack ${PPA} libcloog-isl4_0.18.2-1~12.04_amd64.deb
|
|
|
|
#dpack ${PPA} g++-4.8-multilib_4.8.1-2ubuntu1~12.04_amd64.deb
|
|
|
|
#dpack ${PPA} g++-4.8_4.8.1-2ubuntu1~12.04_amd64.deb
|
|
|
|
#dpack ${PPA} gcc-4.8-locales_4.8.1-2ubuntu1~12.04_all.deb
|
2015-01-24 08:29:24 +01:00
|
|
|
#export CPLUS_INCLUDE_PATH="${TOOLCHAIN}/usr/include/:${TOOLCHAIN}/usr/include/x86_64-linux-gnu:${TOOLCHAIN}/usr/include/c++/4.8:${TOOLCHAIN}/usr/include/x86_64-linux-gnu/c++/4.8:${CPLUS_INCLUDE_PATH}"
|
2015-01-24 07:57:45 +01:00
|
|
|
#dpack ${SECURITY} libc6-dev_2.15-0ubuntu10.9_amd64.deb
|
2015-01-24 08:51:54 +01:00
|
|
|
#wget -q http://mirrors.kernel.org/ubuntu/pool/main/l/linux/linux-libc-dev_3.2.0-75.110_amd64.deb
|
2015-01-24 07:57:45 +01:00
|
|
|
#dpkg -x linux-libc-dev_3.2.0-75.110_amd64.deb ${TOOLCHAIN}
|
2015-01-24 08:51:54 +01:00
|
|
|
#wget -q http://mirrors.kernel.org/ubuntu/pool/main/b/binutils/binutils-gold_2.22-6ubuntu1.1_amd64.deb
|
2015-01-24 07:57:45 +01:00
|
|
|
#dpkg -x binutils-gold_2.22-6ubuntu1.1_amd64.deb ${TOOLCHAIN}
|
2015-01-24 08:51:54 +01:00
|
|
|
#wget -q http://security.ubuntu.com/ubuntu/pool/main/b/binutils/binutils_2.22-6ubuntu1.1_amd64.deb
|
2015-01-24 07:57:45 +01:00
|
|
|
#dpkg -x binutils_2.22-6ubuntu1.1_amd64.deb ${TOOLCHAIN}
|
2015-01-23 23:04:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
declare -A DEPS
|
|
|
|
DEPS["freetype"]="2.5.4"
|
|
|
|
DEPS["harfbuzz"]="2cd5323"
|
|
|
|
DEPS["jpeg"]="v8d"
|
|
|
|
DEPS["libxml2"]="2.9.2"
|
|
|
|
DEPS["libpng"]="1.6.13"
|
|
|
|
DEPS["webp"]="0.4.2"
|
|
|
|
DEPS["icu"]="54.1"
|
|
|
|
DEPS["proj"]="4.8.0"
|
|
|
|
DEPS["libtiff"]="dev"
|
|
|
|
DEPS["boost"]="1.57.0"
|
|
|
|
DEPS["boost_libsystem"]="1.57.0"
|
|
|
|
DEPS["boost_libthread"]="1.57.0"
|
|
|
|
DEPS["boost_libfilesystem"]="1.57.0"
|
|
|
|
DEPS["boost_libprogram_options"]="1.57.0"
|
|
|
|
DEPS["boost_libregex"]="1.57.0"
|
|
|
|
DEPS["boost_libpython"]="1.57.0"
|
|
|
|
DEPS["gdal"]="1.11.1"
|
|
|
|
DEPS["libpq"]="9.4.0"
|
|
|
|
|
|
|
|
if [[ -d ~/.mason ]]; then
|
|
|
|
export PATH=~/.mason:$PATH
|
|
|
|
else
|
|
|
|
if [[ ! -d mason ]]; then
|
2015-01-24 06:44:32 +01:00
|
|
|
git clone --depth 1 https://github.com/mapbox/mason.git ./.mason
|
2015-01-23 23:04:32 +01:00
|
|
|
fi
|
2015-01-24 06:44:32 +01:00
|
|
|
export MASON_DIR=$(pwd)/.mason
|
|
|
|
export PATH=$(pwd)/.mason:$PATH
|
2015-01-23 23:04:32 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
for DEP in "${!DEPS[@]}"; do
|
|
|
|
mason install ${DEP} ${DEPS[$DEP]}
|
|
|
|
done
|
|
|
|
|
|
|
|
for DEP in "${!DEPS[@]}"; do
|
|
|
|
mason link ${DEP} ${DEPS[$DEP]}
|
|
|
|
done
|
|
|
|
|
|
|
|
MASON_LINKED=$(pwd)/mason_packages/.link
|
|
|
|
|
|
|
|
export PROJ_LIB=${MASON_LINKED}/share/proj/
|
|
|
|
export ICU_DATA=${MASON_LINKED}/share/icu/54.1/
|
|
|
|
export GDAL_DATA=${MASON_LINKED}/share/gdal
|
|
|
|
export PKG_CONFIG_PATH="${MASON_LINKED}/lib/pkgconfig"
|
|
|
|
export C_INCLUDE_PATH="${MASON_LINKED}/include"
|
|
|
|
export CPLUS_INCLUDE_PATH="${MASON_LINKED}/include"
|
|
|
|
export LIBRARY_PATH="${MASON_LINKED}/lib"
|
|
|
|
|
|
|
|
if [[ $(uname -s) == 'Linux' ]]; then
|
2015-01-24 07:57:45 +01:00
|
|
|
#setup_linux_cpp11_toolchain
|
|
|
|
setup_clang_toolchain
|
|
|
|
export CPLUS_INCLUDE_PATH="${TOOLCHAIN}/usr/include/c++/4.8:${TOOLCHAIN}/usr/include/x86_64-linux-gnu/c++/4.8:${CPLUS_INCLUDE_PATH}"
|
|
|
|
export LD_LIBRARY_PATH="${TOOLCHAIN}/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH}"
|
2015-01-24 08:51:54 +01:00
|
|
|
export LIBRARY_PATH="${TOOLCHAIN}/usr/lib/x86_64-linux-gnu:${LIBRARY_PATH}"
|
2015-01-24 07:57:45 +01:00
|
|
|
export PATH=${TOOLCHAIN}/usr/bin:$PATH
|
2015-01-23 23:04:32 +01:00
|
|
|
#sudo apt-get -y install zlib1g-dev python-dev make git python-dev python-nose
|
|
|
|
fi
|
|
|
|
|
2015-01-24 08:51:54 +01:00
|
|
|
wget -q https://pypi.python.org/packages/source/n/nose/nose-1.3.4.tar.gz
|
2015-01-24 08:29:24 +01:00
|
|
|
tar -xzf nose-1.3.4.tar.gz
|
|
|
|
export PYTHONPATH=$(pwd)/nose-1.3.4:${PYTHONPATH}
|
|
|
|
|
2015-01-23 23:04:32 +01:00
|
|
|
CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden -DU_CHARSET_IS_UTF8=1"
|
|
|
|
MASON_LIBS="${MASON_LINKED}/lib"
|
|
|
|
MASON_INCLUDES="${MASON_LINKED}/include"
|
|
|
|
|
|
|
|
./configure \
|
2015-01-24 08:05:41 +01:00
|
|
|
CC=${TOOLCHAIN}/usr/bin/clang-3.5 \
|
|
|
|
CXX=${TOOLCHAIN}/usr/bin/clang++-3.5 \
|
2015-01-23 23:04:32 +01:00
|
|
|
INPUT_PLUGINS=all \
|
|
|
|
SAMPLE_INPUT_PLUGINS=True \
|
|
|
|
SVG2PNG=True \
|
2015-01-24 08:29:24 +01:00
|
|
|
BENCHMARK=False \
|
2015-01-23 23:04:32 +01:00
|
|
|
SVG_RENDERER=True \
|
|
|
|
PATH_REMOVE=/usr:/usr/local \
|
|
|
|
RUNTIME_LINK=static \
|
|
|
|
CUSTOM_LDFLAGS="-L${MASON_LIBS}" \
|
|
|
|
CUSTOM_CXXFLAGS="${CXXFLAGS}" \
|
|
|
|
BOOST_INCLUDES="${MASON_INCLUDES}" \
|
|
|
|
BOOST_LIBS="${MASON_LIBS}" \
|
|
|
|
ICU_INCLUDES="${MASON_INCLUDES}" \
|
|
|
|
ICU_LIBS="${MASON_LIBS}" \
|
|
|
|
FREETYPE_INCLUDES="${MASON_INCLUDES}/freetype2" \
|
|
|
|
FREETYPE_LIBS="${MASON_LIBS}" \
|
|
|
|
XML2_INCLUDES="${MASON_INCLUDES}/libxml2" \
|
|
|
|
XML2_LIBS="${MASON_LIBS}" \
|
|
|
|
PNG_INCLUDES="${MASON_INCLUDES}/libpng16" \
|
|
|
|
PNG_LIBS="${MASON_LIBS}" \
|
|
|
|
JPEG_INCLUDES="${MASON_INCLUDES}" \
|
|
|
|
JPEG_LIBS="${MASON_LIBS}" \
|
|
|
|
WEBP_INCLUDES="${MASON_INCLUDES}" \
|
|
|
|
WEBP_LIBS="${MASON_LIBS}" \
|
|
|
|
TIFF_INCLUDES="${MASON_INCLUDES}" \
|
|
|
|
TIFF_LIBS="${MASON_LIBS}" \
|
|
|
|
PROJ_INCLUDES="${MASON_INCLUDES}" \
|
|
|
|
PROJ_LIBS="${MASON_LIBS}" \
|
|
|
|
CAIRO_INCLUDES="${MASON_INCLUDES}" \
|
|
|
|
CAIRO_LIBS="${MASON_LIBS}" \
|
|
|
|
SQLITE_INCLUDES="${MASON_INCLUDES}" \
|
|
|
|
SQLITE_LIBS="${MASON_LIBS}" \
|
|
|
|
HB_INCLUDES="${MASON_INCLUDES}" \
|
|
|
|
HB_LIBS="${MASON_LIBS}" \
|
|
|
|
SQLITE_INCLUDES="${MASON_INCLUDES}" \
|
|
|
|
SQLITE_LIBS="${MASON_LIBS}" \
|
|
|
|
SQLITE_INCLUDES="${MASON_INCLUDES}" \
|
|
|
|
SQLITE_LIBS="${MASON_LIBS}" \
|