-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathcompile-options
More file actions
236 lines (199 loc) · 6.34 KB
/
compile-options
File metadata and controls
236 lines (199 loc) · 6.34 KB
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
# -*- mode:sh -*-
# Calculate dependencies and build parameters according to the environment.
# SOURCE this file, don't execute.
# Autodect PROJECT if not set
if [ x"$PROJECT" = x ]
then
case x"$JOB_NAME" in
*-community-*) PROJECT=community;;
*-enterprise-*) PROJECT=nova;;
*-hub-*) PROJECT=nova;;
*-agent-*) PROJECT=nova;;
esac
fi
# If still not set, then either we are running outside Jenkins, or this
# is not a main "build" type job (it could be the bootstrap job).
# Do directory-based auto-detection.
if [ x"$PROJECT" = x ]
then
if [ -d $BASEDIR/nova ]
then
PROJECT=nova
else
PROJECT=community
fi
fi
export PROJECT
# Detect requirement to use system-provided OpenSSL library.
# When running manually, you can just export this variable.
# It's a flag: if it's set to 1 - then we use system OpenSSL.
# Otherwise, we build it.
if [ x"$SYSTEM_SSL" = x ]
then
# default to using cfengine openssl
SYSTEM_SSL=0
# Detect using system ssl when running a Jenkins job
if expr x"$label" ":" ".*systemssl" >/dev/null
then
SYSTEM_SSL=1
fi
fi
export SYSTEM_SSL
case "$OS_FAMILY" in
aix)
# This flag is needed because AIX defaults to producing .a shared libraries,
# but we need it to make .so libraries. It doesn't work correctly when
# specified in the Makefile, so we specify it in the environment instead.
LDFLAGS="-Wl,-brtl"
# AIX needs default RPATH (libpath on AIX) specified as well, otherwise it
# won't find libc.
LDFLAGS="$LDFLAGS -L$BUILDPREFIX/lib -Wl,-blibpath:$BUILDPREFIX/lib:/usr/lib:/lib"
;;
hpux)
LDFLAGS="-L$BUILDPREFIX/lib -Wl,+b$BUILDPREFIX/lib"
CC=gcc
export CC
;;
mingw)
LDFLAGS="-static-libgcc -L$BUILDPREFIX/lib"
;;
solaris)
LDFLAGS="-L$BUILDPREFIX/lib -Wl,-R$BUILDPREFIX/lib"
if [ "$(uname -p)" = "sparc" ]; then
# ensure 64bit builds on SPARC64
CFLAGS="-m64"
export CFLAGS
fi
;;
*)
LDFLAGS="-L$BUILDPREFIX/lib -Wl,-R$BUILDPREFIX/lib"
;;
esac
# When we don't bundle OpenSSL, then we need to pull it from /usr/lib64.
if [ x"$SYSTEM_SSL" = x1 ]
then
LDFLAGS="$LDFLAGS -L/usr/lib64"
fi
export LDFLAGS
# For Debian builds, which do not automatically inherit build flags
DEB_LDFLAGS_APPEND="$LDFLAGS"
export DEB_LDFLAGS_APPEND
# Embedded DB selection
EMBEDDED_DB="lmdb"
############### Fill in build dependencies in DEPS variable ################
DEPS=
[ $OS_FAMILY = mingw ] && var_append DEPS "pthreads-w32 libgnurx"
# libgcc_s.so is needed before we compile any other dependency
# on some platforms!
case "$OS_FAMILY" in
solaris|aix) var_append DEPS "libgcc" ;;
esac
var_append DEPS "$EMBEDDED_DB pcre2"
if ! [ x"$SYSTEM_SSL" = x1 ]
then
# FIXME: Why do we need zlib?
# ANSWER: Openssl uses it optionally, TODO DISABLE
var_append DEPS "zlib openssl"
fi
# libsasl needed for solaris
case "$OS_FAMILY" in
solaris|hpux) var_append DEPS "sasl2" ;;
esac
# iconv is needed for libxml2 on some platforms
case "$OS_FAMILY" in
aix|solaris) var_append DEPS "libiconv" ;;
esac
var_append DEPS "libxml2 libyaml"
var_append DEPS "diffutils"
# LDAP functions in the agent
# and LDAP authentication functionality in Mission Portal
case "$PROJECT" in
nova) var_append DEPS "openldap"
esac
# libacl & libattr - not for the exotics (linux only?)
case "$OS_FAMILY" in
hpux|aix|solaris|freebsd|mingw) ;;
*) var_append DEPS "libattr libacl" ;;
esac
# ROLE
# We can autodetect if we are building a hub or an agent, but
# that is suboptimal since the list might change at any time or
# we might want to build an agent package for a platform that is a hub
# or viceversa. By default we assume the old behavior but if the
# environment variable EXPLICIT_ROLE is defined, then we change our behavior
# and build according to the role specified by it.
case "$EXPLICIT_ROLE" in
agent) ROLE=agent;;
hub) ROLE=hub;;
*)
# Not running under Jenkins?
if [ x"$JENKINS_SERVER_COOKIE" = x ]
then
case "$PROJECT-$ARCH-$OS-${OS_VERSION}" in
community-*) ROLE=agent;;
# We do not support 32 bits hubs anymore
nova-i386-*-*) ROLE=agent;;
nova-s390*-*-*) ROLE=agent;;
nova-*-centos-*) ROLE=hub;;
nova-*-debian-*) ROLE=hub;;
nova-*-opensuse-*) ROLE=hub;;
nova-*-rhel-*) ROLE=hub;;
nova-*-sles-*) ROLE=hub;;
nova-*-ubuntu-*) ROLE=hub;;
nova-*-mingw-*) ROLE=agent;;
nova-*) ROLE=agent;;
*)
echo "Unknown project: $PROJECT"
exit 42
;;
esac
echo "Autodetected $ROLE role based on missing Jenkins label and OS."
else # we are running under Jenkins
# The "label" variable is set in multi-matrix jobs;
# thus it is *not set* in the bootstrap job.
case x"$label" in
x)
echo "label is not set, assuming that this is not the main build job; Setting ROLE=agent."
ROLE=agent
;;
*_HUB_*)
echo "Autodetected hub role based on '_HUB_' in Jenkins label."
ROLE=hub
;;
*)
echo "Autodetected agent role based on missing '_HUB_' in Jenkins label."
ROLE=agent
;;
esac
fi
;;
esac
export ROLE
## PHP modules
case "$ROLE" in
# HUB-ONLY dependencies
hub)
var_append DEPS "libcurl-hub"
var_append DEPS "libexpat apr apr-util apache git rsync"
var_append DEPS "postgresql php"
;;
# AGENT-ONLY dependencies
agent)
var_append DEPS "libcurl"
;;
esac
# systemd is not a build dependency, but should we generate
# unit files for it?
case "$OS_FAMILY" in
linux) WITH_SYSTEMD=yes;;
*) WITH_SYSTEMD=no;;
esac
case "$OS_FAMILY" in
mingw|freebsd) TESTS=no ;;
*) TESTS=all ;;
esac
export TESTS
# Don't let existing LD_LIBRARY_PATH variables disturb the build.
# Java sets this when Jenkins launches it.
# PS! Solaris shell returns false if the var is already unset.
unset LD_LIBRARY_PATH || true