Snippets

Mike Ruprecht Pidgin for Windows Bootstrap Script

Created by Mike Ruprecht
#!/bin/bash
# Copyright (C) 2016 Pidgin Developers <devel@pidgin.im>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA

# Thanks to Gary Kramlich <grim@reaperworld.com> for the GPG validation bits

set -e

WIN_DEV_DIR=${WIN_DEV_DIR:-$PWD}
CACHE_DIR=${CACHE_DIR:-$WIN_DEV_DIR/cache}
#i686 or x86_64
ARCH=${ARCH:-i686}

BASE_REPO="http://repo.msys2.org/mingw/"
REPO="${BASE_REPO}/${ARCH}/"
FILEPREFIX="mingw-w64-${ARCH}-"
FILESUFFIX="-any.pkg.tar.xz"

if [ "x$ARCH" == "xx86_64" ]; then
	PKG_DIR="mingw64/"
	GPLUGIN_FILE="https://pidgin.atlassian.net/builds/browse/GPLUG-GPLUG2-10/artifact/shared/mingw64/gplugin.tar.xz"
	GPLUGIN_SUM="1774654f6ddfb8b80db6dbe7e2fcdeb2"
else
	PKG_DIR="mingw32/"
	GPLUGIN_FILE="https://pidgin.atlassian.net/builds/browse/GPLUG-GPLUG2-10/artifact/shared/mingw32/gplugin.tar.xz"
	GPLUGIN_SUM="996f7410cefbc0edd5c53b97e0b13c9a"
fi

# Build dependencies
FILES="atk-2.18.0-1 \
	bzip2-1.0.6-5 \
	cairo-1.14.4-1 \
	expat-2.1.0-6 \
	fontconfig-2.12.0-2 \
	freetype-2.6.2-1 \
	gdk-pixbuf2-2.32.1-4 \
	gettext-0.19.6-2 \
	glib2-2.46.2-3 \
	gtk3-3.20.9-2 \
	gstreamer-1.6.1-1 \
	gst-plugins-base-1.6.1-1 \
	harfbuzz-1.0.6-2 \
	json-glib-1.0.4-3 \
	libepoxy-1.2-2 \
	libgadu-1.12.1-1 \
	libiconv-1.14-5 \
	libidn-1.32-3 \
	libpng-1.6.20-1 \
	libsoup-2.52.2-1 \
	libxml2-2.9.2-6 \
	meanwhile-1.0.2-3 \
	pango-1.38.1-1 \
	pixman-0.32.6-3 \
	webkitgtk3-2.4.10-1 \
	zlib-1.2.8-8 \
	gnutls-3.4.8-1 \
	libtasn1-4.8-1 \
	nettle-3.1.1-3 \
	p11-kit-0.23.2-2"

# Runtime dependencies
FILES+="\
	adwaita-icon-theme-3.20-1 \
	ca-certificates-20150426-2 \
	dbus-1.10.8-1 \
	dbus-glib-0.104-1 \
	enchant-1.6.0-8 \
	gcc-libs-6.1.0-1 \
	geoclue-0.12.99-3 \
	glib-networking-2.46.1-1 \
	gmp-6.0.0-3 \
	gst-plugins-good-1.6.1-1 \
	hunspell-1.3.4-10 \
	icu-56.1-1 \
	libffi-3.2.1-3 \
	libjpeg-turbo-1.4.2-1 \
	libsystre-1.0.1-2 \
	libtre-git-r122.c2f5d13-4 \
	libwebp-0.5.0-1 \
	libwinpthread-git-5.0.0.4573.628fdbf-1 \
	libxslt-1.1.28-6 \
	orc-0.4.25-1 \
	protobuf-c-1.2.1-2 \
	sqlite3-3.10.2.0-1"

# Pull in Alexey Pavlov (Alexpux) <alexpux@gmail.com>'s public key
gpg --keyserver keys.gnupg.net --recv-keys A47D45A1

for pkg in ${FILES}; do
	FILE=${FILEPREFIX}${pkg}${FILESUFFIX}

	if [ ! -e "$CACHE_DIR/$FILE" ]; then
		# Download the file
		wget -nv -P"$CACHE_DIR" "${REPO}${FILE}"

		# Verify it downloaded correctly
		wget -nv -P"$CACHE_DIR" "${REPO}${FILE}.sig"
		gpg --verify "${CACHE_DIR}/${FILE}.sig" "${CACHE_DIR}/${FILE}"
	else
		echo "'${CACHE_DIR}/${FILE}' already exists"
	fi

	echo "Extracting ${FILE} to ${WIN_DEV_DIR}"

	# Extract only the contents of $PKG_DIR into $WIN_DEV_DIR 
	tar xf "$CACHE_DIR/$FILE" -C $WIN_DEV_DIR $PKG_DIR --strip-components=1
done

# GPlugin is a special case for now
FILE=`basename "$GPLUGIN_FILE"`

if [ ! -e "$CACHE_DIR/$FILE" ]; then
	wget -nv -P"$CACHE_DIR" "${GPLUGIN_FILE}"
else
	echo "'$CACHE_DIR/$FILE' already exists"
fi

echo "Extracting '$CACHE_DIR/$FILE' to '${WIN_DEV_DIR}'"

# Extract only the contents of $PKG_DIR into $WIN_DEV_DIR 
tar xf "$CACHE_DIR/$FILE" -C $WIN_DEV_DIR $PKG_DIR --strip-components=1

# Verify it downloaded correctly
echo "$GPLUGIN_SUM $CACHE_DIR/$FILE" | md5sum -c -

Comments (0)