~ chicken-core (chicken-5) /scripts/test-dist.sh
Trap1#!/bin/sh
2### test-dist.sh - test distribution tarball
3#
4# usage: test-dist.sh [-bootstrap] PLATFORM [TARBALL]
5
6set -e
7
8pwdopts=
9bootstrap=
10
11if test "$1" = "-bootstrap"; then
12 bootstrap=1
13 shift
14fi
15
16case $# in
17 1|2) ;;
18 *)
19 echo "usage: test-dist.sh [-bootstrap] PLATFORM [TARBALL]"
20 exit 1;;
21esac
22
23platform="$1"
24tarball="$2"
25makeprg=gmake
26
27# use gmake, if available
28if test -z `which gmake`; then
29 makeprg=make
30fi
31
32# need Windows-style drive letter on mingw/msys
33if test -n "$MSYSTEM"; then
34 pwdopts=-W
35fi
36
37# bootstrap, if desired
38prefix=`pwd $pwdopts`/tmp-test-dist
39
40if test \! -x "$prefix/bin/csi"; then
41 echo "no csi at ${prefix} - please build and install chicken first"
42 exit 1
43fi
44
45for ext in htmlprag matchable; do
46 if test `$prefix/bin/csi -p "(extension-information '${ext})"` = "#f"; then
47 $prefix/bin/chicken-install $ext
48 fi
49done
50
51if test -n "$bootstrap"; then
52 $makeprg PLATFORM=$platform PREFIX=$prefix DEBUGBUILD=1 bootstrap
53 $makeprg PLATFORM=$platform PREFIX=$prefix DEBUGBUILD=1 CHICKEN=./chicken-boot confclean all install
54fi
55
56# if no tarball given, create one
57if test -z "$tarball"; then
58 $prefix/bin/csi -s scripts/makedist.scm --make=$makeprg --platform=$platform
59 tarball=chicken-`cat buildversion`.tar.gz
60fi
61
62# prepare testing directory
63if test -d tmp-test-dist; then
64 rm -fr tmp-test-dist/*
65fi
66
67mkdir -p tmp-test-dist
68cp "$tarball" tmp-test-dist
69
70# unpack and enter
71cd tmp-test-dist
72tar xvfz "$tarball"
73cd `basename "$tarball" .tar.gz`
74
75# build #1
76$makeprg PLATFORM=$platform PREFIX=$prefix DEBUGBUILD=1 all install
77# check #1
78$makeprg PLATFORM=$platform PREFIX=$prefix DEBUGBUILD=1 check
79# build once again with freshly built compiler
80touch *.scm
81$makeprg PLATFORM=$platform PREFIX=$prefix DEBUGBUILD=1 CHICKEN=$prefix/bin/chicken all install
82# and check...
83$makeprg PLATFORM=$platform PREFIX=$prefix DEBUGBUILD=1 check
84
85# Install a few eggs
86$prefix/bin/chicken-install -test prometheus
87$prefix/bin/chicken-install opengl
88
89echo "looks good."