2 # Script to prepare a workspace (devel dependencies, check system
3 # configuration) for Pidgin compilation under win32
5 # Written by Tomek Wasilczyk <tomkiewicz@cpw.pidgin.im>, licensed under GNU GPL
11 BONJOUR_SDK_DIR
="/cygdrive/c/Program Files/Bonjour SDK"
12 ACTIVEPERL_GUID_PACKED
="BC98F31FB8440B94CB3674649419766C 547A2C684F806164DB756F228DAB5840 5E7EC16051106BB43818746C209BC8D7"
13 PERL_DIR_FALLBACK
="/cygdrive/c/Perl/bin"
14 if [ "$PLATFORM" == "x86_64" ]; then
15 NSIS_DIR_REGKEY
="HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/NSIS/@"
17 NSIS_DIR_REGKEY
="HKEY_LOCAL_MACHINE/SOFTWARE/NSIS/@"
21 DEBUG_SKIP_DOWNLOADING
=0
24 DOWNLOAD_HOST
="https://pidgin.im/~twasilczyk/win32/devel-deps/"
27 OBS_SKIP
="usr/i686-w64-mingw32/sys-root/mingw"
29 # bsdcpio is used for extracting rpms
30 ARC_CPI
="${DOWNLOAD_HOST}cpio/bsdcpio-3.0.3-1.4.tar.gz;bsdcpio;3.0.3-1.4;0460c7a52f8c93d3c4822d6d1aaf9410f21bd4da;bsdcpio-3.0.3-1.4;bsdcpio"
33 ARC_CSA
="${DOWNLOAD_HOST}cyrus-sasl-2.1.25.tar.gz;Cyrus SASL;2.1.25;b9d7f510c0c5daa71ee5225daacdd58e948a8d19;cyrus-sasl-2.1.25;cyrus-sasl-2.1"
36 ARC_NSS
="${DOWNLOAD_HOST}mingw32-mozilla-nss-devel-3.14.3-2.2.noarch.rpm;NSS;3.14.3-2.2;fd394678ef2a8ef1dbbc20c25701678bc8678acf;${OBS_SKIP};nss-3.14"
38 ARC_NSP
="${DOWNLOAD_HOST}mingw32-mozilla-nspr-devel-4.9.6-4.1.noarch.rpm;NSPR;4.9.6-4.1;b15aefbf99ade3042d0e4ed32f9368ff38064ecd;${OBS_SKIP};nss-3.14"
41 ARC_GTLS
="${DOWNLOAD_HOST}mingw32-libgnutls-devel-3.1.16-2.2.noarch.rpm;GnuTLS;3.1.16-2.2;50406ff150ff81d1282a2f2a551699aa8a53e175;${OBS_SKIP};gnutls-3.1"
44 ARC_PID
="${DOWNLOAD_HOST}pidgin-inst-deps-20130214.tar.gz;inst-deps;20130214;372218ab472c4070cd45489dae175dea5638cf17;;"
47 #mingw gcc and its dependencies
48 ARC_MG1
="${DOWNLOAD_HOST}mingw32-gcc-4.8.0-6.1.noarch.rpm;mingw: gcc;4.8.0-6.1;00591ba625cb4d3968f9907a76e7e3350e80c65b;${OBS_SKIP};mingw"
50 ARC_MG2
="${DOWNLOAD_HOST}mingw32-cpp-4.8.0-6.1.noarch.rpm;mingw: cpp;4.8.0-6.1;ea22584abf14cdf34217bb5eb24a30211a382882;${OBS_SKIP};mingw"
52 ARC_MG3
="${DOWNLOAD_HOST}mingw32-binutils-2.22.52-3.5.noarch.rpm;mingw: binutils;2.22.52-3.5;e6431d8dfa0dfe5a3488017c291cb68193999808;${OBS_SKIP};mingw"
54 ARC_MG4
="${DOWNLOAD_HOST}mingw32-libgmp-5.0.5-1.6.noarch.rpm;mingw: libgmp;5.0.5-1.6;58ff8155e870063a2cab999f413ffa1ec6ad2d16;${OBS_SKIP};mingw"
56 ARC_MG5
="${DOWNLOAD_HOST}mingw32-libmpc-1.0-1.6.noarch.rpm;mingw: libmpc;1.0-1.6;552dd1de81aef3dfdb7b3a87f13b79e6805d9940;${OBS_SKIP};mingw"
58 ARC_MG6
="${DOWNLOAD_HOST}mingw32-libmpfr-3.1.0-1.6.noarch.rpm;mingw: libmpfr;3.1.0-1.6;d86d12af65c442dc260d156528fff009d21dab9c;${OBS_SKIP};mingw"
60 ARC_MG7
="${DOWNLOAD_HOST}mingw32-runtime-20130216-2.3.noarch.rpm;mingw: runtime;20130216-2.3;9ff3810f8313d19ab18458d73565856608cf9188;${OBS_SKIP};mingw"
62 ARC_MG8
="${DOWNLOAD_HOST}mingw32-zlib-1.2.7-1.7.noarch.rpm;mingw: zlib;1.2.7-1.7;c34986df8520de706f9e8516f4353af90ba78f39;${OBS_SKIP};mingw"
64 ARC_MG9
="${DOWNLOAD_HOST}mingw32-headers-20130216-1.1.noarch.rpm;mingw: headers;20130216-1.1;313bdc131e15bbca1e4332395c536f2caa9e54b0;${OBS_SKIP}/include;mingw/lib/gcc/i686-w64-mingw32/4.8.0/include"
66 ARC_MGA
="${DOWNLOAD_HOST}mingw32-libgcc-4.8.0-6.1.noarch.rpm;mingw: libgcc;4.8.0-6.1;ab599bf07bf2d56367c57b442440598358c943af;${OBS_SKIP};mingw"
71 ARC_GT1
="${DOWNLOAD_HOST}mingw32-glib2-devel-2.38.0-1.4.noarch.rpm;gtk: Glib;2.38.0-1.4;9299f85c4eb7fc84bc29d47edd9444cc2fdf3c7a;${OBS_SKIP};${GTK_DIR}"
73 ARC_GT2
="${DOWNLOAD_HOST}mingw32-gtk2-devel-2.24.14-2.7.noarch.rpm;gtk: GTK+2;2.24.14-2.7;4abd5fddf7ca2b6ee7ab35f4b549894bc146a005;${OBS_SKIP};${GTK_DIR}"
75 ARC_GT3
="${DOWNLOAD_HOST}mingw32-libintl-devel-0.18.1.1-13.6.noarch.rpm;gtk: libintl;0.18.1.1-13.6;49afd3059ecc7713debb29b801558958637114d1;${OBS_SKIP};${GTK_DIR}"
77 ARC_GT4
="${DOWNLOAD_HOST}mingw32-zlib-devel-1.2.7-1.7.noarch.rpm;gtk: zlib;1.2.7-1.7;e3fd07747fcd96bbf83d7a1a870feccc19c0e15e;${OBS_SKIP};${GTK_DIR}"
79 ARC_GT5
="${DOWNLOAD_HOST}mingw32-atk-devel-2.8.0-1.5.noarch.rpm;gtk: ATK;2.8.0-1.5;d6c54241ef3ce80b4a6722f23fe47eba88e0a9f0;${OBS_SKIP};${GTK_DIR}"
81 ARC_GT6
="${DOWNLOAD_HOST}mingw32-cairo-devel-1.10.2-8.12.noarch.rpm;gtk: Cairo;1.10.2-8.12;a9ea09988bc896226971dc544d9b499882d37ba6;${OBS_SKIP};${GTK_DIR}"
83 ARC_GT7
="${DOWNLOAD_HOST}mingw32-gdk-pixbuf-devel-2.28.0-1.2.noarch.rpm;gtk: GDK-PixBuf;2.28.0-1.2;d476228dd6e1ad43bbf0dd5d6e9e9bad394c9ec5;${OBS_SKIP};${GTK_DIR}"
85 ARC_GT8
="${DOWNLOAD_HOST}mingw32-pango-devel-1.34.0-2.3.noarch.rpm;gtk: Pango;1.34.0-2.3;c875ae60dacf05b642d7da5f289a3c58ff9b0e52;${OBS_SKIP};${GTK_DIR}"
87 ARC_GT9
="${DOWNLOAD_HOST}mingw32-glib2-2.36.1-1.1.noarch.rpm;gtk: Glib runtimes;2.36.1-1.1;ed468f064f61c5a12b716c83cba8ccbe05d22992;${OBS_SKIP};${GTK_DIR}"
89 ARC_G10
="${DOWNLOAD_HOST}mingw32-libintl-0.18.1.1-13.6.noarch.rpm;gtk: libintl;0.18.1.1-13.6;0e6fde8e86788874366f308e25634f95613e906a;${OBS_SKIP};${GTK_DIR}"
92 ARC_ENC
="${DOWNLOAD_HOST}mingw32-enchant-devel-1.6.0-3.9.noarch.rpm;Enchant;1.6.0-3.9;1daadbb4fbeb06a6ad26bed916dc2a980d971c49;${OBS_SKIP};enchant-1.6"
95 # TODO: is it really necessary?
96 ARC_INT
="${DOWNLOAD_HOST}intltool-0.50.2-4.1.1.noarch.rpm;intltool;0.50.2-4.1.1;92c42de2b8a9827b6dca65090dd4b0e293397689;usr;intltool-0.50"
99 ARC_MWH
="${DOWNLOAD_HOST}mingw32-meanwhile-devel-1.0.2-3.2.noarch.rpm;meanwhile;1.0.2-3.2;2c92bbf6084cb930c923ec94c17b62b4b894c146;${OBS_SKIP};meanwhile-1.0"
101 ARC_MWHD
="${DOWNLOAD_HOST}mingw32-meanwhile-debug-1.0.2-3.2.noarch.rpm;meanwhile debug symbols;1.0.2-3.2;7e3c02178d219426eeb8f4f34147763c7ea5be85;${OBS_SKIP};meanwhile-1.0"
102 ARCHIVES
+="ARC_MWHD "
104 ARC_PRL
="${DOWNLOAD_HOST}perl-5.10.0.tar.gz;Perl;5.10.0;46496029a80cabdfa119cbd70bc14d14bfde8071;perl-5.10.0;perl-5.10"
107 ARC_SIL
="${DOWNLOAD_HOST}mingw32-silc-toolkit-devel-1.1.10-2.1.noarch.rpm;SILC Toolkit;1.1.10-2.1;cc92fc87c013a085bdd0664e8fba1acc5a2ccb18;${OBS_SKIP};silc-toolkit-1.1"
110 ARC_TCL
="${DOWNLOAD_HOST}mingw32-tcl-devel-8.5.9-14.1.noarch.rpm;Tcl;8.5.9-14.1;22a64967654629e01a2f52226c3de431a43683f8;${OBS_SKIP};tcl-8.5;include/tcl-private/generic/(tcl|tclDecls|tclPlatDecls|tclTomMath|tclTomMathDecls)\\.h"
113 ARC_TK
="${DOWNLOAD_HOST}mingw32-tk-devel-8.5.9-8.7.noarch.rpm;Tk;8.5.9-8.7;c469e5933cace0f2eed0fec9892843ca216c51ea;${OBS_SKIP};tcl-8.5;include/tk-private/generic/(tk|tkDecls|tkIntXlibDecls|tkPlatDecls)\\.h"
116 ARC_JSG
="${DOWNLOAD_HOST}mingw32-json-glib-devel-0.14.2-2.1.noarch.rpm;json-glib;0.14.2-2.1;27154ec4e4fa214b72f28658be2de7be4e0a9e3e;${OBS_SKIP};json-glib-0.14"
119 ARC_XML
="${DOWNLOAD_HOST}mingw32-libxml2-devel-2.9.0-2.1.noarch.rpm;libxml2;2.9.0-2.1;bd63823e0be2436ee7d2369aa254e7214a0dd692;${OBS_SKIP};libxml2-2.9"
122 ARC_WKG
="${DOWNLOAD_HOST}mingw32-libwebkitgtk-devel-1.10.2-9.2.noarch.rpm;WebKitGTK+;1.10.2-9.2;02cd5de75e3b4269bc1a31320e95f455d5804be9;${OBS_SKIP};libwebkitgtk-1.10"
125 ARC_SOU
="${DOWNLOAD_HOST}mingw32-libsoup-devel-2.42.2-1.1.noarch.rpm;libsoup;2.42.2-1.1;cb4e520f1bb17c83230f28bb225420dce54c8d80;${OBS_SKIP};libsoup-2.42"
128 ARC_GTT
="${DOWNLOAD_HOST}mingw32-gettext-runtime-0.18.1.1-13.6.noarch.rpm;gettext;0.18.1.1-13.6;e3785e932427d63bf5cf27f258d1236e49437143;${OBS_SKIP};gettext-0.18"
130 ARC_GTL
="${DOWNLOAD_HOST}mingw32-libintl-0.18.1.1-13.6.noarch.rpm;gettext: libintl;0.18.1.1-13.6;0e6fde8e86788874366f308e25634f95613e906a;${OBS_SKIP};gettext-0.18"
133 ARC_VV1
="${DOWNLOAD_HOST}mingw32-gstreamer-devel-0.10.36-10.1.noarch.rpm;gstreamer;0.10.36-10.1;a54b53b31a47dd3d4243b8e772553e0b05430aaf;${OBS_SKIP};gstreamer-0.10"
135 ARC_VV2
="${DOWNLOAD_HOST}mingw32-gst-plugins-base-devel-0.10.36-15.1.noarch.rpm;gst-plugins-base;0.10.36-15.1;5bc0d94abdce4f2f2bafceda8046f01a5b29bd71;${OBS_SKIP};gstreamer-0.10"
137 ARC_VV3
="${DOWNLOAD_HOST}mingw32-farstream-devel-0.1.2-19.1.noarch.rpm;farstream;0.1.2-19.1;6c9f29de289b661d192c88998ed5bdf17de7bcec;${OBS_SKIP};gstreamer-0.10"
140 ARC_GG
="${DOWNLOAD_HOST}mingw32-libgadu-devel-1.12.0rc1-1.5.noarch.rpm;libgadu;1.12.0rc1-1.5;b88941625625628634081cf8aa03dcdc1be63d03;${OBS_SKIP};libgadu-1.12"
146 if [ `uname -o` != "Cygwin" ]; then
148 echo "WARNING: You are on a non-Cygwin platform! Your mileage may vary."
152 function path_win32_to_cygwin
() {
153 path_ret
=`echo "$1" | $SED 's|\\\\|/|g; s|\\(.\\):|/cygdrive/\\1|; s| |\\ |g'`
156 function path_real
() {
157 if [ "$REALPATH" != "" ]; then
158 path_ret
="`${REALPATH} "$1"`"
164 function reg_get_path
() {
166 reg_key
="/proc/registry/$1"
167 if [ ! -f $reg_key ] ; then
168 reg_key
="/proc/registry64/$1"
170 if [ -f $reg_key ] ; then
171 path_win32_to_cygwin
"`cat ${reg_key}`"
172 reg_ret
="${path_ret}"
178 function reg_get_install_path
() {
180 for guid_packed
in $1 ; do
181 reg_get_path
"HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Installer/UserData/S-1-5-18/Products/${guid_packed}/InstallProperties/InstallLocation" && return 0
186 function check_path
() {
190 expected
=`${REALPATH} -e "$expected"`
191 current
=`which "${chk_cmd}" 2> /dev/null`
192 if [ "$expected" == "" ]; then
193 echo "Error while checking path"
197 if [ "$expected" != "$current" ]; then
198 dir
=`dirname "${expected}"` ||
exit 1
199 echo "Adding $dir to PATH"
201 echo "export PATH=\"$dir\":\$PATH" >> ~
/.bashrc
207 function download
() {
213 $WGET -t 3 "$1" -O "$2" -o "wget.log" --retry-connrefused --waitretry=2 --ca-certificate="$WIN32DEV_STORE/cacert.pem" || failed
=1
214 if [ $failed != 0 ]; then
215 echo "Download failed"
224 function sha1sum_calc
() {
225 sha1sum_ret
=`$SHA1SUM "$1" | $SED 's| .*||'`
228 function download_archive
() {
229 url
=`echo "$1" | $CUT -d';' -f1`
230 name
=`echo "$1" | $CUT -d';' -f2`
231 version
=`echo "$1" | $CUT -d';' -f3`
232 sha1sum_orig
=`echo "$1" | $CUT -d';' -f4`
233 file=`$BASENAME "$url"`
237 if [ ! -e "$file" ]; then
238 echo "Downloading ${name} ${version}..."
239 download
"$url" "$file"
243 sha1sum_file
="$sha1sum_ret"
245 if [ "$sha1sum_file" != "$sha1sum_orig" ]; then
246 echo "sha1sum ($sha1sum_file) for $file doesn't match expected value of $sha1sum_orig"
253 function extract_archive
() {
254 url
=`echo "$1" | $CUT -d';' -f1`
255 name
=`echo "$1" | $CUT -d';' -f2`
256 dir_skip
=`echo "$1" | $CUT -d';' -f5`
257 dir_extract
=`echo "$1" | $CUT -d';' -f6`
258 filter_output
=`echo "$1" | $CUT -d';' -f7`
259 file=`$BASENAME "$url"`
260 ext
=`echo "$file" | $SED 's|.*\.\(.*\)|\1|'`
265 if [ "${filter_output}" == "" ]; then
266 # don't match anything (only rpm)
270 if [ "$ext" == "patch" ]; then
271 echo "Applying ${name}..."
276 patch --strip=${dir_skip} --directory="${WIN32DEV_BASE}/${dir_extract}" --forward --quiet --input="$WIN32DEV_STORE/${file}" || exit 1
284 echo "Installing
${name}...
"
288 if [ "$ext" == "gz
" ] || [ "$ext" == "bz2
" ]; then
289 $TAR -xf "$file" -C "tmp
" || exit 1
290 elif [ "$ext" == "zip" ]; then
291 $UNZIP -q "$file" -d "tmp
" || exit 1
292 elif [ "$ext" == "rpm
" ]; then
294 ( ${WIN32DEV_BASE}/bsdcpio/bsdcpio.exe --quiet -di < "../${file}" 2>&1 ) | grep -v -P "${filter_output}" 1>&2
297 echo "Uknown extension: $ext"
302 dst_dir
="${WIN32DEV_BASE}/${dir_extract}"
303 src_dir
="tmp/${dir_skip}"
305 cp -rf "${src_dir}"/* "${dst_dir}"/ ||
exit 1
311 # required and optional system dependencies
312 REALPATH
=`which realpath`
313 BASENAME
=`which basename`
317 SHA1SUM
=`which sha1sum`
321 if [ "$SED" == "" ] ||
[ "$CUT" == "" ] ||
[ "$BASENAME" == "" ] ||
322 [ "$WGET" == "" ] ||
[ "$SHA1SUM" == "" ] ||
[ "$TAR" == "" ] ||
323 [ "$UNZIP" == "" ] ||
[ "$REALPATH" == "" ]; then
325 echo ERROR
: One or
more required utilities were not found. Use Cygwin
\'s setup.exe to
326 echo install all packages listed above.
332 PIDGIN_BASE
="`pwd`/../.."
333 WIN32DEV_BASE
="${PIDGIN_BASE}/../win32-dev"
334 WIN32DEV_STORE
="${PIDGIN_BASE}/../win32-dev-store"
336 if [ ! -e "${PIDGIN_BASE}/ChangeLog" ]; then
337 echo "Pidgin base directory not found"
341 if [ -e "$WIN32DEV_BASE" ] && [ $DEBUG_SKIP_INSTALL == 0 ]; then
342 echo "win32-dev directory ($(readlink -f $WIN32DEV_BASE)) exists, please remove it before proceeding"
346 mkdir
-p "$WIN32DEV_STORE" ||
exit 1
347 path_real
"$PIDGIN_BASE"
348 PIDGIN_BASE
="$path_ret"
349 path_real
"$WIN32DEV_STORE"
350 WIN32DEV_STORE
="$path_ret"
352 cat "$PIDGIN_BASE/share/ca-certs"/*.pem
> "$WIN32DEV_STORE/cacert.pem"
354 # checking for Bonjour SDK
356 # User may choose Bonjour SDK installation during the setup process and it may
357 # be read from registry using one of the following GUIDs:
358 # 5CA28B3B1DEA7654999C464610C010EB 2EA34582882FE334694F0BCD7D8DE336.
359 # Despite this fact, the SDK is installed into hardcoded directory anyway:
360 # "C:\Program Files\Bonjour SDK" (for 32bit and 64bit the path is the same).
361 if [ ! -d "$BONJOUR_SDK_DIR" ]; then
362 echo "Bonjour SDK for Windows v3.0/v2.0.4 is not installed, please do it."
363 echo "You can download this SDK from https://developer.apple.com/bonjour/"
364 echo "(Apple ID may be required)."
370 reg_get_install_path
"$ACTIVEPERL_GUID_PACKED"
371 ACTIVEPERL_DIR
=$reg_ret
373 if [ "$ACTIVEPERL_DIR" != "" ]; then
374 PERL_DIR
="$ACTIVEPERL_DIR/bin"
376 PERL_DIR
="$PERL_DIR_FALLBACK"
379 if ! ${REALPATH} -e "${PERL_DIR}/perl" &> /dev
/null
; then
380 echo "Perl not found in \"${PERL_DIR}\", please install it."
386 reg_get_path
"${NSIS_DIR_REGKEY}"
388 if [ "${NSIS_DIR}" == "" ]; then
389 echo "NSIS not found, please install it."
393 if ! ${REALPATH} -e "${NSIS_DIR}/Plugins/nsisunz.dll" &> /dev
/null
; then
394 echo "NSIS plugin \"nsisunz.dll\" not found in \"${NSIS_DIR}/Plugins\", please install it."
398 if ! ${REALPATH} -e "${NSIS_DIR}/Plugins/SHA1Plugin.dll" &> /dev
/null
; then
399 echo "NSIS plugin \"SHA1Plugin.dll\" not found in \"${NSIS_DIR}/Plugins\", please install it."
403 # downloading archives
404 if [ $DEBUG_SKIP_DOWNLOADING == 0 ]; then
405 echo "Downloading and verifying archives..."
406 for ARCHIVE
in $ARCHIVES ; do
408 download_archive
"$ARCHIVE"
412 echo "Composing workspace..."
413 if [ $DEBUG_SKIP_INSTALL == 0 ]; then
414 mkdir
"$WIN32DEV_BASE" ||
exit 1
416 path_real
"$WIN32DEV_BASE"
417 WIN32DEV_BASE
="$path_ret"
419 if [ $DEBUG_SKIP_INSTALL == 0 ]; then
420 echo "Installing Bonjour SDK..."
421 mkdir
"$WIN32DEV_BASE/bonjour-sdk"
422 cp -r "${BONJOUR_SDK_DIR}"/* "$WIN32DEV_BASE/bonjour-sdk/"
424 for ARCHIVE
in $ARCHIVES ; do
426 extract_archive
"$ARCHIVE"
430 echo "Removing bsdcpio..."
431 rm -rf "${WIN32DEV_BASE}/bsdcpio"
433 echo "Checking PATH..."
435 check_path
"gcc" "${WIN32DEV_BASE}/mingw/bin/gcc" || path_changed
=1
436 check_path
"perl" "${PERL_DIR}/perl" || path_changed
=1
437 check_path
"makensis" "${NSIS_DIR}/makensis" || path_changed
=1
438 if [ $path_changed == 1 ]; then
439 echo "PATH changed - executing sub-shell"
441 echo "This session uses outdated PATH variable - please exit"