Admin/java/build
author blanchet
Mon, 19 May 2014 23:43:53 +0200
changeset 57005 33f3d2ea803d
parent 56607 ab7c656215f2
child 57392 f7a604a2fa63
permissions -rwxr-xr-x
store all MaSh data on the Isabelle side, in preparation for replacing 'mash.py' with ML solution
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
     2
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
     3
## diagnostics
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
     4
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
     5
function fail()
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
     6
{
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
     7
  echo "$1" >&2
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
     8
  exit 2
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
     9
}
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    10
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    11
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    12
## parameters
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    13
56607
ab7c656215f2 updated to jdk-8u5;
wenzelm
parents: 53913
diff changeset
    14
VERSION="8u5"
ab7c656215f2 updated to jdk-8u5;
wenzelm
parents: 53913
diff changeset
    15
FULL_VERSION="1.8.0_05"
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    16
50890
097e38daa03a updated to jdk-7u11;
wenzelm
parents: 50863
diff changeset
    17
ARCHIVE_LINUX32="jdk-${VERSION}-linux-i586.tar.gz"
097e38daa03a updated to jdk-7u11;
wenzelm
parents: 50863
diff changeset
    18
ARCHIVE_LINUX64="jdk-${VERSION}-linux-x64.tar.gz"
097e38daa03a updated to jdk-7u11;
wenzelm
parents: 50863
diff changeset
    19
ARCHIVE_DARWIN="jdk${FULL_VERSION}.jdk.tar.gz"
097e38daa03a updated to jdk-7u11;
wenzelm
parents: 50863
diff changeset
    20
ARCHIVE_WINDOWS="jdk${FULL_VERSION}.tar.gz"
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    21
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    22
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    23
## main
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    24
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    25
DIR="jdk-${VERSION}"
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    26
mkdir "$DIR" || fail "Cannot create fresh directory: \"$DIR\""
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    27
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    28
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    29
# README
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    30
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    31
cat >> "$DIR/README" << EOF
50294
dceb1daa185c updated to jdk-7u9;
wenzelm
parents: 48825
diff changeset
    32
This is JDK $FULL_VERSION as required for Isabelle.
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    33
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    34
See http://www.oracle.com/technetwork/java/javase/downloads/index.html
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    35
for the original downloads, which are covered by the Oracle Binary
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    36
Code License Agreement for Java SE.
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    37
50294
dceb1daa185c updated to jdk-7u9;
wenzelm
parents: 48825
diff changeset
    38
Linux, Mac OS X, Windows work uniformly, depending on certain
dceb1daa185c updated to jdk-7u9;
wenzelm
parents: 48825
diff changeset
    39
platform-specific subdirectories.
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    40
EOF
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    41
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    42
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    43
# settings
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    44
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    45
mkdir "$DIR/etc"
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    46
cat >> "$DIR/etc/settings" << EOF
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    47
# -*- shell-script -*- :mode=shellscript:
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    48
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    49
case "\${ISABELLE_PLATFORM64:-\$ISABELLE_PLATFORM32}" in
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    50
  x86-darwin)
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    51
    echo "### Java 1.7 unavailable on 32bit Macintosh!" >&2
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    52
    ;;
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    53
  x86_64-darwin)
53417
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    54
    ISABELLE_JDK_HOME="\$COMPONENT/\$ISABELLE_PLATFORM64/Contents/Home"
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    55
    ;;
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    56
  *)
53417
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    57
    ISABELLE_JDK_HOME="\$COMPONENT/\${ISABELLE_PLATFORM64:-\$ISABELLE_PLATFORM32}"
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    58
    ;;
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    59
esac
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    60
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    61
if [ -n "\$ISABELLE_JDK_HOME" ]; then
50294
dceb1daa185c updated to jdk-7u9;
wenzelm
parents: 48825
diff changeset
    62
  if [ -d "\$ISABELLE_JDK_HOME" ]; then
dceb1daa185c updated to jdk-7u9;
wenzelm
parents: 48825
diff changeset
    63
    ISABELLE_JAVA_EXT="\${ISABELLE_JDK_HOME}/jre/lib/ext"
dceb1daa185c updated to jdk-7u9;
wenzelm
parents: 48825
diff changeset
    64
  else
dceb1daa185c updated to jdk-7u9;
wenzelm
parents: 48825
diff changeset
    65
    echo "### Missing Java 1.7 platform directory: \"\$ISABELLE_JDK_HOME\"" >&2
dceb1daa185c updated to jdk-7u9;
wenzelm
parents: 48825
diff changeset
    66
    unset ISABELLE_JDK_HOME
dceb1daa185c updated to jdk-7u9;
wenzelm
parents: 48825
diff changeset
    67
  fi
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    68
fi
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    69
EOF
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    70
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    71
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    72
# content
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    73
53913
5ff12177a067 prefer GNU tar for Isabelle to avoid odd extended header keywords produced by Apple's bsdtar (see also 8f6046b7f850);
wenzelm
parents: 53631
diff changeset
    74
#GNU tar (notably on Mac OS X)
5ff12177a067 prefer GNU tar for Isabelle to avoid odd extended header keywords produced by Apple's bsdtar (see also 8f6046b7f850);
wenzelm
parents: 53631
diff changeset
    75
if [ -x /usr/bin/gnutar ]; then
5ff12177a067 prefer GNU tar for Isabelle to avoid odd extended header keywords produced by Apple's bsdtar (see also 8f6046b7f850);
wenzelm
parents: 53631
diff changeset
    76
  function tar() { /usr/bin/gnutar "$@"; }
5ff12177a067 prefer GNU tar for Isabelle to avoid odd extended header keywords produced by Apple's bsdtar (see also 8f6046b7f850);
wenzelm
parents: 53631
diff changeset
    77
fi
50863
8f6046b7f850 some attempts to avoid "._" files on Mac OS X;
wenzelm
parents: 50294
diff changeset
    78
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    79
mkdir "$DIR/x86-linux" "$DIR/x86_64-linux" "$DIR/x86_64-darwin" "$DIR/x86-cygwin"
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    80
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    81
tar -C "$DIR/x86-linux" -xf "$ARCHIVE_LINUX32"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    82
tar -C "$DIR/x86_64-linux" -xf "$ARCHIVE_LINUX64"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    83
tar -C "$DIR/x86_64-darwin" -xf "$ARCHIVE_DARWIN"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    84
tar -C "$DIR/x86-cygwin" -xf "$ARCHIVE_WINDOWS"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    85
53417
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    86
(
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    87
  cd "$DIR"
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    88
  for PLATFORM in x86-linux x86_64-linux x86-cygwin
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    89
  do
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    90
    mv "$PLATFORM/jdk${FULL_VERSION}"/* "$PLATFORM"/.
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    91
    rmdir "$PLATFORM/jdk${FULL_VERSION}"
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    92
  done
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    93
  PLATFORM=x86_64-darwin
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    94
  mv "$PLATFORM/jdk${FULL_VERSION}.jdk"/* "$PLATFORM"/.
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    95
  rmdir "$PLATFORM/jdk${FULL_VERSION}.jdk"
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    96
)
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
    97
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    98
chgrp -R isabelle "$DIR"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    99
chmod -R a+r "$DIR"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   100
chmod -R a+X "$DIR"
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   101
50294
dceb1daa185c updated to jdk-7u9;
wenzelm
parents: 48825
diff changeset
   102
find "$DIR/x86_64-darwin" -name "._*" -exec rm -f {} ";"
dceb1daa185c updated to jdk-7u9;
wenzelm
parents: 48825
diff changeset
   103
50890
097e38daa03a updated to jdk-7u11;
wenzelm
parents: 50863
diff changeset
   104
echo "Sharing ..."
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   105
(
53417
32ec957e5c3e updated to jdk-7u25;
wenzelm
parents: 51776
diff changeset
   106
  cd "$DIR/x86-linux"
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   107
  for FILE in $(find . -type f)
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   108
  do
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   109
    for OTHER in \
53631
e68732cd842e proper sharing after change of directory structure (cf. 32ec957e5c3e);
wenzelm
parents: 53625
diff changeset
   110
      "../x86_64-linux/$FILE" \
e68732cd842e proper sharing after change of directory structure (cf. 32ec957e5c3e);
wenzelm
parents: 53625
diff changeset
   111
      "../x86_64-darwin/Contents/Home/$FILE" \
e68732cd842e proper sharing after change of directory structure (cf. 32ec957e5c3e);
wenzelm
parents: 53625
diff changeset
   112
      "../x86-cygwin/$FILE"
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   113
    do
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   114
      if cmp -s "$FILE" "$OTHER"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   115
      then
53631
e68732cd842e proper sharing after change of directory structure (cf. 32ec957e5c3e);
wenzelm
parents: 53625
diff changeset
   116
        echo -n "."
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   117
        ln -f "$FILE" "$OTHER"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   118
      fi
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   119
    done
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   120
  done
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   121
)
53631
e68732cd842e proper sharing after change of directory structure (cf. 32ec957e5c3e);
wenzelm
parents: 53625
diff changeset
   122
echo
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   123
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   124
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   125
# create archive
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   126
50890
097e38daa03a updated to jdk-7u11;
wenzelm
parents: 50863
diff changeset
   127
echo "Archiving ..."
097e38daa03a updated to jdk-7u11;
wenzelm
parents: 50863
diff changeset
   128
tar -c -z -f "${DIR}.tar.gz" "$DIR" && echo "${DIR}.tar.gz"