]> Pileus Git - ~andy/aweather-pkg/blob - win/setup-mingw-3.6.sh
Update for gentoo and Gtk 3
[~andy/aweather-pkg] / win / setup-mingw-3.6.sh
1 #!/bin/bash
2
3 function extract {
4         bin=false; dev=false; ext=false;
5         eval set -- "`getopt -n "$0" -o bdx -l bin,dev,ext -- "$@"`"
6         while [ ! "$1" == "--" ]; do
7                 case "$1" in
8                         -b|--bin) bin=true ;;
9                         -d|--dev) dev=true ;;
10                         -x|--ext) ext=true ;;
11                 esac
12                 shift
13         done
14
15         zip=$2
16         sub=$(basename "${zip/.zip/}")
17         tmp=`mktemp -d`
18         $ext && unzip "$zip" -d "$tmp/$sub" \
19              || unzip "$zip" -d "$tmp"
20         $dev && rsync -a "$tmp/$sub/" "$DEV/"
21         $bin && rsync -a "$tmp/$sub/" "$BIN/"
22         rm -rf "$tmp"
23 }
24
25 # Install custom programs
26 #   grits    - DESTDIR=/usr/$MINGW make install
27 #   rsl      - DESTDIR=/usr/$MINGW make install
28 #   aweather - DESTDIR=/usr/$MINGW make install
29
30 # Download locations
31 GTK_URI='http://www.tarnyko.net/repo/GTK+-Bundle-3.6.1_(TARNYKO).exe'
32 SOUP_BIN='http://ftp.gnome.org/pub/gnome/binaries/win32/libsoup/2.26/libsoup_2.26.3-1_win32.zip'
33 SOUP_DEV='http://ftp.gnome.org/pub/gnome/binaries/win32/libsoup/2.26/libsoup-dev_2.26.3-1_win32.zip'
34 BZIP_BIN='http://downloads.sourceforge.net/project/gnuwin32/bzip2/1.0.5/bzip2-1.0.5-bin.zip'
35 BZIP_DEV='http://downloads.sourceforge.net/project/gnuwin32/bzip2/1.0.5/bzip2-1.0.5-lib.zip'
36
37 # Install locations
38 GCC="mingw32-gcc"
39 DEV="/usr/mingw32"
40 CLEAN="/usr/mingw32-clean"
41 BIN="/home/andy/src/aweather-win32/local/gtk-3.6.1"
42 EXT="/home/andy/src/aweather-win32/local/packages"
43 GTK="/home/andy/.wine/drive_c/Program Files (x86)/GTK+-Bundle-3.6.1"
44
45 # Create download dir, if needed
46 mkdir -p $EXT
47
48 # Download packages
49 wget -O "$EXT/$(basename  $GTK_URI)" "$GTK_URI"
50 wget -O "$EXT/$(basename $SOUP_BIN)" "$SOUP_BIN"
51 wget -O "$EXT/$(basename $SOUP_DEV)" "$SOUP_DEV"
52 wget -O "$EXT/$(basename $BZIP_BIN)" "$BZIP_BIN"
53 wget -O "$EXT/$(basename $BZIP_DEV)" "$BZIP_DEV"
54
55 # Install GTK Bundle
56 wine extern/gtk-3.6.1-dev.exe
57
58 # Setup dev folder
59 rsync -a --delete "$CLEAN/" "$DEV/"
60 rsync -a          "$GTK/"   "$DEV/"
61 rsync -a --delete "$GTK/"   "$BIN/"
62
63 # Extract packages
64 extract -bdx "$EXT/$(basename $SOUP_BIN)"
65 extract -dx  "$EXT/$(basename $SOUP_DEV)"
66 extract -bdx "$EXT/$(basename $BZIP_BIN)"
67 extract -dx  "$EXT/$(basename $BZIP_DEV)"
68
69 # Cleanup install folders
70 rm  -f $DEV/lib/*.la
71 rm -rf $BIN/{contrib,include,man,manifest,*.exe}
72 rm -rf $BIN/share/{aclocal,bash,doc,gdb,glib,gtk,info,locale,man}*
73 rm  -f $BIN/lib/GNU.Gettext.dll
74 find "$BIN/bin/" "$BIN/lib/" -type f \
75         -and -not -name '*.dll'      \
76         -and -not -name '*.cache'    \
77         -and -not -name 'gspawn-*'   \
78         -delete
79 find "$BIN/bin/" "$BIN/lib/" -type f \
80         -and -not -name 'libxml*dll' \
81         -and -not -name 'iconv.dll'  \
82         -exec strip -s "{}" ";"
83 find "$BIN" -type d -delete 2>/dev/null
84
85 # Working xdg-open
86 $GCC -Wall -mwindows -o $BIN/bin/xdg-open.exe xdg-open.c
87
88 # Custom settings
89 mkdir -p $BIN/etc/{gtk-3.0,pango}
90 cp gtkrc3        $BIN/etc/gtk-3.0/gtkrc
91 cp pango.aliases $BIN/etc/pango/pango.aliases
92
93 # Fix pkg-config
94 sed -i "s!^prefix=.*!prefix=$DEV!" $DEV/lib/pkgconfig/*.pc