author | wenzelm |
Mon, 27 Oct 2014 20:31:51 +0100 | |
changeset 58794 | e1a6a71b741d |
parent 58790 | a42a5129df91 |
child 59417 | fc7054d65f5b |
permissions | -rwxr-xr-x |
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 | 12 |
## parameters |
47970
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
13 |
|
58794 | 14 |
VERSION="7u72" |
15 |
FULL_VERSION="1.7.0_72" |
|
47970
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
16 |
|
50890 | 17 |
ARCHIVE_LINUX32="jdk-${VERSION}-linux-i586.tar.gz" |
18 |
ARCHIVE_LINUX64="jdk-${VERSION}-linux-x64.tar.gz" |
|
19 |
ARCHIVE_DARWIN="jdk${FULL_VERSION}.jdk.tar.gz" |
|
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 | 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 |
58794 | 32 |
This is JDK/JRE $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 | 37 |
|
50294 | 38 |
Linux, Mac OS X, Windows work uniformly, depending on certain |
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 | 49 |
case "\${ISABELLE_PLATFORM64:-\$ISABELLE_PLATFORM32}" in |
50 |
x86-darwin) |
|
57583 | 51 |
echo "### Java unavailable on 32bit Macintosh!" >&2 |
48825 | 52 |
;; |
53 |
x86_64-darwin) |
|
53417 | 54 |
ISABELLE_JDK_HOME="\$COMPONENT/\$ISABELLE_PLATFORM64/Contents/Home" |
48825 | 55 |
;; |
56 |
*) |
|
53417 | 57 |
ISABELLE_JDK_HOME="\$COMPONENT/\${ISABELLE_PLATFORM64:-\$ISABELLE_PLATFORM32}" |
48825 | 58 |
;; |
59 |
esac |
|
47970
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
60 |
EOF |
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 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
63 |
# content |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
64 |
|
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
|
65 |
#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
|
66 |
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
|
67 |
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
|
68 |
fi |
50863 | 69 |
|
48825 | 70 |
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
|
71 |
|
48825 | 72 |
tar -C "$DIR/x86-linux" -xf "$ARCHIVE_LINUX32" |
73 |
tar -C "$DIR/x86_64-linux" -xf "$ARCHIVE_LINUX64" |
|
74 |
tar -C "$DIR/x86_64-darwin" -xf "$ARCHIVE_DARWIN" |
|
75 |
tar -C "$DIR/x86-cygwin" -xf "$ARCHIVE_WINDOWS" |
|
76 |
||
53417 | 77 |
( |
78 |
cd "$DIR" |
|
79 |
for PLATFORM in x86-linux x86_64-linux x86-cygwin |
|
80 |
do |
|
81 |
mv "$PLATFORM/jdk${FULL_VERSION}"/* "$PLATFORM"/. |
|
82 |
rmdir "$PLATFORM/jdk${FULL_VERSION}" |
|
83 |
done |
|
84 |
PLATFORM=x86_64-darwin |
|
85 |
mv "$PLATFORM/jdk${FULL_VERSION}.jdk"/* "$PLATFORM"/. |
|
86 |
rmdir "$PLATFORM/jdk${FULL_VERSION}.jdk" |
|
87 |
) |
|
88 |
||
48825 | 89 |
chgrp -R isabelle "$DIR" |
90 |
chmod -R a+r "$DIR" |
|
91 |
chmod -R a+X "$DIR" |
|
47970
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
92 |
|
50294 | 93 |
find "$DIR/x86_64-darwin" -name "._*" -exec rm -f {} ";" |
94 |
||
50890 | 95 |
echo "Sharing ..." |
47970
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
96 |
( |
53417 | 97 |
cd "$DIR/x86-linux" |
47970
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
98 |
for FILE in $(find . -type f) |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
99 |
do |
48825 | 100 |
for OTHER in \ |
53631
e68732cd842e
proper sharing after change of directory structure (cf. 32ec957e5c3e);
wenzelm
parents:
53625
diff
changeset
|
101 |
"../x86_64-linux/$FILE" \ |
e68732cd842e
proper sharing after change of directory structure (cf. 32ec957e5c3e);
wenzelm
parents:
53625
diff
changeset
|
102 |
"../x86_64-darwin/Contents/Home/$FILE" \ |
e68732cd842e
proper sharing after change of directory structure (cf. 32ec957e5c3e);
wenzelm
parents:
53625
diff
changeset
|
103 |
"../x86-cygwin/$FILE" |
48825 | 104 |
do |
105 |
if cmp -s "$FILE" "$OTHER" |
|
106 |
then |
|
57587 | 107 |
echo -n "*" |
48825 | 108 |
ln -f "$FILE" "$OTHER" |
109 |
fi |
|
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 |
) |
53631
e68732cd842e
proper sharing after change of directory structure (cf. 32ec957e5c3e);
wenzelm
parents:
53625
diff
changeset
|
113 |
echo |
47970
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 |
|
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
116 |
# create archive |
257fc09aa8a1
build hybrid Isabelle component for JDK on x86-linux/x86_64-linux;
wenzelm
parents:
diff
changeset
|
117 |
|
50890 | 118 |
echo "Archiving ..." |
119 |
tar -c -z -f "${DIR}.tar.gz" "$DIR" && echo "${DIR}.tar.gz" |