From 15a3a09d508eed0f6d2612dd42d1b8ea720eb036 Mon Sep 17 00:00:00 2001 From: Nils Gillmann Date: Fri, 7 Sep 2018 15:41:06 +0000 Subject: doc: start work on mdoc generation support Signed-off-by: Nils Gillmann --- configure.ac | 18 +++++++++++++ contrib/packages/guix/guix-env-gillmann.scm | 40 +++++++++++++++++++++-------- doc/documentation/Makefile.am | 12 +++++++++ doc/man/Makefile.am | 5 ++++ 4 files changed, 64 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 10991e574..3be070b91 100644 --- a/configure.ac +++ b/configure.ac @@ -688,6 +688,24 @@ else AC_DEFINE([DOCUMENTATION],[0],[Not building the documentation]) fi +# TODO: Include check for mandoc + texi2mdoc. +# TODO: Rename the switch? Just 'section7' is too vague. +# mdoc section 7 output. +AC_MSG_CHECKING(wether to build section 7 mdoc output) +AC_ARG_ENABLE([section7], +[AS_HELP_STRING([--disable-section7], [do not build section 7 mdoc output])], +[section7=${enableval}], +[section7=yes]) +AC_MSG_RESULT($section7) +if test "x$section7" = "xyes" +then + AM_CONDITIONAL([SECTION7],true) + AC_DEFINE([SECTION7],[1],[Building section 7 mdoc output]) +else + AM_CONDITIONAL([SECTION7],false) + AC_DEFINE([SECTION7],[0],[Not building section 7 mdoc output]) +fi + # should the build process be building only the documentation? AC_MSG_CHECKING(whether to build only documentation) AC_ARG_ENABLE([documentation-only], diff --git a/contrib/packages/guix/guix-env-gillmann.scm b/contrib/packages/guix/guix-env-gillmann.scm index 4b977c1bb..3951620e8 100644 --- a/contrib/packages/guix/guix-env-gillmann.scm +++ b/contrib/packages/guix/guix-env-gillmann.scm @@ -64,6 +64,8 @@ (gnu packages video) (gnu packages web) (gnu packages xiph) + (ports app-text mandoc mandoc) + (ports app-text texi2mdoc texi2mdoc) ((guix licenses) #:prefix license:)) (define %source-dir (current-source-directory)) @@ -119,17 +121,20 @@ ("automake" ,automake) ("gnu-gettext" ,gnu-gettext) ("which" ,which) + ("mandoc" ,mandoc) + ("texi2mdoc" ,texi2mdoc) ("texinfo" ,texinfo-5) ; Debian stable: 5.2 ("libtool" ,libtool))) (outputs '("out" "debug")) + ;;#:configure-flags + ;;(list (string-append "--with-nssdir=" %output "/lib") + ;;"--enable-gcc-hardening" + ;;"--enable-linker-hardening" + ;;;;"--enable-documentation-only") + ;;;"--enable-logging=verbose" + ;;;"CFLAGS=-ggdb -O0") (arguments - `(;#:configure-flags - ;;(list (string-append "--with-nssdir=" %output "/lib") - ;;"--enable-gcc-hardening" - ;;"--enable-linker-hardening" - ;;;;"--enable-documentation-only") - ;;;"--enable-logging=verbose" - ;;;"CFLAGS=-ggdb -O0") + `(#:configure-flags (list "--enable-section7") #:phases ;; swap check and install phases and set paths to installed bin (modify-phases %standard-phases @@ -140,12 +145,25 @@ #t)) (add-after 'patch-bin-sh 'bootstrap (lambda _ - (zero? (system* "sh" "bootstrap")))) + (invoke "sh" "bootstrap"))) + (add-after 'build 'install-section7 + (lambda _ + (with-directory-excursion "doc/documentation" + (invoke "make" "gnunet-c-tutorial.7") + (invoke "make" "gnunet-documentation.7") + (mkdir-p (string-append (assoc-ref %outputs "out") + "/share/man/man7")) + (copy-file "../man/gnunet-c-tutorial.7" + (string-append (assoc-ref %outputs "out") + "/share/man/man7/gnunet-c-tutorial.7")) + (copy-file "../man/gnunet-documentation.7" + (string-append (assoc-ref %outputs "out") + "/share/man/man7/gnunet-documentation.7"))))) ;;(add-before 'build 'chdir ;; (lambda _ ;; (chdir "doc/documentation"))) - (delete 'check) - ;; XXX: https://gnunet.org/bugs/view.php?id=4619 - )))))) + (delete 'check))))))) +;; XXX: https://gnunet.org/bugs/view.php?id=4619 + gnunet-dev-env diff --git a/doc/documentation/Makefile.am b/doc/documentation/Makefile.am index b6c666c4d..0032b22e9 100644 --- a/doc/documentation/Makefile.am +++ b/doc/documentation/Makefile.am @@ -175,6 +175,18 @@ version2.texi: echo "@set EDITION $(PACKAGE_VERSION)" >> $@ echo "@set VERSION $(PACKAGE_VERSION)" >> $@ +if SECTION7 +gnunet-c-tutorial.7: version2.texi + @echo Attempting to output an mdoc formatted section 7 document + @texi2mdoc -I$(pwd):$(pwd)/chapters gnunet-c-tutorial.texi > ../man/gnunet-c-tutorial.7 + +gnunet-documentation.7: version2.texi + @echo Attempting to output an mdoc formatted section 7 document + @texi2mdoc -I$(pwd):$(pwd)/chapters gnunet.texi > ../man/gnunet-documentation.7 + +# TODO: (Maybe) other outputs resulting from this. +endif + # FIXME: rm *.html and *.pdf #doc-clean: # @rm *.aux *.log *.toc *.cp *.cps diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index 37f881d60..d0871571d 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am @@ -46,3 +46,8 @@ man_MANS = \ gnunet-zoneimport.1 EXTRA_DIST = ${man_MANS} + +if SECTION7 +EXTRA_DIST += gnunet-documentation.7 \ + gnunet-c-tutorial.7 +endif -- cgit v1.2.3