Skip to content

Commit e8dab1a

Browse files
committed
compile-options: Refactor/document dependencies
Ticket: ENT-12600 Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
1 parent 876d5c0 commit e8dab1a

File tree

1 file changed

+92
-47
lines changed

1 file changed

+92
-47
lines changed

build-scripts/compile-options

Lines changed: 92 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -103,51 +103,81 @@ export DEB_LDFLAGS_APPEND
103103
############### Fill in build dependencies in DEPS variable ################
104104

105105
DEPS=
106-
[ "$OS_FAMILY" = mingw ] && var_append DEPS "pthreads-w32 libgnurx"
107106

108-
# libgcc_s.so is needed before we compile any other dependency
109-
# on some platforms!
110-
case "$OS_FAMILY" in
111-
solaris|aix) var_append DEPS "libgcc" ;;
112-
esac
107+
# Windows specific dependencies
108+
if [ "$OS_FAMILY" = mingw ]; then
109+
# Win32 does not support pthreads natively. The pthreads-w32 project provide
110+
# solution to this problem.
111+
var_append DEPS "pthreads-w32"
113112

114-
var_append DEPS "lmdb pcre2"
115-
116-
if ! [ "$SYSTEM_SSL" = 1 ]
117-
then
118-
# FIXME: Why do we need zlib?
119-
# ANSWER: Openssl uses it optionally, TODO DISABLE
120-
var_append DEPS "zlib openssl"
113+
# A port of the regex functionality from the glibc Library for use on
114+
# Windows platforms
115+
var_append DEPS "libgnurx"
121116
fi
122117

123-
# libsasl needed for solaris
118+
# AIX / Solaris specific dependencies
124119
case "$OS_FAMILY" in
125-
solaris|hpux) var_append DEPS "sasl2" ;;
126-
esac
120+
solaris|aix)
127121

128-
# iconv is needed for libxml2 on some platforms
129-
case "$OS_FAMILY" in
130-
aix|solaris) var_append DEPS "libiconv" ;;
122+
# libgcc_s.so is needed before we compile any other dependency
123+
# on some platforms!
124+
var_append DEPS "libgcc"
125+
126+
# iconv is needed for libxml2 on some platforms
127+
var_append DEPS "libiconv"
128+
;;
131129
esac
132130

133-
var_append DEPS "libxml2 libyaml"
134-
var_append DEPS "diffutils"
135-
var_append DEPS "librsync"
131+
# We use system bundled SSL on RHEL >= 8
132+
if ! [ "$SYSTEM_SSL" = 1 ]
133+
then
134+
# zlib is a compression library witch is a dependency of OpenSSL. However,
135+
# can we remove it (CFE-4013)?
136+
var_append DEPS "zlib"
136137

137-
# LDAP functions in the agent
138-
# and LDAP authentication functionality in Mission Portal
139-
case "$PROJECT" in
140-
nova) var_append DEPS "openldap"
141-
esac
138+
# Toolkit for TLS
139+
var_append DEPS "openssl"
140+
fi
142141

143-
case "$PROJECT" in
144-
nova) var_append DEPS "leech"
142+
# Solaris / HP-UX specific dependencies
143+
case "$OS_FAMILY" in
144+
solaris|hpux)
145+
# Generic library that implements the Simple Authentication and Security
146+
# Layer (SASL) framework
147+
var_append DEPS "sasl2"
148+
;;
145149
esac
146150

147-
# libacl & libattr - not for the exotics (linux only?)
151+
# Common dependencies
152+
var_append DEPS "libxml2" # Library for parsing XML
153+
var_append DEPS "libyaml" # Library for parsing YAML
154+
var_append DEPS "diffutils" # Library for comparing files
155+
var_append DEPS "librsync" # Library for synchronization of files
156+
var_append DEPS "lmdb" # Library for key-value store
157+
var_append DEPS "pcre2" # Library for compiling/matching regex
158+
159+
# Enterprise only dependencies
160+
if [ "$PROJECT" = nova ]; then
161+
# Used for storing accounts, passwords and group memberships
162+
# - Agent has LDAP related policy functions
163+
# - Mission Portal uses LDAP for authentication functionality
164+
var_append DEPS "openldap"
165+
166+
# Used for efficient synchronization of tabular data
167+
var_append DEPS "leech"
168+
fi
169+
170+
# Non-exotics dependencies
148171
case "$OS_FAMILY" in
149-
hpux|aix|solaris|freebsd|mingw) ;;
150-
*) var_append DEPS "libattr libacl" ;;
172+
hpux|aix|solaris|freebsd|mingw)
173+
;;
174+
*)
175+
# Library for managing Extended Attributes (xattrs) on filesystems
176+
var_append DEPS "libattr"
177+
178+
# POSIX Access Control Lists (ACLs) on filesystems
179+
var_append DEPS "libacl"
180+
;;
151181
esac
152182

153183
# ROLE
@@ -215,32 +245,47 @@ export ROLE
215245
case "$ROLE" in
216246
# HUB-ONLY dependencies
217247
hub)
218-
var_append DEPS "libcurl-hub"
219-
var_append DEPS "nghttp2 libexpat apr apr-util apache git rsync"
220-
var_append DEPS "postgresql php"
248+
# Note that we make a separate curl package for the hub. This is because
249+
# the hub will include the curl binary, but we don't want that for the
250+
# clients.
251+
var_append DEPS "libcurl-hub" # Provides API for performing network requests
252+
var_append DEPS "nghttp2" # Provides implementation of the HTTP/2 protocol.
253+
var_append DEPS "libexpat" # Provides stream-oriented XML parser
254+
var_append DEPS "apr apr-util" # Provides a common interface to underlying OS features (used by Apache)
255+
var_append DEPS "apache" # Provides HTTP server
256+
var_append DEPS "git" # Provides a version control system
257+
var_append DEPS "rsync" # Binary to efficiently synchronize files
258+
var_append DEPS "postgresql" # Relational database
259+
var_append DEPS "php" # Scripting language for web development
221260
;;
222261
# AGENT-ONLY dependencies
223262
agent)
224-
var_append DEPS "libcurl"
263+
var_append DEPS "libcurl" # Provides API for performing network requests
225264
;;
226265
esac
227266

267+
# Make sure init.d script and systemd service is used where needed.
268+
#
269+
# We install in all Linux platforms, because it does no harm on platforms
270+
# without systemd, and it has the advantage of working out of the box on
271+
# platforms that adopt systemd later.
272+
if [ "$OS_FAMILY" = linux ]; then
273+
WITH_SYSTEMD=yes
274+
else
275+
WITH_SYSTEMD=no
276+
fi
228277

229-
# systemd is not a build dependency, but should we generate
230-
# unit files for it?
231-
case "$OS_FAMILY" in
232-
linux) WITH_SYSTEMD=yes;;
233-
*) WITH_SYSTEMD=no;;
234-
esac
235-
236-
278+
# Determine whether or not to run tests
237279
case "$OS_FAMILY" in
238-
mingw|freebsd) TESTS=no ;;
239-
*) TESTS=all ;;
280+
mingw|freebsd)
281+
TESTS=no
282+
;;
283+
*)
284+
TESTS=all
285+
;;
240286
esac
241287
export TESTS
242288

243-
244289
# Don't let existing LD_LIBRARY_PATH variables disturb the build.
245290
# Java sets this when Jenkins launches it.
246291
# PS! Solaris shell returns false if the var is already unset.

0 commit comments

Comments
 (0)