]> Pileus Git - ~andy/aweather-pkg/blobdiff - win/setup-mingw-3.6.sh
Update for gentoo and Gtk 3
[~andy/aweather-pkg] / win / setup-mingw-3.6.sh
diff --git a/win/setup-mingw-3.6.sh b/win/setup-mingw-3.6.sh
new file mode 100755 (executable)
index 0000000..101d58c
--- /dev/null
@@ -0,0 +1,94 @@
+#!/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