Admin/java/build
author wenzelm
Wed Oct 19 18:14:42 2016 +0200 (2016-10-19)
changeset 64313 ae7c11573922
parent 63897 85c83757788c
permissions -rwxr-xr-x
updated to jdk-8u112;
     1 #!/usr/bin/env bash
     2 
     3 THIS="$(cd "$(dirname "$0")"; pwd)"
     4 
     5 
     6 ## diagnostics
     7 
     8 function fail()
     9 {
    10   echo "$1" >&2
    11   exit 2
    12 }
    13 
    14 
    15 ## parameters
    16 
    17 VERSION="8u112"
    18 FULL_VERSION="1.8.0_112"
    19 
    20 ARCHIVE_LINUX32="jdk-${VERSION}-linux-i586.tar.gz"
    21 ARCHIVE_LINUX64="jdk-${VERSION}-linux-x64.tar.gz"
    22 ARCHIVE_WINDOWS32="jdk${FULL_VERSION}-w32.tar.gz"
    23 ARCHIVE_WINDOWS64="jdk${FULL_VERSION}-w64.tar.gz"
    24 ARCHIVE_DARWIN="jdk${FULL_VERSION}.jdk.tar.gz"
    25 
    26 
    27 ## main
    28 
    29 DIR="jdk-${VERSION}"
    30 mkdir "$DIR" || fail "Cannot create fresh directory: \"$DIR\""
    31 
    32 
    33 # README
    34 
    35 cat >> "$DIR/README" << EOF
    36 This is JDK/JRE $FULL_VERSION as required for Isabelle.
    37 
    38 See http://www.oracle.com/technetwork/java/javase/downloads/index.html
    39 for the original downloads, which are covered by the Oracle Binary
    40 Code License Agreement for Java SE.
    41 
    42 Linux, Windows, Mac OS X all work uniformly, depending on certain
    43 platform-specific subdirectories.
    44 EOF
    45 
    46 
    47 # settings
    48 
    49 mkdir "$DIR/etc"
    50 cp "$THIS/settings" "$DIR/etc/settings"
    51 
    52 
    53 # content
    54 
    55 #GNU tar (notably on Mac OS X)
    56 type -p gnutar >/dev/null && function tar() { gnutar "$@"; }
    57 
    58 mkdir "$DIR/x86-linux" "$DIR/x86_64-linux" "$DIR/x86-windows" "$DIR/x86_64-windows" "$DIR/x86_64-darwin"
    59 
    60 tar -C "$DIR/x86-linux" -xf "$ARCHIVE_LINUX32"
    61 tar -C "$DIR/x86_64-linux" -xf "$ARCHIVE_LINUX64"
    62 tar -C "$DIR/x86-windows" -xf "$ARCHIVE_WINDOWS32"
    63 tar -C "$DIR/x86_64-windows" -xf "$ARCHIVE_WINDOWS64"
    64 tar -C "$DIR/x86_64-darwin" -xf "$ARCHIVE_DARWIN"
    65 
    66 (
    67   cd "$DIR"
    68   for PLATFORM in x86-linux x86_64-linux x86-windows x86_64-windows
    69   do
    70     mv "$PLATFORM/jdk${FULL_VERSION}"/* "$PLATFORM"/.
    71     rmdir "$PLATFORM/jdk${FULL_VERSION}"
    72   done
    73   PLATFORM=x86_64-darwin
    74   mv "$PLATFORM/jdk${FULL_VERSION}.jdk"/* "$PLATFORM"/.
    75   rmdir "$PLATFORM/jdk${FULL_VERSION}.jdk"
    76 )
    77 
    78 chgrp -R isabelle "$DIR"
    79 chmod -R a+r "$DIR"
    80 chmod -R a+X "$DIR"
    81 
    82 find "$DIR/x86_64-darwin" -name "._*" -exec rm -f {} ";"
    83 
    84 echo "Sharing ..."
    85 (
    86   cd "$DIR/x86-linux"
    87   for FILE in $(find . -type f)
    88   do
    89     for OTHER in \
    90       "../x86_64-linux/$FILE" \
    91       "../x86-windows/$FILE" \
    92       "../x86_64-windows/$FILE" \
    93       "../x86_64-darwin/Contents/Home/$FILE"
    94     do
    95       if cmp -s "$FILE" "$OTHER"
    96       then
    97         echo -n "*"
    98         ln -f "$FILE" "$OTHER"
    99       fi
   100     done
   101   done
   102 )
   103 echo
   104 
   105 
   106 # create archive
   107 
   108 echo "Archiving ..."
   109 tar -c -z -f "${DIR}.tar.gz" "$DIR" && echo "${DIR}.tar.gz"