OSDN Git Service

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