xref: /minix/external/lgpl3/mpfr/fetch.sh (revision 84d9c625)
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*84d9c625SLionel SambucURL="http://www.minix3.org/distfiles-minix/mpfr-3.1.2.tar.bz2"
9*84d9c625SLionel SambucBACKUP_URL="http://www.mpfr.org/mpfr-3.1.2/mpfr-3.1.2.tar.bz2"
103f40eb35SThomas VeermanFETCH=wget
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
19*84d9c625SLionel 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
26*84d9c625SLionel Sambuc	tar -oxjf mpfr-3.1.2.tar.bz2
27*84d9c625SLionel Sambuc	mv mpfr-3.1.2 dist && \
28d19d7d58SLionel Sambuc	cd dist && \
29d19d7d58SLionel Sambuc	cat ../patches/* |patch -p1
30e3209ae7SThomas Veermanfi
31e3209ae7SThomas Veerman
32