build: Build and install manual pages.

* build-aux/export.make: New file.
* GNUmakefile (man): New target.
  (doc): Depend on man.
  include build-aux/export.make, remove exports.
* guix.scm (mes): Add dependency on help2man.
* configure: Check for help2man.
* install.sh: Install manual pages if built.
This commit is contained in:
Jan Nieuwenhuizen 2018-06-28 23:10:14 +02:00
parent a4770c1eed
commit 72e147f53f
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
6 changed files with 153 additions and 86 deletions

6
.gitignore vendored
View file

@ -52,8 +52,6 @@
?
?.mes
\#*#
/doc/mes.info
/doc/version.texi
/doc/fosdem/fosdem.aux
/doc/fosdem/fosdem.log
/doc/fosdem/fosdem.nav
@ -62,3 +60,7 @@
/doc/fosdem/fosdem.tex
/doc/fosdem/fosdem.toc
/doc/fosdem/fosdem.*vrb
/doc/mes.1
/doc/mes.info
/doc/mescc.1
/doc/version.texi

View file

@ -1,14 +1,31 @@
.PHONY: doc
# Mes --- Maxwell Equations of Software
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of Mes.
#
# Mes is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# Mes is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
GUILE:=guile
GUILE_FLAGS:=--no-auto-compile -L . -L guile -C . -C guile
include .config.make
.config.make:
./configure
./configure --prefix=$(PREFIX)
PHONY_TARGETS:= all all-go build check clean clean-go default doc help install install-info man\
cc mes mes-gcc mes-tcc
PHONY_TARGETS:= all all-go check clean clean-go default help install
.PHONY: $(PHONY_TARGETS)
default: all
@ -25,7 +42,12 @@ mes-gcc:
build-aux/build-cc32.sh
mes-tcc:
ifdef TCC
CC32=$(TCC) build-aux/build-cc32.sh
else
$(warning skipping mes-tcc: no tcc)
endif
mes:
build-aux/build-mes.sh
@ -49,7 +71,9 @@ install:
.config.make: ./configure
seed: all-go mes-gcc mes-tcc
ifdef TCC
cd $(TINYCC_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
endif
cd $(MES_SEED) && git reset --hard HEAD
MES=$(GUILE) GUILE=$(GUILE) SEED=1 build-aux/build-mes.sh
cd $(MES_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
@ -70,7 +94,18 @@ doc/version.texi: doc/mes.texi GNUmakefile
echo "@set EDITION $(VERSION)"; \
echo "@set VERSION $(VERSION)") > $@
doc: doc/version.texi
ifdef MAKEINFO
doc: info
else
$(warning skipping info: no makeinfo)
endif
ifdef HELP2MAN
doc: man
else
$(warning skipping man: no help2man)
endif
info: doc/mes.info
@ -79,6 +114,17 @@ doc/mes.info: doc/mes.texi doc/version.texi GNUmakefile
install-info: info
man: doc/mes.1 doc/mescc.1
doc/mes.1: src/mes.gcc-out
MES_ARENA=10000000 $(HELP2MAN) $< > $@
src/mes.gcc-out:
$(MAKE) cc
doc/mescc.1: src/mes.gcc-out scripts/mescc
MES_ARENA=10000000 $(HELP2MAN) $< > $@
define HELP_TOP
Usage: make [OPTION]... [TARGET]...
@ -102,82 +148,4 @@ export HELP_TOP
help:
@echo "$$HELP_TOP"
ifdef PREFIX
export PREFIX
endif
ifdef VERSION
export VERSION
endif
ifdef CC
export CC
endif
ifdef CC32
export CC32
endif
ifdef BLOOD_ELF
export BLOOD_ELF
endif
ifdef M1
export M1
endif
ifdef HEX2
export HEX2
endif
ifdef GUILE
export GUILE
endif
ifdef GUILE_TOOLS
export GUILE_TOOLS
endif
ifdef TCC
export TCC
endif
ifdef GUILE_LOAD_PATH
export GUILE_LOAD_PATH
endif
ifdef GUILE_LOAD_COMPILED_PATH
export GUILE_LOAD_COMPILED_PATH
endif
ifdef CFLAGS
export CFLAGS
endif
ifdef C32FLAGS
export C32FLAGS
endif
ifdef HEX2FLAGS
export HEX2FLAGS
endif
ifdef M1FLAGS
export M1FLAGS
endif
ifdef MESCCFLAGS
export MESCCFLAGS
endif
ifdef MES_SEED
export MES_SEED
endif
ifdef MESCC_TOOLS_SEED
export MESCC_TOOLS_SEED
endif
ifdef TINYCC_SEED
export TINYCC_SEED
endif
include build-aux/export.make

79
build-aux/export.make Normal file
View file

@ -0,0 +1,79 @@
ifdef PREFIX
export PREFIX
endif
ifdef VERSION
export VERSION
endif
ifdef CC
export CC
endif
ifdef CC32
export CC32
endif
ifdef BLOOD_ELF
export BLOOD_ELF
endif
ifdef M1
export M1
endif
ifdef HEX2
export HEX2
endif
ifdef GUILE
export GUILE
endif
ifdef GUILE_TOOLS
export GUILE_TOOLS
endif
ifdef TCC
export TCC
endif
ifdef GUILE_LOAD_PATH
export GUILE_LOAD_PATH
endif
ifdef GUILE_LOAD_COMPILED_PATH
export GUILE_LOAD_COMPILED_PATH
endif
ifdef CFLAGS
export CFLAGS
endif
ifdef C32FLAGS
export C32FLAGS
endif
ifdef HEX2FLAGS
export HEX2FLAGS
endif
ifdef M1FLAGS
export M1FLAGS
endif
ifdef MESCCFLAGS
export MESCCFLAGS
endif
ifdef MES_SEED
export MES_SEED
endif
ifdef MESCC_TOOLS_SEED
export MESCC_TOOLS_SEED
endif
ifdef TINYCC_SEED
export TINYCC_SEED
endif

4
configure vendored
View file

@ -246,6 +246,7 @@ Some influential environment variables:
(let ((CC32 (or (getenv "CC32")
(if (member ARCH '("i686" "arm")) (string-append BUILD_TRIPLET "-" CC)
"i686-unknown-linux-gnu-gcc")))
(HELP2MAN (or (getenv "HELP2MAN") "help2man"))
(TCC (or (getenv "TCC") "tcc"))
(MAKEINFO (or (getenv "MAKEINFO") "makeinfo"))
(GUILE_TOOLS (or (getenv "GUILE_TOOLS") "guile-tools"))
@ -290,6 +291,8 @@ Some influential environment variables:
(check-version "perl" '(5))
(if (not (check-version "makeinfo" '(6) #:optional? #t))
(set! MAKEINFO #f))
(if (not (check-version "help2man" '(1 47) #:optional? #t))
(set! HELP2MAN #f))
(when (pair? required)
(stderr "\nMissing dependencies [~a], run\n\n" ((->string ", ") required))
@ -305,6 +308,7 @@ Some influential environment variables:
(stdout "ARCH:=~a\n" ARCH)
(stdout "CC:=~a\n" (or CC ""))
(stdout "CC32:=~a\n" (or CC32 ""))
(stdout "HELP2MAN:=~a\n" (or HELP2MAN ""))
(stdout "TCC:=~a\n" (or TCC ""))
(stdout "BLOOD_ELF:=~a\n" (or BLOOD_ELF ""))
(stdout "MES_SEED:=~a\n" (or MES_SEED ""))

View file

@ -50,6 +50,7 @@
(gnu packages cross-base)
(gnu packages gcc)
(gnu packages guile)
(gnu packages man)
(gnu packages mes)
(gnu packages package-management)
(gnu packages perl)

View file

@ -3,7 +3,10 @@
set -e
set -o pipefail
export PREFIX
if [ -n "$BUILD_DEBUG" ]; then
set -x
fi
SHELL=${SHELL-$(command -v sh)}
PREFIX=${PREFIX-/usr/local}
MES_PREFIX=${MES_PREFIX-$PREFIX/share/mes}
@ -63,3 +66,13 @@ if [ -f doc/mes.info ]; then
install-info --info-dir=$PREFIX/share/info doc/mes.info
tar -cf- doc/mes.info* | tar -xf- --strip-components=1 -C $PREFIX/share/info
fi
if [ -f doc/mes.1 ]; then
mkdir -p $PREFIX/man/man1
cp doc/mes.1 $PREFIX/man/man1/
fi
if [ -f doc/mescc.1 ]; then
mkdir -p $PREFIX/man/man1
cp doc/mescc.1 $PREFIX/man/man1/
fi