Remind about the gpg command lines
[platform/upstream/curl.git] / maketgz
1 #! /bin/sh
2 # Script to build release-archives with
3 #
4
5 echo "LIB version number?"
6 read version
7
8 libversion="$version"
9
10 #
11 # Now we have a section to get the major, minor and patch number from the
12 # full version string. We create a single hexadecimal number from it '0xMMmmpp'
13 #
14 perl='$a=<STDIN>;@p=split("[\\.-]",$a);for(0..2){printf STDOUT ("%02x",$p[0+$_]);}';
15
16 numeric=`echo $libversion | perl -e "$perl"`
17
18 echo "CURL version number?"
19 read curlversion
20
21 HEADER=include/curl/curl.h
22 CHEADER=src/version.h
23
24 # Replace version number in header file:
25 sed -e 's/^#define LIBCURL_VERSION .*/#define LIBCURL_VERSION "'$libversion'"/g' \
26     -e 's/^#define LIBCURL_VERSION_NUM .*/#define LIBCURL_VERSION_NUM 0x'$numeric'/g' \
27  $HEADER >$HEADER.new
28
29 # Save old header file
30 cp -p $HEADER $HEADER.old
31
32 # Make new header:
33 mv $HEADER.new $HEADER
34
35 # Replace version number in header file:
36 sed 's/#define CURL_VERSION.*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER >$CHEADER.new
37
38 echo "curl version $curlversion"
39 echo "libcurl version $libversion"
40 echo "libcurl numerical $numeric"
41
42 # Save old header file
43 cp -p $CHEADER $CHEADER.old
44
45 # Make new header:
46 mv $CHEADER.new $CHEADER
47
48 findprog()
49 {
50   file="$1"
51   for part in `echo $PATH| tr ':' ' '`; do
52     path="$part/$file"
53     if [ -x "$path" ]; then
54       # there it is!
55       return 1
56     fi
57   done
58
59   # no such executable
60   return 0
61 }
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 make html
89
90 # And the PDF versions
91 make pdf
92
93 ############################################################################
94 #
95 # Now run make dist to generate a tar.gz archive
96 #
97
98 targz="curl-$version.tar.gz"
99 make dist
100
101 ############################################################################
102 #
103 # Now make a bz2 archive from the tar.gz original
104 #
105
106 bzip2="curl-$version.tar.bz2"
107 echo "Generating $bzip2"
108 gzip -dc $targz | bzip2 - > $bzip2
109
110 ############################################################################
111 #
112 # Now make a zip archive from the tar.gz original
113 #
114 makezip ()
115 {
116   rm -rf $tempdir
117   mkdir $tempdir
118   cd $tempdir
119   gzip -dc ../$targz | tar -xf -
120   find . | zip $zip -@ >/dev/null
121   mv $zip ../
122   cd ..
123   rm -rf $tempdir
124 }
125
126 zip="curl-$version.zip"
127 echo "Generating $zip"
128 tempdir=".builddir"
129 makezip
130
131 echo "------------------"
132 echo "maketgz report:"
133 echo ""
134 ls -l $targz $bzip2 $zip
135
136 md5sum $targz $bzip2 $zip
137
138 echo "Run these commands:"
139 echo "gpg -b -a $targz"
140 echo "gpg -b -a $bzip2"
141 echo "gpg -b -a $zip"