Marcel Telka
2024-04-08 d6ccb6ab62f2f8726859d4d567e79af34435042f
commit | author | age
9c75c0 1 #
NJ 2 # CDDL HEADER START
3 #
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
0b8dd9 21 # Copyright 2017,2022 Gary Mills
0b2b25 22 # Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
9c75c0 23 #
NJ 24
7e1000 25 # These symbols should be used in component Makefiles
GM 26 # whenever PATH is to be defined there:
f627ef 27 #     PATH = $(PATH.illumos)
7e1000 28 #     PATH = $(PATH.gnu)
259be2 29 PATH.illumos =    $(subst $(space),:,$(strip $(PATH.prepend))):$(USRBINDIR$(BITS)):$(USRBINDIR):$(GNUBIN):$(USRSBINDIR$(BITS)):$(USRSBINDIR)
MT 30 PATH.gnu =    $(subst $(space),:,$(strip $(PATH.prepend))):$(GNUBIN):$(USRBINDIR$(BITS)):$(USRBINDIR):$(USRSBINDIR$(BITS)):$(USRSBINDIR)
7e1000 31
GM 32 # Default PATH
f627ef 33 PATH = $(PATH.illumos)
a325d4 34
b643a2 35 # The location of an internal mirror of community source archives that we build
NJ 36 # in this gate.  This mirror has been seeded to include "custom" source archives
37 # for a few components where the communities either no longer provide matching
38 # source archives or we have changes that aren't reflected in their archives or
39 # anywhere else.
58c0dd 40 #INTERNAL_ARCHIVE_MIRROR =    http://userland.us.oracle.com/source-archives
b643a2 41
NJ 42 # The location of an external mirror of community source archives that we build
43 # in this gate.  The external mirror is a replica of the internal mirror.
58c0dd 44 #EXTERNAL_ARCHIVE_MIRROR = \
AS 45 #    http://static.opensolaris.org/action/browse/userland/tarball/userland
b643a2 46
7076c9 47 DLC_ARCHIVE_MIRROR = https://dlc.openindiana.org/oi-userland/source-archives
58825e 48
b643a2 49 # Default to looking for source archives on the internal mirror and the external
NJ 50 # mirror before we hammer on the community source archive repositories.
0de8ff 51 #export DOWNLOAD_SEARCH_PATH +=    $(INTERNAL_ARCHIVE_MIRROR)
JT 52 #export DOWNLOAD_SEARCH_PATH +=    $(EXTERNAL_ARCHIVE_MIRROR)
9aea33 53
58825e 54 # Look for file at DLC server as last resort
AP 55 export DOWNLOAD_FALLBACK_PATH =  $(DLC_ARCHIVE_MIRROR)
56
9aea33 57 # The workspace starts at the mercurial root
5ada66 58 ifeq ($(origin WS_TOP), undefined)
58c0dd 59 export WS_TOP := \
974add 60     $(shell git rev-parse --show-toplevel || hg root 2>/dev/null)
5ada66 61 endif
9aea33 62
4e1558 63 USERLAND_ARCHIVES ?=    $(WS_TOP)/archives/
10a7de 64 WS_MACH =       $(WS_TOP)/$(MACH)
AP 65 WS_LOGS =       $(WS_MACH)/logs
66 WS_REPO =       $(WS_MACH)/repo
67 WS_TOOLS =      $(WS_TOP)/tools
68 WS_MAKE_RULES = $(WS_TOP)/make-rules
69 WS_COMPONENTS = $(WS_TOP)/components
70 WS_LICENSES =   $(WS_TOP)/licenses
71 WS_INCORPORATIONS =     $(WS_TOP)/incorporations
72 WS_LINT_CACHE = $(WS_MACH)/pkglint-cache
4cfb92 73
5c422f 74 # we want our pkg piplines to fail if there is an error
MS 75 # (like if pkgdepend fails in the middle of a pipe), but
76 # we don't want the builds or ./configure's failing as well.
77 # so we only set pipefail for the publish target and have
78 # to reset it for the others since they might be invoked
79 # as dependencies of publish.
80 export SHELLOPTS
81 build:        SHELLOPTS=
82 test:        SHELLOPTS=
83 install:    SHELLOPTS=
84 publish:    SHELLOPTS=pipefail
85
b602c5 86 SHELL=    /bin/bash
MS 87
1f9ba4 88 # This can be overridden to avoid rebuilding when you touch a Makefile
AP 89 MAKEFILE_PREREQ =    Makefile
90
9c75c0 91 CONSOLIDATION =    userland
d05a6f 92 PUBLISHER ?=    $(CONSOLIDATION)
c4768d 93 PUBLISHER_LOCALIZABLE ?=    $(CONSOLIDATION)-localizable
6514ee 94
1e5ead 95 # Defines $(space) as a single blank space, so we can use it to convert
AP 96 # space-separated paths to colon-separated paths in variables with
97 # $(subst $(space),:,$(strip $(SPATHS)))
98 empty :=
99 space := $(empty) $(empty)
100
d6ccb6 101 # Define $(comma) as single comma so we can use it in text transforming functions
MT 102 comma = ,
103
3dc823 104 ROOT =            /
NJ 105
e95eac 106 # Distribution name and version
AP 107 # Note, this determines /etc/release file contents.
108 # Some OI-specific software (like slim installer or openindiana-welcome) 
109 # currently rely on format of first line in this file
110 # to determine the distribution version
111 # (it should look like OpenIndiana Hipster YYYY.MM).
112 DISTRIBUTION_NAME = OpenIndiana Hipster
5e080f 113 DISTRIBUTION_VERSION = 2023.10
097eb5 114 # Native OS version
5ada66 115 OS_VERSION :=        $(shell uname -r)
6514ee 116 SOLARIS_VERSION =    $(OS_VERSION:5.%=2.%)
097eb5 117 # Target OS version
52d240 118 PKG_SOLARIS_VERSION ?= 5.11
5b4e5c 119 PKG_OS_VERSION ?= 0.$(PKG_SOLARIS_VERSION)
e7f82d 120 # auto-conf-y platform
RL 121 i386_PLAT = pc
122 sparc_PLAT = sun
123 PLAT=$($(MACH)_PLAT)
8dc1cb 124 # For pre-gcc-9 the triplet matches the legacy definition
e7f82d 125 GNU_TRIPLET=$(MACH)-$(PLAT)-solaris$(SOLARIS_VERSION)
9c75c0 126
4cfb92 127 include $(WS_MAKE_RULES)/ips-buildinfo.mk
3dc823 128
2eec07 129 COMPILER =        gcc
72a528 130 LINKER =        gcc
0b2b25 131
262335 132 # The value of BITS is set automatically during the build process to either 32
MT 133 # or 64 as needed.
134
135 # This macro makes it possible to determine which components are only built
136 # 64-bit (default) and allow other make-rules files to adjust accordingly.
137 # Possible values are: '32', '64', '32_and_64', '64_and_32', and 'NO_ARCH' (the
138 # orderings specify build preference).
139 BUILD_BITS ?= 64
0b2b25 140
AL 141 # Based on BUILD_BITS, determine which binaries are preferred for a build.
142 # This macro is for the convenience of other make-rules files and should not be
143 # overridden by developers.
144 ifeq ($(strip $(BUILD_BITS)),64)
145 PREFERRED_BITS=64
146 endif
472377 147 # Now we prefer 64-bit
0b2b25 148 ifeq ($(strip $(BUILD_BITS)),64_and_32)
472377 149 PREFERRED_BITS=64
0b2b25 150 endif
AL 151 PREFERRED_BITS ?= 32
152
153 # Map target build to macro/variable naming conventions.  This macro is for the
154 # convenience of other make-rules files and should not be overridden by
155 # developers.
156 ifeq ($(BUILD_BITS),64_and_32)
157 MK_BITS=32_and_64
158 else
159 MK_BITS=$(strip $(BUILD_BITS))
160 endif
161
5874ab 162 #
MT 163 # Upstream support for Python is by default 5 years after the first release.
164 # We will start to obsolete Python versions according the following table:
165 #
166 # +----------------+----------------+
167 # | Python version | Obsolete after |
168 # +----------------+----------------+
169 # |      3.9       |   2025-10      |
170 # +----------------+----------------+
171 #
172 # See https://devguide.python.org/versions/
173 #
174
c72011 175 PYTHON_VERSION = 3.9
5874ab 176 PYTHON_VERSIONS = 3.9
9c75c0 177
0be775 178 # Python up to 2.7 was built both 32-bit and 64-bit.  Starting with Python 3.x
c72011 179 # the python package is built 64-bit only.  So now all PYTHON_VERSIONS are
0be775 180 # 64-bit only.
c72011 181 PYTHON_64_ONLY_VERSIONS = $(PYTHON_VERSIONS)
e45ea2 182
053684 183 # List of python versions we are currently obsoleting.  We no longer build any
MT 184 # packages for these python versions, but there still might be hanging some not
185 # obsoleted yet versioned packages built for PYTHON_VERSIONS_OBSOLETING python
186 # versions.  Or there is just the versioned runtime/python package still
187 # available.
188 #
189 # This list should be usually empty.  Intersection of
190 # PYTHON_VERSIONS_OBSOLETING and PYTHON_VERSIONS lists MUST be always empty.
2453a7 191 PYTHON_VERSIONS_OBSOLETING = 2.7 3.7
053684 192
e5ce0b 193 # PYTHON3_SOABI variable defines the naming scheme
AP 194 # of python3 extension libraries: cpython or abi3.
195 # Currently, most of the components use cpython naming scheme by default,
196 # only python/xattr and python/cryptography require abi3 naming.
197 PYTHON3_SOABI ?= cpython
198 ifeq ($(PYTHON3_SOABI),cpython)
b7829f 199 PY3_CPYTHON_NAMING=
e5ce0b 200 PY3_ABI3_NAMING=\#
AP 201 else ifeq ($(PYTHON3_SOABI),abi3)
b7829f 202 PY3_CPYTHON_NAMING=\#
e5ce0b 203 PY3_ABI3_NAMING=
AP 204 else
205 $(error "Invalid python naming scheme '$(PYTHON3_SOABI)' selected!")
206 endif
207
79b849 208 BASS_O_MATIC =    $(WS_TOOLS)/bass-o-matic
NJ 209
81cc19 210 CLONEY =    $(WS_TOOLS)/cloney
MS 211
b73714 212 CONFIG_SHELL =    /bin/bash
CM 213
79b849 214 PKG_REPO =    file:$(WS_REPO)
74300c 215
72621a 216 COMPONENT =        $(COMPONENT_DIR:$(WS_TOP)/components/%=%)
d4c8f7 217 HUMAN_VERSION ?=    $(COMPONENT_VERSION)
a93d79 218 COMPONENT_SRC_NAME =    $(COMPONENT_NAME)
RB 219
fd5ab5 220 COMPONENT_LICENSE_FILE ?= $(COMPONENT_NAME).license
221
5ada66 222 COMPONENT_DIR :=    $(shell pwd)
818f75 223 SOURCE_DIR =    $(COMPONENT_DIR)/$(COMPONENT_SRC)
c843eb 224 BUILD_DIR =    $(COMPONENT_DIR)/build
74300c 225 PROTO_DIR =    $(BUILD_DIR)/prototype/$(MACH)
9c75c0 226
9e2024 227 ARCHLIBSUBDIR32    =
637cb6 228 ARCHLIBSUBDIR64    = $(MACH64)
AL 229 ARCHLIBSUBDIR    = $(ARCHLIBSUBDIR$(BITS))
230
c63f34 231 ETCDIR =        /etc
AW 232 USRDIR =        /usr
233 BINDIR =        /bin
234 SBINDIR =        /sbin
235 LIBDIR =        /lib
236 LIBEXECDIR =        /libexec
237 VARDIR =        /var
238 KERNELDRVDIR =        /kernel/drv
239 KERNELDRVDIR32 =    /kernel/drv
240 KERNELDRVDIR64 =    /kernel/drv/$(MACH64)
241 USRBINDIR =         $(USRDIR)/bin
242 USRBINDIR32 =        $(USRDIR)/bin/$(MACH32)
243 USRBINDIR64 =        $(USRDIR)/bin/$(MACH64)
244 USRSBINDIR =         $(USRDIR)/sbin
245 USRSBINDIR32 =        $(USRDIR)/sbin/$(MACH32)
246 USRSBINDIR64 =        $(USRDIR)/sbin/$(MACH64)
247 USRLIBDIR =         $(USRDIR)/lib
248 USRLIBDIR32 =        $(USRDIR)/lib
249 USRLIBDIR64 =        $(USRDIR)/lib/$(MACH64)
250 USRLIBEXECDIR =        $(USRDIR)/libexec
251 USRLIBEXECDIR32 =    $(USRDIR)/libexec
252 USRLIBEXECDIR64 =    $(USRDIR)/libexec/$(MACH64)
253 USRSHAREDIR =        $(USRDIR)/share
254 USRINCDIR =         $(USRDIR)/include
f685ac 255 USRSHARELOCALEDIR =    $(USRSHAREDIR)/locale
4f8cfa 256 USRSHAREMANDIR =    $(USRSHAREDIR)/man
8a614a 257 USRSHAREDOCDIR =    $(USRSHAREDIR)/doc
93837d 258 USRSHARELIBDIR =    $(USRSHAREDIR)/lib
4f8cfa 259 USRSHAREMAN1DIR =    $(USRSHAREMANDIR)/man1
8a614a 260 USRSHAREMAN1MDIR =    $(USRSHAREMANDIR)/man1m
4f8cfa 261 USRSHAREMAN3DIR =    $(USRSHAREMANDIR)/man3
f1282e 262 USRSHAREMAN4DIR =    $(USRSHAREMANDIR)/man4
5bb235 263 USRSHAREMAN5DIR =    $(USRSHAREMANDIR)/man5
ca81f7 264 USRSHAREMAN7DIR =    $(USRSHAREMANDIR)/man7
cb0963 265 USRSHAREMAN8DIR =    $(USRSHAREMANDIR)/man8
ffaa30 266 USRKERNELDRVDIR =    $(USRDIR)/kernel/drv
0d49ff 267 USRKERNELDRVDIR32 =    $(USRDIR)/kernel/drv
ffaa30 268 USRKERNELDRVDIR64 =    $(USRDIR)/kernel/drv/$(MACH64)
AL 269
fae1ca 270 # The *.$(BITS) variables are different from those above (better suited for
JK 271 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
c63f34 272 USRBINDIR.32 =         $(USRBINDIR)
AW 273 USRBINDIR.64 =         $(USRBINDIR64)
274 USRSBINDIR.32 =        $(USRSBINDIR)
275 USRSBINDIR.64 =        $(USRSBINDIR64)
276 USRLIBDIR.32 =         $(USRLIBDIR)
277 USRLIBDIR.64 =         $(USRLIBDIR64)
278 USRLIBEXECDIR.32 =    $(USRLIBEXECDIR)
279 USRLIBEXECDIR.64 =    $(USRLIBEXECDIR64)
280 PROTOETCDIR =        $(PROTO_DIR)/$(ETCDIR)
281 PROTOETCSECDIR =     $(PROTO_DIR)/$(ETCDIR)/security
282 PROTOUSRDIR =        $(PROTO_DIR)/$(USRDIR)
283 PROTOBINDIR =        $(PROTO_DIR)/$(BINDIR)
284 PROTOSBINDIR =        $(PROTO_DIR)/$(SBINDIR)
285 PROTOLIBDIR =        $(PROTO_DIR)/$(LIBDIR)
286 PROTOLIBEXECDIR =    $(PROTO_DIR)/$(LIBEXECDIR)
287 PROTOVARDIR =        $(PROTO_DIR)/$(VARDIR)
0d49ff 288 PROTOKERNELDRVDIR =      $(PROTO_DIR)/$(KERNELDRVDIR)
JK 289 PROTOKERNELDRVDIR32 =    $(PROTO_DIR)/$(KERNELDRVDIR32)
ffaa30 290 PROTOKERNELDRVDIR64 =    $(PROTO_DIR)/$(KERNELDRVDIR64)
4f8cfa 291 PROTOUSRBINDIR =    $(PROTO_DIR)/$(USRBINDIR)
724840 292 PROTOUSRBINDIR32 =    $(PROTO_DIR)/$(USRBINDIR32)
2cda1c 293 PROTOUSRBINDIR64 =    $(PROTO_DIR)/$(USRBINDIR64)
8a614a 294 PROTOUSRSBINDIR =    $(PROTO_DIR)/$(USRSBINDIR)
724840 295 PROTOUSRSBINDIR32 =    $(PROTO_DIR)/$(USRSBINDIR32)
AL 296 PROTOUSRSBINDIR64 =    $(PROTO_DIR)/$(USRSBINDIR64)
4f8cfa 297 PROTOUSRLIBDIR =    $(PROTO_DIR)/$(USRLIBDIR)
f540dc 298 PROTOUSRLIBDIR32 =    $(PROTO_DIR)/$(USRLIBDIR32)
4f8cfa 299 PROTOUSRLIBDIR64 =    $(PROTO_DIR)/$(USRLIBDIR64)
c63f34 300 PROTOUSRLIBEXECDIR =    $(PROTO_DIR)/$(USRLIBEXECDIR)
AW 301 PROTOUSRLIBEXECDIR32 =    $(PROTO_DIR)/$(USRLIBEXECDIR32)
302 PROTOUSRLIBEXECDIR64 =    $(PROTO_DIR)/$(USRLIBEXECDIR64)
f685ac 303 PROTOUSRINCDIR =    $(PROTO_DIR)/$(USRINCDIR)
4f8cfa 304 PROTOUSRSHAREDIR =    $(PROTO_DIR)/$(USRSHAREDIR)
93837d 305 PROTOUSRSHARELIBDIR =    $(PROTO_DIR)/$(USRSHARELIBDIR)
4f8cfa 306 PROTOUSRSHAREMANDIR =    $(PROTO_DIR)/$(USRSHAREMANDIR)
8a614a 307 PROTOUSRSHAREDOCDIR =    $(PROTO_DIR)/$(USRSHAREDOCDIR)
4f8cfa 308 PROTOUSRSHAREMAN1DIR =    $(PROTO_DIR)/$(USRSHAREMAN1DIR)
8a614a 309 PROTOUSRSHAREMAN1MDIR =    $(PROTO_DIR)/$(USRSHAREMAN1MDIR)
4f8cfa 310 PROTOUSRSHAREMAN3DIR =    $(PROTO_DIR)/$(USRSHAREMAN3DIR)
f1282e 311 PROTOUSRSHAREMAN4DIR =    $(PROTO_DIR)/$(USRSHAREMAN4DIR)
CM 312 PROTOUSRSHAREMAN5DIR =    $(PROTO_DIR)/$(USRSHAREMAN5DIR)
cb0963 313 PROTOUSRSHAREMAN8DIR =    $(PROTO_DIR)/$(USRSHAREMAN8DIR)
f685ac 314 PROTOUSRSHARELOCALEDIR =    $(PROTO_DIR)/$(USRSHARELOCALEDIR)
0d49ff 315 PROTOUSRKERNELDRVDIR =      $(PROTO_DIR)/$(USRKERNELDRVDIR)
JK 316 PROTOUSRKERNELDRVDIR32 =    $(PROTO_DIR)/$(USRKERNELDRVDIR32)
ffaa30 317 PROTOUSRKERNELDRVDIR64 =    $(PROTO_DIR)/$(USRKERNELDRVDIR64)
4f8cfa 318
fae1ca 319 PROTOUSRBINDIR.32 =     $(PROTOUSRBINDIR)
JK 320 PROTOUSRBINDIR.64 =     $(PROTOUSRBINDIR64)
321 PROTOUSRSBINDIR.32 =    $(PROTOUSRSBINDIR)
322 PROTOUSRSBINDIR.64 =    $(PROTOUSRSBINDIR64)
323 PROTOUSRLIBDIR.32 =     $(PROTOUSRLIBDIR)
324 PROTOUSRLIBDIR.64 =     $(PROTOUSRLIBDIR64)
c63f34 325 PROTOUSRLIBEXECDIR.32 = $(PROTOUSRLIBEXECDIR)
AW 326 PROTOUSRLIBEXECDIR.64 = $(PROTOUSRLIBEXECDIR64)
4f8cfa 327
b728c5 328 # NOTE: We do not build SFW contents
JK 329 # /usr/sfw/bin is just a historic artefact, containing symlinks
3d7f8d 330 SFWBIN =    /usr/sfw/bin
b728c5 331 SFWBIN32 =    $(SFWBIN)
JK 332 SFWBIN64 =    $(SFWBIN)/$(MACH64)
333 SFWSBIN =    /usr/sfw/sbin
334 SFWSBIN32 =    $(SFWSBIN)
335 SFWSBIN64 =    $(SFWSBIN)/$(MACH64)
f685ac 336 SFWINCLUDE =    /usr/sfw/include
3d7f8d 337 SFWLIB =    /usr/sfw/lib
b728c5 338 SFWLIB32 =    $(SFWLIB)
JK 339 SFWLIB64 =    $(SFWLIB)/$(MACH64)
1932c6 340 SFWSHARE =    /usr/sfw/share
b728c5 341 SFWSHAREMAN =    $(SFWSHARE)/man
JK 342 SFWSHAREMAN1 =    $(SFWSHAREMAN)/man1
343 PROTOSFWBIN =       $(PROTO_DIR)/$(SFWBIN)
344 PROTOSFWBIN32 =     $(PROTO_DIR)/$(SFWBIN32)
345 PROTOSFWBIN64 =     $(PROTO_DIR)/$(SFWBIN64)
346 PROTOSFWSBIN =      $(PROTO_DIR)/$(SFWSBIN)
347 PROTOSFWSBIN32 =    $(PROTO_DIR)/$(SFWSBIN32)
348 PROTOSFWSBIN64 =    $(PROTO_DIR)/$(SFWSBIN64)
3d7f8d 349 PROTOSFWLIB =    $(PROTO_DIR)/$(SFWLIB)
b728c5 350 PROTOSFWLIB32 =    $(PROTO_DIR)/$(SFWLIB32)
d92147 351 PROTOSFWLIB64 =    $(PROTO_DIR)/$(SFWLIB64)
1932c6 352 PROTOSFWSHARE =    $(PROTO_DIR)/$(SFWSHARE)
MS 353 PROTOSFWSHAREMAN =    $(PROTO_DIR)/$(SFWSHAREMAN)
354 PROTOSFWSHAREMAN1 =    $(PROTO_DIR)/$(SFWSHAREMAN1)
f685ac 355 PROTOSFWINCLUDE =    $(PROTO_DIR)/$(SFWINCLUDE)
1932c6 356
b728c5 357 # The *.$(BITS) variables are different from those above (better suited for
JK 358 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
359 SFWBIN.32 =     $(SFWBIN)
360 SFWBIN.64 =     $(SFWBIN64)
361 SFWSBIN.32 =    $(SFWSBIN)
362 SFWSBIN.64 =    $(SFWSBIN64)
363 SFWLIB.32 =     $(SFWLIB)
364 SFWLIB.64 =     $(SFWLIB64)
365 PROTOSFWBIN.32 =    $(PROTOSFWBIN)
366 PROTOSFWBIN.64 =    $(PROTOSFWBIN64)
367 PROTOSFWSBIN.32 =    $(PROTOSFWSBIN)
368 PROTOSFWSBIN.64 =    $(PROTOSFWSBIN64)
369 PROTOSFWLIB.32 =    $(PROTOSFWLIB)
370 PROTOSFWLIB.64 =    $(PROTOSFWLIB64)
371
8a52c2 372 CLDIR =    /usr/share/common-lisp
J'S 373 PROTOCLDIR =    $(PROTO_DIR)/$(CLDIR)
374
449120 375 GNUDIR =    /usr/gnu
AL 376 GNUBIN =    $(GNUDIR)/bin
b323a7 377 GNUBIN32 =    $(GNUBIN)/$(MACH32)
JK 378 GNUBIN64 =    $(GNUBIN)/$(MACH64)
449120 379 GNUSBIN =    $(GNUDIR)/sbin
b323a7 380 GNUSBIN32 =    $(GNUSBIN)/$(MACH32)
JK 381 GNUSBIN64 =    $(GNUSBIN)/$(MACH64)
449120 382 GNULIB =    $(GNUDIR)/lib
b323a7 383 GNULIB32 =    $(GNULIB)
JK 384 GNULIB64 =    $(GNULIB)/$(MACH64)
449120 385 GNUSHARE =    $(GNUDIR)/share
b323a7 386 GNUSHAREMAN =    $(GNUSHARE)/man
JK 387 GNUSHAREMAN1 =    $(GNUSHAREMAN)/man1
388 PROTOGNUBIN =       $(PROTO_DIR)/$(GNUBIN)
389 PROTOGNUBIN32 =     $(PROTO_DIR)/$(GNUBIN32)
390 PROTOGNUBIN64 =     $(PROTO_DIR)/$(GNUBIN64)
391 PROTOGNUSBIN =      $(PROTO_DIR)/$(GNUSBIN)
392 PROTOGNUSBIN32 =    $(PROTO_DIR)/$(GNUSBIN32)
393 PROTOGNUSBIN64 =    $(PROTO_DIR)/$(GNUSBIN64)
394 PROTOGNULIB =       $(PROTO_DIR)/$(GNULIB)
395 PROTOGNULIB32 =     $(PROTO_DIR)/$(GNULIB32)
396 PROTOGNULIB64 =     $(PROTO_DIR)/$(GNULIB64)
397 PROTOGNUSHARE =     $(PROTO_DIR)/$(GNUSHARE)
1932c6 398 PROTOGNUSHAREMAN =    $(PROTO_DIR)/$(GNUSHAREMAN)
MS 399 PROTOGNUSHAREMAN1 =    $(PROTO_DIR)/$(GNUSHAREMAN1)
3d7f8d 400
fae1ca 401 # The *.$(BITS) variables are different from those above (better suited for
JK 402 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
403 GNUBIN.32 =     $(GNUBIN)
404 GNUBIN.64 =     $(GNUBIN64)
405 GNUSBIN.32 =    $(GNUSBIN)
406 GNUSBIN.64 =    $(GNUSBIN64)
407 GNULIB.32 =     $(GNULIB)
408 GNULIB.64 =     $(GNULIB64)
409 PROTOGNUBIN.32 =    $(PROTOGNUBIN)
410 PROTOGNUBIN.64 =    $(PROTOGNUBIN64)
411 PROTOGNUSBIN.32 =    $(PROTOGNUSBIN)
412 PROTOGNUSBIN.64 =    $(PROTOGNUSBIN64)
413 PROTOGNULIB.32 =    $(PROTOGNULIB)
414 PROTOGNULIB.64 =    $(PROTOGNULIB64)
415
61c373 416 # work around _TIME, _DATE, embedded date chatter in component builds
NJ 417 # to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
418 # to the appropriate {CONFIGURE|BUILD|INSTALL}_ENV
79b849 419 CONSTANT_TIME =        LD_PRELOAD_32=$(WS_TOOLS)/time-$(MACH32).so
NJ 420 CONSTANT_TIME +=    LD_PRELOAD_64=$(WS_TOOLS)/time-$(MACH64).so
61c373 421 CONSTANT_TIME +=    TIME_CONSTANT=$(TIME_CONSTANT)
80b1b4 422
15328e 423 # List known architectures
AL 424 MACH_LIST = sparc i386
425
5d461f 426 # set MACH from uname -p to either sparc or i386
5ada66 427 MACH :=        $(shell uname -p)
5d461f 428
NJ 429 # set MACH32 from MACH to either sparcv7 or i86
430 MACH32_1 =    $(MACH:sparc=sparcv7)
431 MACH32 =    $(MACH32_1:i386=i86)
432
433 # set MACH64 from MACH to either sparcv9 or amd64
434 MACH64_1 =    $(MACH:sparc=sparcv9)
435 MACH64 =    $(MACH64_1:i386=amd64)
436
f1a511 437 CONFIGURE_NO_ARCH =    $(BUILD_DIR_NO_ARCH)/.configured
c2319a 438 CONFIGURE_32 =        $(BUILD_DIR_32)/.configured
BC 439 CONFIGURE_64 =        $(BUILD_DIR_64)/.configured
440
115d4d 441 # In ideal world all components should support parallel build but it is often
MT 442 # not the case.  So by default we do not run parallel build and allow
443 # components to opt-in for parallel build by setting USE_PARALLEL_BUILD = yes
444 # before the shared-macros.mk file is included.
445 PARALLEL_JOBS ?= 8
446 ifeq ($(strip $(USE_PARALLEL_BUILD)),yes)
447 COMPONENT_BUILD_GMAKE_ARGS += -j$(PARALLEL_JOBS)
448 COMPONENT_BUILD_SETUP_PY_ARGS += -j$(PARALLEL_JOBS)
449 endif
450
f1a511 451 BUILD_DIR_NO_ARCH =    $(BUILD_DIR)/$(MACH)
4f8cfa 452 BUILD_DIR_32 =        $(BUILD_DIR)/$(MACH32)
MS 453 BUILD_DIR_64 =        $(BUILD_DIR)/$(MACH64)
454
f1a511 455 BUILD_NO_ARCH =        $(BUILD_DIR_NO_ARCH)/.built
4f8cfa 456 BUILD_32 =        $(BUILD_DIR_32)/.built
MS 457 BUILD_64 =        $(BUILD_DIR_64)/.built
5d461f 458 BUILD_32_and_64 =    $(BUILD_32) $(BUILD_64)
f1a511 459 $(BUILD_DIR_NO_ARCH)/.built:    BITS=32
4158c0 460 $(BUILD_DIR_32)/.built:        BITS=32
NJ 461 $(BUILD_DIR_64)/.built:        BITS=64
5d461f 462
f1a511 463 INSTALL_NO_ARCH =    $(BUILD_DIR_NO_ARCH)/.installed
4f8cfa 464 INSTALL_32 =        $(BUILD_DIR_32)/.installed
MS 465 INSTALL_64 =        $(BUILD_DIR_64)/.installed
5d461f 466 INSTALL_32_and_64 =    $(INSTALL_32) $(INSTALL_64)
a7cc57 467 $(BUILD_DIR_32)/.installed:       BITS=32
AC 468 $(BUILD_DIR_64)/.installed:       BITS=64
4158c0 469
NJ 470 # set the default target for installation of the component
471 COMPONENT_INSTALL_TARGETS =    install
9c75c0 472
237543 473 # set the default build test results directory
AP 474 COMPONENT_TEST_BUILD_DIR =    $(BUILD_DIR)/test/$(MACH$(BITS))
475
476 # set the default master test results directory
8d70f8 477 COMPONENT_TEST_RESULTS_DIR =    $(COMPONENT_DIR)/test
RB 478
479 # set the default master test results file
9afa19 480 USE_COMMON_TEST_MASTER ?= yes
7bf8b3 481 ifeq ($(strip $(USE_COMMON_TEST_MASTER)),yes)
AL 482 COMPONENT_TEST_MASTER =        $(COMPONENT_TEST_RESULTS_DIR)/results-all.master
483 else
8d70f8 484 COMPONENT_TEST_MASTER =        $(COMPONENT_TEST_RESULTS_DIR)/results-$(BITS).master
7bf8b3 485 endif
8d70f8 486
RB 487 # set the default test results output file
237543 488 COMPONENT_TEST_OUTPUT =        $(COMPONENT_TEST_BUILD_DIR)/test-$(BITS)-results
8d70f8 489
RB 490 # set the default test results comparison diffs file
237543 491 COMPONENT_TEST_DIFFS =        $(COMPONENT_TEST_BUILD_DIR)/test-$(BITS)-diffs
8d70f8 492
RB 493 # set the default test snapshot file
237543 494 COMPONENT_TEST_SNAPSHOT =    $(COMPONENT_TEST_BUILD_DIR)/results-$(BITS).snapshot
AP 495
496 # Normally $(GSED) is simplest, but some results files need more power.
497 COMPONENT_TEST_TRANSFORMER =    $(GSED)
8d70f8 498
RB 499 # The set of default transforms to be applied to the test results to try
500 # to normalize them.
501 COMPONENT_TEST_TRANSFORMS = \
502     '-e "s|$(@D)|\\$$(@D)|g" ' \
503     '-e "s|$(PERL)|\\$$(PERL)|g" ' \
34664f 504     '-e "s|$(PYTHON)|\\$$(PYTHON)|g" ' \
8d70f8 505     '-e "s|$(SOURCE_DIR)|\\$$(SOURCE_DIR)|g" '
658ea7 506 COMPONENT_TEST_TRANSFORMS +=    "-e 's|$(PROTO_DIR)|\$$(PROTO_DIR)|g'"
MT 507 COMPONENT_TEST_TRANSFORMS +=    "-e 's|$(BUILD_DIR)|\$$(BUILD_DIR)|g'"
8d70f8 508
RB 509 # set the default commands used to generate the file containing the set
510 # of transforms to be applied to the test results to try to normalize them.
511 COMPONENT_TEST_CREATE_TRANSFORMS = \
347810 512     print "\#!/bin/sh" > $(COMPONENT_TEST_TRANSFORM_CMD); \
27b18a 513     print '$(CAT) $(COMPONENT_TEST_OUTPUT) | \\' \
MT 514         >> $(COMPONENT_TEST_TRANSFORM_CMD); \
347810 515     print '$(COMPONENT_TEST_TRANSFORMER) ' \
MT 516         $(COMPONENT_TEST_TRANSFORMS) \
517         ' \\' >> $(COMPONENT_TEST_TRANSFORM_CMD); \
518     print '> $(COMPONENT_TEST_SNAPSHOT)' \
519         >> $(COMPONENT_TEST_TRANSFORM_CMD); \
8d70f8 520
RB 521 # set the default command for performing any test result munging
237543 522 COMPONENT_TEST_TRANSFORM_CMD =    $(COMPONENT_TEST_BUILD_DIR)/transform-$(BITS)-results
8d70f8 523
RB 524 # set the default operation to run to perform test result normalization
525 COMPONENT_TEST_PERFORM_TRANSFORM = \
347810 526     $(SHELL) $(COMPONENT_TEST_TRANSFORM_CMD); \
8d70f8 527
RB 528 # set the default command used to compare the master results with the snapshot
61a572 529 COMPONENT_TEST_COMPARE_CMD =    $(GDIFF) -uNb
8d70f8 530
RB 531 # set the default way that master and snapshot test results are compared
532 COMPONENT_TEST_COMPARE = \
347810 533     [ -e $(COMPONENT_TEST_MASTER) ] || exit 1; \
MT 534     $(COMPONENT_TEST_COMPARE_CMD) \
535         $(COMPONENT_TEST_MASTER) $(COMPONENT_TEST_SNAPSHOT) \
536         > $(COMPONENT_TEST_DIFFS); \
537     print "Test results in $(COMPONENT_TEST_OUTPUT)"; \
538     if [ -s $(COMPONENT_TEST_DIFFS) ]; \
8d70f8 539     then \
347810 540         print "Differences found."; \
MT 541         $(CAT) $(COMPONENT_TEST_DIFFS); \
542         exit 2; \
543     else \
544         print "No differences found."; \
8d70f8 545     fi
RB 546
547 # set the default env command to use for test of the component
548 COMPONENT_TEST_ENV_CMD =    $(ENV)
549
550 # set the default command to use for test of the component
551 COMPONENT_TEST_CMD =    $(GMAKE)
4158c0 552
NJ 553 # set the default target for test of the component
554 COMPONENT_TEST_TARGETS =    check
35a012 555
702558 556 # set the default directory for test of the component
AP 557 COMPONENT_TEST_DIR =    $(@D)
8d70f8 558
b6799e 559 # prepare the testing environment before we run tests
MT 560 COMPONENT_TEST_DEP += component-test-environment-prep
561 # we test built components
562 COMPONENT_TEST_DEP += $(BUILD_DIR)/%/.built
563
8d70f8 564 # determine the type of tests we want to run.
RB 565 ifeq ($(strip $(wildcard $(COMPONENT_TEST_RESULTS_DIR)/results-*.master)),)
f1a511 566 TEST_NO_ARCH =        $(BUILD_DIR_NO_ARCH)/.tested
8d70f8 567 TEST_32 =        $(BUILD_DIR_32)/.tested
RB 568 TEST_64 =        $(BUILD_DIR_64)/.tested
569 else
f1a511 570 TEST_NO_ARCH =        $(BUILD_DIR_NO_ARCH)/.tested-and-compared
8d70f8 571 TEST_32 =        $(BUILD_DIR_32)/.tested-and-compared
RB 572 TEST_64 =        $(BUILD_DIR_64)/.tested-and-compared
573 endif
574 TEST_32_and_64 =    $(TEST_32) $(TEST_64)
f1a511 575
AL 576 $(BUILD_DIR_NO_ARCH)/.tested-and-compared: BITS=32
8d70f8 577 $(BUILD_DIR_32)/.tested:        BITS=32
RB 578 $(BUILD_DIR_64)/.tested:        BITS=64
579 $(BUILD_DIR_32)/.tested-and-compared:    BITS=32
580 $(BUILD_DIR_64)/.tested-and-compared:    BITS=64
871b03 581
50cda8 582 # BUILD_TOOLS is the root of all tools not normally installed on the system.
617c23 583 BUILD_TOOLS ?=    /opt
50cda8 584
fcf34c 585 #
c5572a 586 # The CCACHE makefile variable should evaluate to empty string or a pathname
JK 587 # like /usr/bin/ccache depending on your PATH value and "which" implementation.
588 # The assignment via ":=" is important, to only do this once in a Makefile,
589 # and not on every reference to the value as "=" assignment would result in.
590 # Review `man ccache` for optional configuration tuning, like cache size etc.
591 #
592 # For production builds or suspected errors you can disable this feature by
593 # setting ENABLE_CCACHE=false (as makefile or environment variable, which
594 # is currently the default) to not even define the usage of wrapper in the
595 # userland-building makefile system.
596 # If you want to speed up your re-builds, you must set ENABLE_CCACHE=true.
fcf34c 597 # For legacy reasons, the CCACHE_DISABLE and CCACHE_NODISABLE variables (from
JK 598 # configuration of the "ccache" program itself) are also supported, but direct
599 # use is discouraged, since their syntax and usage are counter-intuitive.
c5572a 600 #
JK 601 # Still, absence of ccache in PATH is not considered a fatal error since the
602 # build would just proceed well with original compiler.
603 # Note: In code below we fast-track if the makefile CCACHE variable is defined
604 # but fall back to shell executability tests if just envvar CCACHE is passed.
fcf34c 605 #
c5572a 606 export CCACHE := $(shell \
JK 607     if test -n "$(CCACHE)" ; then \
608         echo "$(CCACHE)"; \
609     else \
fcf34c 610         if test x"$${CCACHE_DISABLE-}" != x -o x"$(CCACHE_DISABLE)" != x \
c5572a 611              -o x"$${ENABLE_CCACHE-}" = xfalse -o x"$(ENABLE_CCACHE)" = xfalse \
JK 612         ; then \
613                 echo "NOT USING CCACHE FOR OI-USERLAND because explicitly disabled" >&2 ; \
614         else \
fcf34c 615             if test x"$${CCACHE_NODISABLE-}" != x -o x"$(CCACHE_NODISABLE)" != x \
c5572a 616                  -o x"$${ENABLE_CCACHE-}" = xtrue -o x"$(ENABLE_CCACHE)" = xtrue \
JK 617             ; then \
618                 for F in \
619                     "$$CCACHE" \
620                     `which ccache 2>/dev/null | egrep '^/'` \
621                     /usr/bin/ccache \
622                 ; do if test -n "$$F" && test -x "$$F" ; then \
623                         echo "$$F" ; \
624                         echo "USING CCACHE FOR OI-USERLAND: $$F" >&2 ; \
fcf34c 625                         if test x"$${CCACHE_DISABLE-}" != x ; then \
JK 626                             echo "WARNING: envvar CCACHE_DISABLE is set, so effectively ccache will not act!" >&2 ; \
627                         fi; \
c5572a 628                         exit 0; \
JK 629                     fi; \
630                 done; \
631                 echo "NOT USING CCACHE FOR OI-USERLAND because not found" >&2 ; \
632             fi; \
633         fi; \
634     fi)
635
13aa14 636 GCC_DEFAULT =    13
362cde 637 GCC_VERSION ?=    $(GCC_DEFAULT)
6d6808 638 GCC_ROOT =    /usr/gcc/$(GCC_VERSION)
9c75c0 639
e6ade5 640 # Define runtime package names to be used in dependencies
AL 641 GCC_VERSION_MAJOR    = $(shell echo $(GCC_VERSION) | $(GSED) -e 's/\([0-9]\+\)\.[0-9]\+.*/\1/')
642 GCC_RUNTIME_PKG      = system/library/gcc-$(GCC_VERSION_MAJOR)-runtime
643 GXX_RUNTIME_PKG      = system/library/g++-$(GCC_VERSION_MAJOR)-runtime
644 GFORTRAN_RUNTIME_PKG = system/library/gfortran-$(GCC_VERSION_MAJOR)-runtime
645 GOBJC_RUNTIME_PKG    = system/library/gobjc-$(GCC_VERSION_MAJOR)-runtime
646
bd9d92 647 CC.gcc.32 =    $(GCC_ROOT)/bin/gcc
3cec7d 648 CXX.gcc.32 =    $(GCC_ROOT)/bin/g++
dcd7ba 649 F77.gcc.32 =    $(GCC_ROOT)/bin/gfortran
bd9d92 650 FC.gcc.32 =    $(GCC_ROOT)/bin/gfortran
9c75c0 651
bd9d92 652 CC.gcc.64 =    $(GCC_ROOT)/bin/gcc
3cec7d 653 CXX.gcc.64 =    $(GCC_ROOT)/bin/g++
dcd7ba 654 F77.gcc.64 =    $(GCC_ROOT)/bin/gfortran
bd9d92 655 FC.gcc.64 =    $(GCC_ROOT)/bin/gfortran
9c75c0 656
8e5cd8 657 # GCC directory macros
8dc1cb 658 GCC_FULL_VERSION = $(shell $(GCC_ROOT)/bin/gcc -dumpversion)
AL 659 # Since gcc-9 the GNU triplet is x86_64-pc-solaris2.11 instead of i386-pc-solaris2.11
660 GCC_GNU_TRIPLET  = $(shell $(GCC_ROOT)/bin/gcc -dumpmachine)
8e5cd8 661 GCC_BINDIR =    $(GCC_ROOT)/bin
AL 662 GCC_LIBDIR.32 =    $(GCC_ROOT)/lib
663 GCC_LIBDIR.64 =    $(GCC_ROOT)/lib/$(MACH64)
664 GCC_LIBDIR =    $(GCC_LIBDIR.$(BITS))
665 GCC_INCDIR =    $(GCC_ROOT)/include
666 GCC_LIBGCCDIR =    $(GCC_ROOT)/lib/gcc
667 GCC_INCGXXDIR =    $(GCC_ROOT)/include/c++/$(GCC_FULL_VERSION)
259be2 668 PATH.prepend +=    $(GCC_BINDIR)
8e5cd8 669
c5572a 670 ifneq ($(strip $(CCACHE)),)
JK 671
672 CCACHE_WRAP_ROOT   =    $(WS_TOOLS)/ccache-wrap
673 export CC_gcc_32  :=    $(CC.gcc.32)
674 export CC_gcc_64  :=    $(CC.gcc.64)
675 export CXX_gcc_32 :=    $(CXX.gcc.32)
676 export CXX_gcc_64 :=    $(CXX.gcc.64)
677 CC.gcc.32  :=    $(CCACHE_WRAP_ROOT)/CC.gcc.32
678 CC.gcc.64  :=    $(CCACHE_WRAP_ROOT)/CC.gcc.64
679 CXX.gcc.32 :=    $(CCACHE_WRAP_ROOT)/CXX.gcc.32
680 CXX.gcc.64 :=    $(CCACHE_WRAP_ROOT)/CXX.gcc.64
681
682 ifneq ($(strip $(CCACHE_DIR)),)
683 export CCACHE_DIR :=    $(CCACHE_DIR)
684 endif
685
686 ifneq ($(strip $(CCACHE_LOGFILE)),)
687 export CCACHE_LOGFILE :=    $(CCACHE_LOGFILE)
688 endif
689
690 endif
9c75c0 691
61c373 692 LD =        /usr/bin/ld
9c75c0 693
f376b2 694 # Clang definitions (we only have 64 bit clang)
d0dd83 695 CLANG_DEFAULT =        18
61f685 696 CLANG_VERSION =        $(CLANG_DEFAULT)
d0dd83 697 CLANG_FULL_VERSION =    $(CLANG_VERSION).1
f376b2 698 CLANG_PREFIX             = /usr/clang/$(CLANG_FULL_VERSION)
259be2 699 CLANG_BINDIR =        $(CLANG_PREFIX)/bin
f376b2 700 CLANG_LIBDIR             = $(CLANG_PREFIX)/lib
AW 701 CLANG_DEVELOPER_PKG      = developer/clang-$(CLANG_VERSION)
702 CLANG_RUNTIME_PKG        = runtime/clang-$(CLANG_VERSION)
703 REQUIRED_PACKAGES_SUBST += CLANG_DEVELOPER_PKG
704 REQUIRED_PACKAGES_SUBST += CLANG_RUNTIME_PKG
259be2 705 PATH.prepend +=        $(CLANG_BINDIR)
f376b2 706
AW 707 # Python definitions
01fbc3 708 PYTHON.3.9.VENDOR_PACKAGES.64 = /usr/lib/python3.9/vendor-packages
AL 709 PYTHON.3.9.VENDOR_PACKAGES.32 = /usr/lib/python3.9/vendor-packages
710 PYTHON.3.9.VENDOR_PACKAGES = $(PYTHON.3.9.VENDOR_PACKAGES.$(BITS))
7999b2 711
MS 712 CC =        $(CC.$(COMPILER).$(BITS))
713 CXX =        $(CXX.$(COMPILER).$(BITS))
dcd7ba 714 F77 =        $(F77.$(COMPILER).$(BITS))
AL 715 FC =        $(FC.$(COMPILER).$(BITS))
7999b2 716
2c8630 717 #
MT 718 # We will start to obsolete major Ruby versions according the following table:
719 #
720 # +--------------+----------------+
721 # | Ruby version | Obsolete after |
722 # +--------------+----------------+
723 # |     2.3      |   2019-03-31   |
724 # |     3.2      |   2026-03-31   |
725 # +--------------+----------------+
726 #
727 # See https://www.ruby-lang.org/en/downloads/branches/
728 #
729
730 RUBY_VERSION = 3.2
ebed51 731
1e5ead 732 RUBY_LIB_VERSION.2.3 = 2.3.0
ebed51 733 RUBY_LIB_VERSION.3.2 = 3.2.0
AW 734
1e5ead 735 RUBY.2.3 =    /usr/ruby/2.3/bin/ruby
ebed51 736 RUBY.3.2 =    /usr/ruby/3.2/bin/ruby
AW 737
18b823 738 RUBY =          $(RUBY.$(RUBY_VERSION))
1e5ead 739 RUBY_LIB_VERSION = $(RUBY_LIB_VERSION.$(RUBY_VERSION))
AP 740
741 # Transform Ruby scripts to call the supported
742 # version-specific ruby; used in multiple *.mk files
743 RUBY_SCRIPT_FIX_FUNC = \
744     $(GNU_GREP) -Rl '^\#! */usr/bin/env ruby' | \
745         /usr/bin/xargs -I\{\} $(GSED) -i -e \
746         '1s%^\#! */usr/bin/env ruby%\#!/usr/ruby/$(RUBY_VERSION)/bin/ruby%' \
747         \{\}
748
18b823 749 # Use the ruby lib versions to represent the RUBY_VERSIONS that
AP 750 # need to get built.  This is done because during package transformations
0de8ff 751 # both the ruby version and the ruby library version are needed.
18b823 752 RUBY_VERSIONS = $(RUBY_LIB_VERSION)
fa74c0 753
955da2 754 PYTHON_VENDOR_PACKAGES.32 = $(PYTHON.$(PYTHON_VERSION).VENDOR_PACKAGES.32)
AP 755 PYTHON_VENDOR_PACKAGES.64 = $(PYTHON.$(PYTHON_VERSION).VENDOR_PACKAGES.64)
a0613d 756 PYTHON_VENDOR_PACKAGES = $(PYTHON_VENDOR_PACKAGES.$(BITS))
fa74c0 757
a847fb 758 # python2 was built for both 32- and 64-bits.
MT 759 # python3 is built for 64-bits only.
760
761 PYTHON.3.9 =    /usr/bin/python3.9
762 PYTHON.3.9.64 =    $(PYTHON.3.9)
01fbc3 763
4e6f9b 764 PYTHON.64 =    $(PYTHON.$(PYTHON_VERSION).64)
a847fb 765 PYTHON =    $(PYTHON.$(PYTHON_VERSION))
9c75c0 766
792915 767 TOX.3.9 =    /usr/bin/tox-3.9
MT 768 TOX =        $(TOX.$(PYTHON_VERSION))
769
5bdc52 770 # The default is site-packages, but that directory belongs to the end-user.
SS 771 # Modules which are shipped by the OS but not with the core Python distribution
772 # belong in vendor-packages.
14c7f2 773 PYTHON_DIR= /usr/lib/python$(PYTHON_VERSION)
7589de 774 PYTHON_LIB= $(PYTHON_DIR)/vendor-packages
fa74c0 775 PYTHON_DATA= $(PYTHON_LIB)
5bdc52 776
8304a6 777 # If the component has python scripts then the first line should probably
AW 778 # point at the python version currently set by the $(PYTHON) variable so
779 # as not to be influenced by the ips python mediator.
780 # In the component's Makefile define PYTHON_SCRIPTS with a list of files
781 # to be edited.
782
783 # Edit the leading #!/usr/bin/python line in python scripts to use the
784 # BUILD's $(PYTHON). The source file must be recompiled after that, as
785 # the corresponding .pyc file is outdated now.
786 PYTHON_SCRIPT_SHEBANG_FIX_FUNC = \
787     $(GSED) -i \
6f314a 788         -e '1s@/usr/bin/python3\{0,1\}$$@$(PYTHON)@' \
MT 789         -e '1s@/usr/bin/python3\{0,1\} @$(PYTHON) @' \
790         -e '1s@/usr/bin/env python3\.[0-9]\{1,\}@$(PYTHON)@' \
791         -e '1s@/usr/bin/env python3\{0,1\}@$(PYTHON)@' \
792     $(PROTO_DIR)/$(1); \
793     $(PYTHON) -m compileall $(PROTO_DIR)/$(1);
8304a6 794
AW 795 # PYTHON_SCRIPTS is a list of files from the calling Makefile.
796 PYTHON_SCRIPTS_PROCESS= \
797     $(foreach s,$(PYTHON_SCRIPTS), \
798             $(call PYTHON_SCRIPT_SHEBANG_FIX_FUNC,$(s)))
799
800 # Finally if PYTHON_SCRIPTS is defined in a Makefile then process them here.
801 # If multiple installs in the component then clear
802 # COMPONENT_POST_INSTALL_ACTION =
803 # and re-add $(PYTHON_SCRIPTS_PROCESS)
c602c4 804 COMPONENT_POST_INSTALL_ACTION += $(PYTHON_SCRIPTS_PROCESS)
8304a6 805
a8d98c 806 JAVA8_HOME =    /usr/jdk/openjdk1.8.0
AW 807 JAVA11_HOME =    /usr/jdk/openjdk11
808 JAVA17_HOME =    /usr/jdk/openjdk17
809 JAVA21_HOME =    /usr/jdk/openjdk21
6f9710 810 JAVA_HOME = $(JAVA17_HOME)
61a323 811
d5d29a 812 # QT macros
AW 813 # We deliver version 5 in 32- and 64-bit variants.
814 QT5_VERSION = 5.15
815 QT5_BASEDIR = $(USRLIBDIR)/qt/$(QT5_VERSION)
816 QT5_BINDIR.32 = $(QT5_BASEDIR)/bin
817 QT5_LIBDIR.32 = $(QT5_BASEDIR)/lib
818 QT5_BINDIR.64 = $(QT5_BASEDIR)/bin/$(MACH64)
819 QT5_LIBDIR.64 = $(QT5_BASEDIR)/lib/$(MACH64)
820 QT5_BINDIR = $(QT5_BINDIR.$(BITS))
821 QT5_LIBDIR = $(QT5_LIBDIR.$(BITS))
822 QT5_INCDIR = $(QT5_BASEDIR)/include
823 QT5_PKG_CONFIG_PATH = $(QT5_LIBDIR)/pkgconfig
824
825 # We deliver version 6 only in a 64-bit variant.
7f56f2 826 QT6_VERSION = 6.6
d5d29a 827 QT6_BASEDIR = $(USRLIBDIR)/qt/$(QT6_VERSION)
AW 828 QT6_BINDIR = $(QT6_BASEDIR)/bin/$(MACH64)
829 QT6_LIBDIR = $(QT6_BASEDIR)/lib/$(MACH64)
830 QT6_PKG_CONFIG_PATH = $(QT6_LIBDIR)/pkgconfig
831
79897a 832 #
MT 833 # Upstream officially supports two recent major Perl versions.  They also aim
834 # to provide critical security fixes for major Perl versions whose 5.x.0
835 # release was within the past three years.
836 #
837 # We support union of both sets.  IOW, we will start to obsolete a major Perl
838 # version if its 5.x.0 was released longer than three years ago AND there are
839 # already released two newer major Perl versions.
840 #
841 # See https://perldoc.perl.org/perlpolicy
842 #
843 #
844 # We will start to obsolete major Perl versions according the following table:
845 #
846 # +--------------+----------------+
847 # | Perl version | Obsolete after |
848 # +--------------+----------------+
849 # |     5.34     |   2024-05-20   |
850 # |     5.36     |   2025-05-28   |
851 # |     5.38     |   2026-07-02   |
852 # +--------------+----------------+
853 #
854 # See https://www.cpan.org/src/README.html
855 #
856
5fb151 857 # This is the default version of Perl
412e27 858 PERL_VERSION =  5.38
9aea33 859
5fb151 860 # The PERL_VERSIONS list should always be in ascending order (newest version
MT 861 # last)
79897a 862 PERL_VERSIONS = 5.34 5.36 5.38
7b3ffe 863 # Perl up to 5.22 was built 32-bit only.  Starting with 5.24 the perl package
MT 864 # is built 64-bit only.  So now all PERL_VERSIONS are 64-bit only.
865 PERL_64_ONLY_VERSIONS = $(PERL_VERSIONS)
6bc9bf 866
45844d 867 # List of perl versions we are currently obsoleting.  We no longer build any
MT 868 # packages for these perl versions, but there still might be hanging some not
869 # obsoleted yet versioned packages built for PERL_VERSIONS_OBSOLETING perl
870 # versions.  Or there is just the versioned runtime/perl package still
871 # available.
872 #
873 # This list should be usually empty.  Intersection of PERL_VERSIONS_OBSOLETING
874 # and PERL_VERSIONS lists MUST be always empty.
ddfa6c 875 PERL_VERSIONS_OBSOLETING =
45844d 876
ecce9a 877 define perl-path-rule
MT 878 PERL.$(1) =        /usr/perl5/$(1)/bin/perl
879 POD2MAN.$(1) =        /usr/perl5/$(1)/bin/pod2man
880 PERL5BINDIR.$(1) =    /usr/perl5/$(1)/bin
881 endef
882 $(foreach perlver,$(PERL_VERSIONS),$(eval $(call perl-path-rule,$(perlver))))
6778e0 883
C 884 PERL5BINDIR =     $(PERL5BINDIR.$(PERL_VERSION))
9e2024 885 PERL =        $(PERL.$(PERL_VERSION))
886 POD2MAN =    $(POD2MAN.$(PERL_VERSION))
6bc9bf 887
5ada66 888 PERL_ARCH :=    $(shell $(PERL) -e 'use Config; print $$Config{archname}')
9581d1 889 PERL_ARCH_FUNC=    $(shell $(1) -e 'use Config; print $$Config{archname}')
6bc9bf 890 # Optimally we should ask perl which C compiler was used but it doesn't
CM 891 # result in a full path name.  Only "c" is being recorded
892 # inside perl builds while we actually need a full path to
0f8a2f 893 # the compiler.
5ada66 894 #PERL_CC :=    $(shell $(PERL) -e 'use Config; print $$Config{cc}')
6bc9bf 895
CM 896 PKG_MACROS +=   PERL_ARCH=$(PERL_ARCH)
897 PKG_MACROS +=   PERL_VERSION=$(PERL_VERSION)
898
e5ad84 899 #
MT 900 # Upstream supports major PostgreSQL versions for 5 years after its initial
901 # release.  After that one last minor version is released and then the major
902 # version is considered EOL.
903 #
904 # We will start to obsolete PostgreSQL versions according the following table:
905 #
906 # +--------------------+----------------+
907 # | PostgreSQL version | Obsolete after |
908 # +--------------------+----------------+
909 # |         12         |   2024-11-14   |
910 # |         14         |   2026-11-12   |
911 # |         15         |   2027-11-11   |
b18706 912 # |         16         |   2028-11-09   |
e5ad84 913 # +--------------------+----------------+
MT 914 #
915 # See https://www.postgresql.org/support/versioning/
916 #
917
eb149b 918 # Config magic for Postgres/EnterpriseDB/...
cec11a 919 # Default DB version should be the newest one we do have so we detect any
MT 920 # incompatibilities as soon as possible.  Components could override this when
921 # they are not ready yet to compile with so new version.
b18706 922 PG_VERSION ?=   16
eb149b 923 PG_IMPLEM ?=    postgres
7fd1f9 924 PG_VERNUM =     $(subst .,,$(PG_VERSION))
eb149b 925 # For dependencies, including REQUIRED_PACKAGES if needed
JK 926 PG_BASEPKG =    database/$(PG_IMPLEM)-$(PG_VERNUM)
b709c0 927 PG_CLIENT_PKG = $(PG_BASEPKG)/client
ddabe6 928 PG_DEVELOPER_PKG = $(PG_BASEPKG)/developer
AP 929 PG_LIBRARY_PKG = $(PG_BASEPKG)/library
703a89 930 PG_SERVICE_PKG = service/$(PG_BASEPKG)
ddabe6 931
b709c0 932 REQUIRED_PACKAGES_SUBST+= PG_CLIENT_PKG
ddabe6 933 REQUIRED_PACKAGES_SUBST+= PG_DEVELOPER_PKG
AP 934 REQUIRED_PACKAGES_SUBST+= PG_LIBRARY_PKG
703a89 935 REQUIRED_PACKAGES_SUBST+= PG_SERVICE_PKG
eb149b 936
JK 937 PG_HOME =       $(USRDIR)/$(PG_IMPLEM)/$(PG_VERSION)
c86c97 938 PG_BINDIR.32 =  $(PG_HOME)/bin/$(MACH32)
AP 939 PG_BINDIR.64 =  $(PG_HOME)/bin
eb149b 940 PG_BINDIR =     $(PG_BINDIR.$(BITS))
7fd1f9 941 PG_INCDIR =     $(PG_HOME)/include
AP 942 PG_MANDIR =     $(PG_HOME)/man
943 PG_SHAREDIR =   $(PG_HOME)/share
944 PG_DOCDIR =     $(PG_HOME)/doc
945 PG_LIBDIR.32 =  $(PG_HOME)/lib
946 PG_LIBDIR.64 =  $(PG_HOME)/lib/$(MACH64)
eb149b 947 PG_LIBDIR =     $(PG_LIBDIR.$(BITS))
7fd1f9 948 PG_CONFIG.32 =  $(PG_BINDIR.32)/pg_config
AP 949 PG_CONFIG.64 =  $(PG_BINDIR.64)/pg_config
eb149b 950 PG_CONFIG =     $(PG_CONFIG.$(BITS))
259be2 951 PATH.prepend +=    $(PG_BINDIR)
7fd1f9 952
AP 953 PKG_MACROS +=   PG_VERSION=$(PG_VERSION)
954 PKG_MACROS +=   PG_VERNUM=$(PG_VERNUM)
eb149b 955 PKG_MACROS +=   PG_BASEPKG=$(PG_BASEPKG)
JK 956
e5ad84 957 #
MT 958 # Upstream maintains long-term MariaDB releases for at least 5 years and
959 # short-term MariaDB releases for at least one year.
960 #
961 # We will start to obsolete MariaDB versions according the following table:
962 #
963 # +-----------------+----------------+
964 # | MariaDB version | Obsolete after |
965 # +-----------------+----------------+
966 # |      10.6       |   2026-07      |
967 # +-----------------+----------------+
968 #
969 # See https://mariadb.org/about/#maintenance-policy
970 #
971
eb149b 972 # Config magic for MySQL/MariaDB/Percona/...
cec11a 973 # Default DB version should be the newest one we do have so we detect any
MT 974 # incompatibilities as soon as possible.  Components could override this when
975 # they are not ready yet to compile with so new version.
eb149b 976 # NOTE: At this time the gate does not provide a recipe for actual "mysql"
JK 977 # The "/usr/mysql/*" trees are mediated to preferred MariaDB or Percona variant
cec11a 978 MYSQL_VERSION ?=   10.6
eb149b 979 MYSQL_IMPLEM ?=    mariadb
JK 980 MYSQL_VERNUM =     $(subst .,,$(MYSQL_VERSION))
e07322 981 MYSQL_MINOR =      $(word 2,$(subst .,$(space),$(MYSQL_VERSION)))
AW 982 # Beginning with mariadb 10.6 we only ship 64 bit versions. That changes the paths.
983 $(if $(shell [ $(MYSQL_MINOR) -ge 6 ] && echo "OK"), \
984     $(eval MYSQL_64_BIT_ONLY := true), \
985     $(eval MYSQL_64_BIT_ONLY := false))
eb149b 986 # For dependencies, including REQUIRED_PACKAGES if needed
JK 987 MYSQL_BASEPKG =    database/$(MYSQL_IMPLEM)-$(MYSQL_VERNUM)
b709c0 988 MYSQL_CLIENT_PKG = $(MYSQL_BASEPKG)/client
AW 989 MYSQL_DEVELOPER_PKG = $(MYSQL_BASEPKG)/developer
990 MYSQL_LIBRARY_PKG = $(MYSQL_BASEPKG)/library
991
992 REQUIRED_PACKAGES_SUBST+= MYSQL_CLIENT_PKG
993 REQUIRED_PACKAGES_SUBST+= MYSQL_DEVELOPER_PKG
994 REQUIRED_PACKAGES_SUBST+= MYSQL_LIBRARY_PKG
eb149b 995
JK 996 MYSQL_HOME =       $(USRDIR)/$(MYSQL_IMPLEM)/$(MYSQL_VERSION)
e07322 997 ifeq ($(strip $(MYSQL_64_BIT_ONLY)),false)
eb149b 998 MYSQL_BINDIR.32 =  $(MYSQL_HOME)/bin
JK 999 MYSQL_BINDIR.64 =  $(MYSQL_HOME)/bin/$(MACH64)
e07322 1000 else
AW 1001 MYSQL_BINDIR.64 =  $(MYSQL_HOME)/bin
1002 endif
eb149b 1003 MYSQL_BINDIR =     $(MYSQL_BINDIR.$(BITS))
JK 1004 MYSQL_INCDIR =     $(MYSQL_HOME)/include
1005 MYSQL_MANDIR =     $(MYSQL_HOME)/man
1006 MYSQL_SHAREDIR =   $(MYSQL_HOME)/share
1007 MYSQL_DOCDIR =     $(MYSQL_HOME)/doc
1008 MYSQL_LIBDIR.32 =  $(MYSQL_HOME)/lib
1009 MYSQL_LIBDIR.64 =  $(MYSQL_HOME)/lib/$(MACH64)
1010 MYSQL_LIBDIR =     $(MYSQL_LIBDIR.$(BITS))
1011 MYSQL_CONFIG.32 =  $(MYSQL_BINDIR.32)/mysql_config
1012 MYSQL_CONFIG.64 =  $(MYSQL_BINDIR.64)/mysql_config
1013 MYSQL_CONFIG =     $(MYSQL_CONFIG.$(BITS))
ac8987 1014 MYSQL_PKG_CONFIG_PATH =    $(MYSQL_LIBDIR)/pkgconfig
259be2 1015 PATH.prepend +=        $(MYSQL_BINDIR)
eb149b 1016
JK 1017 PKG_MACROS +=   MYSQL_VERSION=$(MYSQL_VERSION)
1018 PKG_MACROS +=   MYSQL_VERNUM=$(MYSQL_VERNUM)
1019 PKG_MACROS +=   MYSQL_BASEPKG=$(MYSQL_BASEPKG)
7fd1f9 1020
6f7416 1021 # Default libjpeg implementation layout
AL 1022 JPEG_IMPLEM ?=     libjpeg8-turbo
1023 JPEG_HOME =        $(USRLIBDIR)/$(JPEG_IMPLEM)
1024 JPEG_BINDIR.32 =   $(JPEG_HOME)/bin
1025 JPEG_BINDIR.64 =   $(JPEG_HOME)/bin/$(MACH64)
1026 JPEG_BINDIR =      $(JPEG_BINDIR.$(BITS))
1027 JPEG_INCDIR =      $(USRINCDIR)/$(JPEG_IMPLEM)
1028 JPEG_LIBDIR.32 =   $(JPEG_HOME)/lib
1029 JPEG_LIBDIR.64 =   $(JPEG_HOME)/lib/$(MACH64)
1030 JPEG_LIBDIR =      $(JPEG_LIBDIR.$(BITS))
1031 JPEG_CPPFLAGS =    -I$(JPEG_INCDIR)
1032 JPEG_CFLAGS.32 =   -Wl,-L$(JPEG_LIBDIR.32) -Wl,-R$(JPEG_LIBDIR.32)
1033 JPEG_CFLAGS.64 =   -Wl,-L$(JPEG_LIBDIR.64) -Wl,-R$(JPEG_LIBDIR.64)
1034 JPEG_CFLAGS =      $(JPEG_CFLAGS.$(BITS))
1035 JPEG_CXXFLAGS.32 = -Wl,-L$(JPEG_LIBDIR.32) -Wl,-R$(JPEG_LIBDIR.32)
1036 JPEG_CXXFLAGS.64 = -Wl,-L$(JPEG_LIBDIR.64) -Wl,-R$(JPEG_LIBDIR.64)
1037 JPEG_CXXFLAGS =    $(JPEG_CXXFLAGS.$(BITS))
1038 JPEG_LDFLAGS.32 =  -L$(JPEG_LIBDIR.32) -R$(JPEG_LIBDIR.32)
1039 JPEG_LDFLAGS.64 =  -L$(JPEG_LIBDIR.64) -R$(JPEG_LIBDIR.64)
1040 JPEG_LDFLAGS =     $(JPEG_LDFLAGS.$(BITS))
1041
82bf6a 1042 JPEG_IMPLEM_PKG = image/library/$(JPEG_IMPLEM)
AW 1043 REQUIRED_PACKAGES_SUBST += JPEG_IMPLEM_PKG
1044
23aaef 1045 # This is the default BUILD version of tcl
DL 1046 # Not necessarily the system's default version, i.e. /usr/bin/tclsh
26b2cb 1047 TCL_VERSION =  8.6
AP 1048 TCLSH.8.6.i386.32 =    /usr/bin/i86/tclsh8.6
1049 TCLSH.8.6.i386.64 =    /usr/bin/amd64/tclsh8.6
1050 TCLSH.8.6.sparc.32 =    /usr/bin/sparcv7/tclsh8.6
1051 TCLSH.8.6.sparc.64 =    /usr/bin/sparcv9/tclsh8.6
23aaef 1052 TCLSH =        $(TCLSH.$(TCL_VERSION).$(MACH).$(BITS))
DL 1053
2aa1db 1054 # ICU library
8fd510 1055 ICU_VERSION =            74
MT 1056 ICU_LIBRARY_PKG =        library/icu-$(ICU_VERSION)
2aa1db 1057 REQUIRED_PACKAGES_SUBST +=    ICU_LIBRARY_PKG
MT 1058
1059
6bc9bf 1060 CCSMAKE =    /usr/ccs/bin/make
9c75c0 1061 GMAKE =        /usr/gnu/bin/make
NJ 1062 GPATCH =    /usr/gnu/bin/patch
ff1c63 1063 PATCH_LEVEL =    1
35a012 1064 GPATCH_BACKUP =    --backup --version-control=numbered
NJ 1065 GPATCH_FLAGS =    -p$(PATCH_LEVEL) $(GPATCH_BACKUP)
960e5b 1066 GSED =        /usr/gnu/bin/sed
8d70f8 1067 GDIFF =        /usr/gnu/bin/diff
RB 1068 GSORT =        /usr/gnu/bin/sort
fbf173 1069 GUNZIP =    /usr/bin/gunzip
9c75c0 1070
a99182 1071 SORT =        LC_ALL=C /usr/bin/sort
MT 1072
dd0336 1073 PKGREPO =    /usr/bin/pkgrepo
9c75c0 1074 PKGSEND =    /usr/bin/pkgsend
7bf47e 1075 ifeq   ($(strip $(PKGLINT_COMPONENT)),)
1cba4c 1076 PKGLINT =    /usr/bin/python /usr/bin/pkglint
7bf47e 1077 else
MS 1078 PKGLINT =    ${WS_TOOLS}/pkglint
1079 endif
9c75c0 1080
6cef35 1081 ACLOCAL =    /usr/bin/aclocal-1.16
MT 1082 AUTOMAKE =    /usr/bin/automake-1.16
b06748 1083 AUTORECONF =     /usr/bin/autoreconf
VM 1084
9b6169 1085 KSH93 =         /usr/bin/ksh93
9c75c0 1086 TOUCH =        /usr/bin/touch
NJ 1087 MKDIR =        /bin/mkdir -p
1088 RM =        /bin/rm -f
153732 1089 CP =        /bin/cp -f
2515dc 1090 MV =        /bin/mv -f
3d7f8d 1091 LN =        /bin/ln
8d70f8 1092 CAT =        /bin/cat
3d7f8d 1093 SYMLINK =    /bin/ln -s
c86a36 1094 ENV =        /usr/bin/env -i
14fe6e 1095 FIND =        /usr/bin/find
3d7f8d 1096 INSTALL =    /usr/bin/ginstall
1e5ead 1097 GNU_GREP =    /usr/gnu/bin/grep
81db49 1098 CHMOD =        /usr/bin/chmod
e5e44e 1099 NAWK =        /usr/bin/nawk
SM 1100 TEE =        /usr/bin/tee
3168d6 1101 GAS =        /usr/gnu/bin/as
e2ca11 1102 GTAR =        /usr/gnu/bin/tar
3168d6 1103 STRIP =    /usr/bin/strip
617c23 1104 IPS2TGZ =     $(WS_TOOLS)/ips2tgz
2d72b3 1105 JQ =        /usr/bin/jq
ace7a9 1106 DOS2UNIX =    /usr/bin/dos2unix
baff9a 1107 TAC =        /usr/bin/tac
MT 1108 QUILT =        /usr/bin/quilt
5f4d07 1109 CTFCONVERT =    /opt/onbld/bin/$(MACH)/ctfconvert
4f8cfa 1110
MS 1111 INS.dir=        $(INSTALL) -d $@
1112 INS.file=       $(INSTALL) -m 444 $< $(@D)
3cec7d 1113
4d4a5d 1114 # OpenSSL macros
3000b1 1115 OPENSSL_DEFAULT = 3.1
4d4a5d 1116 ifeq ($(strip $(USE_OPENSSL11)),yes)
2e08ac 1117 OPENSSL_VERSION = 1.1
4d4a5d 1118 else
AL 1119 ifeq ($(strip $(USE_OPENSSL10)),yes)
2e08ac 1120 OPENSSL_VERSION = 1.0
4d4a5d 1121 else
2e08ac 1122 OPENSSL_VERSION ?= $(OPENSSL_DEFAULT)
4d4a5d 1123 endif
AL 1124 endif
f4ee69 1125 PATH.prepend+=$(OPENSSL_BINDIR)
4d4a5d 1126 OPENSSL_PREFIX= $(USRDIR)/openssl/$(OPENSSL_VERSION)
a81647 1127 OPENSSL_BINDIR.64= $(OPENSSL_PREFIX)/bin
AW 1128 OPENSSL_BINDIR.32= $(OPENSSL_PREFIX)/bin/$(MACH32)
1129 OPENSSL_BINDIR= $(OPENSSL_BINDIR.$(BITS))
1130 OPENSSL_LIBDIR.64= $(OPENSSL_PREFIX)/lib/64
1131 OPENSSL_LIBDIR.32= $(OPENSSL_PREFIX)/lib
1132 OPENSSL_LIBDIR= $(OPENSSL_LIBDIR.$(BITS))
1133 OPENSSL_PKG_CONFIG_PATH.32= $(OPENSSL_PREFIX)/lib/pkgconfig
1134 OPENSSL_PKG_CONFIG_PATH.64= $(OPENSSL_PREFIX)/lib/64/pkgconfig
1135 OPENSSL_PKG_CONFIG_PATH= $(OPENSSL_PKG_CONFIG_PATH.$(BITS))
95833b 1136 OPENSSL_INCDIR=$(OPENSSL_PREFIX)/include
4d4a5d 1137
AL 1138 # Pkg-config paths
3cec7d 1139 PKG_CONFIG_PATH.32 = /usr/lib/pkgconfig
NJ 1140 PKG_CONFIG_PATH.64 = /usr/lib/$(MACH64)/pkgconfig
0b8dd9 1141 PKG_CONFIG_PATH = \
ac8987 1142     $(OPENSSL_PKG_CONFIG_PATH):$(MYSQL_PKG_CONFIG_PATH):$(PKG_CONFIG_PATH.$(BITS)):$(PKG_CONFIG_PATH.32)
3cec7d 1143
b55e44 1144 # Set default path for environment modules
AL 1145 MODULE_VERSION =    3.2.10
1146 MODULE_PATH =        /usr/share/Modules/modulefiles
1147 MODULE_VERSIONS_PATH =    /usr/share/Modules/versions
1148
1149 # Path to bash completions
1150 BASH_COMPLETIONS_PATH =    /usr/share/bash-completion/completions
4f8cfa 1151
MS 1152 #
35a012 1153 # C preprocessor flag sets to ease feature selection.  Add the required
NJ 1154 # feature to your Makefile with CPPFLAGS += $(FEATURE_MACRO) and add to
1155 # the component build with CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)" or
1156 # similiar.
1157 #
4f8cfa 1158
35a012 1159 # Enables visibility of some c99 math functions that aren't visible by default.
NJ 1160 # What other side-effects are there?
1161 CPP_C99_EXTENDED_MATH =    -D_STDC_99
e4bbaf 1162
35a012 1163 # Enables large file support for components that have no other means of doing
NJ 1164 # so.  Use CPP_LARGEFILES and not the .32/.64 variety directly
5ada66 1165 CPP_LARGEFILES.32 :=    $(shell getconf LFS_CFLAGS)
DD 1166 CPP_LARGEFILES.64 :=    $(shell getconf LFS64_CFLAGS)
35a012 1167 CPP_LARGEFILES =        $(CPP_LARGEFILES.$(BITS))
4f8cfa 1168
35a012 1169 # Enables some #pragma redefine_extname to POSIX-compliant Standard C Library
NJ 1170 # functions. Also avoids the component's #define _POSIX_C_SOURCE to some value
1171 # we currently do not support.
1172 CPP_POSIX =    -D_POSIX_C_SOURCE=200112L -D_POSIX_PTHREAD_SEMANTICS
4f8cfa 1173
afe8c5 1174 # XPG7 mode.  This option enables XPG7 conformance, plus extensions.
AL 1175 CPP_XPG7MODE=    -D_XOPEN_SOURCE=700 -D__EXTENSIONS__=1 -D_XPG7
1176
4f8cfa 1177 # XPG6 mode.  This option enables XPG6 conformance, plus extensions.
MS 1178 # Amongst other things, this option will cause system calls like
1179 # popen (3C) and system (3C) to invoke the standards-conforming
0f8a2f 1180 # shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh.  Add CPP_XPG6MODE to
35a012 1181 # CFLAGS instead of using this directly
NJ 1182 CPP_XPG6MODE=    -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 -D_XPG6
4f8cfa 1183
0aeacd 1184 # XPG5 mode. These options are specific for C++, where _XPG6,
ST 1185 # _XOPEN_SOURCE=600 and C99 are illegal. -D__EXTENSIONS__=1 is legal in C++.
1186 CPP_XPG5MODE=   -D_XOPEN_SOURCE=500 -D__EXTENSIONS__=1 -D_XPG5
35a012 1187
NJ 1188 # Generate 32/64 bit objects
1189 CC_BITS =    -m$(BITS)
1190
9d5dbf 1191 # Turn on C99 for gcc
DH 1192 gcc_C99_ENABLE =    -std=c99
1193
35a012 1194 # Control register usage for generated code.  SPARC ABI requires system
0f8a2f 1195 # libraries not to use application registers.
15d3df 1196 gcc_XREGS.sparc =    -mno-app-regs
MS 1197 gcc_XREGS.i386 =
1198 gcc_XREGS =        $(gcc_XREGS.$(MACH))
35a012 1199
NJ 1200 # See CPP_XPG6MODE comment above.
0f8a2f 1201 XPG6MODE =        $(CPP_XPG6MODE)
35a012 1202
0aeacd 1203 # See CPP_XPG5MODE comment above. You can only use this in C++, not in C99.
0f8a2f 1204 XPG5MODE =        $(CPP_XPG5MODE)
35a012 1205
4f8cfa 1206 #
35a012 1207 # GNU C compiler flag sets to ease feature selection.  Add the required
NJ 1208 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
1209 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
1210 #
4f8cfa 1211
97299f 1212 # Control the GCC optimization level.
753eab 1213 gcc_OPT.sparc.32 =    -O3 -mcpu=ultrasparc -mvis -mfsmuld
K 1214 gcc_OPT.sparc.64 =    -O3 -mcpu=ultrasparc -mvis -mfsmuld
97299f 1215 gcc_OPT.i386.32 =    -O3
GM 1216 gcc_OPT.i386.64 =    -O3
1217 gcc_OPT =        $(gcc_OPT.$(MACH).$(BITS))
4f8cfa 1218
35a012 1219 # GCC PIC code generation.  Use CC_PIC instead to select PIC code generation.
NJ 1220 gcc_PIC =    -fPIC -DPIC
4f8cfa 1221
35a012 1222 # Generic macro for PIC code generation.  Use this macro instead of the
NJ 1223 # compiler specific variant.
1224 CC_PIC =    $($(COMPILER)_PIC)
4f8cfa 1225
MS 1226
35a012 1227 # Default GNU C compiler flags.  Add the required feature to your Makefile
NJ 1228 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
1229 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.  In most cases, it
1230 # should not be necessary to add CFLAGS to any environment other than the
1231 # configure environment.
1232 CFLAGS.gcc +=    $(gcc_OPT)
15d3df 1233 CFLAGS.gcc +=    $(gcc_XREGS)
4f8cfa 1234
9789f8 1235 # Default GNU C++ compiler flags.  Add the required feature to your Makefile
AL 1236 # with CXXFLAGS += $(FEATURE_MACRO) and add to the component build with
1237 # CONFIGURE_OPTIONS += CXXFLAGS="$(CXXFLAGS)" or similiar.  In most cases, it
1238 # should not be necessary to add CXXFLAGS to any environment other than the
1239 # configure environment.
1240 CXXFLAGS.gcc +=    $(gcc_OPT)
1241 CXXFLAGS.gcc +=    $(gcc_XREGS)
1242
1243 # Default GNU FORTRAN compiler flags.  Add the required feature to your Makefile
1244 # with FCFLAGS += $(FEATURE_MACRO) and add to the component build with
1245 # CONFIGURE_OPTIONS += FCFLAGS="$(FCFLAGS)" or similiar.  In most cases, it
1246 # should not be necessary to add FCFLAGS to any environment other than the
1247 # configure environment.
1248 FCFLAGS.gcc +=    $(gcc_OPT)
1249 FCFLAGS.gcc +=    $(gcc_XREGS)
35a012 1250
NJ 1251 # Build 32 or 64 bit objects.
1252 CFLAGS +=    $(CC_BITS)
1253
1254 # Add compiler specific 'default' features
1255 CFLAGS +=    $(CFLAGS.$(COMPILER))
3cec7d 1256
5f4d07 1257 # Per-compiler CFLAGS to use when building for CTF.  Currently only defined
BS 1258 # for gcc; could be made to work with other compilers.
1259
1260 # -gdwarf-4 is the newest DWARF revision understood by illumos libctf
1261 #
1262 # -gstrict-dwarf prevents the compiler from including newer DWARF features
1263 CTF_CFLAGS.gcc = -g -gdwarf-4 -gstrict-dwarf
1264 # -msave-args makes it possible for debugging tools (specifically pstack and
1265 # mdb) to retrieve function arguments, and is required for the python pstack
1266 # hooks.
1267 CTF_CFLAGS.gcc += -msave-args
1268 # By default, GCC may put parts of functions in different named sub-sections
1269 # of .text based on their presumed or measured calling frequency.  This is not
1270 # currently handled by libctf and other illumos tools which assume that a
1271 # function's text lies in a single contiguous range of virtual addresses.
1272 # Disable this optimization if building with CTF.
1273 CTF_CFLAGS.gcc += -fno-reorder-functions -fno-reorder-blocks-and-partition
1274
1275 # Enable CTF if desired
1276 ifeq ($(strip $(USE_CTF)),yes)
1277 CFLAGS += $(if $(CTF_CFLAGS.$(COMPILER)), \
1278     $(CTF_CFLAGS.$(COMPILER)), \
1279     $(error Error: CTF_CFLAGS.$(COMPILER) must be defined to use CTF with $(COMPILER)))
1280 endif
1281
614c6a 1282 # Build 32 or 64 bit objects in C++ as well.
ST 1283 CXXFLAGS +=    $(CC_BITS)
1284
9789f8 1285 # Add compiler specific 'default' features
AL 1286 CXXFLAGS +=    $(CXXFLAGS.$(COMPILER))
1287
dcd7ba 1288 # Build 32 or 64 bit objects in FORTRAN as well.
AL 1289 F77FLAGS +=    $(CC_BITS)
1290 FCFLAGS +=    $(CC_BITS)
1291
9789f8 1292 # Add compiler specific 'default' features
AL 1293 F77FLAGS +=    $(FCFLAGS.$(COMPILER))
1294 FCFLAGS +=    $(FCFLAGS.$(COMPILER))
dcd7ba 1295
35a012 1296 #
NJ 1297 # Solaris linker flag sets to ease feature selection.  Add the required
1298 # feature to your Makefile with LDFLAGS += $(FEATURE_MACRO) and add to the
1299 # component build with CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)" or similiar.
1300 #
3cec7d 1301
NJ 1302 # set the bittedness that we want to link
db2ec7 1303 ccs.ld.64 = -64
AS 1304 gcc.ld.32 = -m32
1305 gcc.ld.64 = -m64
1306 LD_BITS =      $($(LINKER).ld.$(BITS))
1307 LDFLAGS =      $(LD_BITS)
35a012 1308
NJ 1309 # Reduce the symbol table size, effectively conflicting with -g.  We should
1310 # get linker guidance here.
1311 LD_Z_REDLOCSYM =    -z redlocsym
1312
1313 # Cause the linker to rescan archive libraries and resolve remaining unresolved
1314 # symbols recursively until all symbols are resolved.  Components should be
1315 # linking in the libraries they need, in the required order.  This should
1316 # only be required if the component's native build is horribly broken.
1317 LD_Z_RESCAN_NOW =    -z rescan-now
1318
1319 LD_Z_TEXT =        -z direct
1320
3a5b3f 1321 # make sure that -lc is always present when building shared objects.
RB 1322 LD_DEF_LIBS +=        -lc
1323
35a012 1324 # make sure all symbols are defined.
NJ 1325 LD_Z_DEFS =        -z defs
1326
17fc9e 1327 # eliminate unreferenced dynamic dependencies
NJ 1328 LD_Z_IGNORE =        -z ignore
1329
35a012 1330 # use direct binding
NJ 1331 LD_B_DIRECT =        -Bdirect
1332
0f1b63 1333 # use generic macro names for enabling/disabling ASLR
AC 1334 ASLR_ENABLE =         -z aslr=enable
1335 ASLR_DISABLE =         -z aslr=disable
1336 ASLR_MODE =         $(ASLR_DISABLE)
1337
1338 # by default, turn off Address Space Layout Randomization for ELF executables;
1339 # to explicitly enable ASLR, set ASLR_MODE = $(ASLR_ENABLE)
1340 # in that component's Makefile
1341 LD_Z_ASLR =        $(ASLR_MODE)
1342
a40541 1343 # Define SSP library link flag for 32-bit objects
AL 1344 LD_SSP.32 = -lssp_ns
1345 LD_SSP.64 =
1346 LD_SSP = $(LD_SSP.$(BITS))
1347
35a012 1348 #
NJ 1349 # More Solaris linker flags that we want to be sure that everyone gets.  This
1350 # is automatically added to the calling environment during the 'build' and
1351 # 'install' phases of the component build.  Each individual feature can be
1352 # turned off by adding FEATURE_MACRO= to the component Makefile.
1353 #
1354
1355 # Create a non-executable stack when linking.
ad8773 1356 LD_MAP_NOEXSTK.i386 =    -M /usr/lib/ld/map.noexstk
AB 1357 LD_MAP_NOEXSTK.sparc =    -M /usr/lib/ld/map.noexstk
35a012 1358
NJ 1359 # Create a non-executable bss segment when linking.
1360 LD_MAP_NOEXBSS =    -M /usr/lib/ld/map.noexbss
1361
1362 # Create a non-executable data segment when linking.  Due to PLT needs, the
1363 # data segment must be executable on sparc, but the bss does not.
1364 # see mapfile comments for more information
1365 LD_MAP_NOEXDATA.i386 =    -M /usr/lib/ld/map.noexdata
1366 LD_MAP_NOEXDATA.sparc =    $(LD_MAP_NOEXBSS)
1367
1368 # Page alignment
1369 LD_MAP_PAGEALIGN =    -M /usr/lib/ld/map.pagealign
1370
1371 # Linker options to add when only building libraries
3a5b3f 1372 LD_OPTIONS_SO +=    $(LD_Z_TEXT) $(LD_Z_DEFS) $(LD_DEF_LIBS)
35a012 1373
NJ 1374 # Default linker options that everyone should get.  Do not add additional
1375 # libraries to this macro, as it will apply to everything linked during the
1376 # component build.
ad8773 1377 LD_OPTIONS +=    $(LD_MAP_NOEXSTK.$(MACH)) $(LD_MAP_NOEXDATA.$(MACH)) \
17fc9e 1378         $(LD_MAP_PAGEALIGN) $(LD_B_DIRECT) $(LD_Z_IGNORE)
1932c6 1379
0f1b63 1380 # only used on executables
AC 1381 LD_EXEC_OPTIONS = $(LD_Z_ASLR)
1382
e83e52 1383 # Environment variables and arguments passed into the build and install
1932c6 1384 # environment(s).  These are the initial settings.
MS 1385 COMPONENT_BUILD_ENV= \
0f1b63 1386     LD_OPTIONS="$(LD_OPTIONS)" \
AC 1387     LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1932c6 1388 COMPONENT_INSTALL_ENV= \
0f1b63 1389     LD_OPTIONS="$(LD_OPTIONS)" \
AC 1390     LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1932c6 1391
cba80e 1392 # PATH should be always set
MT 1393 COMPONENT_BUILD_ENV += PATH="$(PATH)"
1394 COMPONENT_INSTALL_ENV += PATH="$(PATH)"
1395 COMPONENT_TEST_ENV += PATH="$(PATH)"
1396
1a7b67 1397 # PERL options which depend on C options should be placed here
0f8a2f 1398 PERL_OPTIMIZE :=    $(shell $(PERL) -e 'use Config; print $$Config{optimize}')
1a7b67 1399
c5572a 1400 # Rewrite absolute source-code paths into relative for ccache, so that any
JK 1401 # workspace with a shared CCACHE_DIR can benefit when compiling a component
1402 ifneq ($(strip $(CCACHE)),)
1403 export CCACHE_BASEDIR = $(BUILD_DIR_$(BITS))
1404 COMPONENT_BUILD_ENV += CCACHE="$(CCACHE)"
1405 COMPONENT_INSTALL_ENV += CCACHE="$(CCACHE)"
1406 COMPONENT_TEST_ENV += CCACHE="$(CCACHE)"
1407 COMPONENT_BUILD_ENV += CC_gcc_32="$(CC_gcc_32)"
b5cf06 1408 COMPONENT_BUILD_ENV += CC_gcc_64="$(CC_gcc_64)"
AL 1409 COMPONENT_BUILD_ENV += CXX_gcc_32="$(CXX_gcc_32)"
c5572a 1410 COMPONENT_BUILD_ENV += CXX_gcc_64="$(CXX_gcc_64)"
JK 1411 COMPONENT_INSTALL_ENV += CC_gcc_32="$(CC_gcc_32)"
b5cf06 1412 COMPONENT_INSTALL_ENV += CC_gcc_64="$(CC_gcc_64)"
AL 1413 COMPONENT_INSTALL_ENV += CXX_gcc_32="$(CXX_gcc_32)"
c5572a 1414 COMPONENT_INSTALL_ENV += CXX_gcc_64="$(CXX_gcc_64)"
JK 1415 COMPONENT_TEST_ENV += CC_gcc_32="$(CC_gcc_32)"
b5cf06 1416 COMPONENT_TEST_ENV += CC_gcc_64="$(CC_gcc_64)"
AL 1417 COMPONENT_TEST_ENV += CXX_gcc_32="$(CXX_gcc_32)"
c5572a 1418 COMPONENT_TEST_ENV += CXX_gcc_64="$(CXX_gcc_64)"
JK 1419 COMPONENT_BUILD_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1420 COMPONENT_INSTALL_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1421 COMPONENT_TEST_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1422
1423 ifneq ($(strip $(CCACHE_DIR)),)
1424 COMPONENT_BUILD_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1425 COMPONENT_INSTALL_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1426 COMPONENT_TEST_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1427 endif
1428
1429 ifneq ($(strip $(CCACHE_LOGFILE)),)
1430 COMPONENT_BUILD_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1431 COMPONENT_INSTALL_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1432 COMPONENT_TEST_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1433 endif
1434
1435 endif
1436
1932c6 1437 # Add any bit-specific settings
e83e52 1438 COMPONENT_BUILD_ENV += $(COMPONENT_BUILD_ENV.$(BITS))
NJ 1439 COMPONENT_BUILD_ARGS += $(COMPONENT_BUILD_ARGS.$(BITS))
1440 COMPONENT_INSTALL_ENV += $(COMPONENT_INSTALL_ENV.$(BITS))
1441 COMPONENT_INSTALL_ARGS += $(COMPONENT_INSTALL_ARGS.$(BITS))
4158c0 1442
3cec7d 1443 # declare these phony so that we avoid filesystem conflicts.
d56e92 1444 .PHONY:    prep build install publish test clean clobber
3cec7d 1445
4158c0 1446 # If there are no tests to execute
NJ 1447 NO_TESTS =    test-nothing
1448 test-nothing:
1449     @echo "There are no tests available at this time."
764663 1450
NJ 1451 # default behaviour for 'component-hook' target is to echo the component
1452 # name and version information, but more complex behaviour can be implemented
1453 # via command line setting of the COMPONENT_HOOK macro.
1454 COMPONENT_HOOK ?=    echo $(COMPONENT_NAME) $(COMPONENT_VERSION)
1455
1456 component-hook:
1457     @$(COMPONENT_HOOK)
1458
8203c7 1459 # We need shell/ksh93 to be able to run scripts in the tools directory
MT 1460 USERLAND_REQUIRED_PACKAGES += shell/ksh93
39e94f 1461
d180f2 1462 #
1463 # Packages with tools that are required to build Userland components
1464 #
1349f8 1465 USERLAND_REQUIRED_PACKAGES += metapackages/build-essential
d180f2 1466
e6ade5 1467 # Define substitution rules for some packages.
AL 1468 # Such package names may change and would be better defined with a macro to
1469 # avoid mass modification of the Makefiles.
1470
1471 # Runtime package names are changed at compiler version major bumps.
1472 REQUIRED_PACKAGES_SUBST+= GCC_RUNTIME_PKG
1473 REQUIRED_PACKAGES_SUBST+= GXX_RUNTIME_PKG
1474 REQUIRED_PACKAGES_SUBST+= GFORTRAN_RUNTIME_PKG
1475 REQUIRED_PACKAGES_SUBST+= GOBJC_RUNTIME_PKG
1476
3129b3 1477 # Generate requirements on all built python version variants for given packages
ccec59 1478 USERLAND_REQUIRED_PACKAGES += $(foreach ver,$(PYTHON_VERSIONS),$(USERLAND_REQUIRED_PACKAGES.python:%=%-$(subst .,,$(ver))))
MT 1479 REQUIRED_PACKAGES += $(foreach ver,$(PYTHON_VERSIONS),$(PYTHON_REQUIRED_PACKAGES:%=%-$(subst .,,$(ver))))
1480 TEST_REQUIRED_PACKAGES += $(foreach ver,$(PYTHON_VERSIONS),$(TEST_REQUIRED_PACKAGES.python:%=%-$(subst .,,$(ver))))
3129b3 1481
45844d 1482 # Generate requirements on all built perl version variants for given packages
ccec59 1483 USERLAND_REQUIRED_PACKAGES += $(foreach ver,$(PERL_VERSIONS),$(USERLAND_REQUIRED_PACKAGES.perl:%=%-$(subst .,,$(ver))))
MT 1484 REQUIRED_PACKAGES += $(foreach ver,$(PERL_VERSIONS),$(PERL_REQUIRED_PACKAGES:%=%-$(subst .,,$(ver))))
1485 TEST_REQUIRED_PACKAGES += $(foreach ver,$(PERL_VERSIONS),$(TEST_REQUIRED_PACKAGES.perl:%=%-$(subst .,,$(ver))))
45844d 1486
f3591a 1487 # Generate conflicting packages for all built python version variants for given package
ccec59 1488 TEST_CONFLICTING_PACKAGES += $(foreach ver,$(PYTHON_VERSIONS),$(TEST_CONFLICTING_PACKAGES.python:%=%-$(subst .,,$(ver))))
f3591a 1489
baff9a 1490 # Targets for some tools rarely used by the build framework.  We do not add
MT 1491 # these tools to USERLAND_REQUIRED_PACKAGES to do not pollute it.
1492 $(QUILT):
1493     @echo
1494     @echo "$(QUILT) is missing"
1495     @echo "Please install developer/quilt package"
1496     @echo
1497     @exit 1
1498
d180f2 1499 include $(WS_MAKE_RULES)/environment.mk
1349f8 1500 include $(WS_MAKE_RULES)/depend.mk
27cdce 1501 include $(WS_MAKE_RULES)/component.mk