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 33DL_CMD="curl -L" 34 35scriptDir="$(cd $(dirname $0);pwd)" 36WK_ROOT=$scriptDir/../.. 37WK_ROOTDIR=$WK_ROOT 38 39DL_DIR=/tmp/webkit-deps 40# NOTE: If you change this, make sure the dir is on the path. 41DEPS_PREFIX=$WK_ROOT/WebKitLibraries/unix 42DLLEXT=so 43 44if [ "${OSTYPE:0:6}" == "darwin" ]; then 45 DLLEXT=dylib 46fi 47 48mkdir -p $DL_DIR 49mkdir -p $DEPS_PREFIX 50 51ICU_VERSION="3.4.1" 52ICU_TARBALL="icu-$ICU_VERSION.tgz" 53ICU_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 57GPERF_VERSION="3.0.1" 58GPERF_TARBALL="gperf-$GPERF_VERSION.tar.gz" 59GPERF_URL="ftp://mirrors.kernel.org/gnu/gperf/$GPERF_TARBALL" 60 61PKG_CONFIG_VERSION="0.20" 62PKG_CONFIG_TARBALL="pkg-config-$PKG_CONFIG_VERSION.tar.gz" 63PKG_CONFIG_URL="http://pkgconfig.freedesktop.org/releases/$PKG_CONFIG_TARBALL" 64 65ICONV_VERSION="1.9.2" 66ICONV_TARBALL="libiconv-$ICONV_VERSION.tar.gz" 67ICONV_URL="http://ftp.gnu.org/pub/gnu/libiconv/$ICONV_TARBALL" 68 69LIBJPEG_VERSION="6b" 70LIBJPEG_TARBALL="jpegsrc.v$LIBJPEG_VERSION.tar.gz" 71LIBJPEG_URL="http://wxwebkit.wxcommunity.com/downloads/deps/$LIBJPEG_TARBALL" 72 73LIBPNG_VERSION="1.2.33" 74LIBPNG_TARBALL="libpng-$LIBPNG_VERSION.tar.gz" 75LIBPNG_URL="http://wxwebkit.wxcommunity.com/downloads/deps/$LIBPNG_TARBALL" 76 77LIBCURL_VERSION="7.19.6" 78LIBCURL_TARBALL="curl-$LIBCURL_VERSION.tar.gz" 79LIBCURL_URL="http://curl.haxx.se/download/$LIBCURL_TARBALL" 80 81export MAC_OS_X_DEPLOYMENT_TARGET=10.4 82 83cd $DL_DIR 84# build ICU 85if [ `which icu-config >/dev/null 2>&1` ]; then 86 $DL_CMD -o $DL_DIR/$ICU_TARBALL $ICU_URL 87 88 tar xzvf $DL_DIR/$ICU_TARBALL 89 cd $DL_DIR/icu/source 90 91 chmod +x configure install-sh 92 93 if [ "${OSTYPE:0:6}" == "darwin" ]; then 94 ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking 95 make CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" \ 96 LDFLAGS="-arch i386 -arch ppc" 97 make install 98 else 99 ./configure --prefix=$DEPS_PREFIX 100 101 make 102 #make check 103 make install 104 fi 105 cd $DL_DIR 106 rm -rf icu 107fi 108 109# TODO: What would be a good way to test for this? 110if [ ! -f $DEPS_PREFIX/lib/libiconv.$DLLEXT ]; then 111 $DL_CMD -o $DL_DIR/$ICONV_TARBALL $ICONV_URL 112 113 tar xzvf $DL_DIR/$ICONV_TARBALL 114 cd $DL_DIR/libiconv-$ICONV_VERSION 115 116 if [ "${OSTYPE:0:6}" == "darwin" ]; then 117 ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking 118 make CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" \ 119 LDFLAGS="-arch i386 -arch ppc" 120 make install 121 else 122 ./configure --prefix=$DEPS_PREFIX 123 124 make 125 make install 126 fi 127 cd $DL_DIR 128 rm -rf $DL_DIR/libiconv-$ICONV_VERSION 129fi 130 131if [ ! -f $DEPS_PREFIX/lib/libjpeg.a ]; then 132 $DL_CMD -o $DL_DIR/$LIBJPEG_TARBALL $LIBJPEG_URL 133 134 tar xzvf $DL_DIR/$LIBJPEG_TARBALL 135 cd $DL_DIR/jpeg-$LIBJPEG_VERSION 136 137 # jpeg install command expects this to exist. 138 mkdir -p $DEPS_PREFIX/man/man1 139 140 if [ "${OSTYPE:0:6}" == "darwin" ]; then 141 ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking 142 make CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" \ 143 LDFLAGS="-arch i386 -arch ppc" 144 make install 145 else 146 ./configure --prefix=$DEPS_PREFIX 147 148 make 149 fi 150 151 cp libjpeg.a $DEPS_PREFIX/lib 152 cp *.h $DEPS_PREFIX/include 153 154 cd $DL_DIR 155 rm -rf $DL_DIR/jpeg-$LIBJPEG_VERSION 156fi 157 158if [ ! -f $DEPS_PREFIX/lib/libpng.a ]; then 159 $DL_CMD -o $DL_DIR/$LIBPNG_TARBALL $LIBPNG_URL 160 161 tar xzvf $DL_DIR/$LIBPNG_TARBALL 162 cd $DL_DIR/libpng-$LIBPNG_VERSION 163 164 if [ "${OSTYPE:0:6}" == "darwin" ]; then 165 ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking 166 make CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" \ 167 LDFLAGS="-arch i386 -arch ppc" 168 make install 169 else 170 ./configure --prefix=$DEPS_PREFIX 171 172 make 173 make install 174 fi 175 176 cd $DL_DIR 177 rm -rf $DL_DIR/libpng-$LIBPNG_VERSION 178fi 179 180if [ ! -f $DEPS_PREFIX/lib/libcurl.$DLLEXT ]; then 181 $DL_CMD -o $DL_DIR/$LIBCURL_TARBALL $LIBCURL_URL 182 183 tar xzvf $DL_DIR/$LIBCURL_TARBALL 184 cd $DL_DIR/curl-$LIBCURL_VERSION 185 186 if [ "${OSTYPE:0:6}" == "darwin" ]; then 187 ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking 188 make CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" \ 189 LDFLAGS="-arch i386 -arch ppc" 190 make install 191 else 192 ./configure --prefix=$DEPS_PREFIX 193 194 make 195 make install 196 fi 197 198 cd $DL_DIR 199 rm -rf $DL_DIR/curl-$LIBCURL_VERSION 200fi 201