3 # Copyright 2008 David Hilvert <dhilvert@gmail.com>
5 # This file is part of libale.
7 # libale is free software: you can redistribute it and/or modify it under the
8 # terms of the GNU Affero General Public License as published by the Free
9 # Software Foundation, either version 3 of the License, or (at your option)
12 # libale is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
17 # You should have received a copy of the GNU Affero General Public License
18 # along with libale. If not, see <http://www.gnu.org/licenses/>.
21 ### 'bootstrap' generates build files for distribution.
24 function bootstrap_error
{
29 # If a version argument is given, generate a tarball.
32 if test "x$1" = "x-v"; then
35 if test "x$BOOTSTRAP_VERSION" = "x"; then
36 echo "bootstrap: -v requires a version argument."
42 REMOTE_REPO
=`./version.sh git-repo`
44 GENERIC_PACKAGE_NAME
=`./version.sh package-name`
46 PACKAGE_NAME
="$GENERIC_PACKAGE_NAME-$BOOTSTRAP_VERSION"
52 if test $SOURCE_DIR = `pwd`; then
53 echo "$0: could not change directory from source."
58 if ! git clone
"$SOURCE_DIR" "$PACKAGE_NAME" && ! git clone
"$REMOTE_REPO" "$PACKAGE_NAME"; then
59 echo "$0: Could not perform git clone."
67 if ! git checkout
$BOOTSTRAP_VERSION && ! git checkout origin
/$BOOTSTRAP_VERSION; then
69 echo "$0: Could not check out version $BOOTSTRAP_VERSION."
75 mv .git ..
/git-moved-
$BOOTSTRAP_VERSION
77 if grep ":version:" VERSION
; then
78 (echo ":%s/^:version:.*/:version: $BOOTSTRAP_VERSION/"; echo ":wq") | ex VERSION
79 elif test -e VERSION
; then
80 echo "$BOOTSTRAP_VERSION" > VERSION
83 if test -e bootstrap
&& (! chmod a
+x bootstrap ||
! .
/bootstrap
); then
84 echo "$0: Nested bootstrap failed."
92 tar czf
$PACKAGE_NAME.
tar.gz
$PACKAGE_NAME
96 mv $TEMPDIR/$PACKAGE_NAME.
tar.gz .
100 echo "Bootstrapped package created as $PACKAGE_NAME.tar.gz."
106 # Check for the existence of a configure script.
109 if test -e configure
&& test "x$1" != "x-r"; then
112 echo "1) Run './configure'."
113 echo "2) Run 'make'."
114 echo "3) Run 'make install'."
116 echo "* To regenerate configure, run '$0 -r'"
122 # Look for files we might need.
125 if ! test -e /usr
/share
/aclocal
/ax_cflags_warn_all.
m4; then
126 echo "Cannot find /usr/share/aclocal/ax_cflags_warn_all.m4. Is aclocal installed?"
130 if ! which autoreconf
&> /dev
/null
; then
131 echo "Cannot find autoreconf. Is autoconf installed?"
135 if ! which automake
&> /dev
/null
; then
136 echo "Cannot find automake."
140 if ! which libtool
&> /dev
/null
; then
141 echo "Cannot find libtool."
146 # Add autoconf archive files.
149 cp /usr
/share
/aclocal
/ax_cflags_warn_all.
m4 m
4/.
150 cp /usr
/share
/aclocal
/ac_c_long_long.
m4 m
4/.
153 # Run autotools' bootstrap script, adding things that automake thinks are
154 # missing, among other things (--install).
160 # Indicate that we're done.
167 # Tell the user what to do next.
172 echo "1) Run './configure'."
173 echo "2) Run 'make'."
174 echo "3) Run 'make install'."