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