1#!/usr/bin/env perl 2 3$version = $ARGV[0]; 4 5if($version eq "") { 6 print "Enter version number!\n"; 7 exit; 8} 9 10if(!-f "include/ares.h") { 11 print "run this script in the ares source root dir\n"; 12 exit; 13} 14 15my ($major, $minor, $patch)=split(/\./, $version); 16 17$major += 0; 18$minor += 0; 19$patch += 0; 20 21open(VER, "<include/ares_version.h") || 22 die "can't open include/ares_version.h"; 23open(NEWV, ">include/ares_version.h.dist"); 24while(<VER>) { 25 $_ =~ s/^\#define ARES_VERSION_MAJOR .*/\#define ARES_VERSION_MAJOR $major/; 26 $_ =~ s/^\#define ARES_VERSION_MINOR .*/\#define ARES_VERSION_MINOR $minor/; 27 $_ =~ s/^\#define ARES_VERSION_PATCH .*/\#define ARES_VERSION_PATCH $patch/; 28 $_ =~ s/^\#define ARES_VERSION_STR .*/\#define ARES_VERSION_STR \"$version\"/; 29 30 print NEWV $_; 31} 32close(VER); 33close(NEWV); 34print "include/ares_version.h.dist created\n"; 35 36if(!-f "configure") { 37 print "running buildconf\n"; 38 `./buildconf`; 39} 40print "adding $version in the configure.ac file\n"; 41`sed -e 's/AC_INIT.*/AC_INIT([c-ares], [$version],/' < configure.ac > configure.ac.dist`; 42 43print "adding $version in the CMakeLists.txt file\n"; 44`sed -e 's/SET.*CARES_VERSION.*/SET (CARES_VERSION "$version")/' < CMakeLists.txt > CMakeLists.txt.dist && rm -f CMakeLists.txt && mv CMakeLists.txt.dist CMakeLists.txt`; 45 46# now make a new configure script with this 47print "makes a new configure script\n"; 48`autoconf configure.ac.dist >configure`; 49 50# now run this new configure to get a fine makefile 51print "running configure\n"; 52`./configure`; 53 54print "produce CHANGES\n"; 55`git log --pretty=fuller --no-color --date=short --decorate=full -1000 | ./git2changes.pl > CHANGES.dist`; 56 57# now make the actual tarball 58print "running make dist\n"; 59`make dist VERSION=$version`; 60 61# remove temporay sourced man pages 62`make -s clean-sourced-manpages`; 63 64print "removing temporary configure.ac file\n"; 65`rm configure.ac.dist`; 66print "removing temporary ares_version.h file\n"; 67`rm include/ares_version.h.dist`; 68 69print "NOTE: now tag this release!\n"; 70