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