]> Pileus Git - ~andy/aweather-pkg/blob - win/setup-mingw-2.24.sh
Misc win32 updates, add suse builds
[~andy/aweather-pkg] / win / setup-mingw-2.24.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 GTK2_URI='http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip'
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 ICNV_URI='http://www.xmlsoft.org/sources/win32/iconv-1.9.2.win32.zip'
37 XML2_URI='http://www.xmlsoft.org/sources/win32/libxml2-2.7.8.win32.zip'
38 GLUT_URI='http://files.transmissionzero.co.uk/software/development/GLUT/freeglut-MinGW-2.8.0-1.mp.zip'
39
40 # Install locations
41 GCC="mingw32-gcc"
42 CLEAN="/usr/mingw32-clean"
43 PKGS="/home/andy/src/aweather-win32/local/packages"
44 DEV="/usr/mingw32-2.24"
45 BIN="/home/andy/src/aweather-win32/local/gtk-2.24"
46
47 # Create download dir, if needed
48 mkdir -p $PKGS
49
50 # Download packages
51 wget -O "$PKGS/$(basename $GTK2_URI)" "$GTK2_URI"
52 wget -O "$PKGS/$(basename $SOUP_BIN)" "$SOUP_BIN"
53 wget -O "$PKGS/$(basename $SOUP_DEV)" "$SOUP_DEV"
54 wget -O "$PKGS/$(basename $BZIP_BIN)" "$BZIP_BIN"
55 wget -O "$PKGS/$(basename $BZIP_DEV)" "$BZIP_DEV"
56 wget -O "$PKGS/$(basename $ICNV_URI)" "$ICNV_URI"
57 wget -O "$PKGS/$(basename $XML2_URI)" "$XML2_URI"
58 wget -O "$PKGS/$(basename $GLUT_URI)" "$GLUT_URI"
59
60 # Setup dev folder
61 rsync -a --delete "$CLEAN/" "$DEV/"
62
63 # Extract packages
64 extract -bdx "$PKGS/$(basename $GTK2_URI)"
65 extract -bdx "$PKGS/$(basename $SOUP_BIN)"
66 extract -dx  "$PKGS/$(basename $SOUP_DEV)"
67 extract -bdx "$PKGS/$(basename $BZIP_BIN)"
68 extract -dx  "$PKGS/$(basename $BZIP_DEV)"
69 extract -bd  "$PKGS/$(basename $ICNV_URI)"
70 extract -bd  "$PKGS/$(basename $XML2_URI)"
71 extract -dx  "$PKGS/$(basename $GLUT_URI)"
72
73 # Cleanup install folders
74 rm  -f $DEV/lib/*.la
75 rm -rf $BIN/{contrib,include,man,manifest,src,*.txt}
76 rm -rf $BIN/share/{aclocal,glib,gtk,locale,man,doc}*
77 rm  -f $BIN/lib/GNU.Gettext.dll
78 rm -rf $BIN/etc/bash_completion.d
79 find "$BIN/bin/" "$BIN/lib/" -type f \
80         -and -not -name '*.dll'      \
81         -and -not -name '*.cache'    \
82         -and -not -name 'gspawn-*'   \
83         -delete
84 find "$BIN/bin/" "$BIN/lib/" -type f \
85         -and -not -name 'libxml*dll' \
86         -and -not -name 'iconv.dll'  \
87         -exec strip -s "{}" ";"
88 find "$BIN" -type d -delete 2>/dev/null
89
90 # Working xdg-open
91 $GCC -Wall -mwindows -o $BIN/bin/xdg-open.exe xdg-open.c
92
93 # Fix broken packages
94 cp /usr/lib/pkgconfig/libxml-2.0.pc $DEV/lib/pkgconfig
95 rename libxml2.dll libxml2-2.dll {$DEV,$BIN}/bin/*
96
97 # Custom settings
98 mkdir -p $BIN/etc/{gtk-2.0,pango}
99 cp gtkrc2        $BIN/etc/gtk-2.0/gtkrc
100 cp pango.aliases $BIN/etc/pango/pango.aliases
101
102 # Fix pkg-config
103 sed -i "s!^prefix=.*!prefix=$DEV!" $DEV/lib/pkgconfig/*.pc