From a6b76e954fed9cb6d3e3b3bb73d99e797d567b11 Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Mon, 16 Sep 2013 22:36:51 +0800 Subject: [PATCH] Misc: Add make-release.sh Add make-release.sh, which creates a release tarball, with documentations built (to lift asciidoc dependency), and COMPTON_VERSION defined. --- make-release.sh | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 make-release.sh diff --git a/make-release.sh b/make-release.sh new file mode 100755 index 0000000..718b1ef --- /dev/null +++ b/make-release.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +GOOD=$'\e[32;01m' +WARN=$'\e[33;01m' +BAD=$'\e[31;01m' +HILITE=$'\e[36;01m' +BRACKET=$'\e[34;01m' +NORMAL=$'\e[0m' + +eerror() { + echo -e "$@" | while read -r ; do + echo " $BAD*$NORMAL $RC_INDENTATION$REPLY" >&2 + done + return 0 +} + +einfo() { + echo -e "$@" | while read -r ; do + echo " $GOOD*$NORMAL $REPLY" + done + return 0 +} + +die() { + eerror "Call stack:" + (( n = ${#FUNCNAME[@]} - 1 )) + while (( n > 0 )); do + funcname=${FUNCNAME[$((n - 1))]} + sourcefile=$(basename ${BASH_SOURCE[${n}]}) + lineno=${BASH_LINENO[$((n - 1))]} + eerror " ${sourcefile}:${lineno} - Called ${funcname}()" + (( n-- )) + done + eerror "Working directory: '$(pwd)'" + exit 1 +} + +main() { + TMP=/tmp + mkdir -p "${TMP}" + + VER="$(make version)" + P="compton-${VER}" + git archive --format=tar -o "${TMP}/${P}.tar" --prefix="${P}/" HEAD || die + cd "${TMP}" || die + tar xf "${TMP}/${P}.tar" || die + sed -i "s/\(COMPTON_VERSION ?=\).*/\1 ${VER}/" "${P}/Makefile" || die + cd "${P}" || die + make docs || die + cd .. || die + tar cJf "${P}.tar.xz" "${P}" || die + rm -r "${P}" "${P}.tar" || die + einfo Archive is now on $(realpath ${P}.tar.xz) +} + +main