xref: /minix/external/lgpl3/mpfr/fetch.sh (revision 0a6a1f1d)
1e3209ae7SThomas Veerman#!/bin/sh
2e3209ae7SThomas Veerman
3e3209ae7SThomas Veerman# Make sure we're in our directory (i.e., where this shell script is)
4e3209ae7SThomas Veermanecho $0
5e3209ae7SThomas Veermancd `dirname $0`
63f40eb35SThomas Veerman
73f40eb35SThomas Veerman# Configure fetch method
8*0a6a1f1dSLionel SambucURL="http://www.minix3.org/pkgsrc/distfiles/minix/3.4.0/mpfr-3.1.2.tar.bz2"
984d9c625SLionel SambucBACKUP_URL="http://www.mpfr.org/mpfr-3.1.2/mpfr-3.1.2.tar.bz2"
1029b8e5ffSLionel SambucFETCH=ftp
113f40eb35SThomas Veermanwhich curl >/dev/null
123f40eb35SThomas Veermanif [ $? -eq 0 ]; then
133f40eb35SThomas Veerman	FETCH="curl -O -f"
143f40eb35SThomas Veermanfi
15e3209ae7SThomas Veerman
16e3209ae7SThomas Veerman# Fetch sources if not available
17e3209ae7SThomas Veermanif [ ! -d dist ];
18e3209ae7SThomas Veermanthen
1984d9c625SLionel Sambuc        if [ ! -f mpfr-3.1.2.tar.bz2 ]; then
203f40eb35SThomas Veerman		$FETCH $URL
213f40eb35SThomas Veerman		if [ $? -ne 0 ]; then
223f40eb35SThomas Veerman			$FETCH $BACKUP_URL
23e3209ae7SThomas Veerman		fi
24e3209ae7SThomas Veerman	fi
25e3209ae7SThomas Veerman
2684d9c625SLionel Sambuc	tar -oxjf mpfr-3.1.2.tar.bz2
2784d9c625SLionel Sambuc	mv mpfr-3.1.2 dist && \
28d19d7d58SLionel Sambuc	cd dist && \
29d19d7d58SLionel Sambuc	cat ../patches/* |patch -p1
30e3209ae7SThomas Veermanfi
31e3209ae7SThomas Veerman
32