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