Admin/build
author wenzelm
Fri, 20 Jul 2012 16:47:17 +0200
changeset 48367 680d297ec71b
parent 47408 63c05991882e
child 48498 62f183129ae6
permissions -rwxr-xr-x
some basic Isabelle options;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
     2
#
27629
ec92e8eb6a1e less verbosity;
wenzelm
parents: 27628
diff changeset
     3
# Administrative build for Isabelle source distribution.
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
     4
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
     5
## directory layout
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
     6
34282
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents: 31831
diff changeset
     7
if [ -z "$ISABELLE_HOME" ]; then
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents: 31831
diff changeset
     8
  ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents: 31831
diff changeset
     9
  ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
549969a7f582 simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents: 31831
diff changeset
    10
fi
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    11
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    12
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    13
## diagnostics
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    14
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    15
PRG="$(basename "$0")"
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    16
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    17
function usage()
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    18
{
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    19
  cat <<EOF
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    20
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    21
Usage: $PRG [MODULES]
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    22
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    23
  Produce Isabelle distribution modules from current repository sources.
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    24
  The MODULES list may contain any of the following:
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    25
46933
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    26
    all             all modules below *except* doc-src
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    27
    browser         graph browser (requires jdk)
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    28
    doc             documentation (requires latex and rail)
46933
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    29
    doc-src         documentation sources from Isabelle theories
47115
1a05adae1cc9 more robust command invocation via ISABELLE_JDK_HOME or SCALA_HOME (NB: bash exec requires genuine executable, not function);
wenzelm
parents: 46933
diff changeset
    30
    jars            Isabelle/Scala layer (requires \$ISABELLE_JDK_HOME and \$SCALA_HOME)
47408
63c05991882e slightly faster default compilation of Isabelle/Scala;
wenzelm
parents: 47115
diff changeset
    31
    jars_test       test separate build of jars
43280
e5dd0ae1b054 support fresh build of jars;
wenzelm
parents: 34876
diff changeset
    32
    jars_fresh      fresh build of jars
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    33
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    34
EOF
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    35
  exit 1
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    36
}
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    37
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    38
function fail()
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    39
{
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    40
  echo "$1" >&2
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    41
  exit 2
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    42
}
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    43
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    44
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    45
## process command line
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    46
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    47
[ "$#" -eq 0 ] && usage
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    48
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    49
MODULES="$@"; shift "$#"
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    50
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    51
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    52
## modules
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    53
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    54
function build_all ()
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    55
{
27649
cb26fe3ea037 tuned build order;
wenzelm
parents: 27629
diff changeset
    56
  build_doc
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    57
  build_browser
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    58
  build_jars
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    59
}
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    60
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    61
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    62
function build_browser ()
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    63
{
34283
7911e83d06c0 simplified build/bootstrap of graph browser -- avoid make;
wenzelm
parents: 34282
diff changeset
    64
  pushd "$ISABELLE_HOME/lib/browser" >/dev/null
34297
5c0a2583f997 pass build error code;
wenzelm
parents: 34284
diff changeset
    65
  "$ISABELLE_TOOL" env ./build || exit $?
34283
7911e83d06c0 simplified build/bootstrap of graph browser -- avoid make;
wenzelm
parents: 34282
diff changeset
    66
  popd >/dev/null
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    67
}
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    68
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    69
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    70
function build_doc ()
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    71
{
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    72
  echo "###"
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    73
  echo "### Building documentation ..."
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    74
  echo "###"
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    75
28956
64754369cee3 eliminated traces of old Distribution directory;
wenzelm
parents: 28504
diff changeset
    76
  cd "$ISABELLE_HOME/doc-src"
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    77
  for DOC in $(cat Dirs)
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    78
  do
27629
ec92e8eb6a1e less verbosity;
wenzelm
parents: 27628
diff changeset
    79
    pushd "$DOC" >/dev/null
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    80
    make clean dvi || fail "DVI document for $DOC failed!"
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    81
    make clean pdf || fail "PDF document for $DOC failed!"
27629
ec92e8eb6a1e less verbosity;
wenzelm
parents: 27628
diff changeset
    82
    popd >/dev/null
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    83
  done
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    84
}
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    85
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
    86
46933
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    87
function build_doc-src ()
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    88
{
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    89
  echo "###"
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    90
  echo "### Building documentation sources..."
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    91
  echo "###"
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    92
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    93
  cd "$ISABELLE_HOME/doc-src"
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    94
  for DOC in $(cat Dirs)
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    95
  do
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    96
    pushd "$DOC" >/dev/null
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    97
    if [[ -f "IsaMakefile" ]]
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    98
    then
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
    99
      "$ISABELLE_TOOL" make || exit $?
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
   100
    fi
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
   101
    popd >/dev/null
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
   102
  done
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
   103
}
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
   104
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
   105
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   106
function build_jars ()
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   107
{
28956
64754369cee3 eliminated traces of old Distribution directory;
wenzelm
parents: 28504
diff changeset
   108
  pushd "$ISABELLE_HOME/src/Pure" >/dev/null
43280
e5dd0ae1b054 support fresh build of jars;
wenzelm
parents: 34876
diff changeset
   109
  "$ISABELLE_TOOL" env ./build-jars "$@" || exit $?
27904
343696007eca jars: build Pure.jar;
wenzelm
parents: 27655
diff changeset
   110
  popd >/dev/null
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   111
}
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   112
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   113
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   114
## main
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   115
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   116
for MODULE in $MODULES
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   117
do
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   118
  case $MODULE in
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   119
    all) build_all;;
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   120
    browser) build_browser;;
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   121
    doc) build_doc;;
46933
3b02b0ef8d48 doc-src build option (for emerging mira configuration)
haftmann
parents: 45385
diff changeset
   122
    doc-src) build_doc-src;;
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   123
    jars) build_jars;;
43280
e5dd0ae1b054 support fresh build of jars;
wenzelm
parents: 34876
diff changeset
   124
    jars_fresh) build_jars -f;;
47408
63c05991882e slightly faster default compilation of Isabelle/Scala;
wenzelm
parents: 47115
diff changeset
   125
    jars_test) build_jars -t;;
27628
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   126
    *) fail "Bad module $MODULE"
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   127
  esac
901656b3205d Administrative build -- finish Isabelle source distribution.
wenzelm
parents:
diff changeset
   128
done