From: Tim Kientzle Date: Mon, 14 Dec 2009 02:54:07 +0000 (-0500) Subject: Refactor the release-building scripts just a bit: X-Git-Tag: v2.8.0~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=192fd4ff94d3ddf8291de20e55d31baafc5c2de9;p=thirdparty%2Flibarchive.git Refactor the release-building scripts just a bit: * bump-version.sh actually bumps the 'version' value * clean.sh attempts to clean the local directory as thoroughly as possible * autogen.sh runs clean.sh, edits the current version value into configure.ac, archive.h, and archive_entry.h, re-runs autoconf/automake/etc, and does a ./configure && make distcheck to verify the distribution on the local system. SVN-Revision: 1736 --- diff --git a/Makefile.am b/Makefile.am index 6c3ddc62b..5638d7500 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,7 +34,8 @@ AM_CPPFLAGS=$(PLATFORMCPPFLAGS) EXTRA_DIST= \ CMakeLists.txt \ build/autogen.sh \ - build/release.sh \ + build/bump-version.sh \ + build/clean.sh \ build/cmake \ build/version \ build/windows \ diff --git a/build/autogen.sh b/build/autogen.sh index 03cd65737..8a9c9deb9 100755 --- a/build/autogen.sh +++ b/build/autogen.sh @@ -1,5 +1,7 @@ #!/bin/sh +PATH=/usr/local/gnu-autotools/bin/:$PATH +export PATH # Start from one level above the build directory if [ -f version ]; then @@ -11,6 +13,40 @@ if [ \! -f build/version ]; then exit 1 fi +# BSD make's "OBJDIR" support freaks out the automake-generated +# Makefile. Effectively disable it. +export MAKEOBJDIRPREFIX=/junk + +# Start from the build directory, where the version file is located +if [ -f build/version ]; then + cd build +fi + +if [ \! -f version ]; then + echo "Can't find version file" + exit 1 +fi + +# Update the build number in the 'version' file. +# Separate number from additional alpha/beta/etc marker +MARKER=`cat version | sed 's/[0-9.]//g'` +# Bump the number +VN=`cat version | sed 's/[^0-9.]//g'` +# Build out the string. +VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER" + +cd .. + +# Clean up the source dir as much as we can. +/bin/sh build/clean.sh + +# Substitute the integer version into Libarchive's archive.h +perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive.h +perl -p -i -e "s/^(#define\tARCHIVE_VERSION_STRING).*/\$1 \"libarchive $VS\"/" libarchive/archive.h +# Substitute versions into configure.ac as well +perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_S\]),.*\)/$1,['"$VS"'])/' configure.ac +perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_N\]),.*\)/$1,['"$VN"'])/' configure.ac + set -xe aclocal -I build/autoconf @@ -23,3 +59,6 @@ esac autoconf autoheader automake -a -c + +./configure +make distcheck diff --git a/build/bump-version.sh b/build/bump-version.sh new file mode 100755 index 000000000..0304cf3fb --- /dev/null +++ b/build/bump-version.sh @@ -0,0 +1,36 @@ +#!/bin/sh +v + +# Start from the build directory, where the version file is located +if [ -f build/version ]; then + cd build +fi + +if [ \! -f version ]; then + echo "Can't find version file" + exit 1 +fi + +# Update the build number in the 'version' file. +# Separate number from additional alpha/beta/etc marker +MARKER=`cat version | sed 's/[0-9.]//g'` +# Bump the number +VN=`cat version | sed 's/[^0-9.]//g'` +# Reassemble and write back out +VN=$(($VN + 1)) +rm -f version.old +mv version version.old +chmod +w version.old +echo $VN$MARKER > version +VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER" +cd .. + +ANNOUNCE=`date +"%b %d, %Y:"`" libarchive $VS released" + +echo $ANNOUNCE + +# Add a version notice to NEWS +mv NEWS NEWS.bak +chmod +w NEWS.bak +echo > NEWS +echo $ANNOUNCE >> NEWS +cat NEWS.bak >> NEWS diff --git a/build/clean.sh b/build/clean.sh new file mode 100755 index 000000000..b5b9c320f --- /dev/null +++ b/build/clean.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +if [ \! -f build/version ]; then + echo 'Must run the clean script from the top-level dir of the libarchive distribution' 1>&2 + exit 1 +fi + +# +# The automake-generated 'maintainer-clean' target does clean up a +# lot. If that fails, try plain 'clean' in case we're using the cmake +# or other makefile. But don't worry if we can't... +# +make maintainer-clean || make clean || true + +# If we're on BSD, blow away the build dir under /usr/obj +rm -rf /usr/obj`pwd` + +# +# Try to clean up a bit more... +# +find . -name '*~' | xargs rm +find . -name '*.rej' | xargs rm +find . -name '*.orig' | xargs rm +find . -name '*.o' | xargs rm +find . -name '*.po' | xargs rm +find . -name '*.lo' | xargs rm +find . -name '*.So' | xargs rm +find . -name '*.a' | xargs rm +find . -name '*.la' | xargs rm +find . -name '.depend' | xargs rm +find . -name '.dirstamp' | xargs rm +find . -name '.deps' | xargs rm -rf +find . -name '.libs' | xargs rm -rf +rm -rf autom4te.cache +rm -f bsdcpio bsdcpio_test bsdtar bsdtar_test libarchive_test +rm -f libtool aclocal.m4 config.h config.h.in +rm -f doc/man/* doc/pdf/* doc/wiki/* doc/html/* doc/text/* +rm -f config.log Makefile.in configure config.status stamp-h1 +rm -f libarchive/*.[35].gz libarchive/libarchive.so* +rm -f libarchive/test/libarchive_test libarchive/test/list.h +rm -f tar/*.1.gz tar/bsdtar tar/test/bsdtar_test tar/test/list.h +rm -f cpio/*.1.gz cpio/bsdcpio cpio/test/bsdcpio_test cpio/test/list.h +rm -f build/autoconf/compile build/autoconf/config.* build/autoconf/ltmain.sh +rm -f build/autoconf/install-sh build/autoconf/depcomp build/autoconf/missing +rm -f build/pkgconfig/libarchive.pc diff --git a/build/release.sh b/build/release.sh deleted file mode 100755 index c45acf83f..000000000 --- a/build/release.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh +v - -PATH=/usr/local/gnu-autotools/bin/:$PATH -export PATH - -# BSD make's "OBJDIR" support freaks out the automake-generated -# Makefile. Effectively disable it. -export MAKEOBJDIRPREFIX=/junk - -# Start from the build directory, where the version file is located -if [ -f build/version ]; then - cd build -fi - -if [ \! -f version ]; then - echo "Can't find version file" - exit 1 -fi - -# Update the build number in the 'version' file. -# Separate number from additional alpha/beta/etc marker -MARKER=`cat version | sed 's/[0-9.]//g'` -# Bump the number -VN=`cat version | sed 's/[^0-9.]//g'` -# Reassemble and write back out -VN=$(($VN + 1)) -rm -f version.old -mv version version.old -chmod +w version.old -echo $VN$MARKER > version -# Build out the string. -VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER" - -cd .. - -# Substitute the integer version into Libarchive's archive.h -perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive.h -perl -p -i -e "s/^(#define\tARCHIVE_VERSION_STRING).*/\$1 \"libarchive $VS\"/" libarchive/archive.h -# Substitute the string version into tar and cpio Makefiles -perl -p -i -e "s/^(BSDTAR_VERSION_STRING)=.*/\$1=$VS/" tar/Makefile -perl -p -i -e "s/^(BSDCPIO_VERSION_STRING)=.*/\$1=$VS/" cpio/Makefile -# Substitute versions into configure.ac as well -perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_S\]),.*\)/$1,['"$VS"'])/' configure.ac -perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_N\]),.*\)/$1,['"$VN"'])/' configure.ac - -# Add a version notice to NEWS -mv NEWS NEWS.bak -chmod +w NEWS.bak -echo > NEWS -echo `date +"%b %d, %Y:"` libarchive $VS released >> NEWS -cat NEWS.bak >> NEWS - -# Clean up first -rm -rf /usr/obj`pwd` -(cd examples/minitar && make cleandir && make clean) -(cd libarchive && make cleandir && make clean) -(cd libarchive/test && make cleandir && make clean && make list.h) -(cd tar && make cleandir && make clean) - -# Build the libarchive distfile -/bin/sh build/autogen.sh -./configure -make distcheck