doc: start work on mdoc generation support
authorNils Gillmann <ng0@n0.is>
Fri, 7 Sep 2018 15:41:06 +0000 (15:41 +0000)
committerNils Gillmann <ng0@n0.is>
Fri, 7 Sep 2018 15:41:06 +0000 (15:41 +0000)
Signed-off-by: Nils Gillmann <ng0@n0.is>
configure.ac
contrib/packages/guix/guix-env-gillmann.scm
doc/documentation/Makefile.am
doc/man/Makefile.am

index 10991e574556cd5c16d40717a0c67b84aa990098..3be070b91926f00c712255fa066bcb230925e4bf 100644 (file)
@@ -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],
index 4b977c1bb67185f0fc8e24126ece215d79b28f23..3951620e818940d598b67c26b308937094b5f021 100644 (file)
@@ -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))
          ("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
                #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
index b6c666c4deccced37d6e9b47ae8bea91905683a3..0032b22e97d806422bf4c0e607888403cbfa1b5f 100644 (file)
@@ -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
index 37f881d6038fdf3ae1cb7246eda670d70baa0150..d0871571d125194c5eea93b0f68f8d3e12f8f40c 100644 (file)
@@ -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