From 56d785bd006ab823caf39fc16e2ae6833ef2d780 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sat, 31 Mar 2018 13:12:54 -0700 Subject: [PATCH] Docs installation - Move downloading the pages from a website to a separate script, invoke as dist hook - Install manpage Signed-off-by: Alexey Neyman --- Makefile.am | 11 +++++++++++ docs/ct-ng.1.in | 21 +++++++-------------- maintainer/create-release.sh | 33 --------------------------------- maintainer/download-docs.sh | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 47 deletions(-) create mode 100755 maintainer/download-docs.sh diff --git a/Makefile.am b/Makefile.am index 2e98016e..e89523c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,14 +9,25 @@ bin_SCRIPTS = ct-ng CLEANFILES = $(bin_SCRIPTS) EXTRA_DIST = ct-ng.in bootstrap +man1_MANS = docs/ct-ng.1 + # paths.sh generated by configure nobase_dist_pkgdata_DATA = $(verbatim_data) paths.sh + + do_subst = ( @SED@ \ -e 's,[@]docdir[@],$(docdir),g' \ -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \ -e 's,[@]pkglibexecdir[@],$(pkglibexecdir),g' \ + -e 's,[@]progname[@],'`echo ct-ng | sed '$(transform)'`',g' \ | $(SHELL) config.status --file=- ) ct-ng: ct-ng.in Makefile $(AM_V_GEN)$(do_subst) < $< >$@-t && chmod a-w,a+x $@-t && mv -f $@-t $@ + +docs/ct-ng.1: docs/ct-ng.1.in + $(AM_V_GEN)$(MKDIR_P) docs && $(do_subst) < $< >$@-t && mv -f $@-t $@ + +dist-hook: maintainer/download-docs.sh + $< $(top_distdir) diff --git a/docs/ct-ng.1.in b/docs/ct-ng.1.in index 4630f30c..924bdd59 100644 --- a/docs/ct-ng.1.in +++ b/docs/ct-ng.1.in @@ -5,15 +5,15 @@ .\" Beautifying URLs .mso www.tmac .\" -.TH crosstool-NG 1 "@@CT_DATE@@" "version @@CT_VERSION@@" "User Commands" +.TH crosstool-NG 1 "@DATE@" "version @PACKAGE_VERSION@" "User Commands" .\" .\" .SH NAME -@@CT_PROG_NAME@@, crosstool-NG \- Build cross-toolchains +@progname@, crosstool-NG \- Build cross-toolchains .\" .\" .SH SYNOPSIS -.B @@CT_PROG_NAME@@ ACTION +.B @progname@ ACTION .\" .\" .SH DESCRIPTION @@ -28,7 +28,7 @@ according to the targeted processor. .SH ACTIONS Here are the most commonly used actions. For other actions, please see the documentation in -.I @@CT_DOCDIR@@ +.I @docdir@ .TP .B help Prints a little help text. @@ -53,7 +53,7 @@ configuration, and associated components' config files, into a sample. Samples are saved in their own sub-directory, named after the target's tuple, in the .I samples sub-directory of the current directory. Samples can be later recalled by calling -.B @@CT_PROG_NAME@@ +.B @progname@ with the target tuple they represent. .\" .TP @@ -117,13 +117,6 @@ configuration file. The generated toolchain is left untouched, as well as samples which are not removed. .\" .TP -.B regtest -Calls the -.B crosstool-NG -regression test suite. All samples are build, and the regression test suite is -run against every one of them. -.\" -.TP .B updatetools Updates the .I config.guess @@ -144,7 +137,7 @@ The list of steps is viewable with the action .\" .SH EXIT VALUE The -.B @@CT_PROG_NAME@@ +.B @progname@ frontend is in fact a .BR make (1) script. See the man page for @@ -170,7 +163,7 @@ Yann E. MORIN and a lot of contributors. .\" .SH SEE ALSO You can find more in-depth documentation in -.IR "@@CT_DOCDIR@@" . +.IR "@docdir@" . Please have a look at the .URL "http://www.kegel.com/crosstool" "original crosstool" " by Daniel KEGEL" diff --git a/maintainer/create-release.sh b/maintainer/create-release.sh index 6aa4cc88..498fc0ad 100755 --- a/maintainer/create-release.sh +++ b/maintainer/create-release.sh @@ -1,8 +1,5 @@ #!/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 ) @@ -43,39 +40,9 @@ 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 diff --git a/maintainer/download-docs.sh b/maintainer/download-docs.sh new file mode 100755 index 00000000..5ef3c6ab --- /dev/null +++ b/maintainer/download-docs.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +distdir=${1:-.} + +# Configurable portions +docs_git=https://github.com/crosstool-ng/crosstool-ng.github.io.git +docs_subdir=_pages/docs + +# Clone a repository for docs. Github does not support 'git archive --remote='. +set -ex +git clone --depth=1 "${docs_git}" "${distdir}/site-docs" + +# Copy the docs instead of the MANUAL_ONLINE placeholder +mkdir -p "${distdir}/docs/manual" +for i in "${distdir}/site-docs/${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}" > "${distdir}/docs/manual/${i##*/}" +done +rm -rf "${distdir}/site-docs"