1#!/bin/sh
2#
3# This is the official script used to make wxWidgets releases.
4#
5# We use the git export features to track which files should be included in the
6# distribution and we don't need to maintain the list of them ourselves but we
7# also don't run the risk of including anything unwanted.
8#
9# See docs/tech/tn0022.txt for usage instructions.
10
11version=$1
12if [ -z "$version" ]; then
13    echo "Must specify the distribution version." >&2
14    exit 1
15fi
16
17root="$(readlink -f $(dirname $(readlink -f $0))/../..)"
18cd "$root"
19
20if ! git diff --quiet; then
21    echo "Working copy has modifications, commit or stash them." >&2
22    exit 2
23fi
24
25set -e
26set -x
27
28prefix=wxWidgets-$version
29destdir="$root/distrib/release/$version"
30
31cleanup() {
32    rm -rf $destdir/$prefix
33}
34
35trap cleanup INT TERM EXIT
36
37cleanup
38
39mkdir -p $destdir
40git archive --prefix=$prefix/ HEAD | (cd $destdir; tar x)
41cd $destdir
42# All setup0.h files are supposed to be renamed to just setup.h when checked
43# out and in the distribution.
44find $prefix/include/wx -type f -name setup0.h | while read f; do
45    mv $f ${f%0.h}.h
46done
47
48# Compile gettext catalogs.
49make -C $prefix/locale allmo
50
51tar cjf $prefix.tar.bz2 $prefix
52
53cd $prefix
54
55zip -q -r ../$prefix.zip .
56
577z a ../$prefix.7z . >/dev/null
587z a ../${prefix}-headers.7z include >/dev/null
59
60# Build HTML documentation packages.
61prefix_docs=$prefix-docs-html
62cd "$root/docs/doxygen"
63rm -rf out
64./regen.sh html
65cd out
66mv html "$prefix_docs"
67tar cjf "$destdir/$prefix_docs.tar.bz2" "$prefix_docs"
68cd "$prefix_docs"
69zip -q -r "$destdir/$prefix_docs.zip" .
70cd "$root"
71rm -rf "$root/docs/doxygen/out"
72