• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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://www.ijg.org/files/$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
77cd $DL_DIR
78# build ICU
79if [ `which icu-config >/dev/null 2>&1` ]; then
80  $DL_CMD -o $DL_DIR/$ICU_TARBALL $ICU_URL
81
82  tar xzvf $DL_DIR/$ICU_TARBALL
83  cd $DL_DIR/icu/source
84
85  chmod +x configure install-sh
86
87  if [ "${OSTYPE:0:6}" == "darwin" ]; then
88    ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
89    make CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" \
90    LDFLAGS="-arch i386 -arch ppc"
91    make install
92  else
93    ./configure --prefix=$DEPS_PREFIX
94
95    make
96    #make check
97    make install
98  fi
99  cd $DL_DIR
100  rm -rf icu
101fi
102
103# TODO: What would be a good way to test for this?
104if [ ! -f $DEPS_PREFIX/lib/libiconv.$DLLEXT ]; then
105  $DL_CMD -o $DL_DIR/$ICONV_TARBALL $ICONV_URL
106
107  tar xzvf $DL_DIR/$ICONV_TARBALL
108  cd $DL_DIR/libiconv-$ICONV_VERSION
109
110  if [ "${OSTYPE:0:6}" == "darwin" ]; then
111    ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
112    make CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" \
113    LDFLAGS="-arch i386 -arch ppc"
114    make install
115  else
116    ./configure --prefix=$DEPS_PREFIX
117
118    make
119    make install
120  fi
121  cd $DL_DIR
122  rm -rf $DL_DIR/libiconv-$ICONV_VERSION
123fi
124
125if [ ! -f $DEPS_PREFIX/lib/libjpeg.a ]; then
126  $DL_CMD -o $DL_DIR/$LIBJPEG_TARBALL $LIBJPEG_URL
127
128  tar xzvf $DL_DIR/$LIBJPEG_TARBALL
129  cd $DL_DIR/jpeg-$LIBJPEG_VERSION
130
131  # jpeg install command expects this to exist.
132  mkdir -p $DEPS_PREFIX/man/man1
133
134  if [ "${OSTYPE:0:6}" == "darwin" ]; then
135    ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
136    make CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" \
137    LDFLAGS="-arch i386 -arch ppc"
138    make install
139  else
140    ./configure --prefix=$DEPS_PREFIX
141
142    make
143  fi
144
145  cp libjpeg.a $DEPS_PREFIX/lib
146  cp *.h $DEPS_PREFIX/include
147
148  cd $DL_DIR
149  rm -rf $DL_DIR/jpeg-$LIBJPEG_VERSION
150fi
151
152if [ ! -f $DEPS_PREFIX/lib/libpng.a ]; then
153  $DL_CMD -o $DL_DIR/$LIBPNG_TARBALL $LIBPNG_URL
154
155  tar xzvf $DL_DIR/$LIBPNG_TARBALL
156  cd $DL_DIR/libpng-$LIBPNG_VERSION
157
158  if [ "${OSTYPE:0:6}" == "darwin" ]; then
159    ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
160    make CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" \
161    LDFLAGS="-arch i386 -arch ppc"
162    make install
163  else
164    ./configure --prefix=$DEPS_PREFIX
165
166    make
167    make install
168  fi
169
170  cd $DL_DIR
171  rm -rf $DL_DIR/libpng-$LIBPNG_VERSION
172fi
173