diff options
| -rw-r--r-- | Makefile | 6 | ||||
| -rw-r--r-- | config.mk | 22 | ||||
| -rwxr-xr-x | tools/mkdist.sh | 30 | 
3 files changed, 31 insertions, 27 deletions
@@ -24,11 +24,7 @@ tests/etc/cpt-hook:  	ln -s ../hook-file $@  dist: docs/cpt.info -	mkdir "cpt-${VERSION}" -	cp -r ${DISTFILES} "cpt-${VERSION}" -	tar cf "cpt-${VERSION}.tar" "cpt-${VERSION}" -	xz -z "cpt-${VERSION}.tar" -	rm -rf -- "cpt-${VERSION}" +	./tools/mkdist.sh "${VERSION}"  install: all  	test "${DOCS}" != yes || ${MAKE} -C docs install @@ -16,25 +16,3 @@ MAKEINFO  = makeinfo  # Comment or change if you don't want to build/install the documentation  DOCS = yes - -# Files to be added into the distribution tarball -DISTFILES = \ -    .build.yml \ -    .dir-locals.el \ -    .editorconfig \ -    .fossil-settings \ -    .gitignore \ -    .shellspec \ -    CHANGELOG.md \ -    LICENSE \ -    Makefile \ -    README \ -    config.mk \ -    contrib \ -    cpt-base \ -    docs \ -    man \ -    spec \ -    src \ -    tests \ -    tools diff --git a/tools/mkdist.sh b/tools/mkdist.sh new file mode 100755 index 0000000..c21e964 --- /dev/null +++ b/tools/mkdist.sh @@ -0,0 +1,30 @@ +#!/bin/sh -e + +out() { printf '%s\n' "$@" >&2 ;} +die() { printf '\033[1;31mERR: \033[m%s\n' "$@" >&2; exit 1;} + +case "$1" in ''|-*) +    die "Run this script by calling 'make dist' from the" \ +        "root repository directory" +esac + +fossil stat >/dev/null 2>&1 || { +    printf '\033[1;31mERR: \033[m%s\n' \ +        "Distribution tarballs can only be generated using the Fossil repository." \ +        "Exiting..." >&2 +    exit 1 +} + +basedir=cpt-$1 +mkdir -p "$basedir" + +fossil ls | while read -r file; do +    case "$file" in +        */*) mkdir -p "$basedir/${file%/*}" +    esac +    cp "$file" "$basedir/$file" +done + +tar cf "$basedir.tar" "$basedir" +xz -z "$basedir.tar" +rm -rf -- "$basedir"  | 
