updated makebundles as Admin isabelle tool;
authorwenzelm
Wed, 09 Jan 2013 18:12:21 +0100
changeset 50790 0088e0805b10
parent 50789 e988d44e04d7
child 50791 ef950fad7807
updated makebundles as Admin isabelle tool;
Admin/Release/makebundle
Admin/components/bundled
Admin/lib/Tools/makebundles
--- a/Admin/Release/makebundle	Wed Jan 09 17:04:59 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-#!/usr/bin/env bash
-#
-# makebundle -- re-package with add-on components
-
-## diagnostics
-
-PRG=$(basename "$0")
-
-function usage()
-{
-  echo
-  echo "Usage: $PRG ARCHIVE PLATFORM"
-  echo
-  echo "  Re-package Isabelle source distribution with add-on components"
-  echo "  and heap images"
-  echo
-  exit 1
-}
-
-function fail()
-{
-  echo "$1" >&2
-  exit 2
-}
-
-
-## implicit and explicit arguments
-
-TMP="/var/tmp/isabelle-makebundle$$"
-mkdir "$TMP" || fail "Cannot create directory $TMP"
-
-[ "$#" -ne 2 ] && usage
-
-ARCHIVE="$1"; shift
-PLATFORM="$1"; shift
-
-[ -f "$ARCHIVE" ] || fail "Bad source archive: $ARCHIVE"
-
-
-## main
-
-ARCHIVE_DIR="$(cd $(dirname "$ARCHIVE"); echo "$PWD")"
-ISABELLE_NAME="$(basename "$ARCHIVE" .tar.gz)"
-ISABELLE_HOME="$TMP/$ISABELLE_NAME"
-
-tar -C "$TMP" -x -z -f "$ARCHIVE"
-
-
-echo "#bundled components" >> "$ISABELLE_HOME/etc/components"
-
-for CONTRIB in "$ARCHIVE_DIR/contrib/"*.tar.gz "$ARCHIVE_DIR/contrib/$PLATFORM"/*.tar.gz
-do
-  if [ -f "$CONTRIB" ]; then
-    tar -C "$ISABELLE_HOME/contrib" -x -z -f "$CONTRIB"
-    NAME="$(basename "$CONTRIB" .tar.gz)"
-    [ -d "$ISABELLE_HOME/contrib/$NAME" ] || fail "Bad archive content $CONTRIB"
-
-    if [ -e "$ISABELLE_HOME/contrib/$NAME/etc/settings" ]; then
-      echo "component $NAME"
-      if [ "$PLATFORM" != x86-cygwin -a "$NAME" = ProofGeneral-3.7.1.1 ]; then
-        echo "#contrib/$NAME" >> "$ISABELLE_HOME/etc/components"
-      elif [ "$PLATFORM" = x86-cygwin -a "$NAME" = ProofGeneral-4.1 ]; then
-        echo "#contrib/$NAME" >> "$ISABELLE_HOME/etc/components"
-      else
-        echo "contrib/$NAME" >> "$ISABELLE_HOME/etc/components"
-      fi
-    else
-      echo "package $NAME"
-    fi
-  fi
-done
-
-if [ "$PLATFORM" = x86-cygwin ]; then
-  TAR="$ARCHIVE_DIR/contrib/x86-cygwin/Isabelle.tar"
-  [ -e "$TAR" ] || fail "Missing $TAR"
-  rm -f "$ISABELLE_HOME/Isabelle"
-  tar -C "$ISABELLE_HOME" -xv -f "$TAR"
-
-  (
-    cd "$ISABELLE_HOME"
-    for DIR in $(find contrib -name x86-linux -o -name x86_64-linux -o -name x86-darwin -o -name x86_64-darwin | sort)
-    do
-      echo "removing $DIR"
-      rm -rf "$DIR"
-    done
-  )
-
-  mv "$ISABELLE_HOME/contrib"/polyml* "$ISABELLE_HOME/contrib/cygwin-1.7.9/usr/local/"
-  (
-    cd "$ISABELLE_HOME/contrib/cygwin-1.7.9"
-    find usr/local/polyml-*/x86-cygwin | gzip > etc/setup/polyml.lst.gz
-  )
-
-  for NAME in ANNOUNCE README NEWS COPYRIGHT CONTRIBUTORS contrib/README
-  do
-    FILE="$ISABELLE_HOME/$NAME"
-    {
-      echo '<?xml version="1.0" encoding="utf-8" ?>'
-      echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
-      echo '<html xmlns="http://www.w3.org/1999/xhtml">'
-      echo '<head>'
-      echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>'
-      echo "<title>${NAME}</title>"
-      echo '</head>'
-      echo '<body>'
-      echo '<pre>'
-      perl -w -p -e "s/&/&amp;/g; s/</&lt;/g; s/>/&gt;/g; s/'/&apos;/g; s/\"/&quot;/g;" "$FILE"
-      echo '</pre>'
-      echo '</body>'
-    } > "${FILE}.html"
-  done
-fi
-
-
-HEAPS_ARCHIVE="$ARCHIVE_DIR/${ISABELLE_NAME}_heaps_${PLATFORM}.tar.gz"
-[ -f "$HEAPS_ARCHIVE" ] || fail "Bad heaps archive: $HEAPS_ARCHIVE"
-echo "heaps"
-tar -C "$TMP" -x -z -f "$HEAPS_ARCHIVE"
-
-case "$PLATFORM" in
-  x86_64-linux)
-    perl -pi -e 's,^ML_PLATFORM=.*$,ML_PLATFORM="\$ISABELLE_PLATFORM64",g;' "$TMP/$ISABELLE_NAME/etc/settings"
-    perl -pi -e "s,^ML_OPTIONS=.*$,ML_OPTIONS=\"-H 400\",g;" "$TMP/$ISABELLE_NAME/etc/settings"
-    ;;
-  *-darwin)
-    perl -pi -e "s,lookAndFeel=.*,lookAndFeel=com.apple.laf.AquaLookAndFeel,g;" \
-      -e "s,delete-line.shortcut=.*,delete-line.shortcut=C+d,g;" \
-      -e "s,delete.shortcut2=.*,delete.shortcut2=A+d,g;" \
-      "$TMP/$ISABELLE_NAME/src/Tools/jEdit/dist/properties/jEdit.props"
-    ;;
-  *-cygwin)
-    perl -pi -e "s,lookAndFeel=.*,lookAndFeel=com.sun.java.swing.plaf.windows.WindowsLookAndFeel,g;" \
-      "$TMP/$ISABELLE_NAME/src/Tools/jEdit/dist/properties/jEdit.props"
-    ;;
-  *)
-    ;;
-esac
-
-BUNDLE_ARCHIVE="${ARCHIVE_DIR}/${ISABELLE_NAME}_bundle_${PLATFORM}.tar.gz"
-
-echo "$(basename "$BUNDLE_ARCHIVE")"
-tar -C "$TMP" -c -z -f "$BUNDLE_ARCHIVE" "$ISABELLE_NAME"
-
-
-# clean up
-cd /tmp
-rm -rf "$TMP"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Admin/components/bundled	Wed Jan 09 18:12:21 2013 +0100
@@ -0,0 +1,3 @@
+#additional components to be bundled for release
+ProofGeneral-4.1
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Admin/lib/Tools/makebundles	Wed Jan 09 18:12:21 2013 +0100
@@ -0,0 +1,181 @@
+#!/usr/bin/env bash
+#
+# DESCRIPTION: re-package Isabelle distribution with add-on components
+
+## diagnostics
+
+PRG=$(basename "$0")
+
+function usage()
+{
+  echo
+  echo "Usage: isabelle $PRG ARCHIVE"
+  echo
+  echo "  Re-package Isabelle source distribution with add-on components"
+  echo "  and post-hoc patches for platform families linux, macos, windows."
+  echo
+  echo "  Add-on components are that of the running Isabelle version!"
+  echo
+  exit 1
+}
+
+function fail()
+{
+  echo "$1" >&2
+  exit 2
+}
+
+
+## arguments
+
+[ "$#" -ne 1 ] && usage
+
+ARCHIVE="$1"; shift
+
+[ -f "$ARCHIVE" ] || fail "Bad source archive: $ARCHIVE"
+
+ARCHIVE_DIR="$(cd $(dirname "$ARCHIVE"); echo "$PWD")"
+ISABELLE_NAME="$(basename "$ARCHIVE" .tar.gz)"
+
+
+## main
+
+for PLATFORM_FAMILY in linux macos windows
+do
+
+echo
+echo "*** $PLATFORM_FAMILY ***"
+
+TMP="/var/tmp/isabelle-makebundle$$"
+mkdir "$TMP" || fail "Cannot create directory $TMP"
+
+ISABELLE_TARGET="$TMP/$ISABELLE_NAME"
+
+tar -C "$TMP" -x -z -f "$ARCHIVE"
+
+
+# bundled components
+
+mkdir -p "$ARCHIVE_DIR/contrib"
+
+echo "#bundled components" >> "$ISABELLE_TARGET/etc/components"
+
+for CATALOG in main bundled "$PLATFORM_FAMILY"
+do
+  CATALOG_FILE="$ISABELLE_HOME/Admin/components/$CATALOG"
+  if [ -f "$CATALOG_FILE" ]
+  then
+    echo "catalog ${CATALOG}"
+    {
+      while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; }
+      do
+        case "$REPLY" in
+          \#* | "") ;;
+          *)
+            COMPONENT="$REPLY"
+            case "$COMPONENT" in
+              jedit_build*) ;;
+              *)
+                echo "  component $COMPONENT"
+                CONTRIB="$ARCHIVE_DIR/contrib/${COMPONENT}.tar.gz"
+                if [ ! -f "$CONTRIB" ]; then
+                  REMOTE="$ISABELLE_COMPONENT_REPOSITORY/${COMPONENT}.tar.gz"
+                  echo "  download $REMOTE"
+                  perl -MLWP::Simple -e "getprint '$REMOTE';" > "$CONTRIB"
+                  perl -e "exit((stat('${CONTRIB}'))[7] == 0 ? 0 : 1);" && exit 2
+                fi
+
+                tar -C "$ISABELLE_TARGET/contrib" -x -z -f "$CONTRIB"
+                echo "contrib/$COMPONENT" >> "$ISABELLE_TARGET/etc/components"
+                ;;
+            esac
+            ;;
+        esac
+      done
+    } < "$CATALOG_FILE"
+  fi
+done
+
+
+# platform patches
+
+case "$PLATFORM_FAMILY" in
+  linux)
+    (
+      cd "$ISABELLE_TARGET"
+      for DIR in contrib/jdk*/*-darwin contrib/jdk*/*-cygwin
+      do
+        echo "removing $DIR"
+        rm -rf "$DIR"
+      done
+    )
+    ;;
+  macos)
+    (
+      cd "$ISABELLE_TARGET"
+      for DIR in contrib/jdk*/*-linux contrib/jdk*/*-cygwin
+      do
+        echo "removing $DIR"
+        rm -rf "$DIR"
+      done
+    )
+    perl -pi -e "s,lookAndFeel=.*,lookAndFeel=com.apple.laf.AquaLookAndFeel,g;" \
+      -e "s,delete-line.shortcut=.*,delete-line.shortcut=C+d,g;" \
+      -e "s,delete.shortcut2=.*,delete.shortcut2=A+d,g;" \
+      "$TMP/$ISABELLE_NAME/src/Tools/jEdit/dist/properties/jEdit.props"
+    ;;
+  windows)
+    (
+      cd "$ISABELLE_TARGET"
+      for DIR in \
+        $(find contrib -name x86-linux -o -name x86_64-linux -o -name x86-darwin -o -name x86_64-darwin | sort)
+      do
+        echo "removing $DIR"
+        rm -rf "$DIR"
+      done
+    )
+
+    perl -pi -e "s,lookAndFeel=.*,lookAndFeel=com.sun.java.swing.plaf.windows.WindowsLookAndFeel,g;" \
+      "$TMP/$ISABELLE_NAME/src/Tools/jEdit/dist/properties/jEdit.props"
+
+# FIXME include cygwin.tar.gz etc.
+#
+#    TAR="$ARCHIVE_DIR/contrib/windows/Isabelle.tar"
+#    [ -e "$TAR" ] || fail "Missing $TAR"
+#    rm -f "$ISABELLE_TARGET/Isabelle"
+#    tar -C "$ISABELLE_TARGET" -xv -f "$TAR"
+
+    for NAME in ANNOUNCE README NEWS COPYRIGHT CONTRIBUTORS contrib/README
+    do
+      FILE="$ISABELLE_TARGET/$NAME"
+      {
+        echo '<?xml version="1.0" encoding="utf-8" ?>'
+        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
+        echo '<html xmlns="http://www.w3.org/1999/xhtml">'
+        echo '<head>'
+        echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>'
+        echo "<title>${NAME}</title>"
+        echo '</head>'
+        echo '<body>'
+        echo '<pre>'
+        perl -w -p -e "s/&/&amp;/g; s/</&lt;/g; s/>/&gt;/g; s/'/&apos;/g; s/\"/&quot;/g;" "$FILE"
+        echo '</pre>'
+        echo '</body>'
+      } > "${FILE}.html"
+    done
+    ;;
+  *)
+    ;;
+esac
+
+BUNDLE_ARCHIVE="${ARCHIVE_DIR}/${ISABELLE_NAME}_bundle_${PLATFORM_FAMILY}.tar.gz"
+
+echo "packaging $(basename "$BUNDLE_ARCHIVE")"
+tar -C "$TMP" -c -z -f "$BUNDLE_ARCHIVE" "$ISABELLE_NAME"
+
+
+# clean up
+rm -rf "$TMP"
+
+done
+