Admin/java/build
author wenzelm
Thu, 16 Aug 2012 14:05:50 +0200
changeset 48825 3a9721d4ccae
parent 47970 Admin/java/build_linux@257fc09aa8a1
child 50294 dceb1daa185c
permissions -rwxr-xr-x
support for jdk-7u6 component;
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
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    14
ARCHIVE_LINUX32="jdk-7u6-linux-i586.tar.gz"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    15
ARCHIVE_LINUX64="jdk-7u6-linux-x64.tar.gz"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    16
ARCHIVE_DARWIN="jdk1.7.0_06.jdk.tar.gz"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    17
ARCHIVE_WINDOWS="jdk1.7.0_06.tar.gz"
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    18
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    19
VERSION="7u6"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    20
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    21
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    22
## variations on version
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    23
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    24
case "$VERSION" in
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    25
  *u?)
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    26
    MAJOR="$(echo "$VERSION" | cut -du -f1)"
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    27
    MINOR="0$(echo "$VERSION" | cut -du -f2)"
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
  *u??)
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    30
    MAJOR="$(echo "$VERSION" | cut -du -f1)"
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    31
    MINOR="$(echo "$VERSION" | cut -du -f2)"
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    32
    ;;
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
    fail "Bad version identifier: \"$VERSION\""
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    35
    ;;
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    36
esac
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    37
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    38
FULL_VERSION="1.${MAJOR}.0_${MINOR}"
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    39
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    40
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    41
## main
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    42
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    43
DIR="jdk-${VERSION}"
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    44
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
    45
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    46
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    47
# README
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    48
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    49
cat >> "$DIR/README" << EOF
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    50
This is JDK $FULL_VERSION for Linux, Mac OS X, Windows.
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    51
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    52
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
    53
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
    54
Code License Agreement for Java SE.
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
Note that Java 1.7 requires 64bit hardware on Mac OS X.
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    57
EOF
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    58
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    59
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    60
# settings
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    61
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    62
mkdir "$DIR/etc"
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    63
cat >> "$DIR/etc/settings" << EOF
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    64
# -*- shell-script -*- :mode=shellscript:
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    65
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    66
case "\${ISABELLE_PLATFORM64:-\$ISABELLE_PLATFORM32}" in
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    67
  x86-darwin)
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    68
    echo "### Java 1.7 unavailable on 32bit Macintosh!" >&2
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    69
    ;;
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    70
  x86_64-darwin)
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    71
    ISABELLE_JDK_HOME="\$COMPONENT/\$ISABELLE_PLATFORM64/jdk${FULL_VERSION}.jdk/Contents/Home"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    72
    ;;
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    73
  *)
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    74
    ISABELLE_JDK_HOME="\$COMPONENT/\${ISABELLE_PLATFORM64:-\$ISABELLE_PLATFORM32}/jdk${FULL_VERSION}"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    75
    ;;
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    76
esac
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    77
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    78
if [ -n "\$ISABELLE_JDK_HOME" ]; then
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    79
  ISABELLE_JAVA_EXT="\${ISABELLE_JDK_HOME}/jre/lib/ext"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    80
fi
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    81
EOF
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    82
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    83
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    84
# content
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    85
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    86
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
    87
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    88
tar -C "$DIR/x86-linux" -xf "$ARCHIVE_LINUX32"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    89
tar -C "$DIR/x86_64-linux" -xf "$ARCHIVE_LINUX64"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    90
tar -C "$DIR/x86_64-darwin" -xf "$ARCHIVE_DARWIN"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    91
tar -C "$DIR/x86-cygwin" -xf "$ARCHIVE_WINDOWS"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    92
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    93
chgrp -R isabelle "$DIR"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    94
chmod -R a+r "$DIR"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    95
chmod -R a+X "$DIR"
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    96
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    97
(
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
    98
  cd "$DIR/x86-linux/jdk${FULL_VERSION}"
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
    99
  for FILE in $(find . -type f)
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   100
  do
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   101
    for OTHER in \
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   102
      "../../x86_64-linux/jdk${FULL_VERSION}/$FILE" \
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   103
      "../../x86_64-darwin/jdk${FULL_VERSION}.jdk/Contents/Home/$FILE" \
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   104
      "../../x86-cygwin/jdk${FULL_VERSION}/$FILE"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   105
    do
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   106
      if cmp -s "$FILE" "$OTHER"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   107
      then
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   108
        ln -f "$FILE" "$OTHER"
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   109
      fi
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   110
    done
47970
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   111
  done
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   112
)
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   113
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   114
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   115
# create archive
257fc09aa8a1 build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff changeset
   116
48825
3a9721d4ccae support for jdk-7u6 component;
wenzelm
parents: 47970
diff changeset
   117
tar -cz -f "${DIR}.tar.gz" "$DIR"