bugs: Advantages for incremental library separation by analogy with incremental
[Ale.git] / bootstrap
blobdf573731d2bb7b7b641bea1daed72f14649e71d1
1 #!/bin/bash
3 # Copyright 2006 David Hilvert <dhilvert@auricle.dyndns.org>,
4 # <dhilvert@ugcs.caltech.edu>
6 # This file is part of the Anti-Lamenessing Engine.
8 # The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with Anti-Lamenessing Engine; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 ###
23 ### 'bootstrap' generates build files for distribution.
24 ###
27 # If a version argument is given, generate a tarball.
30 if test "x$1" = "x-v"; then
31 BOOTSTRAP_VERSION=$2
33 if test "x$BOOTSTRAP_VERSION" = "x"; then
34 echo "bootstrap: -v requires a version argument."
35 exit 1
38 SOURCE_DIR=`pwd`
40 REMOTE_REPO=`./version.sh git-repo`
42 GENERIC_PACKAGE_NAME=`./version.sh invocation`
44 PACKAGE_NAME="$GENERIC_PACKAGE_NAME-$BOOTSTRAP_VERSION"
46 TEMPDIR=`mktemp -d`
48 cd $TEMPDIR
50 if test $SOURCE_DIR = `pwd`; then
51 echo "$0: could not change directory from source."
52 cd $SOURCE_DIR
53 exit 1
56 if ! git clone "$SOURCE_DIR" "$PACKAGE_NAME" && ! git clone "$REMOTE_REPO" "$PACKAGE_NAME"; then
57 echo "$0: Could not perform git clone."
58 cd $SOURCE_DIR
59 rm -rf $TEMPDIR
60 exit 1
63 cd $PACKAGE_NAME
65 if ! git checkout $BOOTSTRAP_VERSION && ! git checkout origin/$BOOTSTRAP_VERSION; then
66 echo "$0: Could not check out version $BOOTSTRAP_VERSION."
67 cd $SOURCE_DIR
68 rm -rf $TEMPDIR
69 exit 1
72 mv .git ../git-moved-$BOOTSTRAP_VERSION
74 if grep ":version:" VERSION; then
75 (echo ":%s/^:version:.*/:version: $BOOTSTRAP_VERSION/"; echo ":wq") | ex VERSION
76 elif test -e VERSION; then
77 echo "$BOOTSTRAP_VERSION" > VERSION
80 if test -e bootstrap && (! chmod a+x bootstrap || ! ./bootstrap); then
81 echo "$0: Nested bootstrap failed."
82 cd $SOURCE_DIR
83 rm -rf $TEMPDIR
84 exit 1
87 cd ..
89 tar czf $PACKAGE_NAME.tar.gz $PACKAGE_NAME
91 cd $SOURCE_DIR
93 mv $TEMPDIR/$PACKAGE_NAME.tar.gz .
95 rm -rf $TEMPDIR
97 echo "Bootstrapped package created as $PACKAGE_NAME.tar.gz."
99 exit 0
103 # Check for the existence of a configure script.
106 if test -e configure && test "x$1" != "x-r"; then
107 echo
108 echo "To install:"
109 echo "1) Run './configure'."
110 echo "2) Run 'make'."
111 echo "3) Run 'make install'."
112 echo ""
113 echo "* To regenerate configure, run '$0 -r'"
114 echo
115 exit 1
118 chmod a+x version.sh
120 if ! which gnulib-tool &> /dev/null; then
121 echo "*** Cannot find 'gnulib-tool'. ***"
122 exit 1
125 if ! which ln &> /dev/null; then
126 echo "*** Cannot find 'ln'. ***"
127 exit 1
130 if ! which automake &> /dev/null; then
131 echo "*** Cannot find 'automake'. ***"
132 exit 1
135 if ! which autoreconf &> /dev/null; then
136 echo "*** Cannot find 'autoreconf'. ***"
137 exit 1
140 if ! test -e /usr/share/aclocal/acx_pthread.m4; then
141 echo "*** Cannot find file '/usr/share/aclocal/acx_pthread.m4'. ***"
142 exit 1
146 # Add autoconf archive files.
149 mkdir -p m4
150 cp /usr/share/aclocal/acx_pthread.m4 m4/.
151 cp /usr/share/aclocal/ax_lang_compiler_ms.m4 m4/.
152 cp /usr/share/aclocal/ax_check_gl.m4 m4/.
153 cp /usr/share/aclocal/ax_check_glu.m4 m4/.
154 cp /usr/share/aclocal/ax_check_glut.m4 m4/.
157 # Make documentation
160 chmod a+x doc/make-changelog
161 chmod a+x doc/make-infos
162 XSLT_VERSION_INFO=`./version.sh -x`
163 export XSLT_VERSION_INFO
164 make -C doc ../TODO ../README ../ChangeLog ../NEWS
165 # XXX: Asciidoc considers out-of-directory includes unsafe.
166 a2x --asciidoc-opts="--unsafe" -f manpage doc/man/ale.1.txt
169 # Make web documentation
172 make -C doc/web
175 # Import GNU extension strndup
178 gnulib-tool --libtool --import strndup error strtod
181 # Placeholders for automake-mandated files.
184 # touch NEWS
185 # touch AUTHORS
188 # Use the automake-mandated spelling for the changelog.
191 # ln -s Changelog ChangeLog
194 # Run autotools' bootstrap script, adding things that automake thinks are
195 # missing, among other things (--install).
198 autoreconf --install
201 # Run automake again, with the --foreign option.
204 # echo ""
205 # echo "Rerunning automake with --foreign flag."
206 # automake --foreign
209 # Make wrapper script executable
212 chmod a+x ./ale
215 # Indicate that we're done.
218 echo ""
219 echo "Done."
222 # Tell the user what to do next.
225 echo
226 echo "To install:"
227 echo "1) Run './configure'."
228 echo "2) Run 'make'."
229 echo "3) Run 'make install'."