11cb0ef41Sopenharmony_ci#!/usr/bin/env perl 21cb0ef41Sopenharmony_ci# Copyright (C) Daniel Stenberg 31cb0ef41Sopenharmony_ci# SPDX-License-Identifier: MIT 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci$version = $ARGV[0]; 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciif($version eq "") { 81cb0ef41Sopenharmony_ci print "Enter version number!\n"; 91cb0ef41Sopenharmony_ci exit; 101cb0ef41Sopenharmony_ci} 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ciif(!-f "include/ares.h") { 131cb0ef41Sopenharmony_ci print "run this script in the ares source root dir\n"; 141cb0ef41Sopenharmony_ci exit; 151cb0ef41Sopenharmony_ci} 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_cimy ($major, $minor, $patch)=split(/\./, $version); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ci$major += 0; 201cb0ef41Sopenharmony_ci$minor += 0; 211cb0ef41Sopenharmony_ci$patch += 0; 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ciopen(VER, "<include/ares_version.h") || 241cb0ef41Sopenharmony_ci die "can't open include/ares_version.h"; 251cb0ef41Sopenharmony_ciopen(NEWV, ">include/ares_version.h.dist"); 261cb0ef41Sopenharmony_ciwhile(<VER>) { 271cb0ef41Sopenharmony_ci $_ =~ s/^\#define ARES_VERSION_MAJOR .*/\#define ARES_VERSION_MAJOR $major/; 281cb0ef41Sopenharmony_ci $_ =~ s/^\#define ARES_VERSION_MINOR .*/\#define ARES_VERSION_MINOR $minor/; 291cb0ef41Sopenharmony_ci $_ =~ s/^\#define ARES_VERSION_PATCH .*/\#define ARES_VERSION_PATCH $patch/; 301cb0ef41Sopenharmony_ci $_ =~ s/^\#define ARES_VERSION_STR .*/\#define ARES_VERSION_STR \"$version\"/; 311cb0ef41Sopenharmony_ci 321cb0ef41Sopenharmony_ci print NEWV $_; 331cb0ef41Sopenharmony_ci} 341cb0ef41Sopenharmony_ciclose(VER); 351cb0ef41Sopenharmony_ciclose(NEWV); 361cb0ef41Sopenharmony_ciprint "include/ares_version.h.dist created\n"; 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_ciif(!-f "configure") { 391cb0ef41Sopenharmony_ci print "running buildconf\n"; 401cb0ef41Sopenharmony_ci `./buildconf`; 411cb0ef41Sopenharmony_ci} 421cb0ef41Sopenharmony_ciprint "adding $version in the configure.ac file\n"; 431cb0ef41Sopenharmony_ci`sed -e 's/AC_INIT.*/AC_INIT([c-ares], [$version],/' < configure.ac > configure.ac.dist`; 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ciprint "adding $version in the CMakeLists.txt file\n"; 461cb0ef41Sopenharmony_ci`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`; 471cb0ef41Sopenharmony_ci 481cb0ef41Sopenharmony_ci# now make a new configure script with this 491cb0ef41Sopenharmony_ciprint "makes a new configure script\n"; 501cb0ef41Sopenharmony_ci`autoconf configure.ac.dist >configure`; 511cb0ef41Sopenharmony_ci 521cb0ef41Sopenharmony_ci# now run this new configure to get a fine makefile 531cb0ef41Sopenharmony_ciprint "running configure\n"; 541cb0ef41Sopenharmony_ci`./configure`; 551cb0ef41Sopenharmony_ci 561cb0ef41Sopenharmony_ciprint "produce CHANGES\n"; 571cb0ef41Sopenharmony_ci`git log --pretty=fuller --no-color --date=short --decorate=full -1000 | ./git2changes.pl > CHANGES.dist`; 581cb0ef41Sopenharmony_ci 591cb0ef41Sopenharmony_ci# now make the actual tarball 601cb0ef41Sopenharmony_ciprint "running make dist\n"; 611cb0ef41Sopenharmony_ci`make dist VERSION=$version`; 621cb0ef41Sopenharmony_ci 631cb0ef41Sopenharmony_ci# remove temporary sourced man pages 641cb0ef41Sopenharmony_ci`make -s clean-sourced-manpages`; 651cb0ef41Sopenharmony_ci 661cb0ef41Sopenharmony_ciprint "removing temporary configure.ac file\n"; 671cb0ef41Sopenharmony_ci`rm configure.ac.dist`; 681cb0ef41Sopenharmony_ciprint "removing temporary ares_version.h file\n"; 691cb0ef41Sopenharmony_ci`rm include/ares_version.h.dist`; 701cb0ef41Sopenharmony_ci 711cb0ef41Sopenharmony_ciprint "NOTE: now tag this release!\n"; 72