make REALLY sure src/config.h.in is a copy of lib/config.h.in
[platform/upstream/curl.git] / maketgz
1 #! /bin/sh
2 # Script to build release-archives with
3 #
4
5 version=$1
6
7 if [ -z "$version" ]; then
8   echo "Specify a version number!"
9   exit
10 fi
11
12 libversion="$version"
13
14 # we make curl the same version as libcurl
15 curlversion=$libversion
16
17 major=`echo $libversion |cut -d. -f1 | sed -e "s/[^0-9]//g"`
18 minor=`echo $libversion |cut -d. -f2 | sed -e "s/[^0-9]//g"`
19 patch=`echo $libversion |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
20
21 numeric=`perl -e 'printf("%02x%02x%02x\n", '"$major, $minor, $patch);"`
22
23 HEADER=include/curl/curlver.h
24 CHEADER=src/version.h
25
26 # Replace version number in header file:
27 sed -e 's/^#define LIBCURL_VERSION .*/#define LIBCURL_VERSION "'$libversion'"/g' \
28     -e 's/^#define LIBCURL_VERSION_NUM .*/#define LIBCURL_VERSION_NUM 0x'$numeric'/g' \
29     -e 's/^#define LIBCURL_VERSION_MAJOR .*/#define LIBCURL_VERSION_MAJOR '$major'/g' \
30     -e 's/^#define LIBCURL_VERSION_MINOR .*/#define LIBCURL_VERSION_MINOR '$minor'/g' \
31     -e 's/^#define LIBCURL_VERSION_PATCH .*/#define LIBCURL_VERSION_PATCH '$patch'/g' \
32  $HEADER >$HEADER.dist
33
34 # Replace version number in header file:
35 sed 's/#define CURL_VERSION .*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER >$CHEADER.dist
36
37 # Replace version number in plist file:
38 PLIST=lib/libcurl.plist
39 sed "s/7\.12\.3/$libversion/g" $PLIST > $PLIST.dist
40
41 echo "curl version $curlversion"
42 echo "libcurl version $libversion"
43 echo "libcurl numerical $numeric"
44
45 findprog()
46 {
47   file="$1"
48   for part in `echo $PATH| tr ':' ' '`; do
49     path="$part/$file"
50     if [ -x "$path" ]; then
51       # there it is!
52       return 1
53     fi
54   done
55
56   # no such executable
57   return 0
58 }
59
60 echo "maketgz: cp lib/config.h.in src/config.h.in"
61 cp lib/config.h.in src/config.h.in
62
63 ############################################################################
64 #
65 # Enforce a rerun of configure (updates the VERSION)
66 #
67
68 echo "Re-running config.status"
69 ./config.status --recheck >/dev/null
70
71 ############################################################################
72 #
73 # automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
74 # been modified.
75 #
76
77 if { findprog automake >/dev/null 2>/dev/null; } then
78   echo "- Could not find or run automake, I hope you know what you're doing!"
79 else
80   echo "Runs automake --include-deps"
81   automake --include-deps Makefile >/dev/null
82 fi
83
84 ############################################################################
85 #
86 # Make sure we have updated HTML versions of all man pages:
87 #
88 echo "make html"
89 make -s html
90
91 # And the PDF versions
92 echo "make pdf"
93 make -s pdf
94
95 ############################################################################
96 #
97 # Now run make dist to generate a tar.gz archive
98 #
99
100 echo "make dist"
101 targz="curl-$version.tar.gz"
102 make -s dist VERSION=$version
103
104 ############################################################################
105 #
106 # Now make a bz2 archive from the tar.gz original
107 #
108
109 bzip2="curl-$version.tar.bz2"
110 echo "Generating $bzip2"
111 gzip -dc $targz | bzip2 - > $bzip2
112
113 ############################################################################
114 #
115 # Now make a zip archive from the tar.gz original
116 #
117 makezip ()
118 {
119   rm -rf $tempdir
120   mkdir $tempdir
121   cd $tempdir
122   gzip -dc ../$targz | tar -xf -
123   find . | zip $zip -@ >/dev/null
124   mv $zip ../
125   cd ..
126   rm -rf $tempdir
127 }
128
129 zip="curl-$version.zip"
130 echo "Generating $zip"
131 tempdir=".builddir"
132 makezip
133
134 echo "------------------"
135 echo "maketgz report:"
136 echo ""
137 ls -l $targz $bzip2 $zip
138
139 md5sum $targz $bzip2 $zip
140
141 echo "Run these commands:"
142 echo "gpg -b -a $targz"
143 echo "gpg -b -a $bzip2"
144 echo "gpg -b -a $zip"