]> sjero.net Git - wget/blob - util/dist-wget
[svn] Merge of fix for bugs 20341 and 20410.
[wget] / util / dist-wget
1 #!/bin/sh
2
3 # Copyright (C) 2001 Free Software Foundation, Inc.
4
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # In addition, as a special exception, the Free Software Foundation
19 # gives permission to link the code of its release of Wget with the
20 # OpenSSL project's "OpenSSL" library (or with modified versions of it
21 # that use the same license as the "OpenSSL" library), and distribute
22 # the linked executables.  You must obey the GNU General Public License
23 # in all respects for all of the code used other than "OpenSSL".  If you
24 # modify this file, you may extend this exception to your version of the
25 # file, but you are not obligated to do so.  If you do not wish to do
26 # so, delete this exception statement from your version.
27
28 ##
29 #
30 # This script creates a Wget distribution (wget-VERSION.tar.gz).
31 # It uses `make dist' to do most of the work, but corrects some
32 # things that `make dist' doesn't and can't do.  Specifically:
33 #
34 # * Checks out the clean source from the Subversion repository to a
35 #   temporary directory.
36 # * Runs autoconf, configure and `make' in the doc and po subdirs to
37 #   make sure that all the generated files, such as `configure',
38 #   `wget.info', and translated PO files, end up in the distribution.
39 # * Optionally changes src/version.c and doc/version.texi to the
40 #   version forced by `--force-version'.
41 # * Runs `make dist' to produce the archive.
42 # * Removes the checkout.
43 #
44 # For example, to produce a Wget beta based on the latest sources on
45 # the trunk, with version changed to "1.23-beta10", run `dist-wget
46 # --force-version 1.23-beta10'.  You can choose which sources will be
47 # used by specifying `-b PATH' ("trunk" by default) in combination
48 # with one of `-D DATE' or `-r REVISION' (the latest revision by
49 # default).
50 #
51 # Use the MAKE environment variable to specify a different version of
52 # make, for example MAKE=gmake dist-wget ...
53 #
54 ##
55
56 set -e
57
58 SVNURL=http://svn.dotsrc.org/repo/wget/
59 SUBDIR=wget.checkout.$$
60 DEBUG=no
61
62 EXPORT_PATH=trunk
63 EXPORT_REVISION=HEAD
64 VERSION=
65 MAKE=${MAKE-make}
66
67 if test x"$TMPDIR" = x
68 then
69   TMPDIR=/tmp
70 fi
71 DEST_DIR=`pwd`
72
73 while test x"$*" != x
74 do
75   case "$1" in
76     -d)
77       DEBUG=yes
78       ;;
79     -b)
80       shift
81       EXPORT_PATH=$1
82       ;;
83     -D)
84       shift
85       # Subversion uses the -r {DATE} syntax for specifying revisions
86       # based on dates.
87       EXPORT_REVISION={$1}
88       ;;
89     -r)
90       shift
91       EXPORT_REVISION=$1
92       ;;
93     --force-version)
94       shift
95       VERSION=$1
96       ;;
97     *)
98       echo "Usage: $0 [-d] [-b BRANCH-PATH] [-r REVISION | -D DATE]" >&2
99       exit 1
100   esac
101   shift
102 done
103
104 # Resolve echo -n incompatibilities.
105 e_n=-n
106 e_c=
107 if test x"`(echo -n foo; echo bar)`" != xfoobar; then
108   e_n=
109   e_c='\c'
110 fi
111
112 # File for output/errors redirection.
113 O=$DEST_DIR/dist-output
114
115 cd $TMPDIR
116
117 echo "Building wget dist in $TMPDIR/$SUBDIR."
118 echo "Output from commands is in $O."
119
120 echo "-----------" >$O
121
122 # Checkout clean sources from the repository.
123 echo $e_n "Exporting $SVNURL$EXPORT_PATH/ (-r $EXPORT_REVISION) to $TMPDIR/$SUBDIR... $e_c"
124 svn export -r "$EXPORT_REVISION" "$SVNURL/$EXPORT_PATH/" $SUBDIR 1>>$O 2>&1
125 echo "done."
126
127 cd $SUBDIR
128
129 # Force the version if required.
130 if test x"$VERSION" != x
131 then
132   echo "Forcing version to $VERSION."
133   echo "char *version_string = \"$VERSION\";" > src/version.c
134   echo "@set VERSION $VERSION" > doc/version.texi
135 fi
136
137 # Create configure and friends.
138 if test ! -f configure; then
139   echo $e_n "Creating \`configure' and \`src/config.h'... $e_c"
140   ./autogen.sh 1>>$O 2>&1
141   echo "done."
142 fi
143
144 # Remove `Makefile' if it already exists.
145 if test -f Makefile; then
146   echo $e_n "Cleaning old Makefiles with \`$MAKE distclean'... $e_c"
147   $MAKE distclean 1>>$O 2>&1
148   echo "done."
149 fi
150
151 # Create a new `Makefile'.
152 echo $e_n "Running configure... $e_c"
153 CFLAGS=-g ./configure 1>>$O 2>&1
154 echo "done."
155
156 # Now build the MO files.
157 echo $e_n "Building MO files out of PO files... $e_c"
158 cd po
159 $MAKE 1>>$O 2>&1
160 cd ..
161 echo "done."
162
163 # Now build the Info documentation and the man page.
164 echo $e_n "Building Info and man documentation... $e_c"
165 cd doc
166 $MAKE 1>>$O 2>&1
167 cd ..
168 echo "done."
169
170 # Create the distribution file.
171 echo $e_n "Creating distribution tarball... $e_c"
172 $MAKE dist 1>>$O 2>&1
173 archive=`echo wget-*.tar.gz`
174 mv "$archive" $DEST_DIR
175 echo "$archive"
176
177 cd ..
178
179 if test $DEBUG = no; then
180   rm -rf $SUBDIR 1>>$O 2>&1
181 fi