From 0f56aa3a5e18d3cf27e2cf5478ed0283e478b070 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Fri, 30 Sep 2022 15:55:42 +0200 Subject: [PATCH 1/3] Change buildsystem to automake Change buildsystem from custom GNUmakefile to standard automake. This allows builds with the standard invocation of autoreconf -if # if not building from dist tarball ./configure make sudo make install The configure.ac is based on the output of autoscan, with quite a bit of manual work added on top. Uses the ancient serial-tests test harness in order to re-use the existing run-tests script. --- .github/workflows/beep-build.yml | 19 +- .gitignore | 17 + Doxyfile.in | 10 +- GNUmakefile | 744 ------------------------------ INSTALL.md | 58 +-- Makefile.am | 170 +++++++ NEWS.md | 4 + PACKAGING.md | 52 +-- auto-m4/.gitignore | 1 + beep-config.h.in | 2 + beep-library.c | 12 +- beep-log.c | 9 + beep-main.c | 1 + beep.1.in | 1 + configure.ac | 102 ++++ contrib/Makefile-files | 7 + contrib/morse/Makefile-files | 7 + m4/Makefile-files | 4 + m4/sb-prog.m4 | 18 + m4/sb-summary.m4 | 40 ++ testbuild-all | 31 +- tests/Makefile-files | 81 ++++ tests/{run-tests => run-tests.in} | 42 +- 23 files changed, 561 insertions(+), 871 deletions(-) delete mode 100644 GNUmakefile create mode 100644 Makefile.am create mode 100644 auto-m4/.gitignore create mode 100644 configure.ac create mode 100644 contrib/Makefile-files create mode 100644 contrib/morse/Makefile-files create mode 100644 m4/Makefile-files create mode 100644 m4/sb-prog.m4 create mode 100644 m4/sb-summary.m4 create mode 100644 tests/Makefile-files rename tests/{run-tests => run-tests.in} (82%) diff --git a/.github/workflows/beep-build.yml b/.github/workflows/beep-build.yml index 8827418..5504e33 100644 --- a/.github/workflows/beep-build.yml +++ b/.github/workflows/beep-build.yml @@ -6,6 +6,8 @@ on: pull_request: branches: [ main, master ] +# Running without pandoc installed. + jobs: build: @@ -15,18 +17,25 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: create local.mk + - name: apt-get install run: | - echo "prefix = ${PWD}/_root" > local.mk + sudo apt-get update + sudo apt-get install -y automake autoconf + - name: autoreconf + run: autoreconf -vis . + - name: configure + run: ./configure --prefix="${PWD}/_root" - name: make - run: make + run: N="$(nproc||echo 2)"; make -j$N -l$N CFLAGS="-std=gnu11 -pedantic -Wall -Wextra -Werror" - name: 'beep --help' run: | ./beep --help > beep-usage.from--help diff -u beep-usage.txt beep-usage.from--help - name: 'make check' run: make check - - name: 'make install-nobuild' - run: make install-nobuild + - name: 'make install' + run: make install - name: 'list installed files' run: (cd "$PWD/_root" && ls -l $(find . -type f | env LC_ALL=C sort) | nl) + - name: 'make distcheck' + run: make distcheck diff --git a/.gitignore b/.gitignore index ace2672..4faf326 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,21 @@ # Files that should not be tracked by Git +# autoreconf +Makefile.in +/aclocal.m4 +/auto-aux/ +/auto-config.h.in +/autom4te.cache/ +/configure + +# configure +.deps/ +Makefile +/auto-config.h +/config.log +/config.status +/stamp-h1 + # The compiled executables /beep /*.clang @@ -37,6 +53,7 @@ /tarball-git-dist/ /beep-*.tar.gz /beep-*.tar.xz +/tests/run-tests # Test results /tests/*.actual.output.new diff --git a/Doxyfile.in b/Doxyfile.in index 7218778..a7809cc 100644 --- a/Doxyfile.in +++ b/Doxyfile.in @@ -1,4 +1,5 @@ # Doxyfile 1.9.1 +# @configure_input@ # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -864,7 +865,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = . +INPUT = @abs_top_srcdir@ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -952,7 +953,6 @@ RECURSIVE = NO # run. EXCLUDE = -EXCLUDE += README.md # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -971,6 +971,12 @@ EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXCLUDE_PATTERNS += *-usage.c +# TODO: Make *.md file links work with both github.com and Doxygen. +EXCLUDE_PATTERNS += INSTALL.md +EXCLUDE_PATTERNS += PACKAGING.md +EXCLUDE_PATTERNS += PERMISSIONS.md +EXCLUDE_PATTERNS += README.md + # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the diff --git a/GNUmakefile b/GNUmakefile deleted file mode 100644 index c27b21b..0000000 --- a/GNUmakefile +++ /dev/null @@ -1,744 +0,0 @@ -######################################################################## -# GNUmakefile for beep -# -# This GNUmakefile has been written to mostly follow the GNU Makefile -# conventions[1], even if there is no "configure" script to accompany -# the GNUmakefile. If you want to keep some definitions across "make" -# invocations instead of providing them on each "make" command line, -# write the definitions into a file "local.mk" make include file, e.g. -# -# CC = clang -# prefix = $(HOME)/foo-prefix -# -# The GNUmakefile also internally follows some conventions known from -# Automake (e.g. bin_PROGRAMS variables), but uses features specific -# to GNU make to implement those Automake like features. -# -# This GNUmakefile makes extensive use of GNU make features and some -# tricks for using GNU make, such as -# * Advanced Auto Dependency Generation[2] -# * Deferred Simple Variable Expansion[3] -# -# [1]: https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html -# [2]: http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ -# [3]: http://make.mad-scientist.net/deferred-simple-variable-expansion/ -# -######################################################################## - - -######################################################################## -# Package metadata -######################################################################## - -PACKAGE_TARNAME = beep -PACKAGE_VERSION = 1.4.13 - - -######################################################################## -# Installation directories -######################################################################## - -# We use GNU makefile conventions for directory names. - -prefix = /usr/local -exec_prefix = $(prefix) -bindir = $(exec_prefix)/bin -sbindir = $(exec_prefix)/sbin -datarootdir = $(prefix)/share -mandir = $(datarootdir)/man -man1dir = $(mandir)/man1 -docdir = $(datarootdir)/doc/$(PACKAGE_TARNAME) -contribdir = $(docdir)/contrib -htmldir = $(docdir) - - -# TODO: We might want to autodetect which kind of $(docdir) is used on -# this system. Until then, people will just need to set -# docdir='$(datarootdir)/doc/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)' -# if they want to use that. Note that what the GNU makefile -# conventions call $(docdir) is called other names by other -# software components, e.g. %{_pkgdocdir} in RPM spec files. - - -######################################################################## -# Tools -######################################################################## - -# This makes it easy to replace any of those tools with specific -# versions, or to disable specific parts of the build. For example, to -# test the portability of the SED commands, you can run with -# SED="busybox sed", or to disable building HTML files from the -# markdown files you can run with PANDOC="false". - -CMP = cmp -DIFF = diff -DOT = dot -DOXYGEN = doxygen -EGREP = $(GREP) -E -FIND = find -GIT = git -GREP = grep -INSTALL = install -MKDIR_P = mkdir -p -PANDOC = pandoc -PYTHON3 = python3 -SED = sed -TAR = tar -TPUT = tput -WC = wc - -DIFF_U = $(DIFF) -u - -# The _DATA and _PROGRAM variants are GNU makefile convention. -# The _DIR variant is our idea. -INSTALL_DIR = $(INSTALL) -m 0755 -d -INSTALL_DATA = $(INSTALL) -m 0644 -p -INSTALL_PROGRAM = $(INSTALL) -m 0755 -p - - -######################################################################## -# This needs to be the first rule -######################################################################## - -.PHONY: all -all: all-local - - -######################################################################## -# Initialize some things for the build system -######################################################################## - - -# Prevent make from using its built-in rules -.SUFFIXES: -COMPILE.c = false COMPILE.c -LINK.c = false LINK.c - - -######################################################################## -# Variables to add to later -######################################################################## - -dist-files = -dist-files += GNUmakefile - -# targets to build for the "all" target -all_TARGETS = - -# targets to build for the "check" target -check_TARGETS = - -bin_PROGRAMS = -check_PROGRAMS = -contrib_DATA = -contrib_SCRIPTS = -sbin_PROGRAMS = -CLEANFILES = -html_DATA = -noinst_html_DATA = -man1_DATA = -doc_DATA = - - -######################################################################## -# Define compiler and linker flags -######################################################################## - -comma := , - -# If supported by $(CC), add given flags to CFLAGS type variable. -# Example usage: -# $(eval $(call check-cflags,common-CFLAGS,-fasynchronous-unwind-tables)) -define check-cflags -$(1) += $$(if $$(shell if $$(CC) $$(patsubst -Wno-%,-W%,$(2)) -x c -o compile-check.o -c - < /dev/null > /dev/null 2>&1; then echo yes; else :; fi; rm -f compile-check.o > /dev/null 2>&1),$(2)) -endef - -# This might be useful or not. -CFLAGS = -CPPFLAGS = -LDFLAGS = -LDADD = - -# Flags common to all executable targets -common_CFLAGS = -common_CPPFLAGS = -common_LDFLAGS = -common_LDADD = - -common_CPPFLAGS += -DPACKAGE_TARNAME='"$(PACKAGE_TARNAME)"' -common_CPPFLAGS += -DPACKAGE_VERSION='"$(PACKAGE_VERSION)"' -common_CFLAGS += -std=gnu99 -common_CFLAGS += $(if $(filter %.o,$@),-Wa$(comma)-adhlns=$(@:.o=.lst)) -common_CFLAGS += -pedantic -$(eval $(call check-cflags,common_CFLAGS,-Werror=unknown-warning-option)) -$(eval $(call check-cflags,common_CFLAGS,-Wall)) -$(eval $(call check-cflags,common_CFLAGS,-Wextra)) -$(eval $(call check-cflags,common_CFLAGS,-Weverything)) -$(eval $(call check-cflags,common_CFLAGS,-Werror)) -$(eval $(call check-cflags,common_CFLAGS,-Wno-padded)) -$(eval $(call check-cflags,common_CFLAGS,-Werror=format-security)) -$(eval $(call check-cflags,common_CFLAGS,-Wno-disabled-macro-expansion)) -$(eval $(call check-cflags,common_CFLAGS,-Wno-format-nonliteral)) -$(eval $(call check-cflags,CPPFLAGS,-D_FORTIFY_SOURCE=2)) -$(eval $(call check-cflags,CPPFLAGS,-D_GLIBCXX_ASSERTIONS)) -# $(eval $(call check-cflags,CFLAGS,-Wp$$(comma)-D_FORTIFY_SOURCE=2)) -# $(eval $(call check-cflags,CFLAGS,-Wp$$(comma)-D_GLIBCXX_ASSERTIONS)) -$(eval $(call check-cflags,CFLAGS,-fasynchronous-unwind-tables)) -$(eval $(call check-cflags,CFLAGS,-fanalyzer)) -$(eval $(call check-cflags,CFLAGS,-fstack-protector-strong)) -$(eval $(call check-cflags,CFLAGS,-fstack-clash-protection)) -$(eval $(call check-cflags,CFLAGS,-fcf-protection)) -$(eval $(call check-cflags,CFLAGS,-fsanitize=undefined)) - - -CFLAGS += -O2 -g -CFLAGS += -save-temps=obj - - -# Create this file to override any of the make variables defined -# above. --include local.mk - - -ifneq (,$(V)) -$(info #=======================================================================) -else -$(info In case of build problems, try running `make' with V=1 to help find the cause.) -endif - - -ifneq (,$(V)) -$(info # common_CFLAGS=$(common_CFLAGS)) -$(info # common_CPPFLAGS=$(common_CPPFLAGS)) -$(info # common_LDADD=$(common_LDADD)) -$(info # common_LDFLAGS=$(common_LDFLAGS)) -$(info # CFLAGS=$(CFLAGS)) -$(info # CPPFLAGS=$(CPPFLAGS)) -$(info # LDADD=$(LDADD)) -$(info # LDFLAGS=$(LDFLAGS)) -endif - - -######################################################################## -# Detect libraries -######################################################################## - - -######################################################################## -# Define executables and their flags -######################################################################## - -check_PROGRAMS += issue-6-benchmark -issue_6_benchmark_SOURCES = issue-6-benchmark.c -issue_6_benchmark_LDADD = -lm - -bin_PROGRAMS += beep -beep_SOURCES = -beep_SOURCES += beep-compiler.h -beep_SOURCES += beep-types.h -beep_SOURCES += beep-log.c -beep_SOURCES += beep-log.h -beep_SOURCES += beep-main.c -beep_SOURCES += beep-library.c -beep_SOURCES += beep-library.h -beep_SOURCES += beep-usage.c -beep_SOURCES += beep-usage.h -beep_SOURCES += beep-drivers.c -beep_SOURCES += beep-drivers.h - -# The drivers here use `__attribute__((constructor))` functions to -# register themselves with `beep_drivers_register()`, so the last one -# listed here will be linked last and have its constructor called at -# the latest time, and thus will have its `driver_detect()` function -# called first. - -beep_SOURCES += beep-driver.h -beep_SOURCES += beep-driver-console.c -beep_SOURCES += beep-driver-evdev.c - -EXTRA_DIST += beep-driver-noop.c -ifneq ($(BEEP_DEBUG_BUILD),) -beep_SOURCES += beep-driver-noop.c -endif - -beep_LDADD = - -beep-log.o : override common_CPPFLAGS += -D_GNU_SOURCE -# beep-log.clang-o : override CFLAGS_clang += -Wno-format-nonliteral - -# sbin_PROGRAMS += beep-foo -# beep_foo_SOURCES = -# beep_foo_SOURCES += beep-log.c -# beep_foo_SOURCES += beep.c -# beep_foo_LDADD = -# beep_foo_LDADD += -lm - - -######################################################################## -# Built sources -######################################################################## - -EXTRA_DIST += beep-usage.txt.in -CLEANFILES += beep-usage.txt - -BUILT_SOURCES += beep-usage.c -CLEANFILES += beep-usage.c -beep-usage.c: beep-usage.txt - $(inhibit-build-command) - @$(call print-rule-description,CONVERT,$@,$<) - printf '%s\n' '/* Auto-generated from `$<`. Modify that file instead. */' > $@ - printf '%s\n' '#include "beep-usage.h"' >> $@ - printf '%s\n' 'char beep_usage[] =' >> $@ - set -e; IFS=""; while read line; do \ - printf ' "%s\\n"\n' "$${line}" >> $@; \ - done < $< - printf '%s\n' ' ;' >> $@ - - -######################################################################## -# Compile and Link rules including automatic dependency generation -# -# For details on the automatic dependency generation, see -# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ -######################################################################## - - -# CALL: define-link-rule -# Defines the per-executable rules. -define define-link-rule -CLEANFILES += $(1).map -dist-files += $$($(2)_SOURCES) -$(2)_OBJS := $$(foreach src,$$($(2)_SOURCES),$$(if $$(filter %.c,$$(src)),$$(src:%.c=%.o),$$(if $$(filter %.h,$$(src)),,$$(error Unhandled source type in $(2)_SOURCES: $$(src))))) - -$(1): $$($(2)_OBJS) - $$(inhibit-build-command) - @$$(call print-rule-description,LINK,$$@) - $$(CC) -Wl,-Map=$(1).map,--cref $$(common_CFLAGS) $$(CFLAGS) $$(common_LDFLAGS) $$($(2)_LDFLAGS) $$(LDFLAGS) -o $$@ $$^ $$(common_LDADD) $$($(2)_LDADD) $$(LDADD) - -$$(patsubst %.o,.deps/%.o.dep,$$($(2)_OBJS))): - --include $$(wildcard $$(patsubst %.o,.deps/%.o.dep,$$($(2)_OBJS))) -endef - - -$(foreach exec,$(bin_PROGRAMS), $(eval $(call define-link-rule,$(exec),$(subst -,_,$(exec)),bin))) -$(foreach exec,$(check_PROGRAMS),$(eval $(call define-link-rule,$(exec),$(subst -,_,$(exec)),check))) -$(foreach exec,$(sbin_PROGRAMS), $(eval $(call define-link-rule,$(exec),$(subst -,_,$(exec)),sbin))) - -%.o: %.c | .deps - $(inhibit-build-command) - @$(call print-rule-description,COMPILE,$@,$<) - $(CC) -MT $@ -MMD -MP -MF .deps/$*.o.dep $(common_CPPFLAGS) $(CPPFLAGS) $(common_CFLAGS) $(CFLAGS) -o $@ -c $< - -.deps: - $(inhibit-build-command) - @$(MKDIR_P) $@ - - -######################################################################## -# Generate doc and similar files -######################################################################## - -EXTRA_DIST += gen-freq-table - -EXTRA_DIST += beep.1.in -man1_DATA += beep.1 -CLEANFILES += beep.1 - -CLEANFILES += CREDITS.html -CLEANFILES += NEWS.html -CLEANFILES += PERMISSIONS.html -CLEANFILES += README.html - -CLEANFILES += DEVELOPMENT.html -CLEANFILES += INSTALL.html -CLEANFILES += PACKAGING.html - -EXTRA_DIST += pandoc.css - -ifeq (yes,$(shell if $(PANDOC) --version > /dev/null 2>&1; then echo yes; else echo no; fi)) - -html_DATA += pandoc.css - -html_DATA += CREDITS.html -html_DATA += NEWS.html -html_DATA += PERMISSIONS.html -html_DATA += README.html - -noinst_html_DATA += DEVELOPMENT.html -noinst_html_DATA += INSTALL.html -noinst_html_DATA += PACKAGING.html - -%.html: %.md - $(inhibit-build-command) - @$(call print-rule-description,PANDOC,$@,$<) - $(PANDOC) --from gfm --to html --standalone -M pagetitle="$$($(SED) -n 1p $<)" -M title="" -c pandoc.css $< -o $@ -endif - -.PHONY: html -html: $(html_DATA) $(noinst_html_DATA) -all-local: $(html_DATA) $(noinst_html_DATA) - -DEFAULT_FREQ = 440 -DEFAULT_LENGTH = 200 -DEFAULT_DELAY = 100 - -REPLACEMENTS = -REPLACEMENTS += -e 's|@PACKAGE_TARNAME@|$(PACKAGE_TARNAME)|g' -REPLACEMENTS += -e 's|@PACKAGE_VERSION@|$(PACKAGE_VERSION)|g' - -REPLACEMENTS += -e 's|@DEFAULT_FREQ@|$(DEFAULT_FREQ)|g' -REPLACEMENTS += -e 's|@DEFAULT_LENGTH@|$(DEFAULT_LENGTH)|g' -REPLACEMENTS += -e 's|@DEFAULT_DELAY@|$(DEFAULT_DELAY)|g' - -REPLACEMENTS += -e 's|[@]docdir@|$(docdir)|g' - -EXTRA_DIST += beep-config.h.in -CLEANFILES += beep-config.h -BUILT_SOURCES += beep-config.h -beep-main.o : beep-config.h - -EXTRA_DIST += Doxyfile.in -CLEANFILES += Doxyfile -CLEANFILES += Doxyfile.new - -%: %.in GNUmakefile - $(inhibit-build-command) - @$(call print-rule-description,SUBSTITUTE,$@,$<) - $(SED) $(REPLACEMENTS) < $< > $@.new - @if $(EGREP) '@([A-Za-z][A-Za-z0-9_]*)@' $@.new; then \ - echo "Error: GNUmakefile fails to substitute some of the variables in \`$<'."; \ - exit 1; \ - fi - mv -f $@.new $@ - -CLEANFILES += doxygen.stamp -.PHONY: doxygen.stamp -doxygen.stamp: Doxyfile $(wildcard *.c) $(wildcard *.h) - $(inhibit-build-command) - @$(call print-rule-description,DOXYGEN,html dox) - cat $< $(if $(V),,| $(SED) -e 's!^QUIET *=.*!QUIET = YES!') | $(DOXYGEN) - - echo > $@ - -dox: doxygen.stamp - -.PHONY: serve-dox -serve-dox: dox - @$(call print-rule-description,SERVING,doxygen html files,dox/html) - $(PYTHON3) -m http.server --directory dox/html - -EXTRA_DIST += COPYING -doc_DATA += COPYING - -EXTRA_DIST += CREDITS.md -doc_DATA += CREDITS.md - -EXTRA_DIST += NEWS.md -doc_DATA += NEWS.md - -EXTRA_DIST += README.md -doc_DATA += README.md - -EXTRA_DIST += PERMISSIONS.md -doc_DATA += PERMISSIONS.md - -EXTRA_DIST += DEVELOPMENT.md -EXTRA_DIST += INSTALL.md -EXTRA_DIST += PACKAGING.md - -EXTRA_DIST += contrib/failure-beeps -contrib_SCRIPTS += contrib/failure-beeps -EXTRA_DIST += contrib/success-beeps -contrib_SCRIPTS += contrib/success-beeps -EXTRA_DIST += contrib/morse/morse2beep.pl -contrib_SCRIPTS += contrib/morse/morse2beep.pl -EXTRA_DIST += contrib/morse/morse2beep.sed -contrib_SCRIPTS += contrib/morse/morse2beep.sed - - -######################################################################## -# Generic targets -######################################################################## - -all_TARGETS += $(bin_PROGRAMS) -all_TARGETS += $(sbin_PROGRAMS) -all_TARGETS += $(man1_DATA) - -.PHONY: all-local -all-local: $(all_TARGETS) - -check_TARGETS += $(all_TARGETS) -check_TARGETS += $(check_PROGRAMS) - -.PHONY: check-targets -check-targets: $(check_TARGETS) - -.PHONY: check -check: tests/run-tests beep $(check_TARGETS) - $(inhibit-build-command) - @$(call print-rule-description,CHECK,$(PWD)/beep) - env PACKAGE_VERSION="${PACKAGE_VERSION}" \ - /bin/bash $< $( __tmp/$(distdir)/local.mk - (cd __tmp/$(distdir) && $(FIND) . -type f) | env LC_ALL=C sort > __tmp/before-build.filelist - $(MAKE) -C __tmp/$(distdir) - $(MAKE) -C __tmp/$(distdir) check - $(MAKE) -C __tmp/$(distdir) install-nobuild - (cd __tmp/_prefix && $(FIND) . -type f) | env LC_ALL=C sort > __tmp/after-install.filelist - @n="$$($(WC) -l < __tmp/after-install.filelist)"; \ - if test "$$n" -eq 0; then \ - echo "Error: Found no installed files"; \ - exit 1; \ - elif test "$$n" -gt 10; then \ - echo "Found $${n} installed files: good."; \ - else \ - echo "Error: Found only $${n} installed files"; \ - exit 1; \ - fi - $(MAKE) -C __tmp/$(distdir) uninstall - (cd __tmp/_prefix && $(FIND) . -type f) | env LC_ALL=C sort > __tmp/after-uninstall.filelist - @n="$$($(WC) -l < __tmp/after-uninstall.filelist)"; \ - if test "$$n" -gt 0; then \ - echo "Error: Found $${n} left over installed files after uninstall"; \ - exit 1; \ - else \ - echo "Found no installed files after uninstall"; \ - fi - $(MAKE) -C __tmp/$(distdir) clean - (cd __tmp/$(distdir) && $(FIND) . -type f) | env LC_ALL=C sort > __tmp/after-clean.filelist - cd __tmp && $(DIFF_U) before-build.filelist after-clean.filelist - - -######################################################################## -# Development helpers -######################################################################## - -# Only have make deal with those variables and rules if this is a git -# repo, and if the git executable has been found. -GIT_INFO_EXCLUDE = $(firstword $(wildcard .git/info/exclude)) -ifneq ($(strip $(GIT_INFO_EXCLUDE)),) -ifdef GIT - -# List all references to documentation in the git repo -.PHONY: refs -refs: - $(GIT) grep -n -E '((http|https)://[a-zA-Z0-9\._/-]+|([A-Z]+\.md)|([a-zA-Z][a-zA-Z0-9_-]+\([0-9]+\)))' - -# List all TODOs and FIXMEs in the git repo -.PHONY: todo fixme -todo fixme: - $(GIT) grep -n -E '(TODO:|FIXME:|\\todo\s|@todo\s)' - -# Generate a kind of dist tarball to help with preparing for release -PACKAGE_TARBASE = $(eval PACKAGE_TARBASE := $$(PACKAGE_TARNAME)-$$(shell $$(GIT) describe --tags | $$(SED) 's/^v\([0-9]\)/\1/'))$(PACKAGE_TARBASE) -.PHONY: git-dist -git-dist: - @$(call print-rule-description,GIT ARCHIVE,$(PACKAGE_TARBASE).tar.gz) - $(GIT) archive --format=tar.gz --prefix=$(PACKAGE_TARBASE)/ --output=$(PACKAGE_TARBASE).tar.gz HEAD - -# Check that the lists of files inside the "git archive" and the "tar" -# dist tarballs are the same. -.PHONY: compare-tarballs -distcheck: compare-tarballs -compare-tarballs: dist git-dist - @$(call print-rule-description,COMPARE,contents of git archive and dist tarball) - rm -rf tarball-dist tarball-git-dist - mkdir tarball-dist && cd tarball-dist && $(TAR) xf ../$(distdir).tar.gz - mkdir tarball-git-dist && cd tarball-git-dist && $(TAR) xf ../$(PACKAGE_TARBASE).tar.gz - diff -ruN tarball-git-dist/$(PACKAGE_TARBASE) tarball-dist/$(distdir) - rm -rf tarball-dist tarball-git-dist - -endif -endif - - -######################################################################## -# Print rule descriptions and silent rules -# -# This is a bit more complex than mad scientist's simple silent -# rules[1]: -# -# * In silent mode, we print aligned descriptions for each target -# being built. -# -# * In non-silent mode, we print a description of the recipe before -# each recipe is actually run, but highlighted a bit to stand out -# from the endless sequence of recipe command text: The description -# line always starts with a "#", and on a TTY, it will be printed -# in bold. -# -# [1]: http://make.mad-scientist.net/managing-recipe-echoing/ -######################################################################## - -# Set V to empty to disable silent rules, non-empty to enable them. -V=1 -V= - -# Note that we cannot use "test -t 1" inside a $(shell ) command, as -# the $(shell) will capture stdout into a variable, so the "test -t 1" -# will always test negative. - -ifeq (,$(V)) -.SILENT: -print-rule-description = $(or\ -$(if $(3),printf "%12s %-22s FROM %s\n" "$(1)" "$(2)" "$(3)"),\ -$(if $(2),printf "%12s %s\n" "$(1)" "$(2)"),\ -$(error $(0) requires at least two parameters)) -else -set-color-vars = if test -t 1; then cb="$$($(TPUT) bold)"; cn="$$($(TPUT) sgr0)"; fi -print-rule-description = $(set-color-vars); $(or\ -$(if $(3),printf "%s# %s %s FROM %s%s\n" "$$cb" "$(1)" "$(2)" "$(3)" "$$cn"),\ -$(if $(2),printf "%s# %s %s%s\n" "$$cb" "$(1)" "$(2)" "$$cn"),\ -$(error $(0) requires at least two parameters)) -endif - - -######################################################################## -# End of GNUmakefile -######################################################################## - -ifneq (,$(V)) -$(info #=======================================================================) -endif diff --git a/INSTALL.md b/INSTALL.md index c4dbae4..b5eec0f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -12,10 +12,13 @@ notable exception should be the step adding users to the `beep` group. Build requirements ================== - * GNU make + * autoconf, automake, make * clang or gcc * Linux kernel headers +Running the tests with "make check" has more requirement like `bash` +or `tput` which are not tested for (at this time). + Compile and Install =================== @@ -23,63 +26,38 @@ Compile and Install The basic way to build and install beep is ``` +[user@host beep]$ autoreconf -vif +[user@host beep]$ ./configure [user@host beep]$ make -[user@host beep]$ make install-nobuild +[user@host beep]$ make install ``` -`beep` does not have a `configure` script, so to make some -configuration options last over different make invocations, do -generate a `local.mk` file containing the appropriate definitions: - The buildsystem will use whatever value `CC` is as a compiler, and use a few tools like `PANDOC` for building html from markdown. You can set these to your desired values, including `PANDOC=false` to disable building and installing html files. -The installation location will be written into some files during -`make`, and will then be used during `make install`. The default -installation location is `prefix=/usr/local`, with `bindir`, `docdir`, -`htmldir`, `mandir`, etc. being used for more specialized installation -directories. For installing into a chroot environment, the `install` -target(s) support `DESTDIR=/path/to/chroot`. - -You can override any of these variables from the `make` command line -like e.g. - -``` -[user@host beep]$ make prefix=$HOME/.local -[user@host beep]$ make prefix=$HOME/.local install -``` +For installing into a chroot environment, the use +`DESTDIR=/path/to/chroot` with the `install` target. -or you can put that definition (and others) into a `local.mk` file: - -``` -[user@host beep]$ cat>local.mk< $@ + echo '#include "beep-usage.h"' >> $@ + echo 'char beep_usage[] =' >> $@ + set -e; IFS=""; while read line; do \ + printf ' "%s\\n"\n' "$${line}" >> $@; \ + done < $< + echo ' ;' >> $@ + +EXTRA_DIST += beep.1.in +CLEANFILES += beep.1 +man1_MANS += beep.1 +beep.1: beep.1.in Makefile + $(SED) $(REPLACEMENTS) < $< > $@ + +EXTRA_DIST += beep-usage.txt.in +CLEANFILES += beep-usage.txt +beep-usage.txt: beep-usage.txt.in Makefile + $(SED) $(REPLACEMENTS) < $< > $@ + +BUILT_SOURCES += beep-config.h +EXTRA_DIST += beep-config.h.in +CLEANFILES += beep-config.h +beep-config.h: beep-config.h.in Makefile + $(SED) $(REPLACEMENTS) < $< > $@ + +EXTRA_DIST += Doxyfile.in +CLEANFILES += Doxyfile +Doxyfile: Doxyfile.in Makefile + $(SED) $(REPLACEMENTS) < $< > $@ + +if HAVE_TOOL_DOXYGEN +CLEANFILES += doxygen.stamp +doxygen.stamp: Doxyfile $(BUILT_SOURCES) $(beep_SOURCES) + $(DOXYGEN) $< + echo timestamp > $@ + +dox: doxygen.stamp + +if HAVE_TOOL_PYTHON3 +.PHONY: serve-dox +serve-dox: dox + $(PYTHON3) -m http.server --directory dox/html +endif +endif + +include contrib/Makefile-files +include contrib/morse/Makefile-files +include m4/Makefile-files +include tests/Makefile-files + +# TODO: make tests run with "make check" and possibly "make installcheck" +# installcheck-local: diff --git a/NEWS.md b/NEWS.md index 7d3ea3b..cc360bb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,10 @@ The big and user visible changes. 1.4.xx ------ * Silence the speaker on SIGHUP (like we do on SIGINT, SIGTERM) + * Changed buildsystem to Automake from proprietary GNUmakefile. + This is primarily to reduce the effort for maintenance and + packaging. Building beep with both clang *and* gcc is still + available for developers through the `testbuild-all` script. 1.4.12 ------ diff --git a/PACKAGING.md b/PACKAGING.md index 7c7e39e..499e3a2 100644 --- a/PACKAGING.md +++ b/PACKAGING.md @@ -12,16 +12,15 @@ also be interesting. Building and installing ----------------------- -The building and installing during a package build can be achieved with +The building and installing during a package build can be achieved as +for every other automake based package, i.e. with ```sh +./configure --prefix=... make -make install-nobuild DESTDIR=/path/to/package-root +make install DESTDIR=/path/to/package-root ``` -While not strictly necessary, using `make install-nobuild` makes sure -that no compilation happens during the installation phase. - You can also add to the default compiler flags by setting or adding to `CFLAGS`, `CPPFLAGS`, `LDFLAGS`, and `LDADD`, by running `make` like e.g. @@ -30,13 +29,13 @@ e.g. make CFLAGS="-O -g -flto=auto -ffat-lto-objects" CPPFLAGS="-I/opt/include" LDFLAGS="-f" LDADD="-L/opt/lib -lmoo" ``` -or putting those definitions into the `local.mk` file. - The buildsystem will use whatever compiler `CC` is set to. `clang` and `gcc` are known to work, other toolchains might. ```sh -make CC=clang +./configure CC=clang +make +make install ``` If your package build has `pandoc` available and working, HTML files @@ -44,39 +43,14 @@ will be built from the markdown files and installed later. If you do not want HTML files built and installed, you can set `PANDOC=false`. If you need to set any of the `*dir` variables like `prefix` or -`docdir` on the `make` command line, you need to set them for both the -build step (`make`) and for the install step (`make install`). You -might either give the very same command line for every invocation of -`make`, or you can write those definitions into a make include file -called `local.mk` once. For example, you might want to achieve the -effect of +`docdir`, set them with `configure --prefix=...` or `configure +--docdir=...` so that the same values are available both for the build +(`make`) and for the install (`make install`) step. -```sh -make prefix='/usr' docdir='$(docdir)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)' -make prefix='/usr' docdir='$(docdir)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)' DESTDIR=/path/to/package-root install -``` - -by creating a `local.mk` which might look as follows in e.g. an RPM -spec file: +Every distribution should contain examples of how to build automake +based packages by invoking `configure`, `make`, and `make install` +with the appropriate parameters and environment variables. -```sh -cat>local.mk< local.mk - echo 'prefix = /usr' >> local.mk - echo 'CFLAGS = $(shell dpkg-buildflags --get CFLAGS)' >> local.mk -``` Files to install for beep ------------------------- diff --git a/auto-m4/.gitignore b/auto-m4/.gitignore new file mode 100644 index 0000000..fe9c2dc --- /dev/null +++ b/auto-m4/.gitignore @@ -0,0 +1 @@ +# dummy file diff --git a/beep-config.h.in b/beep-config.h.in index 760d036..71765df 100644 --- a/beep-config.h.in +++ b/beep-config.h.in @@ -5,6 +5,8 @@ * \author Copyright (C) 2010-2013 Gerfried Fuchs * \author Copyright (C) 2013-2018 Hans Ulrich Niedermann * + * @configure_input@ + * * This program 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 2 of the License, or diff --git a/beep-library.c b/beep-library.c index 27ab3f4..3207dcb 100644 --- a/beep-library.c +++ b/beep-library.c @@ -90,6 +90,8 @@ void safe_errno_exit(const char *const msg) { const int saved_errno = errno; char strerr_buf[128]; +#if (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && !defined(_GNU_SOURCE)) + /* XSI compliant int strerror_r(int errnum, char *buf, size_t buflen); */ const int ret = strerror_r(saved_errno, strerr_buf, sizeof(strerr_buf)); if (ret != 0) { if (write(STDERR_FILENO, "strerror_r error\n", @@ -98,6 +100,12 @@ void safe_errno_exit(const char *const msg) } _exit(EXIT_FAILURE); } + const char *const error_string = strerr_buf; +#else + /* GNU-specific char *strerror_r(int errnum, char *buf, size_t buflen); */ + const char *const error_string = + strerror_r(saved_errno, strerr_buf, sizeof(strerr_buf)); +#endif const size_t msglen = strlen(msg); if (write(STDERR_FILENO, msg, msglen)) { /* ignore all write errors */ @@ -105,8 +113,8 @@ void safe_errno_exit(const char *const msg) if (write(STDERR_FILENO, ": ", 2)) { /* ignore all write errors */ } - const size_t errlen = strlen(strerr_buf); - if (write(STDERR_FILENO, strerr_buf, errlen)) { + const size_t errlen = strlen(error_string); + if (write(STDERR_FILENO, error_string, errlen)) { /* ignore all write errors */ } if (write(STDERR_FILENO, "\n", 1)) { diff --git a/beep-log.c b/beep-log.c index c75e45b..e869356 100644 --- a/beep-log.c +++ b/beep-log.c @@ -64,7 +64,16 @@ void log_internal_vf(const char *const module, const char *levelstr, } else { fprintf(stdout, "%s: %s: ", progname, levelstr); } +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-nonliteral" +#else /* to clang or not to clang */ +#endif vfprintf(stdout, format, copied_args); +#ifdef __clang__ +#pragma clang diagnostic pop +#else /* to clang or not to clang */ +#endif fputc('\n', stdout); va_end(copied_args); diff --git a/beep-main.c b/beep-main.c index a7b2e5b..604c521 100644 --- a/beep-main.c +++ b/beep-main.c @@ -52,6 +52,7 @@ #include #include +#include "auto-config.h" #include "beep-config.h" #include "beep-compiler.h" diff --git a/beep.1.in b/beep.1.in index 49577c5..311ccca 100644 --- a/beep.1.in +++ b/beep.1.in @@ -1,4 +1,5 @@ .\" The beep(1) man page +.\" @configure_input@ .\" .\" This man page has been rewritten adhering to the following .\" documentation: man(7), man-pages(7), tbl(1) diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..3e75923 --- /dev/null +++ b/configure.ac @@ -0,0 +1,102 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.69]) +AC_INIT([beep], + [1.4.13], + [https://github.com/spkr-beep/beep/issues], + [beep], + [https://github.com/spkr-beep/beep]) +AC_CONFIG_AUX_DIR([auto-aux]) +AC_CONFIG_MACRO_DIR([auto-m4]) +AC_CONFIG_SRCDIR([beep-log.h]) +AC_CONFIG_HEADERS([auto-config.h]) + +AM_INIT_AUTOMAKE([ + 1.16 + foreign + serial-tests + subdir-objects + -Wall + -Werror +]) + +# Checks for programs. +AC_PROG_AWK +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_PROG_MKDIR_P +AC_PROG_SED + +dnl Catch our project specific (*s*pkr-*b*beep) macros +m4_pattern_forbid([^SB_])dnl + +dnl While we are still using the old run-tests script, check for tput +dnl and /bin/bash + +SB_PROG([BASH], [bash]) +SB_PROG([DIFF], [diff]) +SB_PROG([DOXYGEN], [doxygen]) +SB_PROG([PANDOC], [pandoc]) +SB_PROG([PYTHON3], [python3]) +SB_PROG([TPUT], [tput]) + +# TODO: Use the proper C standard for compiling. +# TODO: Produce as many warnings and errors as possible when compiling. + +# Checks for libraries. +saved_LIBS="$LIBS" +LIBS="" +AC_CHECK_LIB([m], [lrint]) +AC_SUBST([M_LIBS], ["$LIBS"]) +LIBS="$saved_LIBS" + +# Checks for header files. +AC_CHECK_HEADERS(m4_flatten([ + fcntl.h + limits.h + stddef.h + stdint.h + stdlib.h + string.h + sys/ioctl.h + sys/time.h + unistd.h +])) + +# Checks for typedefs, structures, and compiler characteristics. +AC_CHECK_HEADER_STDBOOL +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_UINT16_T + +# Checks for library functions. +AC_FUNC_FORK +AC_FUNC_MALLOC +AC_FUNC_STRERROR_R +AC_CHECK_FUNCS(m4_flatten([ + clock_gettime + memset + strdup + strerror + strrchr + strtol + strtoul +])) + +AC_SUBST([DEFAULT_FREQ], [440]) +AC_SUBST([DEFAULT_LENGTH], [200]) +AC_SUBST([DEFAULT_DELAY], [100]) + +SB_SUMMARY_VAR([DEFAULT_FREQ]) +SB_SUMMARY_VAR([DEFAULT_LENGTH]) +SB_SUMMARY_VAR([DEFAULT_DELAY]) + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +SB_SUMMARY + +dnl Local Variables: +dnl indent-tabs-mode: nil +dnl End: diff --git a/contrib/Makefile-files b/contrib/Makefile-files new file mode 100644 index 0000000..ce7b90c --- /dev/null +++ b/contrib/Makefile-files @@ -0,0 +1,7 @@ +# -*- makefile-automake -*- + +EXTRA_DIST += %reldir%/failure-beeps +contrib_SCRIPTS += %reldir%/failure-beeps + +EXTRA_DIST += %reldir%/success-beeps +contrib_SCRIPTS += %reldir%/success-beeps diff --git a/contrib/morse/Makefile-files b/contrib/morse/Makefile-files new file mode 100644 index 0000000..fb2ff8d --- /dev/null +++ b/contrib/morse/Makefile-files @@ -0,0 +1,7 @@ +# -*- makefile-automake -*- + +EXTRA_DIST += %reldir%/morse2beep.pl +contrib_SCRIPTS += %reldir%/morse2beep.pl + +EXTRA_DIST += %reldir%/morse2beep.sed +contrib_SCRIPTS += %reldir%/morse2beep.sed diff --git a/m4/Makefile-files b/m4/Makefile-files new file mode 100644 index 0000000..38f3f37 --- /dev/null +++ b/m4/Makefile-files @@ -0,0 +1,4 @@ +# -*- makefile-automake -*- + +EXTRA_DIST += %reldir%/sb-prog.m4 +EXTRA_DIST += %reldir%/sb-summary.m4 diff --git a/m4/sb-prog.m4 b/m4/sb-prog.m4 new file mode 100644 index 0000000..b405574 --- /dev/null +++ b/m4/sb-prog.m4 @@ -0,0 +1,18 @@ +# sb-prog.m4 - check for program, but let user override it -*- Autoconf -*- +# serial 2 +dnl +dnl +dnl +AC_DEFUN([SB_PROG], [dnl +AC_ARG_VAR([$1], [$2 program]) +AS_IF([test x = "x$][$1]["], [dnl +AC_PATH_PROG([$1], [$2], [false]) +]) +AM_CONDITIONAL([HAVE_TOOL_][$1], [test "x$][$1][" != xfalse]) +])dnl +dnl +dnl +dnl +dnl Local Variables: +dnl indent-tabs-mode: nil +dnl End: diff --git a/m4/sb-summary.m4 b/m4/sb-summary.m4 new file mode 100644 index 0000000..93588fd --- /dev/null +++ b/m4/sb-summary.m4 @@ -0,0 +1,40 @@ +# sb-summary.m4 - print summary at the end of configure -*- Autoconf -*- +# serial 3 +dnl +dnl +m4_pattern_forbid([SB_SUMMARY_ITEM_WIDTH])dnl +AC_DEFUN([SB_SUMMARY_ITEM_WIDTH], [17])dnl +dnl +dnl +m4_pattern_forbid([SB_SUMMARY_FILE])dnl +AC_DEFUN([SB_SUMMARY_FILE], [sb_summary.txt])dnl +dnl +dnl +AC_DEFUN_ONCE([SB_SUMMARY_INIT], [dnl +printf '%s for %s-%s:\n' 'Build Summary' "$PACKAGE_TARNAME" "$PACKAGE_VERSION" > SB_SUMMARY_FILE +])dnl +dnl +dnl +AC_DEFUN([SB_SUMMARY_ITEM], [dnl +AC_REQUIRE([SB_SUMMARY_INIT])dnl +printf ' %-]SB_SUMMARY_ITEM_WIDTH[s %s\n' m4_default(["AS_ESCAPE($1)"],[""]) m4_default($2,[""]) >> SB_SUMMARY_FILE +])dnl +dnl +dnl +AC_DEFUN([SB_SUMMARY_VAR], [dnl +AC_REQUIRE([SB_SUMMARY_INIT])dnl +SB_SUMMARY_ITEM([$1], ["$][$1]["])dnl +])dnl +dnl +dnl +AC_DEFUN([SB_SUMMARY], [dnl +AC_REQUIRE([SB_SUMMARY_INIT])dnl +cat "SB_SUMMARY_FILE" +rm -f "SB_SUMMARY_FILE" +])dnl +dnl +dnl +dnl +dnl Local Variables: +dnl indent-tabs-mode: nil +dnl End: diff --git a/testbuild-all b/testbuild-all index 70bc12b..0122bd5 100755 --- a/testbuild-all +++ b/testbuild-all @@ -4,11 +4,15 @@ cd "$(dirname "$0")" export LC_ALL=C +MAKE="${MAKE-make}" + set -ex -# We need to remove the built files from the $(srcdir) in order to -# make the VPATH search work properly for the test builds. -make clean +if test -f Makefile; then + make distclean +fi + +NPROC="$(nproc || echo e)" while read id cc cflags do @@ -19,24 +23,16 @@ do ( mkdir "$builddir" cd "$builddir" - srcdir="${abs_top_srcdir}" - cat>local.mk< after-installation.txt nl after-installation.txt if test -s after-installation.txt; then @@ -55,9 +51,6 @@ EOF fi ) done < $@ + chmod +x $@ +endif +endif + +clean-local: + rm -f %reldir%/*.actual + rm -f %reldir%/*.actual.new + +EXTRA_DIST += %reldir%/00-nothing.expected.0 +EXTRA_DIST += %reldir%/00-nothing.sh +EXTRA_DIST += %reldir%/01-nothing.sh +EXTRA_DIST += %reldir%/02-second-device-name.expected.0 +EXTRA_DIST += %reldir%/02-second-device-name.sh +EXTRA_DIST += %reldir%/03-cmdline-unhandled-option.expected.0 +EXTRA_DIST += %reldir%/03-cmdline-unhandled-option.sh +EXTRA_DIST += %reldir%/04-cmdline-unhandled-non-option.sh +EXTRA_DIST += %reldir%/05-cmdline-help.bash +EXTRA_DIST += %reldir%/05-cmdline-help.expected.0 +EXTRA_DIST += %reldir%/05-cmdline-version.bash +EXTRA_DIST += %reldir%/05-cmdline-version.expected.0 +EXTRA_DIST += %reldir%/10-beep-default.sh +EXTRA_DIST += %reldir%/11-beep-default-logs.expected.0 +EXTRA_DIST += %reldir%/11-beep-default-logs.expected.1 +EXTRA_DIST += %reldir%/11-beep-default-logs.sh +EXTRA_DIST += %reldir%/11-beep-f-880Hz.sh +EXTRA_DIST += %reldir%/20-beep-default.sh +EXTRA_DIST += %reldir%/20-beep-device-dev-evdev-pcspkr.sh +EXTRA_DIST += %reldir%/21-beep-device-dev-console.expected.0 +EXTRA_DIST += %reldir%/21-beep-device-dev-console.expected.1 +EXTRA_DIST += %reldir%/21-beep-device-dev-console.sh +EXTRA_DIST += %reldir%/30-beep-device-dev-tty0.expected.0 +EXTRA_DIST += %reldir%/30-beep-device-dev-tty0.expected.1 +EXTRA_DIST += %reldir%/30-beep-device-dev-tty0.sh +EXTRA_DIST += %reldir%/31-beep-device-dev-tty4.expected.0 +EXTRA_DIST += %reldir%/31-beep-device-dev-tty4.expected.1 +EXTRA_DIST += %reldir%/31-beep-device-dev-tty4.expected.2 +EXTRA_DIST += %reldir%/31-beep-device-dev-tty4.expected.3 +EXTRA_DIST += %reldir%/31-beep-device-dev-tty4.sh +EXTRA_DIST += %reldir%/33-beep-device-dev-tty63.expected.0 +EXTRA_DIST += %reldir%/33-beep-device-dev-tty63.expected.1 +EXTRA_DIST += %reldir%/33-beep-device-dev-tty63.sh +EXTRA_DIST += %reldir%/34-beep-device-dev-ttyXX.expected.0 +EXTRA_DIST += %reldir%/34-beep-device-dev-ttyXX.sh +EXTRA_DIST += %reldir%/35-beep-device-dev-tty99.expected.0 +EXTRA_DIST += %reldir%/35-beep-device-dev-tty99.sh +EXTRA_DIST += %reldir%/36-beep-device-dev-ttyX.expected.0 +EXTRA_DIST += %reldir%/36-beep-device-dev-ttyX.sh +EXTRA_DIST += %reldir%/37-beep-device-dev-ttyS1.expected.0 +EXTRA_DIST += %reldir%/37-beep-device-dev-ttyS1.expected.1 +EXTRA_DIST += %reldir%/37-beep-device-dev-ttyS1.sh +EXTRA_DIST += %reldir%/38-beep-device-dev-tty999.expected.0 +EXTRA_DIST += %reldir%/38-beep-device-dev-tty999.sh +EXTRA_DIST += %reldir%/40-beep-device-dev-vc-0.expected.0 +EXTRA_DIST += %reldir%/40-beep-device-dev-vc-0.sh +EXTRA_DIST += %reldir%/50-long-len-and-signal-SIGINT.expected.0 +EXTRA_DIST += %reldir%/50-long-len-and-signal-SIGINT.sh +EXTRA_DIST += %reldir%/50-long-len-and-signal-SIGTERM.expected.0 +EXTRA_DIST += %reldir%/50-long-len-and-signal-SIGTERM.sh +EXTRA_DIST += %reldir%/51-long-delay-and-signal-SIGINT.expected.0 +EXTRA_DIST += %reldir%/51-long-delay-and-signal-SIGINT.sh +EXTRA_DIST += %reldir%/60-beep-from-stdin.expected.0 +EXTRA_DIST += %reldir%/60-beep-from-stdin.sh +EXTRA_DIST += %reldir%/61-beep-from-stdin.expected.0 +EXTRA_DIST += %reldir%/61-beep-from-stdin.sh +EXTRA_DIST += %reldir%/62-beep-from-stdin.expected.0 +EXTRA_DIST += %reldir%/62-beep-from-stdin.sh +EXTRA_DIST += %reldir%/63-beep-from-stdin.expected.0 +EXTRA_DIST += %reldir%/63-beep-from-stdin.sh diff --git a/tests/run-tests b/tests/run-tests.in similarity index 82% rename from tests/run-tests rename to tests/run-tests.in index 4c30e01..ed4509e 100644 --- a/tests/run-tests +++ b/tests/run-tests.in @@ -1,7 +1,9 @@ -#!/bin/bash +#!@BASH@ +# @configure_input@ # # run-tests - run a given series of test cases for beep # Copyright (C) 2018-2019 Hans Ulrich Niedermann +# Copyright (C) 2022 Hans Ulrich Niedermann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,10 +19,10 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -CMP=cmp -DIFF=diff -SED=sed -SHELL=sh +CMP="${CMP-cmp}" +DIFF="${DIFF-@DIFF@}" +SED="${SED-sed}" +TPUT="${TPUT-@TPUT@}" # TODO: If we have more tone generating tests, find a well-known # melody without repeating notes and play that melody so that a @@ -30,22 +32,23 @@ FREQS=(440 494 554 587 659 740 831 880 988 1109 1175 1319 1480 1661 1760) : set -e : set -x -test_dir="$1" -shift -BEEP="$1" -shift +BEEP="${BEEP-@BEEP@}" export BEEP +PACKAGE_VERSION="${PACKAGE_VERSION-@PACKAGE_VERSION@}" +test_src_dir="${srcdir-@srcdir@}/tests" +test_dst_dir="${builddir-@builddir@}/tests" + skip=0 pass=0 fail=0 if test -t 1; then - hilite="$(tput setaf 3)" - normal="$(tput sgr0)" - green="$(tput setaf 2)" - blue="$(tput setaf 4)" - red="$(tput setaf 1)$(tput bold)" + hilite="$(${TPUT} setaf 3)" + normal="$(${TPUT} sgr0)" + green="$(${TPUT} setaf 2)" + blue="$(${TPUT} setaf 4)" + red="$(${TPUT} setaf 1)$(${TPUT} bold)" else hilite="" normal="" @@ -89,11 +92,10 @@ fi if true; then freq_idx=0 - for test in $(ls -1 "${test_dir}/"*.{bash,sh}); do + for test in $(ls -1 "${test_src_dir}/"*.{bash,sh}); do export FREQ="${FREQS[${freq_idx}]}" base="$(basename $(basename "$test" .bash) .sh)" - dir="$(dirname "$test")" - actual="${dir}/${base}.actual" + actual="${test_dst_dir}/${base}.actual" printf "${hilite}%-32s${normal} " "${base}" if "$have_no_hardware" && grep "^: REQUIRES_HARDWARE" "$test" > /dev/null; then skip="$(expr "${skip}" + 1)" @@ -101,7 +103,7 @@ if true; then elif "${test}" > "${actual}.new" 2>&1; then canonicalize_output < "${actual}.new" > "${actual}" expects_output=false - for file in "${dir}/${base}.expected".[0-9]; do + for file in "${test_src_dir}/${base}.expected".[0-9]; do if test -f "$file"; then expects_output=true break @@ -109,7 +111,7 @@ if true; then done if "${expects_output}"; then expect_fail="true" - for expected in "${dir}/${base}.expected".[0-9]; do + for expected in "${test_src_dir}/${base}.expected".[0-9]; do if ${CMP} --quiet "${expected}" "${actual}"; then pass="$(expr "${pass}" + 1)" echo "${passmsg}${expected/#*expected}" @@ -120,7 +122,7 @@ if true; then if "$expect_fail"; then fail="$(expr "${fail}" + 1)" echo "${failmsg}" - for expected in "${dir}/${base}.expected".[0-9]; do + for expected in "${test_src_dir}/${base}.expected".[0-9]; do ${DIFF} -u "${expected}" "${actual}" done fi From b6c84dc73d029af7ab3aadefe0bb1a6f2f88c4cf Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sun, 16 Oct 2022 14:52:42 +0200 Subject: [PATCH 2/3] Update Doxygen.in file to doxygen 1.9.5 Update Doxygen.in file to doxygen 1.9.5, and have configure script check the doxygen version found before the Makefile.am uses it. --- Doxyfile.in | 448 ++++++++++++++++++++++++++---------------- Makefile.am | 2 +- configure.ac | 3 +- m4/Makefile-files | 1 + m4/sb-prog-doxygen.m4 | 35 ++++ 5 files changed, 317 insertions(+), 172 deletions(-) create mode 100644 m4/sb-prog-doxygen.m4 diff --git a/Doxyfile.in b/Doxyfile.in index a7809cc..e80c150 100644 --- a/Doxyfile.in +++ b/Doxyfile.in @@ -1,4 +1,4 @@ -# Doxyfile 1.9.1 +# Doxyfile 1.9.5 # @configure_input@ # This file describes the settings to be used by the documentation system @@ -13,6 +13,16 @@ # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] #--------------------------------------------------------------------------- # Project related configuration options @@ -61,16 +71,28 @@ PROJECT_LOGO = OUTPUT_DIRECTORY = dox -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes -# performance problems for the file system. +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. # The default value is: NO. CREATE_SUBDIRS = NO +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# numer of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode @@ -82,26 +104,18 @@ ALLOW_UNICODE_NAMES = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English -# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all generated output in the proper direction. -# Possible values are: None, LTR, RTL and Context. -# The default value is: None. - -OUTPUT_TEXT_DIRECTION = None - # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. @@ -259,16 +273,16 @@ TAB_SIZE = 4 # the documentation. An alias has the form: # name=value # For example adding -# "sideeffect=@par Side Effects:\n" +# "sideeffect=@par Side Effects:^^" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines (in the resulting output). You can put ^^ in the value part of an -# alias to insert a newline as if a physical newline was in the original file. -# When you need a literal { or } or , in the value part of an alias you have to -# escape them by means of a backslash (\), this can lead to conflicts with the -# commands \{ and \} for these it is advised to use the version @{ and @} or use -# a double escape (\\{ and \\}) +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) ALIASES = @@ -313,8 +327,8 @@ OPTIMIZE_OUTPUT_SLICE = NO # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and # language is one of the parsers supported by doxygen: IDL, Java, JavaScript, -# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, -# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: # FortranFree, unknown formatted Fortran: Fortran. In the later case the parser # tries to guess whether the code is fixed or free formatted code, this is the # default for Fortran type files). For instance to make doxygen treat .inc files @@ -461,13 +475,13 @@ TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 0 -# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use # during processing. When set to 0 doxygen will based this on the number of # cores available in the system. You can set it explicitly to a value larger # than 0 to get more control over the balance between CPU load and processing # speed. At this moment only the input processing can be done using multiple # threads. Since this is still an experimental feature the default is set to 1, -# which efficively disables parallel processing. Please report any issues you +# which effectively disables parallel processing. Please report any issues you # encounter. Generating dot graphs in parallel is controlled by the # DOT_NUM_THREADS setting. # Minimum value: 0, maximum value: 32, default value: 1. @@ -586,14 +600,15 @@ INTERNAL_DOCS = NO # filesystem is case sensitive (i.e. it supports files in the same directory # whose names only differ in casing), the option must be set to YES to properly # deal with such files in case they appear in the input. For filesystems that -# are not case sensitive the option should be be set to NO to properly deal with +# are not case sensitive the option should be set to NO to properly deal with # output files written for symbols that only differ in casing, such as for two # classes, one named CLASS and the other named Class, and to also support # references to files without having to specify the exact matching casing. On # Windows (including Cygwin) and MacOS, users should typically set this option # to NO, whereas on Linux or other Unix flavors it should typically be set to # YES. -# The default value is: system dependent. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. CASE_SENSE_NAMES = YES @@ -611,6 +626,12 @@ HIDE_SCOPE_NAMES = NO HIDE_COMPOUND_REFERENCE= NO +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. + +SHOW_HEADERFILE = YES + # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. @@ -768,7 +789,8 @@ FILE_VERSION_FILTER = # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE @@ -814,18 +836,26 @@ WARNINGS = YES WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. If -# EXTRACT_ALL is set to YES then this flag will automatically be disabled. +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC # The default value is: NO. WARN_NO_PARAMDOC = YES @@ -845,13 +875,27 @@ WARN_AS_ERROR = YES # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard -# error (stderr). +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). WARN_LOGFILE = @@ -872,10 +916,21 @@ INPUT = @abs_top_srcdir@ # libiconv (or the iconv built into libc) for the transcoding. See the libiconv # documentation (see: # https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING # The default value is: UTF-8. INPUT_ENCODING = UTF-8 +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding +# "INPUT_ENCODING" for further information on supported encodings. + +INPUT_FILE_ENCODING = + # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. @@ -889,10 +944,10 @@ INPUT_ENCODING = UTF-8 # # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), -# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl, -# *.ucf, *.qsf and *.ice. +# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, +# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C +# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, +# *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = *.c \ *.cc \ @@ -981,7 +1036,7 @@ EXCLUDE_PATTERNS += README.md # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test +# ANamespace::AClass, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* @@ -1029,6 +1084,11 @@ IMAGE_PATH = # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. @@ -1070,6 +1130,15 @@ FILTER_SOURCE_PATTERNS = USE_MDFILE_AS_MAINPAGE = +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- @@ -1167,9 +1236,11 @@ VERBATIM_HEADERS = YES CLANG_ASSISTED_PARSING = NO -# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to -# YES then doxygen will add the directory of each input to the include path. +# If the CLANG_ASSISTED_PARSING tag is set to YES and the CLANG_ADD_INC_PATHS +# tag is set to YES then doxygen will add the directory of each input to the +# include path. # The default value is: YES. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. CLANG_ADD_INC_PATHS = YES @@ -1302,9 +1373,26 @@ HTML_EXTRA_STYLESHEET = HTML_EXTRA_FILES = +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. Default setting AUTO_LIGHT +# enables light output unless the user preference is dark output. Other options +# are DARK to always use dark mode, LIGHT to always use light mode, AUTO_DARK to +# default to dark mode unless the user prefers light mode, and TOGGLE to let the +# user toggle between dark and light mode via a button. +# Possible values are: LIGHT Always generate light output., DARK Always generate +# dark output., AUTO_LIGHT Automatically set the mode according to the user +# preference, use light mode if no preference is set (the default)., AUTO_DARK +# Automatically set the mode according to the user preference, use dark mode if +# no preference is set. and TOGGLE Allow to user to switch between light and +# dark mode via a button.. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = AUTO_LIGHT + # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see +# this color. Hue is specified as an angle on a color-wheel, see # https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. @@ -1314,7 +1402,7 @@ HTML_EXTRA_FILES = HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A +# in the HTML output. For a value of 0 the output will use gray-scales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1396,6 +1484,13 @@ GENERATE_DOCSET = NO DOCSET_FEEDNAME = "Doxygen generated docs" +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. @@ -1421,8 +1516,12 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: -# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows. +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML @@ -1581,16 +1680,28 @@ DISABLE_INDEX = NO # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = YES +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # @@ -1615,6 +1726,13 @@ TREEVIEW_WIDTH = 250 EXT_LINKS_IN_WINDOW = NO +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + # If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg # tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see # https://inkscape.org) to generate formulas as SVG images instead of PNGs for @@ -1635,17 +1753,6 @@ HTML_FORMULA_FORMAT = png FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANSPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - # The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands # to create new LaTeX commands to be used in formulas as building blocks. See # the section "Including formulas" for details. @@ -1663,11 +1770,29 @@ FORMULA_MACROFILE = USE_MATHJAX = NO +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_VERSION = MathJax_2 + # When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). # Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1680,15 +1805,21 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from https://www.mathjax.org before deployment. -# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/ # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = @@ -1868,29 +1999,31 @@ PAPER_TYPE = a4 EXTRA_PACKAGES = -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the -# generated LaTeX document. The header should contain everything until the first -# chapter. If it is left blank doxygen will generate a standard header. See -# section "Doxygen usage" for information on how to let doxygen write the -# default header to a separate file. +# The LATEX_HEADER tag can be used to specify a user-defined LaTeX header for +# the generated LaTeX document. The header should contain everything until the +# first chapter. If it is left blank doxygen will generate a standard header. It +# is highly recommended to start with a default header using +# doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty +# and then modify the file new_header.tex. See also section "Doxygen usage" for +# information on how to generate the default header that doxygen normally uses. # -# Note: Only use a user-defined header if you know what you are doing! The -# following commands have a special meaning inside the header: $title, -# $datetime, $date, $doxygenversion, $projectname, $projectnumber, -# $projectbrief, $projectlogo. Doxygen will replace $title with the empty -# string, for the replacement values of the other commands the user is referred -# to HTML_HEADER. +# Note: Only use a user-defined header if you know what you are doing! +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. The following +# commands have a special meaning inside the header (and footer): For a +# description of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HEADER = -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the -# generated LaTeX document. The footer should contain everything after the last -# chapter. If it is left blank doxygen will generate a standard footer. See +# The LATEX_FOOTER tag can be used to specify a user-defined LaTeX footer for +# the generated LaTeX document. The footer should contain everything after the +# last chapter. If it is left blank doxygen will generate a standard footer. See # LATEX_HEADER for more information on how to generate a default footer and what -# special commands can be used inside the footer. -# -# Note: Only use a user-defined footer if you know what you are doing! +# special commands can be used inside the footer. See also section "Doxygen +# usage" for information on how to generate the default footer that doxygen +# normally uses. Note: Only use a user-defined footer if you know what you are +# doing! # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_FOOTER = @@ -1935,8 +2068,7 @@ USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode # command to the generated LaTeX files. This will instruct LaTeX to keep running -# if errors occur, instead of asking the user for help. This option is also used -# when generating formulas in HTML. +# if errors occur, instead of asking the user for help. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1949,16 +2081,6 @@ LATEX_BATCHMODE = NO LATEX_HIDE_INDICES = NO -# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source -# code with syntax highlighting in the LaTeX output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_SOURCE_CODE = NO - # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See # https://en.wikipedia.org/wiki/BibTeX and \cite for more info. @@ -2039,16 +2161,6 @@ RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = -# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code -# with syntax highlighting in the RTF output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_SOURCE_CODE = NO - #--------------------------------------------------------------------------- # Configuration options related to the man page output #--------------------------------------------------------------------------- @@ -2145,15 +2257,6 @@ GENERATE_DOCBOOK = NO DOCBOOK_OUTPUT = docbook -# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the -# program listings (including syntax highlighting and cross-referencing -# information) to the DOCBOOK output. Note that enabling this will significantly -# increase the size of the DOCBOOK output. -# The default value is: NO. -# This tag requires that the tag GENERATE_DOCBOOK is set to YES. - -DOCBOOK_PROGRAMLISTING = NO - #--------------------------------------------------------------------------- # Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- @@ -2240,7 +2343,8 @@ SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by the -# preprocessor. +# preprocessor. Note that the INCLUDE_PATH is not recursive, so the setting of +# RECURSIVE has no effect here. # This tag requires that the tag SEARCH_INCLUDES is set to YES. INCLUDE_PATH = @@ -2334,15 +2438,6 @@ EXTERNAL_PAGES = YES # Configuration options related to the dot tool #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram -# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to -# NO turns the diagrams off. Note that this option also works with HAVE_DOT -# disabled, but it is recommended to install and use dot, since it yields more -# powerful graphs. -# The default value is: YES. - -CLASS_DIAGRAMS = YES - # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. @@ -2375,35 +2470,50 @@ HAVE_DOT = YES DOT_NUM_THREADS = 0 -# When you want a differently looking font in the dot files that doxygen -# generates you can specify the font name using DOT_FONTNAME. You need to make -# sure dot is able to find the font, which can be done by putting it in a -# standard location or by setting the DOTFONTPATH environment variable or by -# setting DOT_FONTPATH to the directory containing the font. -# The default value is: Helvetica. +# DOT_COMMON_ATTR is common attributes for nodes, edges and labels of +# subgraphs. When you want a differently looking font in the dot files that +# doxygen generates you can specify fontname, fontcolor and fontsize attributes. +# For details please see Node, +# Edge and Graph Attributes specification You need to make sure dot is able +# to find the font, which can be done by putting it in a standard location or by +# setting the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. Default graphviz fontsize is 14. +# The default value is: fontname=Helvetica,fontsize=10. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10" + +# DOT_EDGE_ATTR is concatenated with DOT_COMMON_ATTR. For elegant style you can +# add 'arrowhead=open, arrowtail=open, arrowsize=0.5'. Complete documentation about +# arrows shapes. +# The default value is: labelfontname=Helvetica,labelfontsize=10. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTNAME = Helvetica +DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10" -# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of -# dot graphs. -# Minimum value: 4, maximum value: 24, default value: 10. +# DOT_NODE_ATTR is concatenated with DOT_COMMON_ATTR. For view without boxes +# around nodes set 'shape=plain' or 'shape=plaintext' Shapes specification +# The default value is: shape=box,height=0.2,width=0.4. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTSIZE = 10 +DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4" -# By default doxygen will tell dot to use the default font as specified with -# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set -# the path where dot can find it using this tag. +# You can set the path where dot can find font specified with fontname in +# DOT_COMMON_ATTR and others dot attributes. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTPATH = -# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for -# each documented class showing the direct and indirect inheritance relations. -# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. +# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a +# graph for each documented class showing the direct and indirect inheritance +# relations. In case HAVE_DOT is set as well dot will be used to draw the graph, +# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set +# to TEXT the direct and indirect inheritance relations will be shown as texts / +# links. +# Possible values are: NO, YES, TEXT and GRAPH. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. CLASS_GRAPH = YES @@ -2417,7 +2527,8 @@ CLASS_GRAPH = YES COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for -# groups, showing the direct groups dependencies. +# groups, showing the direct groups dependencies. See also the chapter Grouping +# in the manual. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2532,6 +2643,13 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES +# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels +# of child directories generated in directory dependency graphs by dot. +# Minimum value: 1, maximum value: 25, default value: 1. +# This tag requires that the tag DIRECTORY_GRAPH is set to YES. + +DIR_GRAPH_MAX_DEPTH = 1 + # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: @@ -2585,10 +2703,10 @@ MSCFILE_DIRS = DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the -# path where java can find the plantuml.jar file. If left blank, it is assumed -# PlantUML is not used or called during a preprocessing step. Doxygen will -# generate a warning when it encounters a \startuml command in this case and -# will not generate output for the diagram. +# path where java can find the plantuml.jar file or to the filename of jar file +# to be used. If left blank, it is assumed PlantUML is not used or called during +# a preprocessing step. Doxygen will generate a warning when it encounters a +# \startuml command in this case and will not generate output for the diagram. PLANTUML_JAR_PATH = @@ -2626,18 +2744,6 @@ DOT_GRAPH_MAX_NODES = 50 MAX_DOT_GRAPH_DEPTH = 0 -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not seem -# to support this out of the box. -# -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_TRANSPARENT = NO - # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support @@ -2650,6 +2756,8 @@ DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated # graphs. +# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal +# graphical representation for inheritance and collaboration diagrams is used. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2658,8 +2766,8 @@ GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate # files that are used to generate the various graphs. # -# Note: This setting is not only used for dot files but also for msc and -# plantuml temporary files. +# Note: This setting is not only used for dot files but also for msc temporary +# files. # The default value is: YES. DOT_CLEANUP = YES diff --git a/Makefile.am b/Makefile.am index 612469b..1310afd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -146,7 +146,7 @@ CLEANFILES += Doxyfile Doxyfile: Doxyfile.in Makefile $(SED) $(REPLACEMENTS) < $< > $@ -if HAVE_TOOL_DOXYGEN +if HAVE_TOOL_VERSION_DOXYGEN CLEANFILES += doxygen.stamp doxygen.stamp: Doxyfile $(BUILT_SOURCES) $(beep_SOURCES) $(DOXYGEN) $< diff --git a/configure.ac b/configure.ac index 3e75923..84ae853 100644 --- a/configure.ac +++ b/configure.ac @@ -37,11 +37,12 @@ dnl and /bin/bash SB_PROG([BASH], [bash]) SB_PROG([DIFF], [diff]) -SB_PROG([DOXYGEN], [doxygen]) SB_PROG([PANDOC], [pandoc]) SB_PROG([PYTHON3], [python3]) SB_PROG([TPUT], [tput]) +SB_PROG_DOXYGEN([1.9.5]) + # TODO: Use the proper C standard for compiling. # TODO: Produce as many warnings and errors as possible when compiling. diff --git a/m4/Makefile-files b/m4/Makefile-files index 38f3f37..450f233 100644 --- a/m4/Makefile-files +++ b/m4/Makefile-files @@ -1,4 +1,5 @@ # -*- makefile-automake -*- +EXTRA_DIST += %reldir%/sb-prog-doxygen.m4 EXTRA_DIST += %reldir%/sb-prog.m4 EXTRA_DIST += %reldir%/sb-summary.m4 diff --git a/m4/sb-prog-doxygen.m4 b/m4/sb-prog-doxygen.m4 new file mode 100644 index 0000000..8344e5b --- /dev/null +++ b/m4/sb-prog-doxygen.m4 @@ -0,0 +1,35 @@ +# sb-prog-doxygen.m4 - check for doxygen program, but let user override it -*- Autoconf -*- +# serial 2 +dnl +dnl +dnl +AC_DEFUN([SB_PROG_DOXYGEN], [dnl +SB_PROG([DOXYGEN], [doxygen])dnl +m4_ifblank([$1], [dnl + doxygen_version_sufficient=yes +], [dnl + doxygen_version_sufficient=no + AM_COND_IF([HAVE_TOOL_DOXYGEN], [dnl + AC_MSG_CHECKING([doxygen version]) + doxygen_version="$(${DOXYGEN} -v)" + AC_MSG_RESULT([${doxygen_version}]) + AS_VERSION_COMPARE([${doxygen_version}], [$1], [dnl + doxygen_version_sufficient=no + ], [dnl + doxygen_version_sufficient=yes + ], [dnl + doxygen_version_sufficient=yes + ]) + ]) + AC_MSG_CHECKING([if doxygen version is sufficient for our Doxyfile]) + AC_MSG_RESULT([${doxygen_version_sufficient}]) +])dnl +AM_CONDITIONAL([HAVE_TOOL_VERSION_DOXYGEN], + [test "x$doxygen_version_sufficient" = xyes]) +])dnl +dnl +dnl +dnl +dnl Local Variables: +dnl indent-tabs-mode: nil +dnl End: From e4d481cf1294ef6bf7b56fe520971b6702037c14 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Thu, 17 Nov 2022 01:29:20 +0100 Subject: [PATCH 3/3] ci: Stop defining special CFLAGS with -std and warnings --- .github/workflows/beep-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/beep-build.yml b/.github/workflows/beep-build.yml index 5504e33..6c414a9 100644 --- a/.github/workflows/beep-build.yml +++ b/.github/workflows/beep-build.yml @@ -26,7 +26,7 @@ jobs: - name: configure run: ./configure --prefix="${PWD}/_root" - name: make - run: N="$(nproc||echo 2)"; make -j$N -l$N CFLAGS="-std=gnu11 -pedantic -Wall -Wextra -Werror" + run: N="$(nproc||echo 2)"; make -j$N -l$N - name: 'beep --help' run: | ./beep --help > beep-usage.from--help