xref: /openbsd-src/gnu/usr.bin/gcc/contrib/download_f2c (revision 7e568061828b4c9de34171db633016903197fe19)
1*7e568061Sespie#!/bin/sh
2*7e568061Sespie#
3*7e568061Sespie# download_f2c
4*7e568061Sespie#
5*7e568061Sespie# Unpacks a directory full of f2c stuff obtained from netlib, naming
6*7e568061Sespie# the directory f2c-YYYYMMDD (YYYYMMDD being the current date),
7*7e568061Sespie# leaving it in current working directory.
8*7e568061Sespie#
9*7e568061Sespie# This shell script downloads the tarball from netlib, unpacks everything,
10*7e568061Sespie# and strips off the redundant files, leaving a bare-bones (but fully
11*7e568061Sespie# reproducible) f2c source directory.  (You must have yacc/bison to rebuild
12*7e568061Sespie# gram.c, by the way.)
13*7e568061Sespie#
14*7e568061Sespie# (C) 1999 Free Software Foundation
15*7e568061Sespie# Originally by James Craig Burley <craig@jcb-sc.com>, September 1999.
16*7e568061Sespie#
17*7e568061Sespie# This script is Free Software, and it can be copied, distributed and
18*7e568061Sespie# modified as defined in the GNU General Public License.  A copy of
19*7e568061Sespie# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
20*7e568061Sespie#
21*7e568061Sespie# FIXME: Replace WHOAMI with whatever is the canonical way to
22*7e568061Sespie# obtain the user's email address these days.
23*7e568061Sespie
24*7e568061Sespiedir=f2c-`date +%Y%m%d`
25*7e568061Sespieif [ ! -d $dir ]
26*7e568061Sespiethen
27*7e568061Sespie  mkdir $dir
28*7e568061Sespiefi
29*7e568061Sespiecd $dir
30*7e568061Sespie
31*7e568061Sespieecho Preparing $dir...
32*7e568061Sespie
33*7e568061Sespieif [ ! -d tmp ]
34*7e568061Sespiethen
35*7e568061Sespie  mkdir tmp
36*7e568061Sespiefi
37*7e568061Sespie
38*7e568061Sespieif [ ! -f tmp/f2c.tar ]
39*7e568061Sespiethen
40*7e568061Sespie  cd tmp
41*7e568061Sespie  echo Downloading f2c.tar via ftp...
42*7e568061Sespie  ftp -n netlib.bell-labs.com <<EOF
43*7e568061Sespie  user ftp WHOAMI
44*7e568061Sespie  type binary
45*7e568061Sespie  cd netlib
46*7e568061Sespie  get f2c.tar
47*7e568061Sespie  quit
48*7e568061SespieEOF
49*7e568061Sespie  cd ..
50*7e568061Sespiefi
51*7e568061Sespie
52*7e568061Sespieecho Unpacking f2c.tar...
53*7e568061Sespie
54*7e568061Sespietar xf tmp/f2c.tar
55*7e568061Sespiecd f2c
56*7e568061Sespiefind . -name "*.gz" -print | sed -e "s:^\(.*\).gz:rm -f \1.Z:g" | sh
57*7e568061Sespiemv src libf77.gz libi77.gz f2c.1t.gz f2c.h.gz changes.gz disclaimer.gz readme.gz permission.gz ..
58*7e568061Sespiecd ..
59*7e568061Sespierm -fr f2c
60*7e568061Sespiegunzip *.gz
61*7e568061Sespie(cd src; rm -f MD5 MD5.gz gram.c.gz .depend .depend.gz f2c.1.gz index.html index.html.gz; gunzip *.gz)
62*7e568061Sespiesh libf77 > /dev/null && rm libf77
63*7e568061Sespierm -f libF77/xsum0.out libF77/libF77.xsum
64*7e568061Sespiesh libi77 > /dev/null && rm libi77
65*7e568061Sespierm -f libI77/xsum0.out libI77/libI77.xsum
66*7e568061Sespierm -f src/xsum0.out
67*7e568061Sespietouch src/xsum.out
68*7e568061Sespiecmp f2c.h src/f2c.h && rm -fv src/f2c.h
69*7e568061Sespiecmp src/readme src/README && rm -fv src/readme
70*7e568061Sespie
71*7e568061Sespieecho Deleting f2c.tar...
72*7e568061Sespierm tmp/f2c.tar
73*7e568061Sespiermdir tmp
74*7e568061Sespie
75*7e568061Sespiecd ..
76*7e568061Sespie
77*7e568061Sespieecho Latest f2c now in $dir.
78