xref: /minix3/external/gpl3/binutils/fetch.sh (revision 5ef5b27fc158620d80785f43f03fc1ff30cbe16f)
118a5822eSThomas Veerman#!/bin/sh
218a5822eSThomas Veerman
318a5822eSThomas Veerman# Make sure we're in our directory (i.e., where this shell script is)
418a5822eSThomas Veermanecho $0
518a5822eSThomas Veermancd `dirname $0`
618a5822eSThomas Veerman
73f40eb35SThomas Veerman# Configure fetch method
80a6a1f1dSLionel SambucURL="http://www.minix3.org/pkgsrc/distfiles/minix/3.4.0/binutils-2.23.2.tar.bz2"
9c9ea9e7aSLionel SambucBACKUP_URL="http://ftp.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2"
1029b8e5ffSLionel SambucFETCH=ftp
113f40eb35SThomas Veermanwhich curl >/dev/null
123f40eb35SThomas Veermanif [ $? -eq 0 ]; then
133f40eb35SThomas Veerman	FETCH="curl -O -f"
143f40eb35SThomas Veermanfi
153f40eb35SThomas Veerman
1618a5822eSThomas Veerman# Fetch sources if not available
1718a5822eSThomas Veermanif [ ! -d dist ];
1818a5822eSThomas Veermanthen
19c9ea9e7aSLionel Sambuc	if [ ! -f binutils-2.23.2.tar.bz2 ]; then
203f40eb35SThomas Veerman		$FETCH $URL
213f40eb35SThomas Veerman		if [ $? -ne 0 ]; then
223f40eb35SThomas Veerman			$FETCH $BACKUP_URL
233f40eb35SThomas Veerman		fi
2418a5822eSThomas Veerman	fi
2518a5822eSThomas Veerman
26c9ea9e7aSLionel Sambuc	tar -oxjf binutils-2.23.2.tar.bz2 && \
27c9ea9e7aSLionel Sambuc	mv binutils-2.23.2 dist && \
2818a5822eSThomas Veerman	cd dist && \
29*5ef5b27fSLionel Sambuc	cat ../patches/* | patch -p1
30c9ea9e7aSLionel Sambuc	cp ../files/yyscript.h gold && \
315b851f3aSBen Gras	cp ../files/yyscript.c gold && \
325b851f3aSBen Gras	rm -f ld/configdoc.texi
3318a5822eSThomas Veermanfi
3418a5822eSThomas Veerman
35