summary refs log tree commit diff
path: root/pkgs/development/compilers/gcc/4.4/update-gcc.sh
blob: 03297fbadd64f01117660f4d0d3f5d740fa64795 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh

if [ $# -ne 1 ]
then
    echo "Usage: $(basename $0) VERSION"
    echo
    echo "Download and GPG-check component tarballs for GCC VERSION."
    exit 1
fi

version="$1"

set -e

out="sources.nix"

declare -A options

options["core"]="/* langC */ true"
options["g++"]="langCC"
options["fortran"]="langFortran"
options["java"]="langJava"
options["ada"]="langAda"
#options["go"]="langGo"

cat > "$out"<<EOF
/* Automatically generated by \`$(basename $0)', do not edit.
   For GCC ${version}.  */
{ fetchurl, optional, version, langC, langCC, langFortran, langJava, langAda,
  langGo }:

assert version == "${version}";
EOF

for component in core g++ fortran java ada #go
do
    dir="ftp.gnu.org/gnu/gcc/gcc-${version}"
    file="gcc-${component}-${version}.tar.bz2"
    url="${dir}/${file}"

    rm -f "${file}"

    wget "$url"
    hash="$(nix-hash --flat --type sha256 "$file")"
    path="$(nix-store --add-fixed sha256 "$file")"

    rm -f "${file}" "${file}.sig"
    wget "${url}.sig"
    gpg --verify "${file}.sig" "${path}" || gpg2 --verify "${file}.sig" "${path}"
    rm "${file}.sig"

    cat >> "$out" <<EOF
optional ${options[$component]} (fetchurl {
  url = "mirror://gcc/releases/gcc-\${version}/gcc-${component}-\${version}.tar.bz2";
  sha256 = "${hash}";
}) ++
EOF
done

cat >> "$out" <<EOF
[]
EOF

echo "result stored in \`$out'"