Tizen 2.1 base
[framework/web/webkit-efl.git] / Tools / wx / install-unix-extras
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 mkdir -p $DEPS_PREFIX/bin
52 mkdir -p $DEPS_PREFIX/lib
53 mkdir -p $DEPS_PREFIX/include
54  
55 ICU_VERSION="3.4.1"
56 ICU_TARBALL="icu-$ICU_VERSION.tgz"
57 ICU_URL="ftp://ftp.software.ibm.com/software/globalization/icu/$ICU_VERSION/$ICU_TARBALL"
58
59 # dependent app, not lib, what should we do for these?
60
61 GPERF_VERSION="3.0.1"
62 GPERF_TARBALL="gperf-$GPERF_VERSION.tar.gz"
63 GPERF_URL="ftp://mirrors.kernel.org/gnu/gperf/$GPERF_TARBALL"
64
65 PKG_CONFIG_VERSION="0.20"
66 PKG_CONFIG_TARBALL="pkg-config-$PKG_CONFIG_VERSION.tar.gz"
67 PKG_CONFIG_URL="http://pkgconfig.freedesktop.org/releases/$PKG_CONFIG_TARBALL"
68
69 ICONV_VERSION="1.9.2"
70 ICONV_TARBALL="libiconv-$ICONV_VERSION.tar.gz"
71 ICONV_URL="http://ftp.gnu.org/pub/gnu/libiconv/$ICONV_TARBALL"
72
73 LIBJPEG_VERSION="6b"
74 LIBJPEG_TARBALL="jpegsrc.v$LIBJPEG_VERSION.tar.gz"
75 LIBJPEG_URL="http://wxwebkit.wxcommunity.com/downloads/deps/$LIBJPEG_TARBALL"
76
77 LIBPNG_VERSION="1.2.33"
78 LIBPNG_TARBALL="libpng-$LIBPNG_VERSION.tar.gz"
79 LIBPNG_URL="http://wxwebkit.wxcommunity.com/downloads/deps/$LIBPNG_TARBALL"
80
81 LIBCURL_VERSION="7.19.6"
82 LIBCURL_TARBALL="curl-$LIBCURL_VERSION.tar.gz"
83 LIBCURL_URL="http://curl.haxx.se/download/$LIBCURL_TARBALL"
84
85 export MAC_OS_X_DEPLOYMENT_TARGET=10.4
86
87 ARCH_FLAGS="-arch i386 -arch x86_64"
88 SDK="/Developer/SDKs/MacOSX10.4u.sdk"
89
90 if [ ! -d $SDK ]; then
91     SDK="/Developer/SDKs/MacOSX10.5.sdk"
92 fi
93
94 if [ ! -d $SDK ]; then
95     SDK="/Developer/SDKs/MacOSX10.6.sdk"
96 fi
97
98 if [ "${OSTYPE:0:6}" == "darwin" ]; then  
99     if [ -x /usr/bin/gcc-4.0 ]; then
100         export CC="gcc-4.0"
101         export CXX="g++-4.0"
102     fi
103 fi
104
105 cd $DL_DIR
106 # build ICU
107 if [ `which icu-config >/dev/null 2>&1` ]; then
108   $DL_CMD -o $DL_DIR/$ICU_TARBALL $ICU_URL
109
110   tar xzvf $DL_DIR/$ICU_TARBALL
111   cd $DL_DIR/icu/source
112   
113   chmod +x configure install-sh
114
115   if [ "${OSTYPE:0:6}" == "darwin" ]; then  
116     ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
117     make CFLAGS="-O -g -isysroot $SDK $ARCH_FLAGS" \
118     LDFLAGS=$ARCH_FLAGS
119     make install
120   else
121     ./configure --prefix=$DEPS_PREFIX
122   
123     make
124     #make check
125     make install
126   fi
127   cd $DL_DIR
128   rm -rf icu
129 fi
130
131 if [ ! -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 $SDK $ARCH_FLAGS" \
143     LDFLAGS="$ARCH_FLAGS"
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
156 fi
157
158 if [ ! -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 --disable-shared
166     make CFLAGS="-O -g -isysroot $SDK $ARCH_FLAGS" \
167     LDFLAGS="$ARCH_FLAGS"
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
178 fi
179
180 if [ ! -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     # CURL creates different build headers for 32 and 64 bit, so to get a universal build,
188     # we must first create a 32 bit version of the header, then a 64 bit version, and
189     # have the original header simply decide which to use.
190     export CFLAGS="-O -g -isysroot $SDK -mmacosx-version-min=10.4 -arch i386 -arch ppc"
191     ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
192     
193     mkdir -p $DEPS_PREFIX/include/curl
194     
195     cp include/curl/curlbuild.h include/curl/curlbuild32.h
196     
197     make distclean
198     
199     export CFLAGS="-O -g -isysroot $SDK -mmacosx-version-min=10.4 -arch x86_64 -arch ppc64"
200     ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
201     
202     cp include/curl/curlbuild.h include/curl/curlbuild64.h
203     
204     make distclean
205     
206     export CFLAGS="-O -g -isysroot $SDK -mmacosx-version-min=10.4 $ARCH_FLAGS"
207     ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking
208     
209     cat > include/curl/curlbuild.h <<EOF
210 #ifdef __LP64__
211 #include "curlbuild64.h"
212 #else
213 #include "curlbuild32.h"
214 #endif 
215 EOF
216
217     make CFLAGS="-O -g -isysroot $SDK $ARCH_FLAGS" \
218     LDFLAGS="$ARCH_FLAGS"
219     make install
220     
221     cp include/curl/curlbuild32.h $DEPS_PREFIX/include/curl/curlbuild32.h
222     cp include/curl/curlbuild64.h $DEPS_PREFIX/include/curl/curlbuild64.h
223     cp include/curl/curlbuild.h $DEPS_PREFIX/include/curl/curlbuild.h
224     
225   else
226     ./configure --prefix=$DEPS_PREFIX
227   
228     make
229     make install
230   fi
231   
232   cd $DL_DIR
233   rm -rf $DL_DIR/curl-$LIBCURL_VERSION
234 fi