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