new
[libcurl.git] / maketgz
blob6ad429b5d76821660e0d9ac4cd03419c5688616a
1 #! /bin/sh
2 # Script to build release-archives with
5 echo "LIB version number?"
6 read version
8 libversion="$version"
10 echo "CURL version number?"
11 read curlversion
13 HEADER=include/curl/curl.h
14 CHEADER=src/version.h
17 # Replace version number in header file:
18 sed 's/#define LIBCURL_VERSION.*/#define LIBCURL_VERSION "'$libversion'"/g' $HEADER >$HEADER.new
20 # Save old header file
21 cp -p $HEADER $HEADER.old
23 # Make new header:
24 mv $HEADER.new $HEADER
26 # Replace version number in header file:
27 sed 's/#define CURL_VERSION.*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER >$CHEADER.new
29 # Save old header file
30 cp -p $CHEADER $CHEADER.old
32 # Make new header:
33 mv $CHEADER.new $CHEADER
35 findprog()
37 file="$1"
38 for part in `echo $PATH| tr ':' ' '`; do
39 path="$part/$file"
40 if [ -x "$path" ]; then
41 # there it is!
42 return 1
44 done
46 # no such executable
47 return 0
50 ############################################################################
52 # If we have autoconf we can just as well update configure.in to contain our
53 # brand new version number:
56 if { findprog autoconf >/dev/null 2>/dev/null; } then
57 echo "- No autoconf found, we leave configure as it is"
58 else
59 # Replace version number in configure.in file:
61 CONF="configure.in"
63 sed 's/^AM_INIT_AUTOMAKE.*/AM_INIT_AUTOMAKE(curl,"'$version'")/g' $CONF >$CONF.new
65 # Save old file
66 cp -p $CONF $CONF.old
68 # Make new configure.in
69 mv $CONF.new $CONF
71 # Update the configure script
72 echo "Runs autoconf"
73 autoconf
76 ############################################################################
78 # automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
79 # been modified.
82 if { findprog automake >/dev/null 2>/dev/null; } then
83 echo "- Could not find or run automake, I hope you know what you're doing!"
84 else
85 echo "Runs automake --include-deps"
86 automake --include-deps
89 ############################################################################
91 # Now run make first to make the file dates decent and make sure that it
92 # compiles just before release!
95 make
97 # get current dir
98 dir=`pwd`
100 # Get basename
101 orig=`basename $dir`
103 # Get the left part of the dash (-)
104 new=`echo $orig | cut -d- -f1`
106 # Build new directory name
107 n=$new-$version;
109 # Tell the world what we're doing
110 echo "Copying files into distribution archive";
112 if [ -r $n ]; then
113 echo "Directory already exists!"
114 exit
117 # Create the new dir
118 mkdir $n
120 # Copy all relevant files, with path and permissions!
121 tar -cf - `cat FILES` | (cd $n; tar -xBpf -)
123 # Create the distribution root Makefile from Makefile.dist
124 cp -p Makefile.dist $n/Makefile
126 ############################################################################
128 # Replace @SHELL@ with /bin/sh in the Makefile.in files!
130 echo "Replace @SHELL@ with /bin/sh in the Makefile.in files"
131 temp=/tmp/curl$$
132 for file in Makefile.in lib/Makefile.in src/Makefile.in; do
133 in="$n/$file"
134 sed "s:@SHELL@:/bin/sh:g" $in >$temp
135 cp $temp $in
136 done
137 rm -rf $temp
139 # Tell the world what we're doing
140 echo "creates $n.tar.gz";
142 # Make a tar archive of it all
143 tar -cvf $n.tar $n
145 # gzip the archive
146 gzip $n.tar
148 # Make it world readable
149 chmod a+r $n.tar.gz ;
151 # Delete the temp dir
152 rm -rf $n