Admin/Release/build
author wenzelm
Wed, 07 May 2014 18:09:08 +0200
changeset 56902 f901a08c5653
parent 51064 9c425ed4a52c
child 57685 34ec8a580917
permissions -rwxr-xr-x
explicit option to build library, which takes most of the time; produce minimal index, e.g. for test web page;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50899
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
     2
#
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
     3
# Author: Makarius
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
     4
#
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
     5
# build full Isabelle distribution from repository
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
     6
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
     7
THIS="$(cd "$(dirname "$0")"; pwd)"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
     8
PRG="$(basename "$0")"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
     9
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    10
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    11
## diagnostics
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    12
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    13
PRG="$(basename "$0")"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    14
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    15
function usage()
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    16
{
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    17
  echo
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    18
  echo "Usage: isabelle $PRG [OPTIONS] DIR [VERSION]"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    19
  echo
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    20
  echo "  Options are:"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    21
  echo "    -j INT       maximum number of parallel jobs (default 1)"
56902
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
    22
  echo "    -l           build library"
50899
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    23
  echo "    -r RELEASE   proper release with name"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    24
  echo
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    25
  echo "  Make Isabelle distribution DIR, using the local repository clone."
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    26
  echo
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    27
  echo "  VERSION identifies the snapshot, using usual Mercurial terminology;"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    28
  echo "  the default is RELEASE if given, otherwise \"tip\"."
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    29
  echo
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    30
  exit 1
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    31
}
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    32
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    33
function fail()
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    34
{
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    35
  echo "$1" >&2
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    36
  exit 2
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    37
}
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    38
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    39
function check_number()
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    40
{
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    41
  [ -n "$1" -a -z "$(echo "$1" | tr -d '[0-9]')" ] || fail "Bad number: \"$1\""
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    42
}
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    43
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    44
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    45
## process command line
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    46
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    47
# options
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    48
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    49
JOBS=""
56902
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
    50
LIBRARY=""
50899
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    51
RELEASE=""
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    52
56902
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
    53
while getopts "j:lr:" OPT
50899
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    54
do
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    55
  case "$OPT" in
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    56
    j)
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    57
      check_number "$OPTARG"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    58
      JOBS="-j $OPTARG"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    59
      ;;
56902
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
    60
    l)
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
    61
      LIBRARY="true"
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
    62
      ;;
50899
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    63
    r)
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    64
      RELEASE="$OPTARG"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    65
      ;;
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    66
    \?)
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    67
      usage
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    68
      ;;
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    69
  esac
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    70
done
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    71
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    72
shift $(($OPTIND - 1))
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    73
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    74
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    75
# args
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    76
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    77
BASE_DIR=""
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    78
[ "$#" -gt 0 ] && { BASE_DIR="$1"; shift; }
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    79
[ -z "$BASE_DIR" ] && usage
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    80
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    81
VERSION=""
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    82
[ "$#" -gt 0 ] && { VERSION="$1"; shift; }
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    83
[ -z "$VERSION" ] && VERSION="$RELEASE"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    84
[ -z "$VERSION" ] && VERSION="tip"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    85
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    86
[ "$#" -gt 0 ] && usage
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    87
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    88
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    89
## Isabelle settings
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    90
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    91
ISABELLE_TOOL="$THIS/../../bin/isabelle"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    92
ISABELLE_PLATFORM_FAMILY="$("$ISABELLE_TOOL" getenv -b ISABELLE_PLATFORM_FAMILY)"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    93
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    94
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    95
## main
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    96
56902
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
    97
# make dist
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
    98
50899
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
    99
if [ -z "$RELEASE" ]; then
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   100
  DISTNAME="Isabelle_$(env LC_ALL=C date "+%d-%b-%Y")"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   101
  "$ISABELLE_TOOL" makedist -d "$BASE_DIR" $JOBS
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   102
else
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   103
  DISTNAME="$RELEASE"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   104
  "$ISABELLE_TOOL" makedist -d "$BASE_DIR" $JOBS -r "$RELEASE"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   105
fi
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   106
[ "$?" = 0 ] || exit "$?"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   107
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   108
DISTBASE="$BASE_DIR/dist-${DISTNAME}"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   109
51064
9c425ed4a52c separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents: 50899
diff changeset
   110
56902
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   111
# make bundles
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   112
51064
9c425ed4a52c separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents: 50899
diff changeset
   113
for PLATFORM_FAMILY in linux macos windows
9c425ed4a52c separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents: 50899
diff changeset
   114
do
9c425ed4a52c separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents: 50899
diff changeset
   115
9c425ed4a52c separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents: 50899
diff changeset
   116
echo
9c425ed4a52c separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents: 50899
diff changeset
   117
echo "*** $PLATFORM_FAMILY ***"
9c425ed4a52c separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents: 50899
diff changeset
   118
9c425ed4a52c separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents: 50899
diff changeset
   119
"$ISABELLE_TOOL" makedist_bundle "$DISTBASE/${DISTNAME}.tar.gz" "$PLATFORM_FAMILY"
50899
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   120
[ "$?" = 0 ] || exit "$?"
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   121
51064
9c425ed4a52c separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents: 50899
diff changeset
   122
done
9c425ed4a52c separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents: 50899
diff changeset
   123
56902
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   124
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   125
# minimal index
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   126
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   127
cat > "$DISTBASE/index.html" <<EOF
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   128
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   129
<html>
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   130
<head>
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   131
<title>${DISTNAME}</title>
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   132
</head>
50899
506ff6abfde0 grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
diff changeset
   133
56902
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   134
<body>
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   135
<h1>${DISTNAME}</h1>
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   136
<ul>
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   137
<li><a href="${DISTNAME}_linux.tar.gz">Linux</a></li>
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   138
<li><a href="${DISTNAME}.exe">Windows</a></li>
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   139
<li><a href="${DISTNAME}.dmg">Mac OS X</a></li>
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   140
</ul>
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   141
</body>
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   142
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   143
</html>
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   144
EOF
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   145
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   146
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   147
# HTML library
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   148
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   149
if [ -n "$LIBRARY" ]; then
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   150
  "$THIS/build_library" $JOBS "$DISTBASE/${DISTNAME}_${ISABELLE_PLATFORM_FAMILY}.tar.gz"
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   151
fi
f901a08c5653 explicit option to build library, which takes most of the time;
wenzelm
parents: 51064
diff changeset
   152