Skip to content

Commit 86af0b9

Browse files
authored
Merge pull request #1345 from jimklimov/doc-netbsd
Doc for netbsd builds, more clang 13 support, more manpage related recipes
2 parents f46b76e + 1a17e2a commit 86af0b9

16 files changed

+212
-34
lines changed

Makefile.am

+8-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,14 @@ spellcheck spellcheck-interactive:
108108
(cd $(builddir)/data && $(MAKE) -s $@) || RES=$$? ; \
109109
exit $$RES
110110

111-
doc spellcheck-sortdict:
111+
# Note: the "all-docs" and "check-docs" targets may require tools not
112+
# found by `configure` script (and so avoided by conventional recipes)
113+
# such as PDF generators, so it should only be called at developer's
114+
# discretion, choice and risk. The "check-man" targets covers source
115+
# texts, man pages and HTML rendering of man pages, as enabled by tools.
116+
doc spellcheck-sortdict \
117+
all-docs check-docs \
118+
man all-man man-man check-man man-html all-html:
112119
cd $(srcdir)/docs && $(MAKE) $@
113120

114121
# This target adds syntax-checking for committed shell script files,

autogen.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ if [ -n "${PYTHON-}" ] ; then
1515
}
1616
else
1717
PYTHON=""
18-
for P in python python3 python2 ; do
18+
for P in python python3 python2 \
19+
python-3.10 python3.10 \
20+
python-3.9 python3.9 \
21+
python-3.7 python3.7 \
22+
python-3.5 python3.5 \
23+
python-3.4 python3.4 \
24+
python-2.7 python2.7 \
25+
; do
1926
if (command -v "$P" >/dev/null) && $P -c "import re,glob,codecs" ; then
2027
PYTHON="$P"
2128
break
@@ -45,6 +52,7 @@ then
4552
touch scripts/augeas/nutupsconf.aug.in scripts/augeas/nutupsconf.aug.in.AUTOGEN_WITHOUT
4653
else
4754
echo "Aborting $0! To avoid this, please export WITHOUT_NUT_AUGEAS=true and re-run" >&2
55+
echo "or better yet, export PYTHON=python-x.y and re-run" >&2
4856
exit 1
4957
fi
5058
fi

ci_build.sh

+25
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,29 @@ set -e
1818
# CI_REQUIRE_GOOD_GITIGNORE="false" CI_FAILFAST=true DO_CLEAN_CHECK=no BUILD_TYPE=fightwarn ./ci_build.sh
1919
case "$BUILD_TYPE" in
2020
fightwarn) ;; # for default compiler
21+
fightwarn-all)
22+
# This recipe allows to test with different (default-named)
23+
# compiler suites if available. Primary goal is to see whether
24+
# everything is building ok on a given platform, with one shot.
25+
TRIED_BUILD=false
26+
if (command -v gcc) >/dev/null ; then
27+
TRIED_BUILD=true
28+
BUILD_TYPE=fightwarn-gcc "$0" || exit
29+
else
30+
echo "SKIPPING BUILD_TYPE=fightwarn-gcc: compiler not found" >&2
31+
fi
32+
if (command -v clang) >/dev/null ; then
33+
TRIED_BUILD=true
34+
BUILD_TYPE=fightwarn-clang "$0" || exit
35+
else
36+
echo "SKIPPING BUILD_TYPE=fightwarn-clang: compiler not found" >&2
37+
fi
38+
if ! $TRIED_BUILD ; then
39+
echo "FAILED to run: no default-named compilers were found" >&2
40+
exit 1
41+
fi
42+
exit 0
43+
;;
2144
fightwarn-gcc)
2245
CC="gcc"
2346
CXX="g++"
@@ -1401,6 +1424,8 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp
14011424
if [ "$RES_ALLERRORS" != 0 ]; then
14021425
# Leading space is included in FAILED
14031426
echo "FAILED build(s) with code ${RES_ALLERRORS}:${FAILED}" >&2
1427+
else
1428+
echo "(and no build scenarios had failed)" >&2
14041429
fi
14051430

14061431
echo "Initially estimated ${BUILDSTODO_INITIAL} variations for BUILD_TYPE='$BUILD_TYPE'" >&2

common/parseconf.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989

9090
#include "parseconf.h"
9191
#include "attribute.h"
92+
#include "nut_stdint.h"
9293

9394
/* possible states */
9495

@@ -241,7 +242,7 @@ static int findwordstart(PCONF_CTX_t *ctx)
241242
return STATE_FINDEOL;
242243

243244
/* space = not in a word yet, so loop back */
244-
if (isspace(ctx->ch))
245+
if (isspace((size_t)ctx->ch))
245246
return STATE_FINDWORDSTART;
246247

247248
/* \ = literal = accept the next char blindly */
@@ -341,7 +342,7 @@ static int collect(PCONF_CTX_t *ctx)
341342
}
342343

343344
/* space means the word is done */
344-
if (isspace(ctx->ch)) {
345+
if (isspace((size_t)ctx->ch)) {
345346
endofword(ctx);
346347

347348
return STATE_FINDWORDSTART;

common/str.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ char *str_ltrim_space(char *string)
118118

119119
while (
120120
*string != '\0' &&
121-
isspace(*string)
121+
isspace((size_t)*string)
122122
)
123123
memmove(string, string + 1, strlen(string));
124124

@@ -139,7 +139,7 @@ char *str_rtrim_space(char *string)
139139

140140
while (
141141
ptr >= string &&
142-
isspace(*ptr)
142+
isspace((size_t)*ptr)
143143
)
144144
*ptr-- = '\0';
145145

@@ -438,7 +438,7 @@ int str_to_long_strict(const char *string, long *number, const int base)
438438
if (
439439
string == NULL ||
440440
*string == '\0' ||
441-
isspace(*string)
441+
isspace((size_t)*string)
442442
) {
443443
errno = EINVAL;
444444
return 0;
@@ -504,7 +504,7 @@ int str_to_ulong_strict(const char *string, unsigned long *number, const int bas
504504
*string == '\0' ||
505505
*string == '+' ||
506506
*string == '-' ||
507-
isspace(*string)
507+
isspace((size_t)*string)
508508
) {
509509
errno = EINVAL;
510510
return 0;
@@ -568,7 +568,7 @@ int str_to_double_strict(const char *string, double *number, const int base)
568568
if (
569569
string == NULL ||
570570
*string == '\0' ||
571-
isspace(*string)
571+
isspace((size_t)*string)
572572
) {
573573
errno = EINVAL;
574574
return 0;

docs/Makefile.am

+5-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ doc: @DOC_BUILD_LIST@
8787

8888
# This target can be called by developers to go around the configure
8989
# script choices at their risk (e.g. missing tools are possible):
90-
docs: pdf html-single html-chunked man
90+
docs: pdf html-single html-chunked man-man html-man
9191

9292
all-docs: docs
9393

@@ -130,7 +130,10 @@ check-html-chunked: $(ASCIIDOC_HTML_CHUNKED)
130130

131131
# Note: usually the results from man-page check will be reported twice:
132132
# once as a SUBDIRS child makefile, and once via DOC_CHECK_LIST expansion
133-
check-man:
133+
# Note: default `make all` in the man directory caters to drivers etc.
134+
# chosen during configure script execution. The "all-man" and "all-html"
135+
# rules build everything documented.
136+
check-man all-man man-man all-html html-man:
134137
cd $(top_builddir)/docs/man/ && $(MAKE) -f Makefile $@
135138

136139
man:

docs/config-prereqs.txt

+118-3
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,6 @@ networked repository (4.2.x vs 4.9.x)
412412
:; pkg_add \
413413
gd
414414

415-
# Need to find proper package name and/or mirror for this:
416-
:; pkg_add clang
417-
418415
:; pkg_add \
419416
cppunit \
420417
openssl nss \
@@ -470,6 +467,124 @@ scripts), better use this routine to test the config/build:
470467
Note the lack of `pkg-config` also precludes libcppunit tests, although they
471468
also tend to mis-compile/mis-link with GCC (while CLANG seems okay).
472469

470+
NetBSD 9.2
471+
~~~~~~~~~~
472+
473+
Instructions below assume that `pkgin` tool (pkg-src component to
474+
"install binary packages") is present on the system. Text below
475+
was prepared with a VM where "everything" was installed from the
476+
ISO image, including compilers and X11. It is possible that some
477+
packages provided this way differ from those served by `pkgin`,
478+
or on the contrary, that the list of suggested tool installation
479+
below would not include something a bare-minimum system would
480+
require to build NUT.
481+
482+
Note that `PATH` for builds on NetBSD should include `local` and
483+
`pkg`; the default after installation of the test system was:
484+
485+
----
486+
:; PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin:/usr/X11R7/bin:/usr/local/sbin:/usr/local/bin"
487+
:; export PATH
488+
----
489+
490+
NOTE: You may want to reference `ccache` even before all that,
491+
as detailed below:
492+
493+
----
494+
:; PATH="/usr/lib/ccache:$PATH"
495+
:; export PATH
496+
----
497+
498+
To use the `ci_build.sh` don't forget `bash` which is not part of OpenBSD
499+
base installation. It is not required for "legacy" builds arranged by just
500+
`autogen.sh` and `configure` scripts.
501+
502+
----
503+
:; pkgin install \
504+
git python27 python39 curl \
505+
make gmake autoconf automake libltdl libtool \
506+
cppcheck \
507+
pkgconf \
508+
gcc7 clang
509+
510+
;; ( cd /usr/pkg/bin && ( ln -fs python2.7 python2 ; ln -fs python3.9 python3 ) )
511+
512+
# For spell-checking, highly recommended if you would propose pull requests:
513+
:; pkgin install \
514+
aspell aspell-en
515+
516+
# For man-page doc types, footprint on this platform is moderate:
517+
:; pkgin install \
518+
asciidoc
519+
520+
# For other doc types (PDF, HTML) generation - massive packages (TEX, X11):
521+
:; pkgin install \
522+
source-highlight py39-pygments dblatex
523+
524+
# For CGI graph generation - massive packages (X11):
525+
:; pkgin install \
526+
gd openmp
527+
528+
:; pkgin install \
529+
cppunit \
530+
openssl nss \
531+
augeas \
532+
libusb libusb1 \
533+
neon \
534+
net-snmp \
535+
avahi
536+
537+
# Select a LUA-5.1 (or possibly 5.2?) version
538+
:; pkgin install \
539+
lua51
540+
541+
:; pkgin install \
542+
bash dash ast-ksh oksh
543+
----
544+
545+
NOTE: 9TBD) On NetBSD 9.2 this package complains that it requires
546+
OS ABI 9.0, or that `CHECK_OSABI=no` is set in `pkg_install.conf`.
547+
Such file was not found in the test system...
548+
+
549+
----
550+
:; pkgin install \
551+
openipmi
552+
----
553+
554+
Recommended: For compatibility with common setups on other operating
555+
systems, can add dash-number suffixed symlinks to compiler tools (e.g.
556+
`gcc-7` beside the `gcc` installed by package) near the original
557+
binaries and into `/usr/lib/ccache`:
558+
----
559+
:; ( cd /usr/bin && for TOOL in cpp gcc g++ ; do \
560+
ln -s "$TOOL" "$TOOL-7" ; \
561+
done )
562+
563+
# Note that the one delivered binary is `clang-13` and many (unnumbered)
564+
# symlinks to it. For NUT CI style of support for builds with many
565+
# compilers, complete the known numbers:
566+
:; ( cd /usr/pkg/bin && for TOOL in clang-cpp clang++ ; do \
567+
ln -s clang-13 "$TOOL-13" ; \
568+
done )
569+
570+
:; pkgin install ccache
571+
:; ( mkdir -p /usr/lib/ccache && cd /usr/lib/ccache && \
572+
for TOOL in cpp gcc g++ clang ; do \
573+
for VER in "" "-7" ; do \
574+
ln -s ../../pkg/bin/ccache "$TOOL$VER" ; \
575+
done ; \
576+
done ; \
577+
for TOOL in clang clang++ clang-cpp ; do \
578+
for VER in "" "-13" ; do \
579+
ln -s ../../pkg/bin/ccache "$TOOL$VER" ; \
580+
done ; \
581+
done ; \
582+
)
583+
----
584+
585+
NOTE: For Jenkins agents, also need to `pkgin install openjdk11` (will be
586+
in `JAVA_HOME=/usr/pkg/java/openjdk11`).
587+
473588
OpenIndiana 2021.10
474589
~~~~~~~~~~~~~~~~~~~
475590

docs/man/Makefile.am

+5-1
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,11 @@ HTML_MANS = \
735735

736736
all:
737737

738-
html-man: $(HTML_MANS) index.html
738+
all-html html-man: $(HTML_MANS) index.html
739+
740+
# Have a way to build all man pages, not just those that fit currently
741+
# configured drivers, daemons, developer aspect, etc.
742+
all-man man-man: $(MAN_MANS)
739743

740744
if WITH_MANS
741745
if ! SKIP_MANS

docs/nut.dict

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
personal_ws-1.1 en 2869 utf-8
1+
personal_ws-1.1 en 2883 utf-8
22
AAS
3+
ABI
34
ACFAIL
45
ACFREQ
56
ACK
@@ -10,9 +11,9 @@ ACrms
1011
ADDR
1112
ADDRCONFIG
1213
ADDRINFO
14+
ADELSYSTEM
1315
ADK
1416
ADKK
15-
ADELSYSTEM
1617
AEC
1718
AEF
1819
AEG
@@ -57,7 +58,6 @@ AlmCPol
5758
AlmEnbl
5859
Amplon
5960
Ampère
60-
Amplon
6161
Andreas
6262
Andreassen
6363
Andrzej
@@ -747,6 +747,7 @@ OMNIVSINT
747747
ONF
748748
ONV
749749
OOM
750+
OSABI
750751
OSF
751752
OSs
752753
OUTPUTV
@@ -1236,6 +1237,7 @@ VER
12361237
VERFW
12371238
VFI
12381239
VIB
1240+
VM
12391241
VMIN
12401242
VMM
12411243
VMware
@@ -1390,6 +1392,7 @@ ascii
13901392
asciidoc
13911393
asem
13921394
aspell
1395+
ast
13931396
async
13941397
atcl
13951398
ats
@@ -2245,6 +2248,7 @@ offtimedays
22452248
oftd
22462249
oids
22472250
ok
2251+
oksh
22482252
ol
22492253
oldmac
22502254
oldmge
@@ -2262,8 +2266,10 @@ ontimedays
22622266
ontiniedays
22632267
ooce
22642268
openSUSE
2269+
openipmi
22652270
openjdk
22662271
openlog
2272+
openmp
22672273
opensolaris
22682274
openssh
22692275
openssl
@@ -2311,6 +2317,7 @@ pinouts
23112317
pkg
23122318
pkgconf
23132319
pkgconfig
2320+
pkgin
23142321
plaintext
23152322
plugin
23162323
plugnplay

0 commit comments

Comments
 (0)