]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/curl/maketgz
Various Mac OS X tweaks to get this to build. Probably breaking things.
[icculus/iodoom3.git] / neo / curl / 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=`echo "obase=16; $major*256*256 + $minor*256 + $patch" | bc`
22
23 HEADER=include/curl/curl.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 echo "curl version $curlversion"
38 echo "libcurl version $libversion"
39 echo "libcurl numerical $numeric"
40
41 findprog()
42 {
43   file="$1"
44   for part in `echo $PATH| tr ':' ' '`; do
45     path="$part/$file"
46     if [ -x "$path" ]; then
47       # there it is!
48       return 1
49     fi
50   done
51
52   # no such executable
53   return 0
54 }
55
56 ############################################################################
57 #
58 # Enforce a rerun of configure (updates the VERSION)
59 #
60
61 echo "Re-running config.status"
62 ./config.status --recheck >/dev/null
63
64 ############################################################################
65 #
66 # automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
67 # been modified.
68 #
69
70 if { findprog automake >/dev/null 2>/dev/null; } then
71   echo "- Could not find or run automake, I hope you know what you're doing!"
72 else
73   echo "Runs automake --include-deps"
74   automake --include-deps Makefile >/dev/null
75 fi
76
77 ############################################################################
78 #
79 # Make sure we have updated HTML versions of all man pages:
80 #
81 echo "make html"
82 make -s html
83
84 # And the PDF versions
85 echo "make pdf"
86 make -s pdf
87
88 ############################################################################
89 #
90 # Now run make dist to generate a tar.gz archive
91 #
92
93 echo "make dist"
94 targz="curl-$version.tar.gz"
95 make -s dist VERSION=$version
96
97 ############################################################################
98 #
99 # Now make a bz2 archive from the tar.gz original
100 #
101
102 bzip2="curl-$version.tar.bz2"
103 echo "Generating $bzip2"
104 gzip -dc $targz | bzip2 - > $bzip2
105
106 ############################################################################
107 #
108 # Now make a zip archive from the tar.gz original
109 #
110 makezip ()
111 {
112   rm -rf $tempdir
113   mkdir $tempdir
114   cd $tempdir
115   gzip -dc ../$targz | tar -xf -
116   find . | zip $zip -@ >/dev/null
117   mv $zip ../
118   cd ..
119   rm -rf $tempdir
120 }
121
122 zip="curl-$version.zip"
123 echo "Generating $zip"
124 tempdir=".builddir"
125 makezip
126
127 echo "------------------"
128 echo "maketgz report:"
129 echo ""
130 ls -l $targz $bzip2 $zip
131
132 md5sum $targz $bzip2 $zip
133
134 echo "Run these commands:"
135 echo "gpg -b -a $targz"
136 echo "gpg -b -a $bzip2"
137 echo "gpg -b -a $zip"