3
# Copyright (C) 2010-2011 Peter de Ridder <peter@xfce.org>
5
# This library is free software; you can redistribute it and/or
6
# modify it under the terms of the GNU Lesser General Public
7
# License as published by the Free Software Foundation; either
8
# version 2.1 of the License, or (at your option) any later version.
10
# See the file COPYING for the full license text.
13
REPO_URL=http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_11.2
15
DOWNLOAD_PATH=~/dev/mingw/packages/opensuse
16
BUILD_PATH=~/tmp/opensuse
17
INSTALL_PATH=~/dev/mingw/mingw32
19
if [[ "$1" == "update" ]]
24
# create download and build directory
25
mkdir -p $DOWNLOAD_PATH
28
rm $DOWNLOAD_PATH/repomd.xml
29
wget -nc $REPO_URL/repodata/repomd.xml -P $DOWNLOAD_PATH || exit 1
30
OTHER_FILE=`xmlgrep -c -f $DOWNLOAD_PATH/repomd.xml repomd.data:type=other.location | sed 's/.*href="\([^"]*\)".*/\1/'`
32
wget -nc $REPO_URL/$OTHER_FILE -O $DOWNLOAD_PATH/other.xml.gz || exit 1
33
rm $DOWNLOAD_PATH/other.xml
34
#gunzip -N $DOWNLOAD_PATH/`basename $OTHER_FILE`
35
gunzip -N $DOWNLOAD_PATH/other.xml
38
touch packages.version
40
# downlaod all packages
43
VERSION=`xmlgrep -c -f $DOWNLOAD_PATH/other.xml otherdata.package:name="$line":arch="$REPO_ARCH" | awk -F\< '{print $2}' |sed -e 'h' -e 's/^.*ver="\([^"]*\)".*$/\1/p' -e 'g' -e 's/^.*rel="\([^"]*\)".*$/\1/' | sed -e N -e 's/\n/-/' | sort -V -r | head -n 1`
44
FILE=$line-$VERSION.$REPO_ARCH.rpm
45
test "$UPDATE" == yes || echo $FILE >> packages.version
46
if [ ! -f $DOWNLOAD_PATH/$FILE ]
48
test "$UPDATE" == yes && echo $FILE >> packages.version
49
wget -nc $REPO_URL/$REPO_ARCH/$FILE -P $DOWNLOAD_PATH
53
# convert and install packages
58
rpm2cpio $DOWNLOAD_PATH/$line | cpio -i -d
59
# convert pkgconfig files
60
if [ -d $BUILD_PATH/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig ]
62
sed -i -e 's@^prefix=.*@prefix='$INSTALL_PATH'@' -e 's@/usr/i686-pc-mingw32/sys-root/mingw@${prefix}@' $BUILD_PATH/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig/*.pc
65
cp -rf $BUILD_PATH/usr/i686-pc-mingw32/sys-root/mingw/* $INSTALL_PATH/
66
# remove the extracted file
67
rm -rf $BUILD_PATH/usr
69
done < packages.version
71
# remove build directory