Converted these images to PNG, saving a handful of bytes per image
[adiumx.git] / Utilities / dep-build-scripts / purple_make.sh
blob4162f0d5630b00ed7470dbefc20d9608b5478826
1 if [ `sw_vers -productVersion | cut -f 1,2 -d '.'` == 10.4 ] ; then
2 IS_ON_10_4=TRUE
3 else
4 IS_ON_10_4=FALSE
5 fi
7 DEBUG_SYMBOLS=TRUE
9 GLIB=glib-2.14.1
10 MEANWHILE=meanwhile-1.0.2
11 GADU=libgadu-1.7.1
12 INTLTOOL=intltool-0.36.2
13 PROTOCOLS="bonjour gg irc jabber msn myspace novell oscar qq sametime simple yahoo zephyr"
14 PATCHDIR="$PWD"
16 if [ "x$PIDGIN_SOURCE" == "x" ] ; then
17 echo 'Error: you need to set PIDGIN_SOURCE to be the location of' \
18 'your pidgin source tree.'
19 exit 1
22 SDK_ROOT="/Developer/SDKs/MacOSX10.4u.sdk"
23 BASE_CFLAGS="-mmacosx-version-min=10.4 -isysroot $SDK_ROOT"
24 BASE_LDFLAGS="-mmacosx-version-min=10.4 -headerpad_max_install_names -Wl,-syslibroot,$SDK_ROOT"
26 NUMBER_OF_CORES=`sysctl -n hw.activecpu`
28 mkdir build || true
29 cd build
30 mkdir universal || true
32 TARGET_DIR_PPC="$PWD/root-ppc"
33 TARGET_DIR_I386="$PWD/root-i386"
34 TARGET_DIR_BASE="$PWD/root"
35 export PATH_PPC="$TARGET_DIR_PPC/bin:$PATH"
36 export PATH_I386="$TARGET_DIR_I386/bin:$PATH"
38 # On 10.5+, we need glibtoolize to be libtoolize for pidgin, their silly
39 # autogen.sh expects it to be that way right now. In the future I'm hoping
40 # to offer a patch to pidgin so that it'll check and see if glibtoolize
41 # exists if it doesn't find libtoolize.
42 if [ "$IS_ON_10_4" == "FALSE" ] ; then
43 ln -s /usr/bin/glibtoolize $TARGET_DIR_PPC/bin/libtoolize
44 ln -s /usr/bin/glibtoolize $TARGET_DIR_I386/bin/libtoolize
47 # Apply our openssl patch - enables using OpenSSL and allows libgadu with SSL
48 # support. This is OK because OpenSSL is part of the base system on OS X.
50 pushd $PIDGIN_SOURCE
51 ###
52 # Patches bringing in forward changes from libpurple:
54 # libpurple_jabber_fallback_on_old_auth.diff is in im.pidgin.pidgin but not the 2.3.1 branch; diff from 2e5cda103238f64d27e4ed5aa92c149f6d50a5ec to 16e6cd4ffd8a8308380dc016f0afa782a7750374 -evands 12/07
55 # libpurple_jabber_use_builtin_digestmd5.diff was in im.pidgin.pidgin but not the 2.3.1 branch; diff from 16e6cd4ffd8a8308380dc016f0afa782a7750374 to f6430c7013d08f95c60248eeb22c752a0107499b. It has, however, been disapproved, because Openfire 3.4.x fixes the problem. -evands 12/07
56 # libpurple_jabber_cert_against_jid_hostname.diff - im.pidgin.pidgin 6227c43549bf66022512f18bb36d70b7c57c4430 (will be in 2.4.0)
57 # libpurple_buddyicon_cache.diff - im.pidgin.pidgin 5d18b4aee9c05f592af532f9155aadb23ad11d4b (will be in 2.4.0)
59 # libpurple-account-request.fix.diff - fix a crash in the account auth request code. A similar change was made in im.pidgin.pidgin for 2.4.0.
61 # libpurple_flap_connection_validity.diff - fix an oscar crash which could occur after disconnecting. (will be in 2.4.0).
62 ###
63 # Patches for our own hackery
65 # libpurple_jabber_avoid_sasl_option_hack.diff is needed to avoid using PLAIN via SASL on Mac OS X 10.4, where it doesn't work properly
66 # libpurple_makefile_linkage_hacks.diff fixes some linkage problems
68 # libpurple_jabber_parser_error_handler.diff adds a handler for jabber errors
69 # which may fix crashes in __xmlRaiseError() --> _structuredErrorFunc().
71 # libpurple_xmlnode_parser_error_handler does the same for other xml parsing.
72 ###
73 for patch in "$PATCHDIR/libpurple_makefile_linkage_hacks.diff" \
74 "$PATCHDIR/libpurple-restrict-potfiles-to-libpurple.diff" \
75 "$PATCHDIR/libpurple_jabber_use_builtin_digestmd5.diff" \
76 "$PATCHDIR/libpurple_jabber_fallback_on_old_auth.diff" \
77 "$PATCHDIR/libpurple_jabber_parser_error_handler.diff" \
78 "$PATCHDIR/libpurple_jabber_avoid_sasl_option_hack.diff" \
79 "$PATCHDIR/libpurple_jabber_cert_against_jid_hostname.diff" \
80 "$PATCHDIR/libpurple_buddyicon_cache.diff" \
81 "$PATCHDIR/libpurple-account-request.fix.diff" \
82 "$PATCHDIR/libpurple_xmlnode_parser_error_handler.diff" \
83 "$PATCHDIR/libpurple_flap_connection_validity.diff" ; do
84 echo "Applying $patch"
85 cat $patch | patch --forward -p0
86 done
87 popd
90 for ARCH in ppc i386 ; do
91 case $ARCH in
92 ppc) export HOST=powerpc-apple-darwin9
93 export PATH="$PATH_PPC"
94 export ACLOCAL_FLAGS="-I$TARGET_DIR_PPC/share/aclocal"
95 export PKG_CONFIG_PATH="$TARGET_DIR_PPC/lib/pkgconfig"
96 TARGET_DIR=$TARGET_DIR_PPC;;
97 i386) export HOST=i686-apple-darwin9
98 export PATH="$PATH_I386"
99 export ACLOCAL_FLAGS="-I$TARGET_DIR_I386/share/aclocal"
100 export PKG_CONFIG_PATH="$TARGET_DIR_I386/lib/pkgconfig"
101 TARGET_DIR=$TARGET_DIR_I386;;
102 esac
104 #Get access to the sasl headers
105 mkdir -p $TARGET_DIR/include/sasl || true
106 cp $PATCHDIR/cyrus-sasl-2.1.18/include/*.h $TARGET_DIR/include/sasl
108 #Note that whether we use openssl or cdsa the same underlying workarounds (as seen in jabber.c, only usage at present 12/07) are needed
109 export CFLAGS="$BASE_CFLAGS -arch $ARCH -I$TARGET_DIR/include -I$SDK_ROOT/usr/include/kerberosIV -DHAVE_SSL -DHAVE_OPENSSL -fno-common"
111 if [ "$DEBUG_SYMBOLS" = "TRUE" ] ; then
112 export CFLAGS="$CFLAGS -gdwarf-2 -g3"
115 export LDFLAGS="$BASE_LDFLAGS -L$TARGET_DIR/lib -arch $ARCH"
116 mkdir libpurple-$ARCH || true
117 cd libpurple-$ARCH
118 export ARCH
119 export PKG_CONFIG="`which pkg-config`"
120 export MSGFMT="`which msgfmt`"
121 # this part is really ew. We actually re-run autogen.sh per-arch.
122 # we pass configure --help so that it bails out and doesn't fubar the source
123 # tree, because otherwise we'd have to un-configure it. Stupid autotools.
124 pushd $PIDGIN_SOURCE
125 ./autogen.sh --help
126 popd
127 # we don't need pkg-config for this
128 export LIBXML_CFLAGS='-I/usr/include/libxml2'
129 export LIBXML_LIBS='-lxml2'
130 export GADU_CFLAGS="-I$TARGET_DIR/include"
131 export GADU_LIBS="-lgadu"
132 export MEANWHILE_CFLAGS="-I$TARGET_DIR/include/meanwhile -I$TARGET_DIR/include/glib-2.0 -I$TARGET_DIR/lib/glib-2.0/include"
133 export MEANWHILE_LIBS="-lmeanwhile -lglib-2.0 -liconv"
134 $PIDGIN_SOURCE/configure \
135 --disable-gtkui --disable-consoleui \
136 --disable-perl \
137 --enable-debug \
138 --disable-static --enable-shared \
139 --enable-krb4 \
140 --enable-cyrus-sasl \
141 --prefix=$TARGET_DIR \
142 --with-static-prpls="$PROTOCOLS" --disable-plugins \
143 --host=$HOST \
144 --enable-gnutls=no --enable-nss=no --enable-openssl=no $@
145 cd libpurple
146 make -j $NUMBER_OF_CORES && make install
147 # HACK ALERT! We use the following internal-only headers:
148 cp $PIDGIN_SOURCE/libpurple/protocols/oscar/oscar.h \
149 $PIDGIN_SOURCE/libpurple/protocols/oscar/oscar-adium.h \
150 $PIDGIN_SOURCE/libpurple/protocols/oscar/snactypes.h \
151 $PIDGIN_SOURCE/libpurple/protocols/oscar/peer.h \
152 $PIDGIN_SOURCE/libpurple/cmds.h \
153 $PIDGIN_SOURCE/libpurple/internal.h \
154 $PIDGIN_SOURCE/libpurple/protocols/msnp9/*.h \
155 $PIDGIN_SOURCE/libpurple/protocols/yahoo/*.h \
156 $PIDGIN_SOURCE/libpurple/protocols/gg/buddylist.h \
157 $PIDGIN_SOURCE/libpurple/protocols/gg/gg.h \
158 $PIDGIN_SOURCE/libpurple/protocols/gg/search.h \
159 $PIDGIN_SOURCE/libpurple/protocols/jabber/buddy.h \
160 $PIDGIN_SOURCE/libpurple/protocols/jabber/caps.h \
161 $PIDGIN_SOURCE/libpurple/protocols/jabber/jutil.h \
162 $PIDGIN_SOURCE/libpurple/protocols/jabber/presence.h \
163 $PIDGIN_SOURCE/libpurple/protocols/jabber/si.h \
164 $PIDGIN_SOURCE/libpurple/protocols/jabber/jabber.h \
165 $TARGET_DIR/include/libpurple
166 cd ../..
167 done
169 pushd $PIDGIN_SOURCE
170 for patch in "$PATCHDIR/libpurple_jabber_avoid_sasl_option_hack.diff" \
171 "$PATCHDIR/libpurple_jabber_parser_error_handler.diff" \
172 "$PATCHDIR/libpurple_jabber_fallback_on_old_auth.diff" \
173 "$PATCHDIR/libpurple_jabber_use_builtin_digestmd5.diff" \
174 "$PATCHDIR/libpurple-restrict-potfiles-to-libpurple.diff" \
175 "$PATCHDIR/libpurple_makefile_linkage_hacks.diff" \
176 "$PATCHDIR/libpurple_jabber_cert_against_jid_hostname.diff" \
177 "$PATCHDIR/libpurple_buddyicon_cache.diff" \
178 "$PATCHDIR/libpurple-account-request.fix.diff" \
179 "$PATCHDIR/libpurple_xmlnode_parser_error_handler.diff" \
180 "$PATCHDIR/libpurple_flap_connection_validity.diff" ; do
181 patch -R -p0 < $patch
182 done
183 popd