* gfortran.dg/pr70937.f90: require-effective-target lto.
[official-gcc.git] / contrib / download_prerequisites
bloba9eac67de7b58a2367eb152488964272801cdfc5
1 #! /bin/sh
2 #! -*- coding:utf-8; mode:shell-script; -*-
4 # Download some prerequisites needed by GCC.
5 # Run this from the top level of the GCC source tree and the GCC build will do
6 # the right thing. Run it with the `--help` option for more information.
8 # (C) 2010-2016 Free Software Foundation
10 # This program is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see http://www.gnu.org/licenses/.
24 program='download_prerequisites'
25 version='(unversioned)'
27 # MAINTAINERS: If you update the package versions below, please
28 # remember to also update the files `contrib/prerequisites.sha512` and
29 # `contrib/prerequisites.md5` with the new checksums.
31 gmp='gmp-6.1.0.tar.bz2'
32 mpfr='mpfr-3.1.4.tar.bz2'
33 mpc='mpc-1.0.3.tar.gz'
34 isl='isl-0.16.1.tar.bz2'
36 base_url='ftp://gcc.gnu.org/pub/gcc/infrastructure/'
38 echo_archives() {
39 echo "${gmp}"
40 echo "${mpfr}"
41 echo "${mpc}"
42 if [ ${graphite} -gt 0 ]; then echo "${isl}"; fi
45 graphite=1
46 verify=1
47 force=0
48 chksum='sha512'
49 directory='.'
51 helptext="usage: ${program} [OPTION...]
53 Downloads some prerequisites needed by GCC. Run this from the top level of the
54 GCC source tree and the GCC build will do the right thing.
56 The following options are available:
58 --directory=DIR download and unpack packages into DIR instead of '.'
59 --force download again overwriting existing packages
60 --no-force do not download existing packages again (default)
61 --isl download ISL, needed for Graphite loop optimizations (default)
62 --graphite same as --isl
63 --no-isl don't download ISL
64 --no-graphite same as --no-isl
65 --verify verify package integrity after download (default)
66 --no-verify don't verify package integrity
67 --sha512 use SHA512 checksum to verify package integrity (default)
68 --md5 use MD5 checksum to verify package integrity
69 --help show this text and exit
70 --version show version information and exit
73 versiontext="${program} ${version}
74 Copyright (C) 2016 Free Software Foundation, Inc.
75 This is free software; see the source for copying conditions. There is NO
76 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
78 die() {
79 echo "error: $@" >&2
80 exit 1
83 for arg in "$@"
85 case "${arg}" in
86 --help)
87 echo "${helptext}"
88 exit
90 --version)
91 echo "${versiontext}"
92 exit
94 esac
95 done
96 unset arg
98 argnext=
99 for arg in "$@"
101 if [ "x${argnext}" = x ]
102 then
103 case "${arg}" in
104 --directory)
105 argnext='directory'
107 --directory=*)
108 directory="${arg#--directory=}"
110 --force)
111 force=1
113 --no-force)
114 force=0
116 --isl|--graphite)
117 graphite=1
119 --no-isl|--no-graphite)
120 graphite=0
122 --verify)
123 verify=1
125 --no-verify)
126 verify=0
128 --sha512)
129 chksum='sha512'
130 verify=1
132 --md5)
133 chksum='md5'
134 verify=1
137 die "unknown option: ${arg}"
140 die "too many arguments"
142 esac
143 else
144 case "${arg}" in
146 die "Missing argument for option --${argnext}"
148 esac
149 case "${argnext}" in
150 directory)
151 directory="${arg}"
154 die "The impossible has happened"
156 esac
157 argnext=
159 done
160 [ "x${argnext}" = x ] || die "Missing argument for option --${argnext}"
161 unset arg argnext
163 [ -e ./gcc/BASE-VER ] \
164 || die "You must run this script in the top-level GCC source directory"
166 [ -d "${directory}" ] \
167 || die "No such directory: ${directory}"
169 for ar in $(echo_archives)
171 if [ ${force} -gt 0 ]; then rm -f "${directory}/${ar}"; fi
172 [ -e "${directory}/${ar}" ] \
173 || wget --no-verbose -O "${directory}/${ar}" "${base_url}${ar}" \
174 || die "Cannot download ${ar} from ${base_url}"
175 done
176 unset ar
178 if [ ${verify} -gt 0 ]
179 then
180 chksumfile="contrib/prerequisites.${chksum}"
181 [ -r "${chksumfile}" ] || die "No checksums available"
182 for ar in $(echo_archives)
184 grep "${ar}" "${chksumfile}" \
185 | ( cd "${directory}" && "${chksum}sum" --check ) \
186 || die "Cannot verify integrity of possibly corrupted file ${ar}"
187 done
188 unset chksumfile
190 unset ar
192 for ar in $(echo_archives)
194 package="${ar%.tar*}"
195 if [ ${force} -gt 0 ]; then rm -rf "${directory}/${package}"; fi
196 [ -e "${directory}/${package}" ] \
197 || ( cd "${directory}" && tar -xf "${ar}" ) \
198 || die "Cannot extract package from ${ar}"
199 unset package
200 done
201 unset ar
203 for ar in $(echo_archives)
205 target="${directory}/${ar%.tar*}/"
206 linkname="${ar%-*}"
207 if [ ${force} -gt 0 ]; then rm -f "${linkname}"; fi
208 [ -e "${linkname}" ] \
209 || ln -s "${target}" "${linkname}" \
210 || die "Cannot create symbolic link ${linkname} --> ${target}"
211 unset target linkname
212 done
213 unset ar
215 echo "All prerequisites downloaded successfully."