mxml/makesrcdist
2024-11-18 09:48:30 -05:00

98 lines
2.4 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
#
# makesrcdist - make a source distribution of Mini-XML.
#
# https://www.msweet.org/mxml
#
# Copyright © 2003-2024 by Michael R Sweet.
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
#
if test $# != 1; then
echo "Usage: ./makesrcdist version"
exit 1
fi
# Check that various files are up-to-date...
version=$1
version_major=$(echo $version | awk -F. '{print $1}')
version_minor=$(echo $version | awk -F. '{print $2}')
status=0
if ! grep -q "Changes in Mini-XML $version" CHANGES.md; then
echo "Update CHANGES.md."
status=1
fi
if test "$(grep AC_INIT configure.ac | awk '{print $2}')" != "[$version],"; then
echo "Update configure.ac."
status=1
fi
if test "$(grep MXML_MAJOR_VERSION mxml.h | awk '{print $4}')" != "$version_major"; then
echo "Update MXML_MAJOR_VERSION in mxml.h."
status=1
fi
if test "$(grep MXML_MINOR_VERSION mxml.h | awk '{print $4}')" != "$version_minor"; then
echo "Update MXML_MINOR_VERSION in mxml.h."
status=1
fi
if ! grep -q "Version: $version" mxml.spec; then
echo "Update mxml.spec."
status=1
fi
if test "$(grep MXML_VERSION linux/config.h | awk '${print $5}')" != "v$version\""; then
echo "Update MXML_VERSION in linux/config.h."
status=1
fi
if test "$(grep MXML_VERSION vcnet/config.h | awk '${print $5}')" != "v$version\""; then
echo "Update MXML_VERSION in vcnet/config.h."
status=1
fi
if ! grep -q "<version>$version</version>" vcnet/libmxml4_native.nuspec; then
echo "Update vcnet/libmxml4_native.nuspec."
status=1
fi
if ! grep -q "version=\"$version\" />" vcnet/libmxml4_native.nuspec; then
echo "Update vcnet/libmxml4_native.nuspec."
status=1
fi
if ! grep -q "<version>$version</version>" vcnet/libmxml4_native.redist.nuspec; then
echo "Update vcnet/libmxml4_native.redist.nuspec."
status=1
fi
if test "$(grep MXML_VERSION xcode/config.h | awk '${print $5}')" != "v$version\""; then
echo "Update MXML_VERSION in xcode/config.h."
status=1
fi
if test $status = 1; then
exit 1
fi
# Create tag and archives...
echo Creating tag for release...
git tag -m "Tag $version" v$version
git push origin v$version
echo Creating mxml-$version.tar.gz...
git archive --format tar --prefix=mxml-$version/ HEAD | gzip -v9 >mxml-$version.tar.gz
gpg --detach-sign mxml-$version.tar.gz
echo Creating mxml-$version.zip...
git archive --format zip --prefix=mxml-$version/ HEAD >mxml-$version.zip
gpg --detach-sign mxml-$version.zip