Admin/lib/Tools/makedist_bundle
changeset 66724 1e1f9f603385
parent 64176 35644caa62a7
child 66726 5223317b8c56
equal deleted inserted replaced
66723:18cc87e2335f 66724:1e1f9f603385
    10 {
    10 {
    11   echo
    11   echo
    12   echo "Usage: isabelle $PRG ARCHIVE PLATFORM_FAMILY [REMOTE_MAC]"
    12   echo "Usage: isabelle $PRG ARCHIVE PLATFORM_FAMILY [REMOTE_MAC]"
    13   echo
    13   echo
    14   echo "  Re-package Isabelle source distribution with add-on components and"
    14   echo "  Re-package Isabelle source distribution with add-on components and"
    15   echo "  post-hoc patches for platform family linux, windows, windows64, macos."
    15   echo "  post-hoc patches for platform family linux, windows, macos."
    16   echo
    16   echo
    17   echo "  The optional remote Mac OS X system is used for dmg build."
    17   echo "  The optional remote Mac OS X system is used for dmg build."
    18   echo
    18   echo
    19   echo "  Add-on components are that of the running Isabelle version!"
    19   echo "  Add-on components are that of the running Isabelle version!"
    20   echo
    20   echo
    33 [ "$#" -ne 2 -a "$#" -ne 3 ] && usage
    33 [ "$#" -ne 2 -a "$#" -ne 3 ] && usage
    34 
    34 
    35 ARCHIVE="$1"; shift
    35 ARCHIVE="$1"; shift
    36 PLATFORM_FAMILY="$1"; shift
    36 PLATFORM_FAMILY="$1"; shift
    37 REMOTE_MAC="$1"; shift
    37 REMOTE_MAC="$1"; shift
    38 
       
    39 if [ "$PLATFORM_FAMILY" = windows64 ]; then
       
    40   PLATFORM_FAM="windows"
       
    41 else
       
    42   PLATFORM_FAM="$PLATFORM_FAMILY"
       
    43 fi
       
    44 
    38 
    45 [ -f "$ARCHIVE" ] || fail "Bad source archive: $ARCHIVE"
    39 [ -f "$ARCHIVE" ] || fail "Bad source archive: $ARCHIVE"
    46 
    40 
    47 ARCHIVE_DIR="$(cd $(dirname "$ARCHIVE"); echo "$PWD")"
    41 ARCHIVE_DIR="$(cd $(dirname "$ARCHIVE"); echo "$PWD")"
    48 ISABELLE_NAME="$(basename "$ARCHIVE" .tar.gz)"
    42 ISABELLE_NAME="$(basename "$ARCHIVE" .tar.gz)"
    96   fi
    90   fi
    97 fi
    91 fi
    98 
    92 
    99 echo "#bundled components" >> "$ISABELLE_TARGET/etc/components"
    93 echo "#bundled components" >> "$ISABELLE_TARGET/etc/components"
   100 
    94 
   101 for CATALOG in main "$PLATFORM_FAM" bundled "bundled-$PLATFORM_FAM"
    95 for CATALOG in main "$PLATFORM_FAMILY" bundled "bundled-$PLATFORM_FAMILY"
   102 do
    96 do
   103   CATALOG_FILE="$ISABELLE_HOME/Admin/components/$CATALOG"
    97   CATALOG_FILE="$ISABELLE_HOME/Admin/components/$CATALOG"
   104   if [ -f "$CATALOG_FILE" ]
    98   if [ -f "$CATALOG_FILE" ]
   105   then
    99   then
   106     echo "catalog ${CATALOG}"
   100     echo "catalog ${CATALOG}"
   192 # platform-specific setup (inside archive)
   186 # platform-specific setup (inside archive)
   193 
   187 
   194 perl -pi -e "s,view.title=Isabelle/jEdit,view.title=${ISABELLE_NAME},g;" \
   188 perl -pi -e "s,view.title=Isabelle/jEdit,view.title=${ISABELLE_NAME},g;" \
   195   "$ISABELLE_TARGET/src/Tools/jEdit/dist/properties/jEdit.props"
   189   "$ISABELLE_TARGET/src/Tools/jEdit/dist/properties/jEdit.props"
   196 
   190 
   197 case "$PLATFORM_FAM" in
   191 case "$PLATFORM_FAMILY" in
   198   linux)
   192   linux)
   199     purge_target 'contrib -name "x86*-darwin" -o -name "x86*-cygwin" -o -name "x86*-windows"'
   193     purge_target 'contrib -name "x86*-darwin" -o -name "x86*-cygwin" -o -name "x86*-windows"'
   200     purge_jdk "x86-linux"
   194     purge_jdk "x86-linux"
   201     purge_jdk "x86_64-linux"
   195     purge_jdk "x86_64-linux"
   202 
   196 
   248       -e "s,delete.shortcut2=.*,delete.shortcut2=A+d,g;" \
   242       -e "s,delete.shortcut2=.*,delete.shortcut2=A+d,g;" \
   249       -e "s,plugin-blacklist.MacOSX.jar=true,plugin-blacklist.MacOSX.jar=,g;" \
   243       -e "s,plugin-blacklist.MacOSX.jar=true,plugin-blacklist.MacOSX.jar=,g;" \
   250       "$ISABELLE_TARGET/src/Tools/jEdit/dist/properties/jEdit.props"
   244       "$ISABELLE_TARGET/src/Tools/jEdit/dist/properties/jEdit.props"
   251     ;;
   245     ;;
   252   windows)
   246   windows)
   253     if [ "$PLATFORM_FAMILY" = windows ]; then
   247     purge_target 'contrib -name "x86*-linux" -o -name "x86*-darwin"'
   254       purge_target 'contrib -name x86_64-windows -o -name "x86*-linux" -o -name "x86*-darwin"'
   248     purge_target 'contrib/jdk -name "x86-windows"'
   255       PLATFORM="x86-windows"
   249     purge_jdk "x86_64-windows"
   256       PLATFORM_IS_64="false"
       
   257       PLATFORM_BITS="32"
       
   258     else
       
   259       purge_target 'contrib -name "x86*-linux" -o -name "x86*-darwin"'
       
   260       purge_target 'contrib/jdk -name "x86-windows"'
       
   261       PLATFORM="x86_64-windows"
       
   262       PLATFORM_IS_64="true"
       
   263       PLATFORM_BITS="64"
       
   264     fi
       
   265     purge_jdk "$PLATFORM"
       
   266 
   250 
   267     mv "$ISABELLE_TARGET/contrib/windows_app" "$TMP/."
   251     mv "$ISABELLE_TARGET/contrib/windows_app" "$TMP/."
   268 
   252 
   269     perl -pi \
   253     perl -pi \
   270       -e "s,lookAndFeel=.*,lookAndFeel=com.sun.java.swing.plaf.windows.WindowsLookAndFeel,g;" \
   254       -e "s,lookAndFeel=.*,lookAndFeel=com.sun.java.swing.plaf.windows.WindowsLookAndFeel,g;" \
   273 
   257 
   274     (
   258     (
   275       init_component "$JEDIT_HOME"
   259       init_component "$JEDIT_HOME"
   276 
   260 
   277       declare -a JAVA_ARGS=()
   261       declare -a JAVA_ARGS=()
   278       if [ "$PLATFORM_FAMILY" = windows ]; then
   262       echo -e "# Java runtime options for 64bit platform\r"
   279         echo -e "# Java runtime options for 32bit platform\r"
   263       eval "JAVA_ARGS=($ISABELLE_JAVA_SYSTEM_OPTIONS $JEDIT_JAVA_SYSTEM_OPTIONS $JEDIT_JAVA_OPTIONS64)"
   280         eval "JAVA_ARGS=($ISABELLE_JAVA_SYSTEM_OPTIONS $JEDIT_JAVA_SYSTEM_OPTIONS $JEDIT_JAVA_OPTIONS32)"
       
   281       else
       
   282         echo -e "# Java runtime options for 64bit platform\r"
       
   283         eval "JAVA_ARGS=($ISABELLE_JAVA_SYSTEM_OPTIONS $JEDIT_JAVA_SYSTEM_OPTIONS $JEDIT_JAVA_OPTIONS64)"
       
   284       fi
       
   285       for ARG in "${JAVA_ARGS[@]}"
   264       for ARG in "${JAVA_ARGS[@]}"
   286       do
   265       do
   287         echo -e "$ARG\r"
   266         echo -e "$ARG\r"
   288       done
   267       done
   289       echo -e "-Disabelle.jedit_server=${ISABELLE_NAME}\r"
   268       echo -e "-Disabelle.jedit_server=${ISABELLE_NAME}\r"
   307         -e "s,{OUTFILE},$ISABELLE_TARGET/${ISABELLE_NAME}.exe,g;" \
   286         -e "s,{OUTFILE},$ISABELLE_TARGET/${ISABELLE_NAME}.exe,g;" \
   308         -e "s,{ICON},$APP_TEMPLATE/isabelle_transparent.ico,g;" \
   287         -e "s,{ICON},$APP_TEMPLATE/isabelle_transparent.ico,g;" \
   309         -e "s,{SPLASH},$APP_TEMPLATE/isabelle.bmp,g;" \
   288         -e "s,{SPLASH},$APP_TEMPLATE/isabelle.bmp,g;" \
   310         -e "s,{CLASSPATH},$EXE_CLASSPATH,g;" \
   289         -e "s,{CLASSPATH},$EXE_CLASSPATH,g;" \
   311         -e "s,{ISABELLE_NAME},$ISABELLE_NAME,g;" \
   290         -e "s,{ISABELLE_NAME},$ISABELLE_NAME,g;" \
   312         -e "s,{PLATFORM},$PLATFORM,g;" \
       
   313         -e "s,{PLATFORM_IS_64},$PLATFORM_IS_64,g;" \
       
   314         -e "s,{PLATFORM_BITS},$PLATFORM_BITS,g;" \
       
   315         "$APP_TEMPLATE/isabelle.xml" > isabelle.xml
   291         "$APP_TEMPLATE/isabelle.xml" > isabelle.xml
   316 
   292 
   317       "windows_app/launch4j-${ISABELLE_PLATFORM_FAMILY}/launch4j" isabelle.xml
   293       "windows_app/launch4j-${ISABELLE_PLATFORM_FAMILY}/launch4j" isabelle.xml
   318 
   294 
   319       cp "$APP_TEMPLATE/manifest.xml" "$ISABELLE_TARGET/${ISABELLE_NAME}.exe.manifest"
   295       cp "$APP_TEMPLATE/manifest.xml" "$ISABELLE_TARGET/${ISABELLE_NAME}.exe.manifest"
   359 tar -C "$TMP" -c -z -f "$BUNDLE_ARCHIVE" "$ISABELLE_NAME" || exit 2
   335 tar -C "$TMP" -c -z -f "$BUNDLE_ARCHIVE" "$ISABELLE_NAME" || exit 2
   360 
   336 
   361 
   337 
   362 # platform-specific setup (outside archive)
   338 # platform-specific setup (outside archive)
   363 
   339 
   364 case "$PLATFORM_FAM" in
   340 case "$PLATFORM_FAMILY" in
   365   linux)
   341   linux)
   366     echo "application for $PLATFORM_FAMILY"
   342     echo "application for $PLATFORM_FAMILY"
   367     ln -s "${ISABELLE_NAME}_linux.tar.gz" "${ARCHIVE_DIR}/${ISABELLE_NAME}_app.tar.gz"
   343     ln -s "${ISABELLE_NAME}_linux.tar.gz" "${ARCHIVE_DIR}/${ISABELLE_NAME}_app.tar.gz"
   368     ;;
   344     ;;
   369   macos)
   345   macos)
   430       fi
   406       fi
   431     )
   407     )
   432     ;;
   408     ;;
   433   windows)
   409   windows)
   434     (
   410     (
   435       if [ "$PLATFORM_FAMILY" = windows ]; then
       
   436         PLATFORM_SUFFIX="-win32"
       
   437       else
       
   438         PLATFORM_SUFFIX="-win64"
       
   439       fi
       
   440 
       
   441       cd "$TMP"
   411       cd "$TMP"
   442       rm -f "${ARCHIVE_DIR}/${ISABELLE_NAME}.7z"
   412       rm -f "${ARCHIVE_DIR}/${ISABELLE_NAME}.7z"
   443       7z -y -bd a "$TMP/${ISABELLE_NAME}.7z" "$ISABELLE_NAME" || exit 2
   413       7z -y -bd a "$TMP/${ISABELLE_NAME}.7z" "$ISABELLE_NAME" || exit 2
   444 
   414 
   445       echo "application for $PLATFORM_FAMILY"
   415       echo "application for $PLATFORM_FAMILY"
   446       (
   416       (
   447         cat "windows_app/7zsd_All.sfx"
   417         cat "windows_app/7zsd_All.sfx"
   448         cat "$ISABELLE_HOME/Admin/Windows/Installer/sfx.txt" | \
   418         cat "$ISABELLE_HOME/Admin/Windows/Installer/sfx.txt" | \
   449           perl -p -e "s,{ISABELLE_NAME},${ISABELLE_NAME},g;"
   419           perl -p -e "s,{ISABELLE_NAME},${ISABELLE_NAME},g;"
   450         cat "$TMP/${ISABELLE_NAME}.7z"
   420         cat "$TMP/${ISABELLE_NAME}.7z"
   451       ) > "${ARCHIVE_DIR}/${ISABELLE_NAME}${PLATFORM_SUFFIX}.exe"
   421       ) > "${ARCHIVE_DIR}/${ISABELLE_NAME}.exe"
   452       chmod +x "${ARCHIVE_DIR}/${ISABELLE_NAME}${PLATFORM_SUFFIX}.exe"
   422       chmod +x "${ARCHIVE_DIR}/${ISABELLE_NAME}.exe"
   453     )
   423     )
   454     ;;
   424     ;;
   455   *)
   425   *)
   456     ;;
   426     ;;
   457 esac
   427 esac