xref: /minix/external/gpl3/binutils/fetch.sh (revision 7f5f010b)
1#!/bin/sh
2
3# Make sure we're in our directory (i.e., where this shell script is)
4echo $0
5cd `dirname $0`
6
7# Configure fetch method
8URL="http://www.minix3.org/pkgsrc/distfiles/minix/3.3.0/binutils-2.23.2.tar.bz2"
9BACKUP_URL="http://ftp.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2"
10FETCH=ftp
11which curl >/dev/null
12if [ $? -eq 0 ]; then
13	FETCH="curl -O -f"
14fi
15
16# Fetch sources if not available
17if [ ! -d dist ];
18then
19	if [ ! -f binutils-2.23.2.tar.bz2 ]; then
20		$FETCH $URL
21		if [ $? -ne 0 ]; then
22			$FETCH $BACKUP_URL
23		fi
24	fi
25
26	tar -oxjf binutils-2.23.2.tar.bz2 && \
27	mv binutils-2.23.2 dist && \
28	cd dist && \
29	cat ../patches/* | patch -p1 && \
30	cp ../files/yyscript.h gold && \
31	cp ../files/yyscript.c gold && \
32	rm -f ld/configdoc.texi
33fi
34
35