}
# Install locations
-DEV=/usr/i686-pc-mingw32-2.24
+MINGW=i486-mingw32
+DEV=/usr/$MINGW/usr
BIN=/scratch/aweather-win32/local/gtk/gtk-2.24
+EXT=/home/andy/b/scratch/aweather/local/extern
# Copy clean folder
-rsync -a /usr/i686-pc-mingw32-clean/ "$DEV/"
+rsync -a /usr/$MINGW-clean/ "$DEV/"
# Extract packages
-extract -bdx /scratch/aweather/local/extern/gtk+-bundle_2.24.8-20111122_win32.zip
-extract -bd /scratch/aweather/local/extern/iconv-1.9.2.win32.zip
-extract -bd /scratch/aweather/local/extern/libxml2-2.7.6.win32.zip
-extract -bx /scratch/aweather/local/extern/libsoup_2.26.3-1_win32.zip
-extract -dx /scratch/aweather/local/extern/libsoup-dev_2.26.3-1_win32.zip
-extract -bx /scratch/aweather/local/extern/bzip2-1.0.5-bin.zip
-extract -dx /scratch/aweather/local/extern/bzip2-1.0.5-lib.zip
-#extract -dx /scratch/aweather/local/extern/freeglut-MinGW-2.8.0-1.mp.zip
+extract -bdx $EXT/gtk+-bundle_2.24.8-20111122_win32.zip
+extract -bd $EXT/iconv-1.9.2.win32.zip
+extract -bd $EXT/libxml2-2.7.6.win32.zip
+extract -bx $EXT/libsoup_2.26.3-1_win32.zip
+extract -dx $EXT/libsoup-dev_2.26.3-1_win32.zip
+extract -bx $EXT/bzip2-1.0.5-bin.zip
+extract -dx $EXT/bzip2-1.0.5-lib.zip
+extract -dx $EXT/freeglut-MinGW-2.8.0-1.mp.zip
# Cleanup install folders
rm -f $DEV/lib/*.la
cp /usr/lib/pkgconfig/libxml-2.0.pc $DEV/lib/pkgconfig
rename libxml2.dll libxml2-2.dll {$DEV,$BIN}/bin/*
-i686-pc-mingw32-gcc -Wall -mwindows -o $BIN/bin/xdg-open.exe xdg-open.c
+$MINGW-gcc -Wall -mwindows -o $BIN/bin/xdg-open.exe xdg-open.c
cp gtkrc $BIN/etc/gtk-2.0/gtkrc
cp pango.aliases $BIN/etc/pango/pango.aliases
# Fix pkg-config
-sed -i 's!^prefix=.*!prefix=/usr/i686-pc-mingw32!' \
+sed -i 's!^prefix=.*!prefix=/usr/'$MINGW'/usr!' \
$DEV/lib/pkgconfig/*.pc
# Install custom programs
-# grits - DESTDIR=/usr/i686-pc-mingw32 make install
-# rsl - DESTDIR=/usr/i686-pc-mingw32 make install
-# aweather - DESTDIR=/usr/i686-pc-mingw32 make install
+# grits - DESTDIR=/usr/$MINGW make install
+# rsl - DESTDIR=/usr/$MINGW make install
+# aweather - DESTDIR=/usr/$MINGW make install
--- /dev/null
+#!/bin/bash
+
+function extract {
+ bin=false; dev=false; ext=false;
+ eval set -- "`getopt -n "$0" -o bdx -l bin,dev,ext -- "$@"`"
+ while [ ! "$1" == "--" ]; do
+ case "$1" in
+ -b|--bin) bin=true ;;
+ -d|--dev) dev=true ;;
+ -x|--ext) ext=true ;;
+ esac
+ shift
+ done
+
+ zip=$2
+ sub=$(basename "${zip/.zip/}")
+ tmp=`mktemp -d`
+ $ext && unzip "$zip" -d "$tmp/$sub" \
+ || unzip "$zip" -d "$tmp"
+ $dev && rsync -a "$tmp/$sub/" "$DEV/"
+ $bin && rsync -a "$tmp/$sub/" "$BIN/"
+ rm -rf "$tmp"
+}
+
+# Install custom programs
+# grits - DESTDIR=/usr/$MINGW make install
+# rsl - DESTDIR=/usr/$MINGW make install
+# aweather - DESTDIR=/usr/$MINGW make install
+
+# Download locations
+GTK_URI='http://www.tarnyko.net/repo/GTK+-Bundle-3.6.1_(TARNYKO).exe'
+SOUP_BIN='http://ftp.gnome.org/pub/gnome/binaries/win32/libsoup/2.26/libsoup_2.26.3-1_win32.zip'
+SOUP_DEV='http://ftp.gnome.org/pub/gnome/binaries/win32/libsoup/2.26/libsoup-dev_2.26.3-1_win32.zip'
+BZIP_BIN='http://downloads.sourceforge.net/project/gnuwin32/bzip2/1.0.5/bzip2-1.0.5-bin.zip'
+BZIP_DEV='http://downloads.sourceforge.net/project/gnuwin32/bzip2/1.0.5/bzip2-1.0.5-lib.zip'
+
+# Install locations
+GCC="mingw32-gcc"
+DEV="/usr/mingw32"
+CLEAN="/usr/mingw32-clean"
+BIN="/home/andy/src/aweather-win32/local/gtk-3.6.1"
+EXT="/home/andy/src/aweather-win32/local/packages"
+GTK="/home/andy/.wine/drive_c/Program Files (x86)/GTK+-Bundle-3.6.1"
+
+# Create download dir, if needed
+mkdir -p $EXT
+
+# Download packages
+wget -O "$EXT/$(basename $GTK_URI)" "$GTK_URI"
+wget -O "$EXT/$(basename $SOUP_BIN)" "$SOUP_BIN"
+wget -O "$EXT/$(basename $SOUP_DEV)" "$SOUP_DEV"
+wget -O "$EXT/$(basename $BZIP_BIN)" "$BZIP_BIN"
+wget -O "$EXT/$(basename $BZIP_DEV)" "$BZIP_DEV"
+
+# Install GTK Bundle
+wine extern/gtk-3.6.1-dev.exe
+
+# Setup dev folder
+rsync -a --delete "$CLEAN/" "$DEV/"
+rsync -a "$GTK/" "$DEV/"
+rsync -a --delete "$GTK/" "$BIN/"
+
+# Extract packages
+extract -bdx "$EXT/$(basename $SOUP_BIN)"
+extract -dx "$EXT/$(basename $SOUP_DEV)"
+extract -bdx "$EXT/$(basename $BZIP_BIN)"
+extract -dx "$EXT/$(basename $BZIP_DEV)"
+
+# Cleanup install folders
+rm -f $DEV/lib/*.la
+rm -rf $BIN/{contrib,include,man,manifest,*.exe}
+rm -rf $BIN/share/{aclocal,bash,doc,gdb,glib,gtk,info,locale,man}*
+rm -f $BIN/lib/GNU.Gettext.dll
+find "$BIN/bin/" "$BIN/lib/" -type f \
+ -and -not -name '*.dll' \
+ -and -not -name '*.cache' \
+ -and -not -name 'gspawn-*' \
+ -delete
+find "$BIN/bin/" "$BIN/lib/" -type f \
+ -and -not -name 'libxml*dll' \
+ -and -not -name 'iconv.dll' \
+ -exec strip -s "{}" ";"
+find "$BIN" -type d -delete 2>/dev/null
+
+# Working xdg-open
+$GCC -Wall -mwindows -o $BIN/bin/xdg-open.exe xdg-open.c
+
+# Custom settings
+mkdir -p $BIN/etc/{gtk-3.0,pango}
+cp gtkrc3 $BIN/etc/gtk-3.0/gtkrc
+cp pango.aliases $BIN/etc/pango/pango.aliases
+
+# Fix pkg-config
+sed -i "s!^prefix=.*!prefix=$DEV!" $DEV/lib/pkgconfig/*.pc