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