lw-build-system/scripts/release.sh

93 lines
2.0 KiB
Bash
Raw Normal View History

#!/bin/sh
2006-07-28 10:54:59 +01:00
# lw-build-system/scripts/release.sh
2006-07-24 14:24:06 +01:00
#
2006-07-28 10:54:59 +01:00
# (c)2006, Laurence Withers, <l@lwithers.me.uk>.
2007-10-14 11:31:40 +01:00
# Released under the GNU GPLv3. See file COPYING or
# http://www.gnu.org/copyleft/gpl.html for details.
2006-07-24 14:24:06 +01:00
#
# Prepares package for release. Expects the version number on the
# command line.
# Get the directory of the repository (needed to include functions file)
cd "$(dirname $0)"
REPOS=$(dirname "$(pwd)")
2006-07-24 15:29:44 +01:00
[ -z "${VERBOSE}" ] && VERBOSE=0
source "${REPOS}/scripts/functions.sh" || exit 1
2006-07-24 14:24:06 +01:00
# Get version etc.
if [ $# -ne 2 ]
then
2006-07-28 10:54:59 +01:00
echo "Usage: $0 <version> <output_dir>"
2006-07-24 14:24:06 +01:00
exit 1
fi
VER=$1
DIR=$2
2006-07-28 10:54:59 +01:00
PKGNAME="$(basename ${REPOS})-${VER}"
2006-07-24 14:24:06 +01:00
# move to output directory and clone git repository
echo "Cloning repository..."
do_cmd cd "${DIR}" || exit 1
do_cmd rm -rf "${PKGNAME}" "${PKGNAME}-doc" || exit 1
do_cmd git clone --local --shared -n "${REPOS}" "${PKGNAME}" || exit 1
2006-07-24 14:24:06 +01:00
do_cmd cd "${PKGNAME}" || exit 1
print_success "Done"
# Check out a new copy of the library from git
echo "Checking out tag ${VER}..."
do_cmd git checkout -b releaseprivate "${VER}" || exit 1
2006-07-24 14:24:06 +01:00
print_success "Done"
2006-08-24 23:44:46 +01:00
# Check that the default build operation runs
do_cmd ./make.sh || exit 1
2006-07-24 14:24:06 +01:00
2006-08-24 23:44:46 +01:00
# build and save the documentation, if required
BUILD_DOCS=""
[ -e src/docs ] && BUILD_DOCS="1"
if [ ! -z ${BUILD_DOCS} ]
then
do_cmd ./make.sh docs || exit 1
do_cmd mv html "../${PKGNAME}-doc" || exit 1
fi
2006-07-24 14:24:06 +01:00
# Clean up
do_cmd ./make.sh clean || exit 1
do_cmd rm -rf .git || exit 1
# Build archive, md5sum and signature
cd ..
tar c "${PKGNAME}" | bzip2 > "${PKGNAME}.tar.bz2"
2006-07-24 15:42:09 +01:00
sha1sum "${PKGNAME}.tar.bz2" > "${PKGNAME}.sha1"
2006-07-24 14:24:06 +01:00
gpg -a -b "${PKGNAME}.tar.bz2"
2006-08-24 23:44:46 +01:00
if [ ! -z ${BUILD_DOCS} ]
then
tar c "${PKGNAME}-doc" | bzip2 > "${PKGNAME}-doc.tar.bz2"
sha1sum "${PKGNAME}-doc.tar.bz2" > "${PKGNAME}-doc.sha1"
gpg -a -b "${PKGNAME}-doc.tar.bz2"
fi
2006-07-24 14:24:06 +01:00
# clean up
rm -rf "${PKGNAME}" "${PKGNAME}-doc"
2006-07-28 10:54:59 +01:00
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
2007-08-08 13:03:18 +01:00
# vim: syntax=sh:ts=4:sw=4:expandtab