diff --git a/.gitignore b/.gitignore index 98480b07..daedcdd6 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ build.log targets/ # .. and log for 'build-all' .build-all +# .. and release creation +release diff --git a/Makefile.in b/Makefile.in index 634abaf2..3d2c6077 100644 --- a/Makefile.in +++ b/Makefile.in @@ -304,14 +304,13 @@ $(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): $(DESTDIR)$(libdir) @tar cf - --exclude='*.sh.in' $(patsubst install-lib-%-copy,%,$(@)) \ |(cd "$(DESTDIR)$(libdir)"; tar xf -) -# Huh? It seems we need at least one command to make this rule kick-in. -install-lib-%: install-lib-%-copy; @true +# We need at least one command to make this rule kick-in. +install-lib-%: install-lib-%-copy + @true -# Huh? that one does not inherit the -opy dependency, above... install-lib-scripts: install-lib-scripts-copy @chmod a+x $(DESTDIR)$(libdir)/scripts/crosstool-NG.sh @chmod a+x $(DESTDIR)$(libdir)/scripts/saveSample.sh - @rm -f "$(DESTDIR)$(libdir)/scripts/addToolVersion.sh" install-lib-main: $(DESTDIR)$(libdir) $(patsubst %,install-lib-%,$(LIB_SUB_DIR)) @echo " INST 'steps.mk'" @@ -361,8 +360,8 @@ install-doc-message: install-doc-real: $(DESTDIR)$(docdir) - @echo " INST 'docs/*.txt'" - @for doc_file in docs/*.txt; do \ + @echo " INST 'docs/manual/*.md'" + @for doc_file in docs/manual/*.md; do \ $(install) -m 644 "$${doc_file}" "$(DESTDIR)$(docdir)"; \ done diff --git a/maintainer/README b/maintainer/README new file mode 100644 index 00000000..d0d174a5 --- /dev/null +++ b/maintainer/README @@ -0,0 +1,5 @@ +These scripts are not of much interest to the end user. +They are used to automate everyday maintenance tasks for crosstool-NG. As such, +they are not subject to the same level of portability requirements - they can +expect to be run on a fairly modern Linux distribution, with bash, GNU sed and +grep, etc. diff --git a/scripts/addToolVersion.sh b/maintainer/addToolVersion.sh similarity index 100% rename from scripts/addToolVersion.sh rename to maintainer/addToolVersion.sh diff --git a/maintainer/create-release.sh b/maintainer/create-release.sh new file mode 100755 index 00000000..b04747e1 --- /dev/null +++ b/maintainer/create-release.sh @@ -0,0 +1,100 @@ +#!/bin/bash + +# Configurable portions +docs_git=https://github.com/crosstool-ng/crosstool-ng.github.io.git +docs_subdir=_pages/docs +formats=( "bz2" "xz" ) +declare -A tar_opt=( ["bz2"]=j ["xz"]=J ) +digests=( md5 sha1 sha512 ) + +do_trace() +{ + echo " --> $@" >&2 +} + +do_abort() +{ + echo "ERROR: $@" >&2 + exit 1 +} + +# Go to the top-level +topdir=`git rev-parse --show-toplevel` +if [ -z "${topdir}" ]; then + do_abort "Not in the Git clone" +fi +cd "${topdir}" + +# Determine the version. Replace the dashes with dots, as packaging +# systems don't expect dashes in versions, but they're ok in package +# name. +version=`git describe | sed -r -e 's,-,.,g' -e 's,^crosstool\.ng\.,crosstool-ng-,'` +do_trace "Creating release for ${version}" + +# Create the base working directory +if [ -e "release" -a ! -d "release" ]; then + do_abort "File 'release' already exists but is not a directory" +fi +mkdir -p "release" + +# Copy the base stuff +do_trace "Copying crosstool-NG" +rm -rf "release/${version}" +git archive --prefix="${version}/" HEAD | tar xf - -C "release" + +# Clone a repository for docs. Github does not support 'git archive --remote='. +do_trace "Checking out docs" +rm -rf "release/site" +git clone --depth=1 "${docs_git}" "release/site" + +# The rest of modifications are inside the release directory +cd "release/${version}" + +# Copy the docs instead of the MANUAL_ONLINE placeholder +do_trace "Replacing docs" +rm "docs/MANUAL_ONLINE" +mkdir -p "docs/manual" +for i in "../site/${docs_subdir}/"*.md; do + awk ' +BEGIN { skip=0; } + { + if ($0=="---") { + if (NR==1) { + skip=1 + next + } + else if (skip) { + skip=0 + next + } + } + if (!skip) { + print $0 + } + } +' < "${i}" > "docs/manual/${i##*/}" +done + +# Run bootstrap before it is removed +do_trace "Bootstrapping" +./bootstrap +rm -f bootstrap + +# Remove other things not for the end user +do_trace "Removing unreleased files" +rm -f .travis.* +find -name .gitignore | xargs rm +rm -rf autom4te.cache maintainer + +# Go back to top level +cd ../.. + +# Package up +do_trace "Packaging" +for fmt in "${formats[@]}"; do + tar c${tar_opt[$fmt]}f "release/${version}.tar.${fmt}" -C "release" "${version}" + for h in "${digests[@]}"; do + ${h}sum "release/${version}.tar.${fmt}" > "release/${version}.tar.${fmt}.${h}" + done + # TBD sign +done diff --git a/scripts/patch-renumber.sh b/maintainer/patch-renumber.sh similarity index 100% rename from scripts/patch-renumber.sh rename to maintainer/patch-renumber.sh diff --git a/scripts/patch-rework.sh b/maintainer/patch-rework.sh similarity index 100% rename from scripts/patch-rework.sh rename to maintainer/patch-rework.sh diff --git a/scripts/build/debug/000-template.sh b/scripts/build/debug/000-template.sh deleted file mode 100644 index 47d2caea..00000000 --- a/scripts/build/debug/000-template.sh +++ /dev/null @@ -1,34 +0,0 @@ -# Template file for a debug utility - -# Put your download code here -do_debug_foobar_get() { - # For example: - # CT_GetFile "foobar-${CT_FOOBAR_VERSION}" http://foobar.com/releases/ - : -} - -# Put your extract code here -do_debug_foobar_extract() { - # For example: - # CT_Extract "foobar-${CT_FOOBAR_VERSION}" - # CT_Patch "foobar" "${CT_FOOBAR_VERSION}" - : -} - -# Put your build code here -do_debug_foobar_build() { - # For example: - # mkdir -p "${CT_BUILD_DIR}/build-foobar" - # CT_Pushd "${CT_BUILD_DIR}/build-foobar" - # CT_DoExecLog CFG \ - # "${CT_SRC_DIR}/foobar-${CT_FOOBAR_VERSION}/configure" \ - # --build=${CT_BUILD} \ - # --host=${CT_TARGET} \ - # --prefix=/usr \ - # --foobar-options - # CT_DoExecLog ALL make - # CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" install - # CT_Popd - : -} - diff --git a/scripts/functions b/scripts/functions index ab141d5d..0ba96b48 100644 --- a/scripts/functions +++ b/scripts/functions @@ -422,7 +422,7 @@ CT_SanitizeVarDir() { } if (!seencomp && !isabs && !trail) { # Eliminated all components, but no trailing slash - - # if the result is appened with /foo, must not become absolute + # if the result is appended with /foo, must not become absolute printf "."; } if ((!seencomp && isabs) || (seencomp && trail)) {