about summary refs log tree commit diff
path: root/pkgs/development/libraries/qt-5/5.5/fetchsrcs.sh
blob: c958b5c9eed31d2b84c2b2407b5c8b32877fe738 (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
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils findutils gnused nix wget

set -x

MAJOR_VERSION="5.5"
VERSION="${MAJOR_VERSION}.1"
# The trailing slash at the end is necessary!
RELEASE_URLS=(
    "http://download.qt.io/official_releases/qt/$MAJOR_VERSION/$VERSION/submodules/"
    "http://download.qt.io/community_releases/$MAJOR_VERSION/$VERSION/"
)
EXTRA_WGET_ARGS='-A *.tar.xz'

mkdir tmp; cd tmp

for url in "${RELEASE_URLS[@]}"; do
    wget -nH -r -c --no-parent $url $EXTRA_WGET_ARGS
done

cat >../srcs.nix <<EOF
# DO NOT EDIT! This file is generated automatically by fetchsrcs.sh
{ fetchurl, mirror }:

{
EOF

workdir=$(pwd)

find . | sort | while read src; do
    if [[ -f "${src}" ]]; then
        url="${src:2}"
        # Sanitize file name
        filename=$(basename "$src" | tr '@' '_')
        nameversion="${filename%.tar.*}"
        name=$(echo "$nameversion" | sed -e 's,-[[:digit:]].*,,' | sed -e 's,-opensource-src$,,')
        version=$(echo "$nameversion" | sed -e 's,^\([[:alpha:]][[:alnum:]]*-\)\+,,')
        sha256=$(nix-hash --type sha256 --base32 --flat "$src")
        cat >>../srcs.nix <<EOF
  $name = {
    version = "$version";
    src = fetchurl {
      url = "\${mirror}/$url";
      sha256 = "$sha256";
      name = "$filename";
    };
  };
EOF
    fi
done

echo "}" >>../srcs.nix

cd ..