]> sjero.net Git - wget/blob - util/dist-wget
ed6e9ded41e86e566ddd60c18e407a6e4d9d5244
[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 CVS source from the repository to a temporary
36 #   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 CVS sources,
46 # with version "1.23-beta10", run `dist-wget --force-version 1.23-beta10'.
47 # You can choose which sources will be used by specifying `-D DATE'
48 # or `-r TAG'.
49 #
50 ##
51
52 set -e
53
54 CVSROOT=:pserver:cvs@sunsite.dk:/pack/anoncvs
55 SUBDIR=wget.cvs.$$
56 DEBUG=no
57
58 EXPORT_TAG='-r HEAD'
59 VERSION=
60 MAKE=${MAKE-make}
61
62 if test x"$TMPDIR" = x
63 then
64   TMPDIR=/tmp
65 fi
66 DEST_DIR=`pwd`
67
68 while test x"$*" != x
69 do
70   case "$1" in
71     -d)
72       DEBUG=yes
73       ;;
74     -D)
75       shift
76       EXPORT_TAG="-D $1"
77       ;;
78     -r)
79       shift
80       EXPORT_TAG="-r $1"
81       ;;
82     --force-version)
83       shift
84       VERSION=$1
85       ;;
86     *)
87       echo "Usage: $0 [-d] [-r TAG | -D DATE]" >&2
88       exit 1
89   esac
90   shift
91 done
92
93 # Resolve echo -n incompatibilities.
94 e_n=-n
95 e_c=
96 if test x"`(echo -n foo; echo bar)`" != xfoobar; then
97   e_n=
98   e_c='\c'
99 fi
100
101 # File for output/errors redirection.
102 O=$DEST_DIR/dist-output
103
104 cd $TMPDIR
105
106 echo "Building wget dist in $TMPDIR/$SUBDIR."
107 echo "Output from commands is in $O."
108
109 echo "-----------" >$O
110
111 # Checkout clean sources from the repository.
112 echo $e_n "Exporting ($EXPORT_TAG) out the CVS tree to $TMPDIR/$SUBDIR... $e_c"
113 cvs -d $CVSROOT export $EXPORT_TAG -d $SUBDIR wget 1>>$O 2>&1
114 echo "done."
115
116 cd $SUBDIR
117
118 # Remove the dummy `Branches' directory.
119 rm -rf Branches 1>>$O 2>&1
120
121 # Force the version if required.
122 if test x"$VERSION" != x
123 then
124   echo "Forcing version to $VERSION."
125   echo "char *version_string = \"$VERSION\";" > src/version.c
126   echo "@set VERSION $VERSION" > doc/version.texi
127 fi
128
129 # Create configure and friends.
130 if test ! -f configure; then
131   echo $e_n "Creating \`configure' from \`configure.in'... $e_c"
132   $MAKE -f Makefile.cvs 1>>$O 2>&1
133   echo "done."
134 fi
135
136 # Remove `Makefile' if it already exists.
137 if test -f Makefile; then
138   echo $e_n "Cleaning old Makefiles with \`$MAKE distclean'... $e_c"
139   $MAKE distclean 1>>$O 2>&1
140   echo "done."
141 fi
142
143 # Create a new `Makefile'.
144 echo $e_n "Running configure... $e_c"
145 CFLAGS=-g ./configure 1>>$O 2>&1
146 echo "done."
147
148 # Now build the MO files.
149 echo $e_n "Building MO files out of PO files... $e_c"
150 cd po
151 $MAKE 1>>$O 2>&1
152 cd ..
153 echo "done."
154
155 # Now build the Info documentation and the man page.
156 echo $e_n "Building Info and man documentation... $e_c"
157 cd doc
158 $MAKE 1>>$O 2>&1
159 cd ..
160 echo "done."
161
162 # Create the distribution file.
163 echo $e_n "Creating distribution tarball... $e_c"
164 $MAKE dist 1>>$O 2>&1
165 archive=`echo wget-*.tar.gz`
166 mv "$archive" $DEST_DIR
167 echo "$archive"
168
169 cd ..
170
171 if test $DEBUG = no; then
172   rm -rf $SUBDIR 1>>$O 2>&1
173 fi