Home | History | Annotate | Download | only in wx
      1 #!/bin/sh
      2 
      3 # Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
      4 #
      5 # Redistribution and use in source and binary forms, with or without
      6 # modification, are permitted provided that the following conditions
      7 # are met:
      8 #
      9 # 1.  Redistributions of source code must retain the above copyright
     10 #     notice, this list of conditions and the following disclaimer. 
     11 # 2.  Redistributions in binary form must reproduce the above copyright
     12 #     notice, this list of conditions and the following disclaimer in the
     13 #     documentation and/or other materials provided with the distribution. 
     14 # 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
     15 #     its contributors may be used to endorse or promote products derived
     16 #     from this software without specific prior written permission. 
     17 #
     18 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
     19 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     20 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     21 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
     22 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     23 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     24 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     25 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     27 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28 
     29 # A script to download the extra libraries needed to build WebKit on UNIX-based OSes.
     30 # libxml/libxslt need to be added, but so far I've had them on all the (UNIX) machines
     31 # I've tested on, so I don't have a machine to test the code on.
     32 
     33 DL_CMD="curl -L"
     34 
     35 scriptDir="$(cd $(dirname $0);pwd)"
     36 WK_ROOT=$scriptDir/../..
     37 WK_ROOTDIR=$WK_ROOT
     38 
     39 DL_DIR=/tmp/webkit-deps
     40 # NOTE: If you change this, make sure the dir is on the path.
     41 DEPS_PREFIX=$WK_ROOT/WebKitLibraries/unix
     42 DLLEXT=so
     43 
     44 if [ "${OSTYPE:0:6}" == "darwin" ]; then
     45     DLLEXT=dylib
     46 fi
     47 
     48 mkdir -p $DL_DIR
     49 mkdir -p $DEPS_PREFIX
     50 
     51 ICU_VERSION="3.4.1"
     52 ICU_TARBALL="icu-$ICU_VERSION.tgz"
     53 ICU_URL="ftp://ftp.software.ibm.com/software/globalization/icu/$ICU_VERSION/$ICU_TARBALL"
     54 
     55 # dependent app, not lib, what should we do for these?
     56 
     57 GPERF_VERSION="3.0.1"
     58 GPERF_TARBALL="gperf-$GPERF_VERSION.tar.gz"
     59 GPERF_URL="ftp://mirrors.kernel.org/gnu/gperf/$GPERF_TARBALL"
     60 
     61 PKG_CONFIG_VERSION="0.20"
     62 PKG_CONFIG_TARBALL="pkg-config-$PKG_CONFIG_VERSION.tar.gz"
     63 PKG_CONFIG_URL="http://pkgconfig.freedesktop.org/releases/$PKG_CONFIG_TARBALL"
     64 
     65 ICONV_VERSION="1.9.2"
     66 ICONV_TARBALL="libiconv-$ICONV_VERSION.tar.gz"
     67 ICONV_URL="http://ftp.gnu.org/pub/gnu/libiconv/$ICONV_TARBALL"
     68 
     69 LIBJPEG_VERSION="6b"
     70 LIBJPEG_TARBALL="jpegsrc.v$LIBJPEG_VERSION.tar.gz"
     71 LIBJPEG_URL="http://wxwebkit.wxcommunity.com/downloads/deps/$LIBJPEG_TARBALL"
     72 
     73 LIBPNG_VERSION="1.2.33"
     74 LIBPNG_TARBALL="libpng-$LIBPNG_VERSION.tar.gz"
     75 LIBPNG_URL="http://wxwebkit.wxcommunity.com/downloads/deps/$LIBPNG_TARBALL"
     76 
     77 LIBCURL_VERSION="7.19.6"
     78 LIBCURL_TARBALL="curl-$LIBCURL_VERSION.tar.gz"
     79 LIBCURL_URL="http://curl.haxx.se/download/$LIBCURL_TARBALL"
     80 
     81 export MAC_OS_X_DEPLOYMENT_TARGET=10.4
     82 
     83 ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
     84 SDK="/Developer/SDKs/MacOSX10.4u.sdk"
     85 
     86 if [ ! -d $SDK ]; then
     87     SDK="/Developer/SDKs/MacOSX10.5.sdk"
     88 fi
     89 
     90 if [ "${OSTYPE:0:6}" == "darwin" ]; then  
     91     export CC="gcc-4.0"
     92     export CXX="g++-4.0"
     93 fi
     94 
     95 cd $DL_DIR
     96 # build ICU
     97 if [ `which icu-config >/dev/null 2>&1` ]; then
     98   $DL_CMD -o $DL_DIR/$ICU_TARBALL $ICU_URL
     99 
    100   tar xzvf $DL_DIR/$ICU_TARBALL
    101   cd $DL_DIR/icu/source
    102   
    103   chmod +x configure install-sh
    104 
    105   if [ "${OSTYPE:0:6}" == "darwin" ]; then  
    106     ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
    107     make CFLAGS="-O -g -isysroot $SDK $ARCH_FLAGS" \
    108     LDFLAGS=$ARCH_FLAGS
    109     make install
    110   else
    111     ./configure --prefix=$DEPS_PREFIX
    112   
    113     make
    114     #make check
    115     make install
    116   fi
    117   cd $DL_DIR
    118   rm -rf icu
    119 fi
    120 
    121 # TODO: What would be a good way to test for this?
    122 if [ ! -f $DEPS_PREFIX/lib/libiconv.$DLLEXT ]; then
    123   $DL_CMD -o $DL_DIR/$ICONV_TARBALL $ICONV_URL
    124 
    125   tar xzvf $DL_DIR/$ICONV_TARBALL
    126   cd $DL_DIR/libiconv-$ICONV_VERSION
    127 
    128   if [ "${OSTYPE:0:6}" == "darwin" ]; then  
    129     ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
    130     make CFLAGS="-O -g -isysroot $SDK $ARCH_FLAGS" \
    131     LDFLAGS="$ARCH_FLAGS"
    132     make install
    133   else
    134     ./configure --prefix=$DEPS_PREFIX
    135   
    136     make
    137     make install
    138   fi
    139   cd $DL_DIR
    140   rm -rf $DL_DIR/libiconv-$ICONV_VERSION
    141 fi
    142 
    143 if [ ! -f $DEPS_PREFIX/lib/libjpeg.a ]; then
    144   $DL_CMD -o $DL_DIR/$LIBJPEG_TARBALL $LIBJPEG_URL
    145 
    146   tar xzvf $DL_DIR/$LIBJPEG_TARBALL
    147   cd $DL_DIR/jpeg-$LIBJPEG_VERSION
    148 
    149   # jpeg install command expects this to exist.
    150   mkdir -p $DEPS_PREFIX/man/man1
    151 
    152   if [ "${OSTYPE:0:6}" == "darwin" ]; then
    153     ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
    154     make CFLAGS="-O -g -isysroot $SDK $ARCH_FLAGS" \
    155     LDFLAGS="$ARCH_FLAGS"
    156     make install
    157   else
    158     ./configure --prefix=$DEPS_PREFIX
    159   
    160     make
    161   fi
    162   
    163   cp libjpeg.a $DEPS_PREFIX/lib
    164   cp *.h $DEPS_PREFIX/include
    165   
    166   cd $DL_DIR
    167   rm -rf $DL_DIR/jpeg-$LIBJPEG_VERSION
    168 fi
    169 
    170 if [ ! -f $DEPS_PREFIX/lib/libpng.a ]; then
    171   $DL_CMD -o $DL_DIR/$LIBPNG_TARBALL $LIBPNG_URL
    172 
    173   tar xzvf $DL_DIR/$LIBPNG_TARBALL
    174   cd $DL_DIR/libpng-$LIBPNG_VERSION
    175 
    176   if [ "${OSTYPE:0:6}" == "darwin" ]; then
    177     ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
    178     make CFLAGS="-O -g -isysroot $SDK $ARCH_FLAGS" \
    179     LDFLAGS="$ARCH_FLAGS"
    180     make install
    181   else
    182     ./configure --prefix=$DEPS_PREFIX
    183   
    184     make
    185     make install
    186   fi
    187   
    188   cd $DL_DIR
    189   rm -rf $DL_DIR/libpng-$LIBPNG_VERSION
    190 fi
    191 
    192 if [ ! -f $DEPS_PREFIX/lib/libcurl.$DLLEXT ]; then
    193   $DL_CMD -o $DL_DIR/$LIBCURL_TARBALL $LIBCURL_URL
    194 
    195   tar xzvf $DL_DIR/$LIBCURL_TARBALL
    196   cd $DL_DIR/curl-$LIBCURL_VERSION
    197 
    198   if [ "${OSTYPE:0:6}" == "darwin" ]; then
    199     # CURL creates different build headers for 32 and 64 bit, so to get a universal build,
    200     # we must first create a 32 bit version of the header, then a 64 bit version, and
    201     # have the original header simply decide which to use.
    202     export CFLAGS="-O -g -isysroot $SDK -mmacosx-version-min=10.4 -arch i386 -arch ppc"
    203     ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
    204     
    205     mkdir -p $DEPS_PREFIX/include/curl
    206     
    207     cp include/curl/curlbuild.h include/curl/curlbuild32.h
    208     cp include/curl/curlbuild.h $DEPS_PREFIX/include/curl/curlbuild32.h
    209     
    210     make distclean
    211     
    212     export CFLAGS="-O -g -isysroot $SDK -mmacosx-version-min=10.4 -arch x86_64 -arch ppc64"
    213     ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
    214     
    215     cp include/curl/curlbuild.h include/curl/curlbuild64.h
    216     cp include/curl/curlbuild.h $DEPS_PREFIX/include/curl/curlbuild64.h
    217     
    218     make distclean
    219     
    220     export CFLAGS="-O -g -isysroot $SDK -mmacosx-version-min=10.4 $ARCH_FLAGS"
    221     ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
    222     
    223     cat > include/curl/curlbuild.h <<EOF
    224 #ifdef __LP64__
    225 #include "curlbuild64.h"
    226 #else
    227 #include "curlbuild32.h"
    228 #endif 
    229 EOF
    230 
    231     make CFLAGS="-O -g -isysroot $SDK $ARCH_FLAGS" \
    232     LDFLAGS="$ARCH_FLAGS"
    233     make install
    234   else
    235     ./configure --prefix=$DEPS_PREFIX
    236   
    237     make
    238     make install
    239   fi
    240   
    241   cd $DL_DIR
    242   rm -rf $DL_DIR/curl-$LIBCURL_VERSION
    243 fi
    244