]> Pileus Git - ~andy/aweather-pkg/blob - win/setup-mingw-2.24.sh
Update OS X build
[~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 locations
26 MINGW=i486-mingw32
27 DEV=/usr/$MINGW/usr
28 BIN=/scratch/aweather-win32/local/gtk/gtk-2.24
29 EXT=/home/andy/b/scratch/aweather/local/extern
30
31 # Copy clean folder
32 rsync -a /usr/$MINGW-clean/ "$DEV/"
33
34 # Extract packages
35 extract -bdx $EXT/gtk+-bundle_2.24.8-20111122_win32.zip
36 extract -bd  $EXT/iconv-1.9.2.win32.zip
37 extract -bd  $EXT/libxml2-2.7.6.win32.zip
38 extract -bx  $EXT/libsoup_2.26.3-1_win32.zip
39 extract -dx  $EXT/libsoup-dev_2.26.3-1_win32.zip
40 extract -bx  $EXT/bzip2-1.0.5-bin.zip
41 extract -dx  $EXT/bzip2-1.0.5-lib.zip
42 extract -dx  $EXT/freeglut-MinGW-2.8.0-1.mp.zip
43
44 # Cleanup install folders
45 rm  -f $DEV/lib/*.la
46 rm -rf $BIN/{contrib,include,man,manifest,src,*.txt}
47 rm -rf $BIN/share/{aclocal,glib,gtk,locale,man,doc}*
48 rm  -f $BIN/lib/GNU.Gettext.dll
49 rm -rf $BIN/etc/bash_completion.d
50 find "$BIN/bin/" "$BIN/lib/" -type f \
51         -and -not -name '*.dll'      \
52         -and -not -name '*.cache'    \
53         -and -not -name 'gspawn-*'   \
54         -delete
55 find "$BIN/bin/" "$BIN/lib/" -type f \
56         -and -not -name 'libxml*dll' \
57         -and -not -name 'iconv.dll'  \
58         -exec strip -s "{}" ";"
59 find "$BIN" -type d -delete 2>/dev/null
60
61 # Fix broken packages
62 cp /usr/lib/pkgconfig/libxml-2.0.pc $DEV/lib/pkgconfig
63 rename libxml2.dll libxml2-2.dll {$DEV,$BIN}/bin/*
64
65 $MINGW-gcc -Wall -mwindows -o $BIN/bin/xdg-open.exe xdg-open.c
66 cp gtkrc $BIN/etc/gtk-2.0/gtkrc
67 cp pango.aliases $BIN/etc/pango/pango.aliases
68
69 # Fix pkg-config
70 sed -i 's!^prefix=.*!prefix=/usr/'$MINGW'/usr!' \
71         $DEV/lib/pkgconfig/*.pc
72
73 # Install custom programs
74 #   grits    - DESTDIR=/usr/$MINGW make install
75 #   rsl      - DESTDIR=/usr/$MINGW make install
76 #   aweather - DESTDIR=/usr/$MINGW make install