-
-
Notifications
You must be signed in to change notification settings - Fork 350
/
config-prereqs.txt
1655 lines (1344 loc) · 58.2 KB
/
config-prereqs.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
ifdef::website[]
Prerequisites for building NUT on different OSes
================================================
endif::website[]
This chapter aims to list packages with the tools needed on a freshly minimally
deployed worker to build as many targets of NUT recipes as possible, mainly
the diverse driver and documentation types.
NUT codebase generally should not depend on particular operating system or
kernel technology and version, and with the operating systems listed below
one can benefit from use of containers (jails, zones) to build and test
against numerous OS distributions on one physical or virtual machine,
e.g. to cover non-regression with older tool kits while taking advantage
of new releases.
* For Linux systems, we have notes on link:ci-farm-lxc-setup.txt[Setting
up the multi-arch Linux LXC container farm for NUT CI]
Some of the below are alternatives, e.g. compiler toolkits (gcc vs. clang)
or SSL implementations (OpenSSL vs Mozilla NSS) -- no problem installing
both, at a disk space cost.
[NOTE]
======
Some NUT branches may need additional or different software versions
that are not yet included into `master` branch dependencies, e.g. the DMF
(Dynamic Mapping Files) sub-project needs LUA 5.1 for build and run-time,
and some Python modules for build, e.g. using OS packaging or custom call
to `pip install pycparser`.
In case your system still provides a Python 2.x environment (and for some
reason you want to use it instead of Python 3.x), but does not anymore
provide a `pip` nor `pycparser` packages for it, you may need to use an
external bootstrap first, e.g.:
------
# Fetch get-pip.py for python 2.7
:; curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
:; python2 get-pip.py
:; python2 -m pip --version
:; python2 -m pip install pycparser
------
======
More packages and/or system setup may be needed to actually run NUT with
all features enabled; chapters below concern just with building it.
General call to Test the ability to configure and build
-------------------------------------------------------
Check out from git, generate files and configure to tailor to your build
environment, and build some tests:
------
:; mkdir -p nut && cd nut && \
git clone https://github.com/networkupstools/nut/ -b master .
:; ./autogen.sh && \
./configure --with-doc=all --with-all --with-cgi && \
make all && make check && make spellcheck
------
You can toggle some `configure` options to check different dependency
variants, e.g. `--with-ssl=nss` vs. `--with-ssl=openssl`
For reproducible runs of various pre-sets of configuration during
development, take a look at `ci_build.sh` script and different `BUILD_TYPE`
(and other) environment variable settings that it supports. A minimal run
with it is just to call the script, e.g.:
------
:; mkdir -p nut && cd nut && \
git clone https://github.com/networkupstools/nut/ -b fightwarn .
:; ./ci_build.sh
------
[NOTE]
======
To build older releases, such as "vanilla" NUT 2.7.4 and older,
you may need to address some nuances:
* Ensure that `python` in `PATH` points to a python-2.x implementation
(`master` branch is fixed to work with python 2 and 3)
* Ensure that `bash` is your user and maybe system shell (or ensure the
generated `configure` script gets interpreted by it)
* Generally you may have better results with GNU Make newer than 3.81
than with other make implementations; however, builds are regularly
tested by CI with Sun dmake and BSD make as well, so recipes should
not expect GNU-only syntax and constructs to work
* Parallel builds should be okay in current development version and
since NUT 2.8.0 (is a bug to log and fix, if not), but they may be
failure-prone in 2.7.4 and earlier releases
======
For intensive rebuilds, `ccache` is recommended. Note that instructions
below detail how to provide its directory with symlinks as `/usr/lib/ccache`
which is not the default case in all OS distributions. Recent versions of
the NUT `ci_build.sh` script allow to override the location by using the
`CI_CCACHE_SYMLINKDIR` environment variable, which is cumbersome and only
recommended for build agents with immutable system areas, etc.
Build prerequisites to make NUT from scratch on various Operating Systems
-------------------------------------------------------------------------
Debian 10/11/12
~~~~~~~~~~~~~~~
Being a popular baseline among Linux distributions, Debian is an
important build target. Related common operating systems include
Ubuntu and customized distros for Raspberry Pi, Proxmox, as well
as many others.
The package list below should largely apply to those as well,
however note that some well-known package names tend to differ.
A few of those are noted below.
[NOTE]
======
While Debian distros I've seen (8 to 11) provide a "libusb-dev"
for libusb-0.1 headers, the binary library package name is specifically
versioned package by default of the current release (e.g. "libusb-0.1-4"),
while names of both the library and development packages for libusb-1.0
must be determined with:
------
:; apt-cache search 'libusb.*1\.0.*'
------
yielding e.g. "libusb-1.0-0-dev" (string name was seen with different
actual package source versions on both Debian 8 "Jessie" and
Debian 11 "Buster").
======
[NOTE]
.FUN NOTE
======
For development on the road (or a native ARM build) you can use the
link:https://termux.dev/en/[Termux] project on Android. It provides
a sufficiently Debian-like operating environment for all intents and
purposes, but you may have to use their `pkg` wrapper instead of `apt`
tooling directly.
You would need at least a couple of gigabytes available on the internal
phone storage though, especially if using `ccache` or setting up cross
builds.
======
Debian-like package installations commonly start with an update of
metadata about recently published package revisions:
------
:; apt-get update
:; apt-get install \
ccache time \
git perl curl \
make autoconf automake libltdl-dev libtool \
valgrind \
cppcheck \
pkg-config \
gcc g++ clang
# NOTE: Older Debian-like distributions may lack a "libtool-bin"
:; apt-get install \
libtool-bin
# See comments below, python version and package naming depends on distro
:; apt-get install \
python
# NOTE: For python, you may eventually have to specify a variant like this
# (numbers depending on default or additional packages of your distro):
# :; apt-get install python2 python2.7 python-is-python2
# and/or:
# :; apt-get install python3 python3.9
# You can find a list of what is (pre-)installed with:
# :; dpkg -l | grep -Ei 'perl|python'
#
# For localization maintenance (currently in Python NUT-Monitor app),
# provide an `msgfmt` implementation, e.g.:
# :; apt-get install gettext
#
# To install the Python NUT-Monitor app, you may need some modules:
# :; apt-get install pip
# For Python3:
# :; python3 -m pip install PyQt5 configparser
# For spell-checking, highly recommended if you would propose pull requests:
:; apt-get install \
aspell aspell-en
# For other doc types (man-page, PDF, HTML) generation - massive packages (TEX, X11):
:; apt-get install \
asciidoc source-highlight python3-pygments dblatex
# For CGI graph generation - massive packages (X11):
:; apt-get install \
libgd-dev
# Optionally for sd_notify integration:
:; apt-get install \
libsystemd-dev
# NOTE: Some older Debian-like distributions, could ship "libcrypto-dev"
# and/or "openssl-dev" instead of "libssl-dev" by its modern name
# and may lack a libgpiod2 + libgpiod-dev altogether
:; apt-get install \
libcppunit-dev \
libssl-dev libnss3-dev \
augeas-tools libaugeas-dev augeas-lenses \
libusb-dev libusb-1.0-0-dev \
libi2c-dev \
libmodbus-dev \
libsnmp-dev \
libpowerman0-dev \
libfreeipmi-dev libipmimonitoring-dev \
libavahi-common-dev libavahi-core-dev libavahi-client-dev
# For libneon, see below
# NOTE: Older Debian-like distributions may lack a "libgpiod-dev"
# Others above are present as far back as Debian 7 at least
:; apt-get install \
libgpiod-dev
# NOTE: Some distributions lack a lua*-dev and only offer the base package
:; apt-get install lua5.1
:; apt-get install lua5.1-dev || true
:; apt-get install \
bash dash ksh busybox
------
Alternatives that can depend on your system's other packaging choices:
------
:; apt-get install libneon27-dev
# ... or
:; apt-get install libneon27-gnutls-dev
------
Over time, Debian and Ubuntu had different packages and libraries providing
the actual methods for I2C; if your system lacks the `libi2c` (and so fails
to `./configure --with-all`), try adding the following packages:
------
:; apt-get install build-essential git-core libi2c-dev i2c-tools lm-sensors
------
For cross-builds (note that not everything supports multilib approach,
limiting standard package installations to one or another implementation;
in that case local containers each with one ARCH may be a better choice,
with `qemu-user-static` playing a role to "natively" run the other-ARCH
complete environments):
------
:; apt-get install \
gcc-multilib g++-multilib \
crossbuild-essential \
gcc-10:armhf gcc-10-base:armhf \
qemu-user-static
------
NOTE: For Jenkins agents, also need to `apt-get install openjdk-11-jdk-headless`.
You may have to ensure that `/proc` is mounted in the target chroot
(or do this from the running container).
CentOS 6 and 7
~~~~~~~~~~~~~~
CentOS is another popular baseline among Linux distributions, being a free
derivative of the RedHat Linux, upon which many other distros are based as
well. These systems typically use the RPM package manager, using directly
`rpm` command, or `yum` or `dnf` front-ends depending on their generation.
For CI farm container setup, prepared root filesystem archives from
http://download.proxmox.com/images/system/ worked sufficiently well.
Prepare CentOS repository mirrors
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For CentOS 7 it seems that not all repositories are equally good; some of
the software below is only served by EPEL (Extra Packages for Enterprise
Linux), as detailed at:
* https://docs.fedoraproject.org/en-US/epel/
* https://www.redhat.com/en/blog/whats-epel-and-how-do-i-use-it
* https://pkgs.org/download/epel-release
You may have to specify a mirror as the `baseurl` in a `/etc/yum.repos.d/...`
file (as the aged distributions become less served by mirrors), such as:
* https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/7/x86_64/
+
------
# e.g. for CentOS7 currently:
:; yum install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm
# And edit /etc/yum.repos.d/epel.repo to uncomment and set the baseurl=...
# lines, and comment away the mirrorlist= lines (if yum hiccups otherwise)
------
For systemd support on CentOS 7 (no equivalent found for CentOS 6),
you can use backports repository below:
------
:; curl https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7
> /etc/yum.repos.d/systemd-backports-for-centos-7.repo
------
For CentOS 6 (the oldest I could try) the situation is similar, with sites like
https://www.getpagespeed.com/server-setup/how-to-fix-yum-after-centos-6-went-eol
detailing how to replace `/etc/yum.repos.d/` contents (you can wholesale rename
the existing directory and populate a new one with `curl` downloads from the
article), and additional key trust for EPEL packages:
------
:; yum install https://dl.fedoraproject.org/pub/archive/epel/6/x86_64/epel-release-6-8.noarch.rpm
------
Set up CentOS packages for NUT
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Instructions below apply to both CentOS 6 and 7 (a few nuances for 6 commented).
General developer system helpers mentioned in link:ci-farm-lxc-setup.txt[]:
------
:; yum update
:; yum install \
sudo vim mc p7zip pigz pbzip2 tar
------
To have SSH access to the build VM/Container, you may have to install and
enable it:
------
:; yum install \
openssh-server openssh-clients
:; chkconfig sshd on
:; service sshd start
# If there are errors loading generated host keys, remove mentioned files
# including the one with .pub extension and retry with:
#:; service sshd restart
------
NOTE: Below we request to install generic `python` per system defaults.
You may request specifically `python2` or `python3` (or both): current
NUT should be compatible with both (2.7+ at least).
NOTE: On CentOS, `libusb` means 0.1.x and `libusbx` means 1.x.x API version
(latter is not available for CentOS 6).
NOTE: On CentOS, it seems that development against libi2c/smbus is not
supported. Neither the suitable devel packages were found, nor i2c-based
drivers in distro packaging of NUT. Resolution and doc PRs are welcome.
------
:; yum install \
ccache time \
file \
git perl curl \
make autoconf automake libtool-ltdl-devel libtool \
valgrind \
cppcheck \
pkgconfig \
gcc gcc-c++ clang
# See comments below, python version and package naming depends on distro
:; yum install \
python
# NOTE: For python, you may eventually have to specify a variant like this
# (numbers depending on default or additional packages of your distro):
# :; yum install python-2.7.5
# and/or:
# :; yum install python3 python3-3.6.8
# You can find a list of what is (pre-)installed with:
# :; rpm -qa | grep -Ei 'perl|python'
# Note that CentOS 6 includes python-2.6.x and does not serve newer versions
# For spell-checking, highly recommended if you would propose pull requests:
:; yum install \
aspell aspell-en
# For other doc types (man-page, PDF, HTML) generation - massive packages (TEX, X11):
:; yum install \
asciidoc source-highlight python-pygments dblatex
# For CGI graph generation - massive packages (X11):
:; yum install \
gd-devel
# Optionally for sd_notify integration (on CentOS 7+, not on 6):
:; yum install \
systemd-devel
# NOTE: "libusbx" is the CentOS way of naming "libusb-1.0" (not in CentOS 6)
# vs. the older "libusb" as the package with "libusb-0.1"
:; yum install \
cppunit-devel \
openssl-devel nss-devel \
augeas augeas-devel \
libusb-devel libusbx-devel \
i2c-tools \
libmodbus-devel \
net-snmp-devel \
powerman-devel \
freeipmi-devel \
avahi-devel \
neon-devel
#?# is python-augeas needed? exists at least...
#?# no (lib)i2c-devel ...
#?# no (lib)ipmimonitoring-devel ... would "freeipmi-ipmidetectd" cut it at least for run-time?
#?# no (lib)gpio(d)-devel - starts with CentOS 8 (or extra repositories for later minor releases of CentOS 7)
# Some NUT code related to lua may be currently limited to lua-5.1
# or possibly 5.2; the former is default in CentOS 7 releases...
:; yum install \
lua-devel
:; yum install \
bash dash ksh
------
NOTE: `busybox` is not packaged for CentOS 7 release; a static binary can
be downloaded if needed. For more details, see
https://unix.stackexchange.com/questions/475584/cannot-install-busybox-on-centos
CentOS packaging for 64-bit systems delivers the directory for dispatching
compiler symlinks as `/usr/lib64/ccache`. You can set it up same way as for
other described environments by adding a symlink `/usr/lib/ccache`:
------
:; ln -s ../lib64/ccache/ "$ALTROOT"/usr/lib/
------
NOTE: For Jenkins agents, also need to `yum install java-11-openjdk-headless`
(not available for CentOS 6).
Arch Linux
~~~~~~~~~~
Update the lower-level OS and package databases:
------
:; pacman -Syu
------
Install tools and prerequisites for NUT:
------
:; pacman -S --needed \
base-devel \
autoconf automake libtool libltdl \
clang gcc \
ccache \
git \
vim python perl \
pkgconf \
cppcheck valgrind
# For spell-checking, highly recommended if you would propose pull requests:
:; pacman -S --needed \
aspell en-aspell
# For man-page doc types generation:
:; pacman -S --needed \
asciidoc
# For other doc types (PDF, HTML) generation - massive packages (TEX, X11):
:; pacman -S --needed \
source-highlight dblatex
# For CGI graph generation - massive packages (X11):
:; pacman -S --needed \
gd
# Optionally for sd_notify integration:
:; pacman -S --needed \
systemd
:; pacman -S --needed \
cppunit \
openssl nss \
augeas \
libusb \
neon \
net-snmp \
freeipmi \
avahi
#?# no (lib)gpio(d)
:; pacman -S --needed \
lua51
:; pacman -S --needed \
bash dash busybox ksh93
------
Recommended for NUT CI farm integration (matching specific toolkit versions
in a build matrix), and note the unusual location of `/usr/lib/ccache/bin/`
for symlinks:
------
:; gcc --version
gcc (GCC) 12.2.0
...
# Note: this distro delivers "gcc" et al as file names
# so symlinks like this may erode after upgrades.
# TODO: Rename and then link?..
:; (cd /usr/bin \
&& for V in 12 12.2.0 ; do for T in gcc g++ cpp ; do \
ln -fsr $T $T-$V ; \
done; done)
:; (cd /usr/lib/ccache/bin/ \
&& for V in 12 12.2.0 ; do for T in gcc g++ ; do \
ln -fsr /usr/bin/ccache $T-$V ; \
done; done)
:; clang --version
clang version 14.0.6
...
:; (cd /usr/bin && ln -fs clang-14 clang++-14 && ln -fs clang-14 clang-cpp-14)
:; (cd /usr/lib/ccache/bin/ \
&& for V in 14 ; do for T in clang clang++ ; do \
ln -fsr /usr/bin/ccache $T-$V ; \
done; done)
------
Also for CI build agents, a Java environment (JDK11+ since summer 2022) is
required:
------
# Search for available Java versions:
:; pacman -Ss | egrep 'jre|jdk'
# Pick one:
:; pacman -S --needed \
jre11-openjdk-headless
------
Slackware Linux 15
~~~~~~~~~~~~~~~~~~
Another long-term presence in the Linux landscape, and sometimes the baseline
for appliances, the Slackware project recently hit release 15 in 2022, averaging
two years per major release.
It can be installed e.g. in a VM, using ISO images from the project site; see:
* http://www.slackware.com/ => http://www.slackware.com/getslack/ =>
https://mirrors.slackware.com/slackware/slackware-iso/slackware64-15.0-iso/
* https://slackware.nl/slackware/slackware64-current-iso/
You would have to first log in as `root` and run `cgdisk` to define partitioning
for your virtual HDD, such as the common `/boot`, `swap` and `/` Linux layout,
and run `setup` to install "everything".
Note that "out of the box" Slackware does not currently on networked package
repositories and calculated dependency trees, so one has to know exactly what
they want installed.
Third-party projects for package managers are also available, e.g.
link:https://slackpkg.org/documentation.html[`slackpkg`] => see also
https://docs.slackware.com/slackware:slackpkg and
https://slackpkg.org/stable/ :
----
:; wget https://slackpkg.org/stable/slackpkg-15.0.10-noarch-1.txz && \
installpkg slackpkg-15.0.10-noarch-1.txz
----
Uncomment a mirror from `/etc/slackpkg/mirrors` according to your location
and other preferences (or use the top-listed default), and begin with:
----
:; slackpkg update
----
Note that packages may be only installed or re-installed/upgraded as separate
explicit operations, so the procedure to bring your system into needed shape
is a bit cumbersome (and each command may by default be interactive with a
choice menu), e.g.:
----
:; for P in \
bash mc vim sudo \
; do slackpkg info "$P" || slackpkg install $P || break ; done
----
For procedures below, this is automated via `root` profile to become a
`slackpkg-install` command:
----
:; grep "slackpkg-install" ~/.profile || {
echo 'slackpkg-install() { for P in "$@" ; do echo "=== $P:"; slackpkg info "$P" || slackpkg install "$P" || break ; done; }' >> ~/.profile
}
:; . ~/.profile
----
If something has a hiccup, it suggests to look for the right name, e.g.:
----
:; slackpkg search python
----
For NUT dependencies and build tools:
----
:; slackpkg update
# Baseline toolkits:
# Note there is no cppcheck, cppunit, valgrind...
# Note clang compiler tools are part of llvm package
:; slackpkg-install \
ccache time \
coreutils diffutils \
git python3 perl curl \
make autoconf automake libtool binutils \
pkg-config \
gcc llvm
# For spell-checking, highly recommended if you would propose pull requests:
:; slackpkg-install aspell{,-en}
# Note there is no direct "asciidoc" nor "a2x", just the competing project
# "rubygem-asciidoctor" that NUT currently has no recipes for, so you can
# not compile man/html/pdf docs here, per the default repository. See below
# for tools from alternative repositories, which seem to work well. Manpage
# compilation would require docbook-xml resources; older versions are in
# this package https://slackbuilds.org/repository/15.0/system/docbook-xml/
# and recent ones are in not-installed part of main repository:
:; slackpkg-install linuxdoc-tools
# More on Python (for NUT-Monitor UI):
:; slackpkg-install \
python-pip qt5 gettext-tools gettext
# For CGI graph generation - massive packages (X11):
:; slackpkg-install \
gd
# General dependencies:
:; slackpkg-install \
openssl openssl-solibs mozilla-nss \
libusb \
net-snmp \
neon
# Shells:
:; slackpkg-install \
bash dash ksh93
----
Some more packages are available on the side, including Java (useful
e.g. to make this environment into a fully fledged Jenkins worker).
Other common NUT dependencies absent from primary Slackware repositories
can be found and downloaded (seek `*.txz` package files, although a few
are named `*.tgz`) from here, and passed to `installpkg`:
* http://www.slackware.com/~alien/slackbuilds/openjdk11/
* http://www.slackware.com/~alien/slackbuilds/asciidoc/
* http://www.slackware.com/~alien/slackbuilds/cppunit/
* http://www.slackware.com/~alien/slackbuilds/lua/ (5.1 in "stable") and
http://www.slackware.com/~alien/slackbuilds/lua53/ (5.4 in "current"
as of Slackware 15.1 candidate in the works) -- note that LUA is not
needed for the current NUT code base, but may become needed after import
of features from forks
...and even the environment for Windows cross-builds, ancient compilers
and modern toolkits to cover all bases:
* http://www.slackware.com/~alien/slackbuilds/MinGW-w64/
* http://www.slackware.com/~alien/slackbuilds/docker/
* http://www.slackware.com/~alien/slackbuilds/gcc34/
* http://www.slackware.com/~alien/slackbuilds/gcc5/
FWIW, another "more official" but older Java package seems to be at:
* http://www.slackware.com/~alien/slackbuilds/openjdk/
* https://slackbuilds.org/repository/15.0/development/jdk/
An example routine to install the latest instance of a package could be
like this:
----
:; wget -m -l1 http://www.slackware.com/~alien/slackbuilds/asciidoc/pkg/ && \
find . -name '*.t?z'
:; installpkg ./www.slackware.com/~alien/slackbuilds/asciidoc/pkg/asciidoc-8.1.0-noarch-2.tgz
----
Upon community members' recommendations, Sotirov's SlackPack is also considered
a reputable repository: https://sotirov-bg.net/slackpack/ and should cover most
if not all of the dependencies required for NUT building (including PowerMan,
IPMI etc.)
NOTE: If setting up a CI farm agent with builds in RAM disk, keep in mind that
default mount options for `/dev/shm` preclude script execution. Either set up
the agent in a non-standard fashion (to use another work area), or if this is
a dedicated machine -- relax the mount options in `/etc/fstab`. Here is an
example with `noexec` which we *must avoid* for such use-case:
----
:; mount | grep /dev/shm
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,inode64)
----
FreeBSD 12.2
~~~~~~~~~~~~
Note that `PATH` for builds on BSD should include `/usr/local/...`:
------
:; PATH=/usr/local/libexec/ccache:/usr/local/bin:/usr/bin:$PATH
:; export PATH
------
NOTE: You may want to reference `ccache` even before all that, as detailed
below.
------
:; pkg install \
git perl5 curl \
gmake autoconf automake autotools libltdl libtool \
valgrind \
cppcheck \
pkgconf \
gcc clang
# See comments below, python version and package naming depends on distro
:; pkg install \
python
# NOTE: For python, you may eventually have to specify a variant like this
# (numbers depending on default or additional packages of your distro):
# :; pkg install python2 python27
# and/or:
# :; pkg install python3 python37
# You can find a list of what is (pre-)installed with:
# :; pkg info | grep -Ei 'perl|python'
# For spell-checking, highly recommended if you would propose pull requests:
:; pkg install \
aspell en-aspell
# For other doc types (man-page, PDF, HTML) generation - massive packages (TEX, X11):
:; pkg install \
asciidoc source-highlight textproc/py-pygments dblatex
# For CGI graph generation - massive packages (X11):
:; pkg install \
libgd
:; pkg install \
cppunit \
nss \
augeas \
libmodbus \
neon \
net-snmp \
powerman \
freeipmi \
avahi
# NOTE: At least on FreeBSD 12, system-provided crypto exists and is used
# by libnetsnmp, libneon, etc. - but is not marked as a package. Conversely,
# the openssl-1.1.1k (as of this writing) can be installed as a package into
# /usr/local/lib and then causes linking conflicts. The core system-provided
# build of openssl does include headers and is useful for NUT build "as is".
# ONLY INSTALL THIS PACKAGE IF REQUIRED (may get problems to rectify later):
:; test -e /lib/libcrypto.so -a -e /usr/lib/libssl.so || \
pkg install openssl
:; pkg install \
lua51
:; pkg install \
bash dash busybox ksh93
------
Recommended:
------
:; pkg install ccache
:; ccache-update-links
------
For compatibility with common setups on other operating systems, can symlink
`/usr/local/libexec/ccache` as `/usr/lib/ccache` and possibly add dash-number
suffixed symlinks to compiler tools (e.g. `gcc-10` beside `gcc10` installed
by package).
NOTE: For Jenkins agents, also need to `pkg install openjdk11` (11 or 17
required since summer 2022) -- and do note its further OS configuration
suggestions for special filesystem mounts.
Due to BSD specific paths *when not using* an implementation of `pkg-config`
or `pkgconf` (so guessing of flags is left to administrator -- TBD in NUT
`m4` scripts), better use this routine to test the config/build:
----
:; ./configure --with-doc=all --with-all --with-cgi \
--without-avahi --without-powerman --without-modbus \
### CPPFLAGS="-I/usr/local/include -I/usr/include" \
### LDFLAGS="-L/usr/local/lib -L/usr/lib"
----
Note the lack of `pkg-config` also precludes `libcppunit` tests, although
they also tend to mis-compile/mis-link with GCC (while CLANG seems okay).
OpenBSD 6.5
~~~~~~~~~~~
Note that `PATH` for builds on BSD should include `/usr/local/...`:
------
:; PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
:; export PATH
------
NOTE: You may want to reference `ccache` even before all that, as detailed
below.
OpenBSD delivers many versions of numerous packages, you should specify
your pick interactively or as part of package name (e.g. `autoconf-2.69p2`).
NOTE: For the purposes of builds with Jenkins CI agents, since summer 2022 it
requires JDK11 which was first delivered with OpenBSD 6.5. Earlier iterations
used OpenBSD 6.4 and version nuances in this document may still reflect that.
During builds, you may have to tell system dispatcher scripts which version
to use (which feels inconvenient, but on the up-side for CI -- this system
allows to test many versions of auto-tools in the same agent), e.g.:
------
:; export AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.13
------
To use the `ci_build.sh` don't forget `bash` which is not part of OpenBSD
base installation. It is not required for "legacy" builds arranged by just
`autogen.sh` and `configure` scripts.
NOTE: The OpenBSD 6.5 `install65.iso` installation includes a set of packages
that seems to exceed whatever is available on network mirrors; for example,
the CD image included `clang` program while it is not available to `pkg_add`,
at least not via http://ftp.netbsd.hu/mirrors/openbsd/6.5/packages/amd64/
mirror. The `gcc` version on CD image differed notably from that in the
networked repository (4.2.x vs 4.9.x).
You may have to echo a working base URL (part before "6.5/..." into the
`/etc/installurl` file, since the old distribution is no longer served by
default site.
------
# Optionally, make the environment comfortable, e.g.:
:; pkg_add sudo bash mc wget rsync
:; pkg_add \
git curl \
gmake autoconf automake libltdl libtool \
valgrind \
cppcheck \
pkgconf \
gcc clang
# See comments below, python version and package naming depends on distro
:; pkg_add \
python
# NOTE: For python, you may eventually have to specify a variant like this
# (numbers depending on default or additional packages of your distro):
# :; pkg_add python-2.7.15p0 py-pip
# and/or:
# :; pkg_add python-3.6.6p1 py3-pip
# although you might succeed specifying shorter names and the packager
# will offer a list of matching variants (as it does for "python" above).
# NOTE: "perl" is not currently a package, but seemingly part of base OS.
# You can find a list of what is (pre-)installed with:
# :; pkg_info | grep -Ei 'perl|python'
# For spell-checking, highly recommended if you would propose pull requests:
:; pkg_add \
aspell
# For other doc types (man-page, PDF, HTML) generation - massive packages (TEX, X11):
:; pkg_add \
asciidoc source-highlight py-pygments dblatex \
docbook2x docbook-to-man
# For CGI graph generation - massive packages (X11):
:; pkg_add \
gd
:; pkg_add \
cppunit \
openssl nss \
augeas \
libusb1 \
net-snmp \
avahi
# For netxml-ups driver the library should suffice; however for nut-scanner
# you may currently require to add a `libneon.so` symlink (the package seems
# to only deliver a numbered SO library name), e.g.:
:; pkg_add neon && \
if ! test -s /usr/local/lib/libneon.so ; then
ln -s "`cd /usr/local/lib && ls -1 libneon.so.* | sort -n | tail -1`" /usr/local/lib/libneon.so
fi
# Select a LUA-5.1 (or possibly 5.2?) version
:; pkg_add \
lua
:; pkg_add \
bash dash ksh93
:; pkg_add \
argp-standalone \
freeipmi
------
Recommended:
------
:; pkg_add ccache
:; ( mkdir -p /usr/lib/ccache && cd /usr/lib/ccache && \
for TOOL in cpp gcc g++ clang clang++ clang-cpp ; do \
ln -s ../../local/bin/ccache "$TOOL" ; \
done ; \
)
:; ( cd /usr/bin && for T in gcc g++ cpp ; do ln -s "$T" "$T-4.2.1" ; done )
:; ( cd /usr/lib/ccache && for T in gcc g++ cpp ; do ln -s "$T" "$T-4.2.1" ; done )
:; ( cd /usr/bin && for T in clang clang++ clang-cpp ; do ln -s "$T" "$T-7.0.1" ; done )
:; ( cd /usr/lib/ccache && for T in clang clang++ clang-cpp ; do ln -s "$T" "$T-7.0.1" ; done )
------
For compatibility with common setups on other operating systems, can add
dash-number suffixed symlinks to compiler tools (e.g. `gcc-4.2.1` beside
`gcc` installed by package) into `/usr/lib/ccache`.
NOTE: For Jenkins agents, also need to `pkg_add jdk` (if asked, pick version
11 or 17); can request `pkg_add jdk%11`. You would likely have to update
the trusted CA store to connect to NUT CI, see e.g. (raw!) download from
https://gist.github.com/galan/ec8b5f92dd325a97e2f66e524d28aaf8
but ensure that you run it with `bash` and it does `wget` the certificates
(maybe with `--no-check-certificate` option if the OS does not trust current
internet infrastructure either), and revise the suggested certificate files
vs. https://letsencrypt.org/certificates/ and/or comments to that gist.
Due to BSD specific paths *when not using* an implementation of `pkg-config`
or `pkgconf` (so guessing of flags is left to administrator -- TBD in NUT
`m4` scripts), better use this routine to test the config/build:
------
:; ./configure --with-doc=all --with-all --with-cgi \
--without-avahi --without-powerman --without-modbus \
### CPPFLAGS="-I/usr/local/include -I/usr/include"
### LDFLAGS="-L/usr/local/lib -L/usr/lib"
------
Note the lack of `pkg-config` also precludes `libcppunit` tests, although
they also tend to mis-compile/mis-link with GCC (while CLANG seems okay).
NetBSD 9.2
~~~~~~~~~~
Instructions below assume that `pkgin` tool (pkg-src component to
"install binary packages") is present on the system. Text below
was prepared with a VM where "everything" was installed from the
ISO image, including compilers and X11. It is possible that some
packages provided this way differ from those served by `pkgin`,
or on the contrary, that the list of suggested tool installation
below would not include something a bare-minimum system would
require to build NUT.
Note that `PATH` for builds on NetBSD should include `local` and
`pkg`; the default after installation of the test system was:
------
:; PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin:/usr/X11R7/bin:/usr/local/sbin:/usr/local/bin"
:; export PATH
------
NOTE: You may want to reference `ccache` even before all that,
as detailed below:
------
:; PATH="/usr/lib/ccache:$PATH"
:; export PATH
------
To use the `ci_build.sh` don't forget `bash` which may be not part of NetBSD
base installation. It is not required for "legacy" builds arranged by just
`autogen.sh` and `configure` scripts.
Also note that the `install-sh` helper added by autotools from OS-provided
resources when generating the `configure` script may be old and its directory
creation mode is not safe for parallel-`make` installations. If this happens,
you can work around by `make MKDIRPROG="mkdir -p" install -j 8` for example.
------
:; pkgin install \
git perl curl \
make gmake autoconf automake libltdl libtool \
cppcheck \
pkgconf \
gcc7 clang
# See comments below, python version and package naming depends on distro
:; pkgin install \
python27 python39
;; ( cd /usr/pkg/bin && ( ln -fs python2.7 python2 ; ln -fs python3.9 python3 ) )
# You can find a list of what is (pre-)installed with: