<commit_before># build notes for compiling mapnik deps statically
# and "FAT" (aka. universal) in order to allow
# linking a fully standalone libmapnik.a

PREFIX=`pwd`/osx/sources
mkdir -p $PREFIX
export DYLD_LIBRARY_PATH=$PREFIX/lib
export DYLD_LIBRARY_PATH=$PREFIX/lib
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export PATH=$PREFIX/bin:$PATH
export CORE_CFLAGS="-O3 -arch x86_64 -arch i386 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk"
export CORE_CXXFLAGS=$CORE_CFLAGS
export CORE_LDFLAGS="-Wl,-search_paths_first -arch x86_64 -arch i386 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk"
export ARCHFLAGS="-arch x86_64 -arch i386"


cd osx
mkdir -p deps
cd deps


# icucore headers - temporary workaround until I can get more recent icu versions working
wget http://www.opensource.apple.com/tarballs/ICU/ICU-400.38.tar.gz
tar xvf ICU-400.38.tar.gz
cd ICU-400.38
make install
cp -R build/usr/local/include/unicode/ ../../sources/include/unicode
cd ../

# boost
wget http://voxel.dl.sourceforge.net/project/boost/boost/1.47.0/boost_1_47_0.tar.bz2
tar xjvf boost_1_47_0.tar.bz2
cd boost_1_47_0
./bootstrap.sh

# no icu variant
./bjam --prefix=$PREFIX -j2 -d2 \
  --with-thread \
  --with-filesystem \
  --with-program_options --with-system --with-chrono \
  --with-regex --disable-icu \
  toolset=darwin \
  macosx-version=10.6 \
  address-model=32_64 \
  architecture=x86 \
  link=static \
  variant=release \
  stage

./bjam --prefix=$PREFIX -j2 -d2 \
  --with-thread \
  --with-filesystem \
  --with-program_options --with-system --with-chrono \
  --with-regex --disable-icu \
  toolset=darwin \
  macosx-version=10.6 \
  address-model=32_64 \
  architecture=x86 \
  link=static \
  variant=release \
  install

cd ../

# universal flags
export CFLAGS=$CORE_CFLAGS
export CXXFLAGS=$CORE_CXXFLAGS
export LDFLAGS=$CORE_LDFLAGS

# sqlite
wget http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz
tar xvf sqlite-autoconf-3070701.tar.gz
cd sqlite-autoconf-3070701
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
make -j4
make install
cd ../


# freetype
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.6.tar.bz2
tar xvf freetype-2.4.6.tar.bz2
cd freetype-2.4.6
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
make -j4
make install
cd ../

# proj4
wget http://download.osgeo.org/proj/proj-datumgrid-1.5.zip
#wget http://download.osgeo.org/proj/proj-4.7.0.tar.gz
#tar xvf proj-4.7.0.tar.gz
#cd proj-4.7.0
# we use trunk instead for better threading support
svn co http://svn.osgeo.org/metacrs/proj/trunk/proj proj-trunk # at the time pre-release 4.8.0
cd proj-trunk/nad
unzip ../../proj-datumgrid-1.5.zip
cd ../
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
make -j4
make install
cd ../

# libpng
wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.4.tar.gz
tar xvf libpng-1.5.4.tar.gz
cd libpng-1.5.4
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
make -j4
make install
cd ../

# libjpeg
wget http://www.ijg.org/files/jpegsrc.v8c.tar.gz
tar xvf jpegsrc.v8c.tar.gz
cd jpeg-8c
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
make -j4
make install
cd ../

# libtiff
wget http://download.osgeo.org/libtiff/tiff-3.9.5.tar.gz
tar xvf tiff-3.9.5.tar.gz
cd tiff-3.9.5
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
make -j4
make install
cd ../

# gettext which provides libintl for libpq
wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
tar xvf gettext-0.18.1.1.tar.gz
cd gettext-0.18.1.1
export CC=gcc
export CXX=g++
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking \
--without-included-gettext --disable-debug --without-included-glib \
--without-included-libcroco  --without-included-libxml \
--without-emacs --without-git --without-cvs
make -j4
make install
cd ../


# postgis
# install postgres 9.x client from http://www.kyngchaos.com/software/postgres
# then copy the static libpq.a to a prioritized directory:
cp /usr/local/pgsql/lib/libpq.a osx/sources/lib/libpq_s.a


# gdal 1.8.1
wget http://download.osgeo.org/gdal/gdal-1.8.1.tar.gz
tar xvf gdal-1.8.1.tar.gz
cd gdal-1.8.1
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking \
--with-libtiff=$PREFIX \
--with-jpeg=$PREFIX \
--with-png=$PREFIX \<commit_msg>osx: switch lpq linking back<commit_after># build notes for compiling mapnik deps statically
# and "FAT" (aka. universal) in order to allow
# linking a fully standalone libmapnik.a

PREFIX=`pwd`/osx/sources
mkdir -p $PREFIX
export DYLD_LIBRARY_PATH=$PREFIX/lib
export DYLD_LIBRARY_PATH=$PREFIX/lib
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export PATH=$PREFIX/bin:$PATH
export CORE_CFLAGS="-O3 -arch x86_64 -arch i386 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk"
export CORE_CXXFLAGS=$CORE_CFLAGS
export CORE_LDFLAGS="-Wl,-search_paths_first -arch x86_64 -arch i386 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk"
export ARCHFLAGS="-arch x86_64 -arch i386"


cd osx
mkdir -p deps
cd deps


# icucore headers - temporary workaround until I can get more recent icu versions working
wget http://www.opensource.apple.com/tarballs/ICU/ICU-400.38.tar.gz
tar xvf ICU-400.38.tar.gz
cd ICU-400.38
make install
cp -R build/usr/local/include/unicode/ ../../sources/include/unicode
cd ../

# boost
wget http://voxel.dl.sourceforge.net/project/boost/boost/1.47.0/boost_1_47_0.tar.bz2
tar xjvf boost_1_47_0.tar.bz2
cd boost_1_47_0
./bootstrap.sh

# no icu variant
./bjam --prefix=$PREFIX -j2 -d2 \
  --with-thread \
  --with-filesystem \
  --with-program_options --with-system --with-chrono \
  --with-regex --disable-icu \
  toolset=darwin \
  macosx-version=10.6 \
  address-model=32_64 \
  architecture=x86 \
  link=static \
  variant=release \
  stage

./bjam --prefix=$PREFIX -j2 -d2 \
  --with-thread \
  --with-filesystem \
  --with-program_options --with-system --with-chrono \
  --with-regex --disable-icu \
  toolset=darwin \
  macosx-version=10.6 \
  address-model=32_64 \
  architecture=x86 \
  link=static \
  variant=release \
  install

cd ../

# universal flags
export CFLAGS=$CORE_CFLAGS
export CXXFLAGS=$CORE_CXXFLAGS
export LDFLAGS=$CORE_LDFLAGS

# sqlite
wget http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz
tar xvf sqlite-autoconf-3070701.tar.gz
cd sqlite-autoconf-3070701
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
make -j4
make install
cd ../


# freetype
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.6.tar.bz2
tar xvf freetype-2.4.6.tar.bz2
cd freetype-2.4.6
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
make -j4
make install
cd ../

# proj4
wget http://download.osgeo.org/proj/proj-datumgrid-1.5.zip
#wget http://download.osgeo.org/proj/proj-4.7.0.tar.gz
#tar xvf proj-4.7.0.tar.gz
#cd proj-4.7.0
# we use trunk instead for better threading support
svn co http://svn.osgeo.org/metacrs/proj/trunk/proj proj-trunk # at the time pre-release 4.8.0
cd proj-trunk/nad
unzip ../../proj-datumgrid-1.5.zip
cd ../
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
make -j4
make install
cd ../

# libpng
wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.4.tar.gz
tar xvf libpng-1.5.4.tar.gz
cd libpng-1.5.4
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
make -j4
make install
cd ../

# libjpeg
wget http://www.ijg.org/files/jpegsrc.v8c.tar.gz
tar xvf jpegsrc.v8c.tar.gz
cd jpeg-8c
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
make -j4
make install
cd ../

# libtiff
wget http://download.osgeo.org/libtiff/tiff-3.9.5.tar.gz
tar xvf tiff-3.9.5.tar.gz
cd tiff-3.9.5
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking
make -j4
make install
cd ../

# gettext which provides libintl for libpq
wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
tar xvf gettext-0.18.1.1.tar.gz
cd gettext-0.18.1.1
export CC=gcc
export CXX=g++
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking \
--without-included-gettext --disable-debug --without-included-glib \
--without-included-libcroco  --without-included-libxml \
--without-emacs --without-git --without-cvs
make -j4
make install
cd ../


# postgis
# install postgres 9.x client from somewhere. 
# http://www.kyngchaos.com/software/postgres works nicely
# then copy the clients static libpq.a to a prioritized directory:
cp /usr/local/pgsql/lib/libpq.a osx/sources/lib/libpq.a
# then edit plugins/input/postgis/SConscript adding more libs to link to


# gdal 1.8.1
wget http://download.osgeo.org/gdal/gdal-1.8.1.tar.gz
tar xvf gdal-1.8.1.tar.gz
cd gdal-1.8.1
./configure --prefix=$PREFIX --enable-static --disable-shared --disable-dependency-tracking \
--with-libtiff=$PREFIX \
--with-jpeg=$PREFIX \
--with-png=$PREFIX \
{'fraction_non_alphanumeric': 0.15142265343944183, 'fraction_numerical': 0.041643955085577236, 'mean_word_length': 3.3375886524822693, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 2}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '222269', 'n_tokens_mistral': 3785, 'n_tokens_neox': 3482, 'n_words': 717}