sdl2: update to 2.30.10
[oi-userland.git] / make-rules / shared-macros.mk
blob651991a44525b3632e7f00b95146ac4b71fa629d
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.10
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/sparc - for GCC version older than 9
129 # x86_64/sparcv9 - for GCC version 9 and newer
130 ifeq ($(MACH), i386)
131 GNU_CPU = $(if $(filter $(GCC_VERSION),3 4 7),$(MACH),$(MACH:i386=x86_64))
132 else
133 GNU_CPU = $(if $(filter $(GCC_VERSION),3 4 7),$(MACH),$(MACH:sparc=sparcv9))
134 endif
135 # The vendor part of the triplet is:
136 # pc - for x86
137 # sun - for SPARC
138 GNU_VENDOR.i386 = pc
139 GNU_VENDOR.sparc = sun
140 GNU_VENDOR = $(GNU_VENDOR.$(MACH))
141 # The os part of the triplet is solaris2.11
142 GNU_OS = solaris$(SOLARIS_VERSION)
144 include $(WS_MAKE_RULES)/ips-buildinfo.mk
146 COMPILER = gcc
147 LINKER = gcc
149 # The value of BITS is set automatically during the build process to either 32
150 # or 64 as needed.
152 # This macro makes it possible to determine which components are only built
153 # 64-bit (default) and allow other make-rules files to adjust accordingly.
154 # Possible values are: '32', '64', '32_and_64', '64_and_32', and 'NO_ARCH' (the
155 # orderings specify build preference).
156 BUILD_BITS ?= 64
158 # Based on BUILD_BITS, determine which binaries are preferred for a build.
159 # This macro is for the convenience of other make-rules files and should not be
160 # overridden by developers.
161 ifeq ($(strip $(BUILD_BITS)),64)
162 PREFERRED_BITS=64
163 endif
164 # Now we prefer 64-bit
165 ifeq ($(strip $(BUILD_BITS)),64_and_32)
166 PREFERRED_BITS=64
167 endif
168 PREFERRED_BITS ?= 32
170 # Map target build to macro/variable naming conventions. This macro is for the
171 # convenience of other make-rules files and should not be overridden by
172 # developers.
173 ifeq ($(BUILD_BITS),64_and_32)
174 MK_BITS=32_and_64
175 else
176 MK_BITS=$(strip $(BUILD_BITS))
177 endif
180 # Upstream support for Python is by default 5 years after the first release.
181 # We will start to obsolete Python versions according the following table:
183 # +----------------+----------------+
184 # | Python version | Obsolete after |
185 # +----------------+----------------+
186 # | 3.9 | 2025-10 |
187 # +----------------+----------------+
189 # See https://devguide.python.org/versions/
192 PYTHON_VERSION = 3.9
193 PYTHON_VERSIONS = 3.9
195 # Python up to 2.7 was built both 32-bit and 64-bit. Starting with Python 3.x
196 # the python package is built 64-bit only. So now all PYTHON_VERSIONS are
197 # 64-bit only.
198 PYTHON_64_ONLY_VERSIONS = $(PYTHON_VERSIONS)
200 # List of python versions we are currently obsoleting. We no longer build any
201 # packages for these python versions, but there still might be hanging some not
202 # obsoleted yet versioned packages built for PYTHON_VERSIONS_OBSOLETING python
203 # versions. Or there is just the versioned runtime/python package still
204 # available.
206 # This list should be usually empty. Intersection of
207 # PYTHON_VERSIONS_OBSOLETING and PYTHON_VERSIONS lists MUST be always empty.
208 PYTHON_VERSIONS_OBSOLETING = 2.7 3.7
210 # PYTHON3_SOABI variable defines the naming scheme
211 # of python3 extension libraries: cpython or abi3.
212 # Currently, most of the components use cpython naming scheme by default,
213 # only python/xattr and python/cryptography require abi3 naming.
214 PYTHON3_SOABI ?= cpython
215 ifeq ($(PYTHON3_SOABI),cpython)
216 PY3_CPYTHON_NAMING=
217 PY3_ABI3_NAMING=\#
218 else ifeq ($(PYTHON3_SOABI),abi3)
219 PY3_CPYTHON_NAMING=\#
220 PY3_ABI3_NAMING=
221 else
222 $(error "Invalid python naming scheme '$(PYTHON3_SOABI)' selected!")
223 endif
225 BASS_O_MATIC = $(WS_TOOLS)/bass-o-matic
227 CLONEY = $(WS_TOOLS)/cloney
229 CONFIG_SHELL = /bin/bash
231 PKG_REPO = file:$(WS_REPO)
233 COMPONENT = $(COMPONENT_DIR:$(WS_TOP)/components/%=%)
234 HUMAN_VERSION ?= $(COMPONENT_VERSION)
235 COMPONENT_SRC_NAME = $(COMPONENT_NAME)
237 COMPONENT_LICENSE_FILE ?= $(COMPONENT_NAME).license
239 COMPONENT_DIR := $(shell pwd)
240 SOURCE_DIR = $(COMPONENT_DIR)/$(COMPONENT_SRC)
241 BUILD_DIR = $(COMPONENT_DIR)/build
242 PROTO_DIR = $(BUILD_DIR)/prototype/$(MACH)
244 ARCHLIBSUBDIR32 =
245 ARCHLIBSUBDIR64 = $(MACH64)
246 ARCHLIBSUBDIR = $(ARCHLIBSUBDIR$(BITS))
248 ETCDIR = /etc
249 USRDIR = /usr
250 BINDIR = /bin
251 SBINDIR = /sbin
252 LIBDIR = /lib
253 LIBEXECDIR = /libexec
254 VARDIR = /var
255 KERNELDRVDIR = /kernel/drv
256 KERNELDRVDIR32 = /kernel/drv
257 KERNELDRVDIR64 = /kernel/drv/$(MACH64)
258 USRBINDIR = $(USRDIR)/bin
259 USRBINDIR32 = $(USRDIR)/bin/$(MACH32)
260 USRBINDIR64 = $(USRDIR)/bin/$(MACH64)
261 USRSBINDIR = $(USRDIR)/sbin
262 USRSBINDIR32 = $(USRDIR)/sbin/$(MACH32)
263 USRSBINDIR64 = $(USRDIR)/sbin/$(MACH64)
264 USRLIBDIR = $(USRDIR)/lib
265 USRLIBDIR32 = $(USRDIR)/lib
266 USRLIBDIR64 = $(USRDIR)/lib/$(MACH64)
267 USRLIBEXECDIR = $(USRDIR)/libexec
268 USRLIBEXECDIR32 = $(USRDIR)/libexec
269 USRLIBEXECDIR64 = $(USRDIR)/libexec/$(MACH64)
270 USRSHAREDIR = $(USRDIR)/share
271 USRINCDIR = $(USRDIR)/include
272 USRSHARELOCALEDIR = $(USRSHAREDIR)/locale
273 USRSHAREMANDIR = $(USRSHAREDIR)/man
274 USRSHAREDOCDIR = $(USRSHAREDIR)/doc
275 USRSHARELIBDIR = $(USRSHAREDIR)/lib
276 USRSHAREMAN1DIR = $(USRSHAREMANDIR)/man1
277 USRSHAREMAN1MDIR = $(USRSHAREMANDIR)/man1m
278 USRSHAREMAN3DIR = $(USRSHAREMANDIR)/man3
279 USRSHAREMAN4DIR = $(USRSHAREMANDIR)/man4
280 USRSHAREMAN5DIR = $(USRSHAREMANDIR)/man5
281 USRSHAREMAN7DIR = $(USRSHAREMANDIR)/man7
282 USRSHAREMAN8DIR = $(USRSHAREMANDIR)/man8
283 USRKERNELDRVDIR = $(USRDIR)/kernel/drv
284 USRKERNELDRVDIR32 = $(USRDIR)/kernel/drv
285 USRKERNELDRVDIR64 = $(USRDIR)/kernel/drv/$(MACH64)
287 # The *.$(BITS) variables are different from those above (better suited for
288 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
289 USRBINDIR.32 = $(USRBINDIR)
290 USRBINDIR.64 = $(USRBINDIR64)
291 USRSBINDIR.32 = $(USRSBINDIR)
292 USRSBINDIR.64 = $(USRSBINDIR64)
293 USRLIBDIR.32 = $(USRLIBDIR)
294 USRLIBDIR.64 = $(USRLIBDIR64)
295 USRLIBEXECDIR.32 = $(USRLIBEXECDIR)
296 USRLIBEXECDIR.64 = $(USRLIBEXECDIR64)
297 PROTOETCDIR = $(PROTO_DIR)/$(ETCDIR)
298 PROTOETCSECDIR = $(PROTO_DIR)/$(ETCDIR)/security
299 PROTOUSRDIR = $(PROTO_DIR)/$(USRDIR)
300 PROTOBINDIR = $(PROTO_DIR)/$(BINDIR)
301 PROTOSBINDIR = $(PROTO_DIR)/$(SBINDIR)
302 PROTOLIBDIR = $(PROTO_DIR)/$(LIBDIR)
303 PROTOLIBEXECDIR = $(PROTO_DIR)/$(LIBEXECDIR)
304 PROTOVARDIR = $(PROTO_DIR)/$(VARDIR)
305 PROTOKERNELDRVDIR = $(PROTO_DIR)/$(KERNELDRVDIR)
306 PROTOKERNELDRVDIR32 = $(PROTO_DIR)/$(KERNELDRVDIR32)
307 PROTOKERNELDRVDIR64 = $(PROTO_DIR)/$(KERNELDRVDIR64)
308 PROTOUSRBINDIR = $(PROTO_DIR)/$(USRBINDIR)
309 PROTOUSRBINDIR32 = $(PROTO_DIR)/$(USRBINDIR32)
310 PROTOUSRBINDIR64 = $(PROTO_DIR)/$(USRBINDIR64)
311 PROTOUSRSBINDIR = $(PROTO_DIR)/$(USRSBINDIR)
312 PROTOUSRSBINDIR32 = $(PROTO_DIR)/$(USRSBINDIR32)
313 PROTOUSRSBINDIR64 = $(PROTO_DIR)/$(USRSBINDIR64)
314 PROTOUSRLIBDIR = $(PROTO_DIR)/$(USRLIBDIR)
315 PROTOUSRLIBDIR32 = $(PROTO_DIR)/$(USRLIBDIR32)
316 PROTOUSRLIBDIR64 = $(PROTO_DIR)/$(USRLIBDIR64)
317 PROTOUSRLIBEXECDIR = $(PROTO_DIR)/$(USRLIBEXECDIR)
318 PROTOUSRLIBEXECDIR32 = $(PROTO_DIR)/$(USRLIBEXECDIR32)
319 PROTOUSRLIBEXECDIR64 = $(PROTO_DIR)/$(USRLIBEXECDIR64)
320 PROTOUSRINCDIR = $(PROTO_DIR)/$(USRINCDIR)
321 PROTOUSRSHAREDIR = $(PROTO_DIR)/$(USRSHAREDIR)
322 PROTOUSRSHARELIBDIR = $(PROTO_DIR)/$(USRSHARELIBDIR)
323 PROTOUSRSHAREMANDIR = $(PROTO_DIR)/$(USRSHAREMANDIR)
324 PROTOUSRSHAREDOCDIR = $(PROTO_DIR)/$(USRSHAREDOCDIR)
325 PROTOUSRSHAREMAN1DIR = $(PROTO_DIR)/$(USRSHAREMAN1DIR)
326 PROTOUSRSHAREMAN1MDIR = $(PROTO_DIR)/$(USRSHAREMAN1MDIR)
327 PROTOUSRSHAREMAN3DIR = $(PROTO_DIR)/$(USRSHAREMAN3DIR)
328 PROTOUSRSHAREMAN4DIR = $(PROTO_DIR)/$(USRSHAREMAN4DIR)
329 PROTOUSRSHAREMAN5DIR = $(PROTO_DIR)/$(USRSHAREMAN5DIR)
330 PROTOUSRSHAREMAN8DIR = $(PROTO_DIR)/$(USRSHAREMAN8DIR)
331 PROTOUSRSHARELOCALEDIR = $(PROTO_DIR)/$(USRSHARELOCALEDIR)
332 PROTOUSRKERNELDRVDIR = $(PROTO_DIR)/$(USRKERNELDRVDIR)
333 PROTOUSRKERNELDRVDIR32 = $(PROTO_DIR)/$(USRKERNELDRVDIR32)
334 PROTOUSRKERNELDRVDIR64 = $(PROTO_DIR)/$(USRKERNELDRVDIR64)
336 PROTOUSRBINDIR.32 = $(PROTOUSRBINDIR)
337 PROTOUSRBINDIR.64 = $(PROTOUSRBINDIR64)
338 PROTOUSRSBINDIR.32 = $(PROTOUSRSBINDIR)
339 PROTOUSRSBINDIR.64 = $(PROTOUSRSBINDIR64)
340 PROTOUSRLIBDIR.32 = $(PROTOUSRLIBDIR)
341 PROTOUSRLIBDIR.64 = $(PROTOUSRLIBDIR64)
342 PROTOUSRLIBEXECDIR.32 = $(PROTOUSRLIBEXECDIR)
343 PROTOUSRLIBEXECDIR.64 = $(PROTOUSRLIBEXECDIR64)
345 # NOTE: We do not build SFW contents
346 # /usr/sfw/bin is just a historic artefact, containing symlinks
347 SFWBIN = /usr/sfw/bin
348 SFWBIN32 = $(SFWBIN)
349 SFWBIN64 = $(SFWBIN)/$(MACH64)
350 SFWSBIN = /usr/sfw/sbin
351 SFWSBIN32 = $(SFWSBIN)
352 SFWSBIN64 = $(SFWSBIN)/$(MACH64)
353 SFWINCLUDE = /usr/sfw/include
354 SFWLIB = /usr/sfw/lib
355 SFWLIB32 = $(SFWLIB)
356 SFWLIB64 = $(SFWLIB)/$(MACH64)
357 SFWSHARE = /usr/sfw/share
358 SFWSHAREMAN = $(SFWSHARE)/man
359 SFWSHAREMAN1 = $(SFWSHAREMAN)/man1
360 PROTOSFWBIN = $(PROTO_DIR)/$(SFWBIN)
361 PROTOSFWBIN32 = $(PROTO_DIR)/$(SFWBIN32)
362 PROTOSFWBIN64 = $(PROTO_DIR)/$(SFWBIN64)
363 PROTOSFWSBIN = $(PROTO_DIR)/$(SFWSBIN)
364 PROTOSFWSBIN32 = $(PROTO_DIR)/$(SFWSBIN32)
365 PROTOSFWSBIN64 = $(PROTO_DIR)/$(SFWSBIN64)
366 PROTOSFWLIB = $(PROTO_DIR)/$(SFWLIB)
367 PROTOSFWLIB32 = $(PROTO_DIR)/$(SFWLIB32)
368 PROTOSFWLIB64 = $(PROTO_DIR)/$(SFWLIB64)
369 PROTOSFWSHARE = $(PROTO_DIR)/$(SFWSHARE)
370 PROTOSFWSHAREMAN = $(PROTO_DIR)/$(SFWSHAREMAN)
371 PROTOSFWSHAREMAN1 = $(PROTO_DIR)/$(SFWSHAREMAN1)
372 PROTOSFWINCLUDE = $(PROTO_DIR)/$(SFWINCLUDE)
374 # The *.$(BITS) variables are different from those above (better suited for
375 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
376 SFWBIN.32 = $(SFWBIN)
377 SFWBIN.64 = $(SFWBIN64)
378 SFWSBIN.32 = $(SFWSBIN)
379 SFWSBIN.64 = $(SFWSBIN64)
380 SFWLIB.32 = $(SFWLIB)
381 SFWLIB.64 = $(SFWLIB64)
382 PROTOSFWBIN.32 = $(PROTOSFWBIN)
383 PROTOSFWBIN.64 = $(PROTOSFWBIN64)
384 PROTOSFWSBIN.32 = $(PROTOSFWSBIN)
385 PROTOSFWSBIN.64 = $(PROTOSFWSBIN64)
386 PROTOSFWLIB.32 = $(PROTOSFWLIB)
387 PROTOSFWLIB.64 = $(PROTOSFWLIB64)
389 CLDIR = /usr/share/common-lisp
390 PROTOCLDIR = $(PROTO_DIR)/$(CLDIR)
392 GNUDIR = /usr/gnu
393 GNUBIN = $(GNUDIR)/bin
394 GNUBIN32 = $(GNUBIN)/$(MACH32)
395 GNUBIN64 = $(GNUBIN)/$(MACH64)
396 GNUSBIN = $(GNUDIR)/sbin
397 GNUSBIN32 = $(GNUSBIN)/$(MACH32)
398 GNUSBIN64 = $(GNUSBIN)/$(MACH64)
399 GNULIB = $(GNUDIR)/lib
400 GNULIB32 = $(GNULIB)
401 GNULIB64 = $(GNULIB)/$(MACH64)
402 GNUSHARE = $(GNUDIR)/share
403 GNUSHAREMAN = $(GNUSHARE)/man
404 GNUSHAREMAN1 = $(GNUSHAREMAN)/man1
405 PROTOGNUBIN = $(PROTO_DIR)/$(GNUBIN)
406 PROTOGNUBIN32 = $(PROTO_DIR)/$(GNUBIN32)
407 PROTOGNUBIN64 = $(PROTO_DIR)/$(GNUBIN64)
408 PROTOGNUSBIN = $(PROTO_DIR)/$(GNUSBIN)
409 PROTOGNUSBIN32 = $(PROTO_DIR)/$(GNUSBIN32)
410 PROTOGNUSBIN64 = $(PROTO_DIR)/$(GNUSBIN64)
411 PROTOGNULIB = $(PROTO_DIR)/$(GNULIB)
412 PROTOGNULIB32 = $(PROTO_DIR)/$(GNULIB32)
413 PROTOGNULIB64 = $(PROTO_DIR)/$(GNULIB64)
414 PROTOGNUSHARE = $(PROTO_DIR)/$(GNUSHARE)
415 PROTOGNUSHAREMAN = $(PROTO_DIR)/$(GNUSHAREMAN)
416 PROTOGNUSHAREMAN1 = $(PROTO_DIR)/$(GNUSHAREMAN1)
418 # The *.$(BITS) variables are different from those above (better suited for
419 # isaexec wrapper), and allow for default 32-bit vs. nondefault 64-bit setups
420 GNUBIN.32 = $(GNUBIN)
421 GNUBIN.64 = $(GNUBIN64)
422 GNUSBIN.32 = $(GNUSBIN)
423 GNUSBIN.64 = $(GNUSBIN64)
424 GNULIB.32 = $(GNULIB)
425 GNULIB.64 = $(GNULIB64)
426 PROTOGNUBIN.32 = $(PROTOGNUBIN)
427 PROTOGNUBIN.64 = $(PROTOGNUBIN64)
428 PROTOGNUSBIN.32 = $(PROTOGNUSBIN)
429 PROTOGNUSBIN.64 = $(PROTOGNUSBIN64)
430 PROTOGNULIB.32 = $(PROTOGNULIB)
431 PROTOGNULIB.64 = $(PROTOGNULIB64)
433 # work around _TIME, _DATE, embedded date chatter in component builds
434 # to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
435 # to the appropriate {CONFIGURE|BUILD|INSTALL}_ENV
436 CONSTANT_TIME = LD_PRELOAD_32=$(WS_TOOLS)/time-$(MACH32).so
437 CONSTANT_TIME += LD_PRELOAD_64=$(WS_TOOLS)/time-$(MACH64).so
438 CONSTANT_TIME += TIME_CONSTANT=$(TIME_CONSTANT)
440 # List known architectures
441 MACH_LIST = sparc i386
443 # set MACH from uname -p to either sparc or i386
444 MACH := $(shell uname -p)
446 # set MACH32 from MACH to either sparcv7 or i86
447 MACH32_1 = $(MACH:sparc=sparcv7)
448 MACH32 = $(MACH32_1:i386=i86)
450 # set MACH64 from MACH to either sparcv9 or amd64
451 MACH64_1 = $(MACH:sparc=sparcv9)
452 MACH64 = $(MACH64_1:i386=amd64)
454 CONFIGURE_NO_ARCH = $(BUILD_DIR_NO_ARCH)/.configured
455 CONFIGURE_32 = $(BUILD_DIR_32)/.configured
456 CONFIGURE_64 = $(BUILD_DIR_64)/.configured
458 BUILD_DIR_NO_ARCH = $(BUILD_DIR)/$(MACH)
459 BUILD_DIR_32 = $(BUILD_DIR)/$(MACH32)
460 BUILD_DIR_64 = $(BUILD_DIR)/$(MACH64)
462 BUILD_NO_ARCH = $(BUILD_DIR_NO_ARCH)/.built
463 BUILD_32 = $(BUILD_DIR_32)/.built
464 BUILD_64 = $(BUILD_DIR_64)/.built
465 BUILD_32_and_64 = $(BUILD_32) $(BUILD_64)
466 $(BUILD_DIR_NO_ARCH)/.built: BITS=32
467 $(BUILD_DIR_32)/.built: BITS=32
468 $(BUILD_DIR_64)/.built: BITS=64
470 INSTALL_NO_ARCH = $(BUILD_DIR_NO_ARCH)/.installed
471 INSTALL_32 = $(BUILD_DIR_32)/.installed
472 INSTALL_64 = $(BUILD_DIR_64)/.installed
473 INSTALL_32_and_64 = $(INSTALL_32) $(INSTALL_64)
474 $(BUILD_DIR_32)/.installed: BITS=32
475 $(BUILD_DIR_64)/.installed: BITS=64
476 # If we are building both 32 and 64 bit then make sure we install in the
477 # desired order: the preferred one last
478 ifeq ($(strip $(BUILD_BITS)),64_and_32)
479 $(INSTALL_64): $(INSTALL_32)
480 endif
481 ifeq ($(strip $(BUILD_BITS)),32_and_64)
482 $(INSTALL_32): $(INSTALL_64)
483 endif
485 # set the default target for installation of the component
486 COMPONENT_INSTALL_TARGETS = install
488 # set the default build test results directory
489 COMPONENT_TEST_BUILD_DIR = $(BUILD_DIR)/test/$(MACH$(BITS))
491 # set the default master test results directory
492 COMPONENT_TEST_RESULTS_DIR = $(COMPONENT_DIR)/test
494 # set the default master test results file
495 USE_COMMON_TEST_MASTER ?= yes
496 ifeq ($(strip $(USE_COMMON_TEST_MASTER)),yes)
497 COMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-all.master
498 else
499 COMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-$(BITS).master
500 endif
502 # set the default test results output file
503 COMPONENT_TEST_OUTPUT = $(COMPONENT_TEST_BUILD_DIR)/test-$(BITS)-results
505 # set the default test results comparison diffs file
506 COMPONENT_TEST_DIFFS = $(COMPONENT_TEST_BUILD_DIR)/test-$(BITS)-diffs
508 # set the default test snapshot file
509 COMPONENT_TEST_SNAPSHOT = $(COMPONENT_TEST_BUILD_DIR)/results-$(BITS).snapshot
511 # Normally $(GSED) is simplest, but some results files need more power.
512 COMPONENT_TEST_TRANSFORMER = $(GSED)
514 # The set of default transforms to be applied to the test results to try
515 # to normalize them.
516 COMPONENT_TEST_TRANSFORMS = \
517 '-e "s|$(@D)|\\$$(@D)|g" ' \
518 '-e "s|$(PERL)|\\$$(PERL)|g" ' \
519 '-e "s|$(PYTHON)|\\$$(PYTHON)|g" ' \
520 '-e "s|$(SOURCE_DIR)|\\$$(SOURCE_DIR)|g" '
521 COMPONENT_TEST_TRANSFORMS += "-e 's|$(PROTO_DIR)|\$$(PROTO_DIR)|g'"
522 COMPONENT_TEST_TRANSFORMS += "-e 's|$(BUILD_DIR)|\$$(BUILD_DIR)|g'"
524 # set the default commands used to generate the file containing the set
525 # of transforms to be applied to the test results to try to normalize them.
526 COMPONENT_TEST_CREATE_TRANSFORMS = \
527 print "\#!/bin/sh" > $(COMPONENT_TEST_TRANSFORM_CMD); \
528 print '$(CAT) $(COMPONENT_TEST_OUTPUT) | \\' \
529 >> $(COMPONENT_TEST_TRANSFORM_CMD); \
530 print '$(COMPONENT_TEST_TRANSFORMER) ' \
531 $(COMPONENT_TEST_TRANSFORMS) \
532 ' \\' >> $(COMPONENT_TEST_TRANSFORM_CMD); \
533 print '> $(COMPONENT_TEST_SNAPSHOT)' \
534 >> $(COMPONENT_TEST_TRANSFORM_CMD); \
536 # set the default command for performing any test result munging
537 COMPONENT_TEST_TRANSFORM_CMD = $(COMPONENT_TEST_BUILD_DIR)/transform-$(BITS)-results
539 # set the default operation to run to perform test result normalization
540 COMPONENT_TEST_PERFORM_TRANSFORM = \
541 $(SHELL) $(COMPONENT_TEST_TRANSFORM_CMD); \
543 # set the default command used to compare the master results with the snapshot
544 COMPONENT_TEST_COMPARE_CMD = $(GDIFF) -uNb
546 # set the default way that master and snapshot test results are compared
547 COMPONENT_TEST_COMPARE = \
548 [ -e $(COMPONENT_TEST_MASTER) ] || exit 1; \
549 $(COMPONENT_TEST_COMPARE_CMD) \
550 $(COMPONENT_TEST_MASTER) $(COMPONENT_TEST_SNAPSHOT) \
551 > $(COMPONENT_TEST_DIFFS); \
552 print "Test results in $(COMPONENT_TEST_OUTPUT)"; \
553 if [ -s $(COMPONENT_TEST_DIFFS) ]; \
554 then \
555 print "Differences found."; \
556 $(CAT) $(COMPONENT_TEST_DIFFS); \
557 exit 2; \
558 else \
559 print "No differences found."; \
562 # set the default env command to use for test of the component
563 COMPONENT_TEST_ENV_CMD = $(ENV)
565 # set the default command to use for test of the component
566 COMPONENT_TEST_CMD = $(GMAKE)
568 # set the default target for test of the component
569 COMPONENT_TEST_TARGETS = check
571 # set the default directory for test of the component
572 COMPONENT_TEST_DIR = $(@D)
574 # prepare the testing environment before we run tests
575 COMPONENT_TEST_DEP += component-test-environment-prep
576 # we test built components
577 COMPONENT_TEST_DEP += $(BUILD_DIR)/%/.built
579 # determine the type of tests we want to run.
580 ifeq ($(strip $(wildcard $(COMPONENT_TEST_RESULTS_DIR)/results-*.master)),)
581 TEST_NO_ARCH = $(BUILD_DIR_NO_ARCH)/.tested
582 TEST_32 = $(BUILD_DIR_32)/.tested
583 TEST_64 = $(BUILD_DIR_64)/.tested
584 else
585 TEST_NO_ARCH = $(BUILD_DIR_NO_ARCH)/.tested-and-compared
586 TEST_32 = $(BUILD_DIR_32)/.tested-and-compared
587 TEST_64 = $(BUILD_DIR_64)/.tested-and-compared
588 endif
589 TEST_32_and_64 = $(TEST_32) $(TEST_64)
591 $(BUILD_DIR_NO_ARCH)/.tested-and-compared: BITS=32
592 $(BUILD_DIR_32)/.tested: BITS=32
593 $(BUILD_DIR_64)/.tested: BITS=64
594 $(BUILD_DIR_32)/.tested-and-compared: BITS=32
595 $(BUILD_DIR_64)/.tested-and-compared: BITS=64
597 # BUILD_TOOLS is the root of all tools not normally installed on the system.
598 BUILD_TOOLS ?= /opt
601 # The CCACHE makefile variable should evaluate to empty string or a pathname
602 # like /usr/bin/ccache depending on your PATH value and "which" implementation.
603 # The assignment via ":=" is important, to only do this once in a Makefile,
604 # and not on every reference to the value as "=" assignment would result in.
605 # Review `man ccache` for optional configuration tuning, like cache size etc.
607 # For production builds or suspected errors you can disable this feature by
608 # setting ENABLE_CCACHE=false (as makefile or environment variable, which
609 # is currently the default) to not even define the usage of wrapper in the
610 # userland-building makefile system.
611 # If you want to speed up your re-builds, you must set ENABLE_CCACHE=true.
612 # For legacy reasons, the CCACHE_DISABLE and CCACHE_NODISABLE variables (from
613 # configuration of the "ccache" program itself) are also supported, but direct
614 # use is discouraged, since their syntax and usage are counter-intuitive.
616 # Still, absence of ccache in PATH is not considered a fatal error since the
617 # build would just proceed well with original compiler.
618 # Note: In code below we fast-track if the makefile CCACHE variable is defined
619 # but fall back to shell executability tests if just envvar CCACHE is passed.
621 export CCACHE := $(shell \
622 if test -n "$(CCACHE)" ; then \
623 echo "$(CCACHE)"; \
624 else \
625 if test x"$${CCACHE_DISABLE-}" != x -o x"$(CCACHE_DISABLE)" != x \
626 -o x"$${ENABLE_CCACHE-}" = xfalse -o x"$(ENABLE_CCACHE)" = xfalse \
627 ; then \
628 echo "NOT USING CCACHE FOR OI-USERLAND because explicitly disabled" >&2 ; \
629 else \
630 if test x"$${CCACHE_NODISABLE-}" != x -o x"$(CCACHE_NODISABLE)" != x \
631 -o x"$${ENABLE_CCACHE-}" = xtrue -o x"$(ENABLE_CCACHE)" = xtrue \
632 ; then \
633 for F in \
634 "$$CCACHE" \
635 `which ccache 2>/dev/null | egrep '^/'` \
636 /usr/bin/ccache \
637 ; do if test -n "$$F" && test -x "$$F" ; then \
638 echo "$$F" ; \
639 echo "USING CCACHE FOR OI-USERLAND: $$F" >&2 ; \
640 if test x"$${CCACHE_DISABLE-}" != x ; then \
641 echo "WARNING: envvar CCACHE_DISABLE is set, so effectively ccache will not act!" >&2 ; \
642 fi; \
643 exit 0; \
644 fi; \
645 done; \
646 echo "NOT USING CCACHE FOR OI-USERLAND because not found" >&2 ; \
647 fi; \
648 fi; \
651 GCC_DEFAULT = 13
652 GCC_VERSION ?= $(GCC_DEFAULT)
653 GCC_ROOT = /usr/gcc/$(GCC_VERSION)
655 # If a component asked for non-default gcc version we need to make sure it is
656 # installed
657 USERLAND_REQUIRED_PACKAGES += $(if $(filter-out $(GCC_DEFAULT),$(GCC_VERSION)),developer/gcc-$(GCC_VERSION))
659 # Define runtime package names to be used in dependencies
660 GCC_RUNTIME_PKG = system/library/gcc-$(GCC_VERSION)-runtime
661 GXX_RUNTIME_PKG = system/library/g++-$(GCC_VERSION)-runtime
662 GCCGO_RUNTIME_PKG = system/library/gccgo-$(GCC_VERSION)-runtime
663 GFORTRAN_RUNTIME_PKG = system/library/gfortran-$(GCC_VERSION)-runtime
664 GOBJC_RUNTIME_PKG = system/library/gobjc-$(GCC_VERSION)-runtime
666 CC.gcc.32 = $(GCC_ROOT)/bin/gcc
667 CXX.gcc.32 = $(GCC_ROOT)/bin/g++
668 F77.gcc.32 = $(GCC_ROOT)/bin/gfortran
669 FC.gcc.32 = $(GCC_ROOT)/bin/gfortran
671 CC.gcc.64 = $(GCC_ROOT)/bin/gcc
672 CXX.gcc.64 = $(GCC_ROOT)/bin/g++
673 F77.gcc.64 = $(GCC_ROOT)/bin/gfortran
674 FC.gcc.64 = $(GCC_ROOT)/bin/gfortran
676 # GCC directory macros
677 GCC_FULL_VERSION = $(shell $(GCC_ROOT)/bin/gcc -dumpversion)
678 GCC_GNU_TRIPLET = $(GNU_TRIPLET)
679 GCC_BINDIR = $(GCC_ROOT)/bin
680 GCC_LIBDIR.32 = $(GCC_ROOT)/lib
681 GCC_LIBDIR.64 = $(GCC_ROOT)/lib/$(MACH64)
682 GCC_LIBDIR = $(GCC_LIBDIR.$(BITS))
683 GCC_INCDIR = $(GCC_ROOT)/include
684 GCC_LIBGCCDIR = $(GCC_ROOT)/lib/gcc
685 GCC_INCGXXDIR = $(GCC_ROOT)/include/c++/$(GCC_FULL_VERSION)
686 PATH.prepend += $(GCC_BINDIR)
688 ifneq ($(strip $(CCACHE)),)
690 CCACHE_WRAP_ROOT = $(WS_TOOLS)/ccache-wrap
691 export CC_gcc_32 := $(CC.gcc.32)
692 export CC_gcc_64 := $(CC.gcc.64)
693 export CXX_gcc_32 := $(CXX.gcc.32)
694 export CXX_gcc_64 := $(CXX.gcc.64)
695 CC.gcc.32 := $(CCACHE_WRAP_ROOT)/CC.gcc.32
696 CC.gcc.64 := $(CCACHE_WRAP_ROOT)/CC.gcc.64
697 CXX.gcc.32 := $(CCACHE_WRAP_ROOT)/CXX.gcc.32
698 CXX.gcc.64 := $(CCACHE_WRAP_ROOT)/CXX.gcc.64
700 ifneq ($(strip $(CCACHE_DIR)),)
701 export CCACHE_DIR := $(CCACHE_DIR)
702 endif
704 ifneq ($(strip $(CCACHE_LOGFILE)),)
705 export CCACHE_LOGFILE := $(CCACHE_LOGFILE)
706 endif
708 endif
710 LD = /usr/bin/ld
712 # Clang definitions (we only have 64 bit clang)
713 CLANG_DEFAULT = 18
714 CLANG_VERSION ?= $(CLANG_DEFAULT)
715 CLANG_PREFIX = /usr/clang/$(CLANG_VERSION)
716 CLANG_BINDIR = $(CLANG_PREFIX)/bin
717 CLANG_LIBDIR = $(CLANG_PREFIX)/lib
718 CLANG_DEVELOPER_PKG = developer/clang-$(CLANG_VERSION)
719 CLANG_RUNTIME_PKG = runtime/clang-$(CLANG_VERSION)
720 REQUIRED_PACKAGES_SUBST += CLANG_DEVELOPER_PKG
721 REQUIRED_PACKAGES_SUBST += CLANG_RUNTIME_PKG
722 PATH.prepend += $(CLANG_BINDIR)
724 # If a component asked for non-default clang version we need to make sure it is
725 # installed. The clang component is an exception because its CLANG_VERSION
726 # often does not match the CLANG_DEFAULT and it does not need any clang for
727 # building (clang is built using gcc).
728 USERLAND_REQUIRED_PACKAGES += $(if $(filter-out clang,$(COMPONENT_NAME)), \
729 $(if $(filter-out $(CLANG_DEFAULT),$(CLANG_VERSION)),$(CLANG_DEVELOPER_PKG)))
731 # Python definitions
732 PYTHON.3.9.VENDOR_PACKAGES.64 = /usr/lib/python3.9/vendor-packages
733 PYTHON.3.9.VENDOR_PACKAGES.32 = /usr/lib/python3.9/vendor-packages
734 PYTHON.3.9.VENDOR_PACKAGES = $(PYTHON.3.9.VENDOR_PACKAGES.$(BITS))
736 CC = $(CC.$(COMPILER).$(BITS))
737 CXX = $(CXX.$(COMPILER).$(BITS))
738 F77 = $(F77.$(COMPILER).$(BITS))
739 FC = $(FC.$(COMPILER).$(BITS))
742 # We will start to obsolete major Ruby versions according the following table:
744 # +--------------+----------------+
745 # | Ruby version | Obsolete after |
746 # +--------------+----------------+
747 # | 2.3 | 2019-03-31 |
748 # | 3.2 | 2026-03-31 |
749 # +--------------+----------------+
751 # See https://www.ruby-lang.org/en/downloads/branches/
754 RUBY_VERSION = 3.2
756 RUBY_LIB_VERSION.2.3 = 2.3.0
757 RUBY_LIB_VERSION.3.2 = 3.2.0
759 RUBY.2.3 = /usr/ruby/2.3/bin/ruby
760 RUBY.3.2 = /usr/ruby/3.2/bin/ruby
762 RUBY = $(RUBY.$(RUBY_VERSION))
763 RUBY_LIB_VERSION = $(RUBY_LIB_VERSION.$(RUBY_VERSION))
765 # Transform Ruby scripts to call the supported
766 # version-specific ruby; used in multiple *.mk files
767 RUBY_SCRIPT_FIX_FUNC = \
768 $(GNU_GREP) -Rl '^\#! */usr/bin/env ruby' | \
769 /usr/bin/xargs -I\{\} $(GSED) -i -e \
770 '1s%^\#! */usr/bin/env ruby%\#!/usr/ruby/$(RUBY_VERSION)/bin/ruby%' \
771 \{\}
773 # Use the ruby lib versions to represent the RUBY_VERSIONS that
774 # need to get built. This is done because during package transformations
775 # both the ruby version and the ruby library version are needed.
776 RUBY_VERSIONS = $(RUBY_LIB_VERSION)
778 PYTHON_VENDOR_PACKAGES.32 = $(PYTHON.$(PYTHON_VERSION).VENDOR_PACKAGES.32)
779 PYTHON_VENDOR_PACKAGES.64 = $(PYTHON.$(PYTHON_VERSION).VENDOR_PACKAGES.64)
780 PYTHON_VENDOR_PACKAGES = $(PYTHON_VENDOR_PACKAGES.$(BITS))
782 # python2 was built for both 32- and 64-bits.
783 # python3 is built for 64-bits only.
785 PYTHON.3.9 = /usr/bin/python3.9
786 PYTHON.3.9.64 = $(PYTHON.3.9)
788 PYTHON.64 = $(PYTHON.$(PYTHON_VERSION).64)
789 PYTHON = $(PYTHON.$(PYTHON_VERSION))
791 TOX.3.9 = /usr/bin/tox-3.9
792 TOX = $(TOX.$(PYTHON_VERSION))
794 # The default is site-packages, but that directory belongs to the end-user.
795 # Modules which are shipped by the OS but not with the core Python distribution
796 # belong in vendor-packages.
797 PYTHON_DIR= /usr/lib/python$(PYTHON_VERSION)
798 PYTHON_LIB= $(PYTHON_DIR)/vendor-packages
799 PYTHON_DATA= $(PYTHON_LIB)
801 # If the component has python scripts then the first line should probably
802 # point at the python version currently set by the $(PYTHON) variable so
803 # as not to be influenced by the ips python mediator.
804 # In the component's Makefile define PYTHON_SCRIPTS with a list of files
805 # to be edited.
807 # Edit the leading #!/usr/bin/python line in python scripts to use the
808 # BUILD's $(PYTHON). The source file must be recompiled after that, as
809 # the corresponding .pyc file is outdated now.
810 PYTHON_SCRIPT_SHEBANG_FIX_FUNC = \
811 $(GSED) -i \
812 -e '1s@/usr/bin/python3\{0,1\}$$@$(PYTHON)@' \
813 -e '1s@/usr/bin/python3\{0,1\} @$(PYTHON) @' \
814 -e '1s@/usr/bin/env python3\.[0-9]\{1,\}@$(PYTHON)@' \
815 -e '1s@/usr/bin/env python3\{0,1\}@$(PYTHON)@' \
816 $(PROTO_DIR)/$(1); \
817 $(PYTHON) -m compileall $(PROTO_DIR)/$(1);
819 # PYTHON_SCRIPTS is a list of files from the calling Makefile.
820 PYTHON_SCRIPTS_PROCESS= \
821 $(foreach s,$(PYTHON_SCRIPTS), \
822 $(call PYTHON_SCRIPT_SHEBANG_FIX_FUNC,$(s)))
824 # Finally if PYTHON_SCRIPTS is defined in a Makefile then process them here.
825 # If multiple installs in the component then clear
826 # COMPONENT_POST_INSTALL_ACTION =
827 # and re-add $(PYTHON_SCRIPTS_PROCESS)
828 COMPONENT_POST_INSTALL_ACTION += $(PYTHON_SCRIPTS_PROCESS)
830 JAVA8_HOME = /usr/jdk/openjdk1.8.0
831 JAVA11_HOME = /usr/jdk/openjdk11
832 JAVA17_HOME = /usr/jdk/openjdk17
833 JAVA21_HOME = /usr/jdk/openjdk21
834 JAVA_HOME = $(JAVA17_HOME)
836 # QT macros
837 # We deliver version 5 in 32- and 64-bit variants.
838 QT5_VERSION = 5.15
839 QT5_BASEDIR = $(USRLIBDIR)/qt/$(QT5_VERSION)
840 QT5_BINDIR.32 = $(QT5_BASEDIR)/bin
841 QT5_LIBDIR.32 = $(QT5_BASEDIR)/lib
842 QT5_BINDIR.64 = $(QT5_BASEDIR)/bin/$(MACH64)
843 QT5_LIBDIR.64 = $(QT5_BASEDIR)/lib/$(MACH64)
844 QT5_BINDIR = $(QT5_BINDIR.$(BITS))
845 QT5_LIBDIR = $(QT5_LIBDIR.$(BITS))
846 QT5_INCDIR = $(QT5_BASEDIR)/include
847 QT5_PKG_CONFIG_PATH = $(QT5_LIBDIR)/pkgconfig
849 # We deliver version 6 only in a 64-bit variant.
850 QT6_VERSION = 6.6
851 QT6_BASEDIR = $(USRLIBDIR)/qt/$(QT6_VERSION)
852 QT6_BINDIR = $(QT6_BASEDIR)/bin/$(MACH64)
853 QT6_LIBDIR = $(QT6_BASEDIR)/lib/$(MACH64)
854 QT6_PKG_CONFIG_PATH = $(QT6_LIBDIR)/pkgconfig
857 # Upstream officially supports two recent major Perl versions. They also aim
858 # to provide critical security fixes for major Perl versions whose 5.x.0
859 # release was within the past three years.
861 # We support union of both sets. IOW, we will start to obsolete a major Perl
862 # version if its 5.x.0 was released longer than three years ago AND there are
863 # already released two newer major Perl versions.
865 # See https://perldoc.perl.org/perlpolicy
868 # We will start to obsolete major Perl versions according the following table:
870 # +--------------+----------------+
871 # | Perl version | Obsolete after |
872 # +--------------+----------------+
873 # | 5.36 | 2025-05-28 |
874 # | 5.38 | 2026-07-02 |
875 # | 5.40 | 2027-06-09 |
876 # +--------------+----------------+
878 # See https://www.cpan.org/src/README.html
881 # This is the default version of Perl
882 PERL_VERSION = 5.40
884 # The PERL_VERSIONS list should always be in ascending order (newest version
885 # last)
886 PERL_VERSIONS = 5.36 5.38 5.40
887 # Perl up to 5.22 was built 32-bit only. Starting with 5.24 the perl package
888 # is built 64-bit only. So now all PERL_VERSIONS are 64-bit only.
889 PERL_64_ONLY_VERSIONS = $(PERL_VERSIONS)
891 # List of perl versions we are currently obsoleting. We no longer build any
892 # packages for these perl versions, but there still might be hanging some not
893 # obsoleted yet versioned packages built for PERL_VERSIONS_OBSOLETING perl
894 # versions. Or there is just the versioned runtime/perl package still
895 # available.
897 # This list should be usually empty. Intersection of PERL_VERSIONS_OBSOLETING
898 # and PERL_VERSIONS lists MUST be always empty.
899 PERL_VERSIONS_OBSOLETING =
901 define perl-path-rule
902 PERL.$(1) = /usr/perl5/$(1)/bin/perl
903 POD2MAN.$(1) = /usr/perl5/$(1)/bin/pod2man
904 PERL5BINDIR.$(1) = /usr/perl5/$(1)/bin
905 endef
906 $(foreach perlver,$(PERL_VERSIONS),$(eval $(call perl-path-rule,$(perlver))))
908 PERL5BINDIR = $(PERL5BINDIR.$(PERL_VERSION))
909 PERL = $(PERL.$(PERL_VERSION))
910 POD2MAN = $(POD2MAN.$(PERL_VERSION))
912 PERL_ARCH := $(shell $(PERL) -e 'use Config; print $$Config{archname}')
913 PERL_ARCH_FUNC= $(shell $(1) -e 'use Config; print $$Config{archname}')
914 # Optimally we should ask perl which C compiler was used but it doesn't
915 # result in a full path name. Only "c" is being recorded
916 # inside perl builds while we actually need a full path to
917 # the compiler.
918 #PERL_CC := $(shell $(PERL) -e 'use Config; print $$Config{cc}')
920 PKG_MACROS += PERL_ARCH=$(PERL_ARCH)
921 PKG_MACROS += PERL_VERSION=$(PERL_VERSION)
924 # Upstream supports major PostgreSQL versions for 5 years after its initial
925 # release. After that one last minor version is released and then the major
926 # version is considered EOL.
928 # We will start to obsolete PostgreSQL versions according the following table:
930 # +--------------------+----------------+
931 # | PostgreSQL version | Obsolete after |
932 # +--------------------+----------------+
933 # | 12 | 2024-11-14 |
934 # | 14 | 2026-11-12 |
935 # | 15 | 2027-11-11 |
936 # | 16 | 2028-11-09 |
937 # +--------------------+----------------+
939 # See https://www.postgresql.org/support/versioning/
942 # Config magic for Postgres/EnterpriseDB/...
943 # Default DB version should be the newest one we do have so we detect any
944 # incompatibilities as soon as possible. Components could override this when
945 # they are not ready yet to compile with so new version.
946 PG_VERSION ?= 16
947 PG_IMPLEM ?= postgres
948 PG_VERNUM = $(subst .,,$(PG_VERSION))
949 # For dependencies, including REQUIRED_PACKAGES if needed
950 PG_BASEPKG = database/$(PG_IMPLEM)-$(PG_VERNUM)
951 PG_CLIENT_PKG = $(PG_BASEPKG)/client
952 PG_DEVELOPER_PKG = $(PG_BASEPKG)/developer
953 PG_LIBRARY_PKG = $(PG_BASEPKG)/library
954 PG_SERVICE_PKG = service/$(PG_BASEPKG)
956 REQUIRED_PACKAGES_SUBST+= PG_CLIENT_PKG
957 REQUIRED_PACKAGES_SUBST+= PG_DEVELOPER_PKG
958 REQUIRED_PACKAGES_SUBST+= PG_LIBRARY_PKG
959 REQUIRED_PACKAGES_SUBST+= PG_SERVICE_PKG
961 PG_HOME = $(USRDIR)/$(PG_IMPLEM)/$(PG_VERSION)
962 PG_BINDIR.32 = $(PG_HOME)/bin/$(MACH32)
963 PG_BINDIR.64 = $(PG_HOME)/bin
964 PG_BINDIR = $(PG_BINDIR.$(BITS))
965 PG_INCDIR = $(PG_HOME)/include
966 PG_MANDIR = $(PG_HOME)/man
967 PG_SHAREDIR = $(PG_HOME)/share
968 PG_DOCDIR = $(PG_HOME)/doc
969 PG_LIBDIR.32 = $(PG_HOME)/lib
970 PG_LIBDIR.64 = $(PG_HOME)/lib/$(MACH64)
971 PG_LIBDIR = $(PG_LIBDIR.$(BITS))
972 PG_CONFIG.32 = $(PG_BINDIR.32)/pg_config
973 PG_CONFIG.64 = $(PG_BINDIR.64)/pg_config
974 PG_CONFIG = $(PG_CONFIG.$(BITS))
975 PATH.prepend += $(PG_BINDIR)
977 PKG_MACROS += PG_VERSION=$(PG_VERSION)
978 PKG_MACROS += PG_VERNUM=$(PG_VERNUM)
979 PKG_MACROS += PG_BASEPKG=$(PG_BASEPKG)
982 # Upstream maintains long-term MariaDB releases for at least 5 years and
983 # short-term MariaDB releases for at least one year.
985 # We will start to obsolete MariaDB versions according the following table:
987 # +-----------------+----------------+
988 # | MariaDB version | Obsolete after |
989 # +-----------------+----------------+
990 # | 10.6 | 2026-07 |
991 # +-----------------+----------------+
993 # See https://mariadb.org/about/#maintenance-policy
996 # Config magic for MySQL/MariaDB/Percona/...
997 # Default DB version should be the newest one we do have so we detect any
998 # incompatibilities as soon as possible. Components could override this when
999 # they are not ready yet to compile with so new version.
1000 # NOTE: At this time the gate does not provide a recipe for actual "mysql"
1001 # The "/usr/mysql/*" trees are mediated to preferred MariaDB or Percona variant
1002 MYSQL_VERSION ?= 10.6
1003 MYSQL_IMPLEM ?= mariadb
1004 MYSQL_VERNUM = $(subst .,,$(MYSQL_VERSION))
1005 MYSQL_MINOR = $(word 2,$(subst .,$(space),$(MYSQL_VERSION)))
1006 # Beginning with mariadb 10.6 we only ship 64 bit versions. That changes the paths.
1007 $(if $(shell [ $(MYSQL_MINOR) -ge 6 ] && echo "OK"), \
1008 $(eval MYSQL_64_BIT_ONLY := true), \
1009 $(eval MYSQL_64_BIT_ONLY := false))
1010 # For dependencies, including REQUIRED_PACKAGES if needed
1011 MYSQL_BASEPKG = database/$(MYSQL_IMPLEM)-$(MYSQL_VERNUM)
1012 MYSQL_CLIENT_PKG = $(MYSQL_BASEPKG)/client
1013 MYSQL_DEVELOPER_PKG = $(MYSQL_BASEPKG)/developer
1014 MYSQL_LIBRARY_PKG = $(MYSQL_BASEPKG)/library
1016 REQUIRED_PACKAGES_SUBST+= MYSQL_CLIENT_PKG
1017 REQUIRED_PACKAGES_SUBST+= MYSQL_DEVELOPER_PKG
1018 REQUIRED_PACKAGES_SUBST+= MYSQL_LIBRARY_PKG
1020 MYSQL_HOME = $(USRDIR)/$(MYSQL_IMPLEM)/$(MYSQL_VERSION)
1021 ifeq ($(strip $(MYSQL_64_BIT_ONLY)),false)
1022 MYSQL_BINDIR.32 = $(MYSQL_HOME)/bin
1023 MYSQL_BINDIR.64 = $(MYSQL_HOME)/bin/$(MACH64)
1024 else
1025 MYSQL_BINDIR.64 = $(MYSQL_HOME)/bin
1026 endif
1027 MYSQL_BINDIR = $(MYSQL_BINDIR.$(BITS))
1028 MYSQL_INCDIR = $(MYSQL_HOME)/include
1029 MYSQL_MANDIR = $(MYSQL_HOME)/man
1030 MYSQL_SHAREDIR = $(MYSQL_HOME)/share
1031 MYSQL_DOCDIR = $(MYSQL_HOME)/doc
1032 MYSQL_LIBDIR.32 = $(MYSQL_HOME)/lib
1033 MYSQL_LIBDIR.64 = $(MYSQL_HOME)/lib/$(MACH64)
1034 MYSQL_LIBDIR = $(MYSQL_LIBDIR.$(BITS))
1035 MYSQL_CONFIG.32 = $(MYSQL_BINDIR.32)/mysql_config
1036 MYSQL_CONFIG.64 = $(MYSQL_BINDIR.64)/mysql_config
1037 MYSQL_CONFIG = $(MYSQL_CONFIG.$(BITS))
1038 MYSQL_PKG_CONFIG_PATH = $(MYSQL_LIBDIR)/pkgconfig
1039 PATH.prepend += $(MYSQL_BINDIR)
1040 PKG_CONFIG_PATH.prepend += $(MYSQL_PKG_CONFIG_PATH)
1042 PKG_MACROS += MYSQL_VERSION=$(MYSQL_VERSION)
1043 PKG_MACROS += MYSQL_VERNUM=$(MYSQL_VERNUM)
1044 PKG_MACROS += MYSQL_BASEPKG=$(MYSQL_BASEPKG)
1046 # Default libjpeg implementation layout
1047 JPEG_DEFAULT = 8
1048 JPEG_VERSION ?= $(JPEG_DEFAULT)
1049 JPEG_IMPLEM = libjpeg$(JPEG_VERSION)-turbo
1050 JPEG_HOME = $(if $(filter $(JPEG_DEFAULT),$(JPEG_VERSION)),$(USRDIR),$(USRLIBDIR)/$(JPEG_IMPLEM))
1051 JPEG_INCDIR = $(if $(filter $(JPEG_DEFAULT),$(JPEG_VERSION)),$(USRINCDIR),$(USRINCDIR)/$(JPEG_IMPLEM))
1052 JPEG_LIBDIR.32 = $(JPEG_HOME)/lib
1053 JPEG_LIBDIR.64 = $(JPEG_HOME)/lib/$(MACH64)
1054 JPEG_LIBDIR = $(JPEG_LIBDIR.$(BITS))
1055 JPEG_CPPFLAGS = -I$(JPEG_INCDIR)
1056 JPEG_CFLAGS.32 = -Wl,-L$(JPEG_LIBDIR.32) -Wl,-R$(JPEG_LIBDIR.32)
1057 JPEG_CFLAGS.64 = -Wl,-L$(JPEG_LIBDIR.64) -Wl,-R$(JPEG_LIBDIR.64)
1058 JPEG_CFLAGS = $(JPEG_CFLAGS.$(BITS))
1059 JPEG_CXXFLAGS.32 = -Wl,-L$(JPEG_LIBDIR.32) -Wl,-R$(JPEG_LIBDIR.32)
1060 JPEG_CXXFLAGS.64 = -Wl,-L$(JPEG_LIBDIR.64) -Wl,-R$(JPEG_LIBDIR.64)
1061 JPEG_CXXFLAGS = $(JPEG_CXXFLAGS.$(BITS))
1062 JPEG_LDFLAGS.32 = -L$(JPEG_LIBDIR.32) -R$(JPEG_LIBDIR.32)
1063 JPEG_LDFLAGS.64 = -L$(JPEG_LIBDIR.64) -R$(JPEG_LIBDIR.64)
1064 JPEG_LDFLAGS = $(JPEG_LDFLAGS.$(BITS))
1066 PKG_CONFIG_PATH.prepend += $(if $(filter $(JPEG_DEFAULT),$(JPEG_VERSION)),,$(JPEG_LIBDIR)/pkgconfig)
1068 JPEG_IMPLEM_PKG = image/library/$(JPEG_IMPLEM)
1069 REQUIRED_PACKAGES_SUBST += JPEG_IMPLEM_PKG
1071 # This is the default BUILD version of tcl
1072 # Not necessarily the system's default version, i.e. /usr/bin/tclsh
1073 TCL_VERSION = 8.6
1074 TCLSH.8.6.i386.32 = /usr/bin/i86/tclsh8.6
1075 TCLSH.8.6.i386.64 = /usr/bin/amd64/tclsh8.6
1076 TCLSH.8.6.sparc.32 = /usr/bin/sparcv7/tclsh8.6
1077 TCLSH.8.6.sparc.64 = /usr/bin/sparcv9/tclsh8.6
1078 TCLSH = $(TCLSH.$(TCL_VERSION).$(MACH).$(BITS))
1080 # ICU library
1081 ICU_VERSION = 76
1082 ICU_LIBRARY_PKG = library/icu-$(ICU_VERSION)
1083 REQUIRED_PACKAGES_SUBST += ICU_LIBRARY_PKG
1085 # GNU readline
1086 READLINE_VERSION = 8
1087 READLINE_PKG = library/readline-$(READLINE_VERSION)
1088 REQUIRED_PACKAGES_SUBST += READLINE_PKG
1091 CCSMAKE = /usr/ccs/bin/make
1092 GMAKE = /usr/gnu/bin/make
1093 GPATCH = /usr/gnu/bin/patch
1094 PATCH_LEVEL = 1
1095 GPATCH_BACKUP = --backup --version-control=numbered
1096 GPATCH_FLAGS = -p$(PATCH_LEVEL) $(GPATCH_BACKUP)
1097 GSED = /usr/gnu/bin/sed
1098 GDIFF = /usr/gnu/bin/diff
1099 GSORT = /usr/gnu/bin/sort
1100 GUNZIP = /usr/bin/gunzip
1102 SORT = LC_ALL=C /usr/bin/sort
1104 PKGREPO = /usr/bin/pkgrepo
1105 PKGSEND = /usr/bin/pkgsend
1106 ifeq ($(strip $(PKGLINT_COMPONENT)),)
1107 PKGLINT = /usr/bin/python /usr/bin/pkglint
1108 else
1109 PKGLINT = ${WS_TOOLS}/pkglint
1110 endif
1112 ACLOCAL = /usr/bin/aclocal-1.16
1113 AUTOMAKE = /usr/bin/automake-1.16
1114 AUTORECONF = /usr/bin/autoreconf
1116 KSH93 = /usr/bin/ksh93
1117 TOUCH = /usr/bin/touch
1118 MKDIR = /bin/mkdir -p
1119 RM = /bin/rm -f
1120 CP = /bin/cp -f
1121 MV = /bin/mv -f
1122 LN = /bin/ln
1123 CAT = /bin/cat
1124 SYMLINK = /bin/ln -s
1125 ENV = /usr/bin/env -i
1126 FIND = /usr/bin/find
1127 INSTALL = /usr/bin/ginstall
1128 GNU_GREP = /usr/gnu/bin/grep
1129 CHMOD = /usr/bin/chmod
1130 NAWK = /usr/bin/nawk
1131 TEE = /usr/bin/tee
1132 GAS = /usr/gnu/bin/as
1133 GTAR = /usr/gnu/bin/tar
1134 STRIP = /usr/bin/strip
1135 IPS2TGZ = $(WS_TOOLS)/ips2tgz
1136 JQ = /usr/bin/jq
1137 DOS2UNIX = /usr/bin/dos2unix
1138 TAC = /usr/bin/tac
1139 QUILT = /usr/bin/quilt
1140 CTFCONVERT = /opt/onbld/bin/$(MACH)/ctfconvert
1141 ELFEDIT = /usr/bin/elfedit
1143 INS.dir= $(INSTALL) -d $@
1144 INS.file= $(INSTALL) -m 444 $< $(@D)
1146 # OpenSSL macros
1147 OPENSSL_DEFAULT = 3
1148 ifeq ($(strip $(USE_OPENSSL11)),yes)
1149 OPENSSL_VERSION = 1.1
1150 else
1151 ifeq ($(strip $(USE_OPENSSL10)),yes)
1152 OPENSSL_VERSION = 1.0
1153 else
1154 OPENSSL_VERSION ?= $(OPENSSL_DEFAULT)
1155 endif
1156 endif
1157 PATH.prepend+=$(OPENSSL_BINDIR)
1158 OPENSSL_PREFIX= $(USRDIR)/openssl/$(OPENSSL_VERSION)
1159 OPENSSL_BINDIR.64= $(OPENSSL_PREFIX)/bin
1160 OPENSSL_BINDIR.32= $(OPENSSL_PREFIX)/bin/$(MACH32)
1161 OPENSSL_BINDIR= $(OPENSSL_BINDIR.$(BITS))
1162 OPENSSL_LIBDIR.64= $(OPENSSL_PREFIX)/lib/$(MACH64)
1163 OPENSSL_LIBDIR.32= $(OPENSSL_PREFIX)/lib
1164 OPENSSL_LIBDIR= $(OPENSSL_LIBDIR.$(BITS))
1165 OPENSSL_PKG_CONFIG_PATH.32= $(OPENSSL_PREFIX)/lib/pkgconfig
1166 OPENSSL_PKG_CONFIG_PATH.64= $(OPENSSL_PREFIX)/lib/$(MACH64)/pkgconfig
1167 OPENSSL_PKG_CONFIG_PATH= $(OPENSSL_PKG_CONFIG_PATH.$(BITS))
1168 OPENSSL_INCDIR=$(OPENSSL_PREFIX)/include
1169 OPENSSL_ETCDIR=$(ETCDIR)/openssl/$(OPENSSL_VERSION)
1171 PKG_CONFIG_PATH.prepend += $(OPENSSL_PKG_CONFIG_PATH)
1173 # The OpenSSL 1.0 package is without the version suffix so it needs special handling
1174 OPENSSL_PKG = library/security/openssl$(subst -10,,-$(subst .,,$(OPENSSL_VERSION)))
1175 REQUIRED_PACKAGES_SUBST += OPENSSL_PKG
1177 # Pkg-config paths
1178 PKG_CONFIG_PATH.32 = /usr/lib/pkgconfig
1179 PKG_CONFIG_PATH.64 = /usr/lib/$(MACH64)/pkgconfig
1180 PKG_CONFIG_PATH = $(subst $(space),:,$(strip $(PKG_CONFIG_PATH.prepend))):$(PKG_CONFIG_PATH.$(BITS)):$(PKG_CONFIG_PATH.32)
1182 # Set default path for environment modules
1183 MODULE_VERSION = 3.2.10
1184 MODULE_PATH = /usr/share/Modules/modulefiles
1185 MODULE_VERSIONS_PATH = /usr/share/Modules/versions
1187 # Path to bash completions
1188 BASH_COMPLETIONS_PATH = /usr/share/bash-completion/completions
1191 # C preprocessor flag sets to ease feature selection. Add the required
1192 # feature to your Makefile with CPPFLAGS += $(FEATURE_MACRO) and add to
1193 # the component build with CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)" or
1194 # similiar.
1197 # Enables visibility of some c99 math functions that aren't visible by default.
1198 # What other side-effects are there?
1199 CPP_C99_EXTENDED_MATH = -D_STDC_99
1201 # Enables large file support for components that have no other means of doing
1202 # so. Use CPP_LARGEFILES and not the .32/.64 variety directly
1203 CPP_LARGEFILES.32 := $(shell getconf LFS_CFLAGS)
1204 CPP_LARGEFILES.64 := $(shell getconf LFS64_CFLAGS)
1205 CPP_LARGEFILES = $(CPP_LARGEFILES.$(BITS))
1207 # Enables some #pragma redefine_extname to POSIX-compliant Standard C Library
1208 # functions. Also avoids the component's #define _POSIX_C_SOURCE to some value
1209 # we currently do not support.
1210 CPP_POSIX = -D_POSIX_C_SOURCE=200112L -D_POSIX_PTHREAD_SEMANTICS
1212 # XPG8 mode. This option enables XPG8 conformance, plus extensions.
1213 CPP_XPG8MODE= -D_XOPEN_SOURCE=800 -D__EXTENSIONS__=1 -D_XPG8
1215 # XPG7 mode. This option enables XPG7 conformance, plus extensions.
1216 CPP_XPG7MODE= -D_XOPEN_SOURCE=700 -D__EXTENSIONS__=1 -D_XPG7
1218 # XPG6 mode. This option enables XPG6 conformance, plus extensions.
1219 # Amongst other things, this option will cause system calls like
1220 # popen (3C) and system (3C) to invoke the standards-conforming
1221 # shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh. Add CPP_XPG6MODE to
1222 # CFLAGS instead of using this directly
1223 CPP_XPG6MODE= -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 -D_XPG6
1225 # XPG5 mode. These options are specific for C++, where _XPG6,
1226 # _XOPEN_SOURCE=600 and C99 are illegal. -D__EXTENSIONS__=1 is legal in C++.
1227 CPP_XPG5MODE= -D_XOPEN_SOURCE=500 -D__EXTENSIONS__=1 -D_XPG5
1229 # Generate 32/64 bit objects
1230 CC_BITS = -m$(BITS)
1232 # Turn on C99 for gcc
1233 gcc_C99_ENABLE = -std=c99
1235 # Turn on C23 for gcc
1237 # Please note that gcc up to version 14 does not fully support C23 and so
1238 # __STDC_VERSION__ does not expand to 202311L there, but to 202000L instead.
1239 # This is not sufficient for turning on C23 in our headers and so we need to
1240 # define _STDC_C23 as well. See /usr/include/sys/feature_tests.h for details.
1242 # Although the -std=c2x option is deprecated (since gcc 14) and -std=c23 should
1243 # be used instead, it is not available for gcc 13 and older and so we opted to
1244 # use -std=c2x for compatibility.
1245 gcc_C23_ENABLE = -std=c2x -D_STDC_C23
1247 # Control register usage for generated code. SPARC ABI requires system
1248 # libraries not to use application registers.
1249 gcc_XREGS.sparc = -mno-app-regs
1250 gcc_XREGS.i386 =
1251 gcc_XREGS = $(gcc_XREGS.$(MACH))
1253 # See CPP_XPG8MODE comment above.
1254 XPG8MODE = $(CPP_XPG8MODE)
1256 # See CPP_XPG7MODE comment above.
1257 XPG7MODE = $(CPP_XPG7MODE)
1259 # See CPP_XPG6MODE comment above.
1260 XPG6MODE = $(CPP_XPG6MODE)
1262 # See CPP_XPG5MODE comment above. You can only use this in C++, not in C99.
1263 XPG5MODE = $(CPP_XPG5MODE)
1266 # GNU C compiler flag sets to ease feature selection. Add the required
1267 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
1268 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
1271 # Control the GCC optimization level.
1272 gcc_OPT.sparc.32 = -O3 -mcpu=ultrasparc -mvis -mfsmuld
1273 gcc_OPT.sparc.64 = -O3 -mcpu=ultrasparc -mvis -mfsmuld
1274 gcc_OPT.i386.32 = -O3
1275 gcc_OPT.i386.64 = -O3
1276 gcc_OPT = $(gcc_OPT.$(MACH).$(BITS))
1278 # GCC PIC code generation. Use CC_PIC instead to select PIC code generation.
1279 gcc_PIC = -fPIC -DPIC
1281 # Generic macro for PIC code generation. Use this macro instead of the
1282 # compiler specific variant.
1283 CC_PIC = $($(COMPILER)_PIC)
1286 # Default GNU C compiler flags. Add the required feature to your Makefile
1287 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
1288 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar. In most cases, it
1289 # should not be necessary to add CFLAGS to any environment other than the
1290 # configure environment.
1291 CFLAGS.gcc += $(gcc_OPT)
1292 CFLAGS.gcc += $(gcc_XREGS)
1294 # Default GNU C++ compiler flags. Add the required feature to your Makefile
1295 # with CXXFLAGS += $(FEATURE_MACRO) and add to the component build with
1296 # CONFIGURE_OPTIONS += CXXFLAGS="$(CXXFLAGS)" or similiar. In most cases, it
1297 # should not be necessary to add CXXFLAGS to any environment other than the
1298 # configure environment.
1299 CXXFLAGS.gcc += $(gcc_OPT)
1300 CXXFLAGS.gcc += $(gcc_XREGS)
1302 # Default GNU FORTRAN compiler flags. Add the required feature to your Makefile
1303 # with FCFLAGS += $(FEATURE_MACRO) and add to the component build with
1304 # CONFIGURE_OPTIONS += FCFLAGS="$(FCFLAGS)" or similiar. In most cases, it
1305 # should not be necessary to add FCFLAGS to any environment other than the
1306 # configure environment.
1307 FCFLAGS.gcc += $(gcc_OPT)
1308 FCFLAGS.gcc += $(gcc_XREGS)
1310 # Build 32 or 64 bit objects.
1311 CFLAGS += $(CC_BITS)
1313 # Add compiler specific 'default' features
1314 CFLAGS += $(CFLAGS.$(COMPILER))
1316 # Per-compiler CFLAGS to use when building for CTF. Currently only defined
1317 # for gcc; could be made to work with other compilers.
1319 # -gdwarf-4 is the newest DWARF revision understood by illumos libctf
1321 # -gstrict-dwarf prevents the compiler from including newer DWARF features
1322 CTF_CFLAGS.gcc = -g -gdwarf-4 -gstrict-dwarf
1323 # -msave-args makes it possible for debugging tools (specifically pstack and
1324 # mdb) to retrieve function arguments, and is required for the python pstack
1325 # hooks.
1326 CTF_CFLAGS.gcc += -msave-args
1327 # By default, GCC may put parts of functions in different named sub-sections
1328 # of .text based on their presumed or measured calling frequency. This is not
1329 # currently handled by libctf and other illumos tools which assume that a
1330 # function's text lies in a single contiguous range of virtual addresses.
1331 # Disable this optimization if building with CTF.
1332 CTF_CFLAGS.gcc += -fno-reorder-functions -fno-reorder-blocks-and-partition
1334 # Enable CTF if desired
1335 ifeq ($(strip $(USE_CTF)),yes)
1336 CFLAGS += $(if $(CTF_CFLAGS.$(COMPILER)), \
1337 $(CTF_CFLAGS.$(COMPILER)), \
1338 $(error Error: CTF_CFLAGS.$(COMPILER) must be defined to use CTF with $(COMPILER)))
1339 endif
1341 # Build 32 or 64 bit objects in C++ as well.
1342 CXXFLAGS += $(CC_BITS)
1344 # Add compiler specific 'default' features
1345 CXXFLAGS += $(CXXFLAGS.$(COMPILER))
1347 # Build 32 or 64 bit objects in FORTRAN as well.
1348 F77FLAGS += $(CC_BITS)
1349 FCFLAGS += $(CC_BITS)
1351 # Add compiler specific 'default' features
1352 F77FLAGS += $(FCFLAGS.$(COMPILER))
1353 FCFLAGS += $(FCFLAGS.$(COMPILER))
1356 # Solaris linker flag sets to ease feature selection. Add the required
1357 # feature to your Makefile with LDFLAGS += $(FEATURE_MACRO) and add to the
1358 # component build with CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)" or similiar.
1361 # set the bittedness that we want to link
1362 ccs.ld.64 = -64
1363 gcc.ld.32 = -m32
1364 gcc.ld.64 = -m64
1365 LD_BITS = $($(LINKER).ld.$(BITS))
1366 LDFLAGS = $(LD_BITS)
1368 # Reduce the symbol table size, effectively conflicting with -g. We should
1369 # get linker guidance here.
1370 LD_Z_REDLOCSYM = -z redlocsym
1372 # Cause the linker to rescan archive libraries and resolve remaining unresolved
1373 # symbols recursively until all symbols are resolved. Components should be
1374 # linking in the libraries they need, in the required order. This should
1375 # only be required if the component's native build is horribly broken.
1376 LD_Z_RESCAN_NOW = -z rescan-now
1378 LD_Z_TEXT = -z direct
1380 # make sure that -lc is always present when building shared objects.
1381 LD_DEF_LIBS += -lc
1383 # make sure all symbols are defined.
1384 LD_Z_DEFS = -z defs
1386 # eliminate unreferenced dynamic dependencies
1387 LD_Z_IGNORE = -z ignore
1389 # use direct binding
1390 LD_B_DIRECT = -Bdirect
1392 # use generic macro names for enabling/disabling ASLR
1393 ASLR_ENABLE = -z aslr=enable
1394 ASLR_DISABLE = -z aslr=disable
1395 ASLR_MODE = $(ASLR_DISABLE)
1397 # by default, turn off Address Space Layout Randomization for ELF executables;
1398 # to explicitly enable ASLR, set ASLR_MODE = $(ASLR_ENABLE)
1399 # in that component's Makefile
1400 LD_Z_ASLR = $(ASLR_MODE)
1402 # Define SSP library link flag for 32-bit objects
1403 LD_SSP.32 = -lssp_ns
1404 LD_SSP.64 =
1405 LD_SSP = $(LD_SSP.$(BITS))
1408 # More Solaris linker flags that we want to be sure that everyone gets. This
1409 # is automatically added to the calling environment during the 'build' and
1410 # 'install' phases of the component build. Each individual feature can be
1411 # turned off by adding FEATURE_MACRO= to the component Makefile.
1414 # Create a non-executable stack when linking.
1415 LD_MAP_NOEXSTK.i386 = -M /usr/lib/ld/map.noexstk
1416 LD_MAP_NOEXSTK.sparc = -M /usr/lib/ld/map.noexstk
1418 # Create a non-executable bss segment when linking.
1419 LD_MAP_NOEXBSS = -M /usr/lib/ld/map.noexbss
1421 # Create a non-executable data segment when linking. Due to PLT needs, the
1422 # data segment must be executable on sparc, but the bss does not.
1423 # see mapfile comments for more information
1424 LD_MAP_NOEXDATA.i386 = -M /usr/lib/ld/map.noexdata
1425 LD_MAP_NOEXDATA.sparc = $(LD_MAP_NOEXBSS)
1427 # Page alignment
1428 LD_MAP_PAGEALIGN = -M /usr/lib/ld/map.pagealign
1430 # Linker options to add when only building libraries
1431 LD_OPTIONS_SO += $(LD_Z_TEXT) $(LD_Z_DEFS) $(LD_DEF_LIBS)
1433 # Default linker options that everyone should get. Do not add additional
1434 # libraries to this macro, as it will apply to everything linked during the
1435 # component build.
1436 LD_OPTIONS += $(LD_MAP_NOEXSTK.$(MACH)) $(LD_MAP_NOEXDATA.$(MACH)) \
1437 $(LD_MAP_PAGEALIGN) $(LD_B_DIRECT) $(LD_Z_IGNORE)
1439 # only used on executables
1440 LD_EXEC_OPTIONS = $(LD_Z_ASLR)
1442 # Environment variables and arguments passed into the build and install
1443 # environment(s). These are the initial settings.
1444 COMPONENT_BUILD_ENV= \
1445 LD_OPTIONS="$(LD_OPTIONS)" \
1446 LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1447 COMPONENT_INSTALL_ENV= \
1448 LD_OPTIONS="$(LD_OPTIONS)" \
1449 LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1451 # PATH should be always set
1452 COMPONENT_BUILD_ENV += PATH="$(PATH)"
1453 COMPONENT_INSTALL_ENV += PATH="$(PATH)"
1454 COMPONENT_TEST_ENV += PATH="$(PATH)"
1456 # PERL options which depend on C options should be placed here
1457 PERL_OPTIMIZE := $(shell $(PERL) -e 'use Config; print $$Config{optimize}')
1459 # Rewrite absolute source-code paths into relative for ccache, so that any
1460 # workspace with a shared CCACHE_DIR can benefit when compiling a component
1461 ifneq ($(strip $(CCACHE)),)
1462 export CCACHE_BASEDIR = $(BUILD_DIR_$(BITS))
1463 COMPONENT_BUILD_ENV += CCACHE="$(CCACHE)"
1464 COMPONENT_INSTALL_ENV += CCACHE="$(CCACHE)"
1465 COMPONENT_TEST_ENV += CCACHE="$(CCACHE)"
1466 COMPONENT_BUILD_ENV += CC_gcc_32="$(CC_gcc_32)"
1467 COMPONENT_BUILD_ENV += CC_gcc_64="$(CC_gcc_64)"
1468 COMPONENT_BUILD_ENV += CXX_gcc_32="$(CXX_gcc_32)"
1469 COMPONENT_BUILD_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1470 COMPONENT_INSTALL_ENV += CC_gcc_32="$(CC_gcc_32)"
1471 COMPONENT_INSTALL_ENV += CC_gcc_64="$(CC_gcc_64)"
1472 COMPONENT_INSTALL_ENV += CXX_gcc_32="$(CXX_gcc_32)"
1473 COMPONENT_INSTALL_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1474 COMPONENT_TEST_ENV += CC_gcc_32="$(CC_gcc_32)"
1475 COMPONENT_TEST_ENV += CC_gcc_64="$(CC_gcc_64)"
1476 COMPONENT_TEST_ENV += CXX_gcc_32="$(CXX_gcc_32)"
1477 COMPONENT_TEST_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1478 COMPONENT_BUILD_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1479 COMPONENT_INSTALL_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1480 COMPONENT_TEST_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1482 ifneq ($(strip $(CCACHE_DIR)),)
1483 COMPONENT_BUILD_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1484 COMPONENT_INSTALL_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1485 COMPONENT_TEST_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1486 endif
1488 ifneq ($(strip $(CCACHE_LOGFILE)),)
1489 COMPONENT_BUILD_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1490 COMPONENT_INSTALL_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1491 COMPONENT_TEST_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1492 endif
1494 endif
1496 # Add any bit-specific settings
1497 COMPONENT_BUILD_ENV += $(COMPONENT_BUILD_ENV.$(BITS))
1498 COMPONENT_BUILD_ARGS += $(COMPONENT_BUILD_ARGS.$(BITS))
1499 COMPONENT_INSTALL_ENV += $(COMPONENT_INSTALL_ENV.$(BITS))
1500 COMPONENT_INSTALL_ARGS += $(COMPONENT_INSTALL_ARGS.$(BITS))
1502 # declare these phony so that we avoid filesystem conflicts.
1503 .PHONY: prep build install publish test clean clobber
1505 # If there are no tests to execute
1506 NO_TESTS = test-nothing
1507 test-nothing:
1508 @echo "There are no tests available at this time."
1510 # default behaviour for 'component-hook' target is to echo the component
1511 # name and version information, but more complex behaviour can be implemented
1512 # via command line setting of the COMPONENT_HOOK macro.
1513 COMPONENT_HOOK ?= echo $(COMPONENT_NAME) $(COMPONENT_VERSION)
1515 component-hook:
1516 @$(COMPONENT_HOOK)
1518 # We need shell/ksh93 to be able to run scripts in the tools directory
1519 USERLAND_REQUIRED_PACKAGES += shell/ksh93
1522 # Packages with tools that are required to build Userland components
1524 USERLAND_REQUIRED_PACKAGES += metapackages/build-essential
1526 # Define substitution rules for some packages.
1527 # Such package names may change and would be better defined with a macro to
1528 # avoid mass modification of the Makefiles.
1530 # Runtime package names are changed at compiler version major bumps.
1531 REQUIRED_PACKAGES_SUBST+= GCC_RUNTIME_PKG
1532 REQUIRED_PACKAGES_SUBST+= GXX_RUNTIME_PKG
1533 REQUIRED_PACKAGES_SUBST+= GCCGO_RUNTIME_PKG
1534 REQUIRED_PACKAGES_SUBST+= GFORTRAN_RUNTIME_PKG
1535 REQUIRED_PACKAGES_SUBST+= GOBJC_RUNTIME_PKG
1537 # Generate requirements on all built python version variants for given packages
1538 USERLAND_REQUIRED_PACKAGES += $(foreach ver,$(PYTHON_VERSIONS),$(USERLAND_REQUIRED_PACKAGES.python:%=%-$(subst .,,$(ver))))
1539 REQUIRED_PACKAGES += $(foreach ver,$(PYTHON_VERSIONS),$(PYTHON_REQUIRED_PACKAGES:%=%-$(subst .,,$(ver))))
1540 TEST_REQUIRED_PACKAGES += $(foreach ver,$(PYTHON_VERSIONS),$(TEST_REQUIRED_PACKAGES.python:%=%-$(subst .,,$(ver))))
1542 # Generate requirements on all built perl version variants for given packages
1543 USERLAND_REQUIRED_PACKAGES += $(foreach ver,$(PERL_VERSIONS),$(USERLAND_REQUIRED_PACKAGES.perl:%=%-$(subst .,,$(ver))))
1544 REQUIRED_PACKAGES += $(foreach ver,$(PERL_VERSIONS),$(PERL_REQUIRED_PACKAGES:%=%-$(subst .,,$(ver))))
1545 TEST_REQUIRED_PACKAGES += $(foreach ver,$(PERL_VERSIONS),$(TEST_REQUIRED_PACKAGES.perl:%=%-$(subst .,,$(ver))))
1547 # Generate conflicting packages for all built python version variants for given package
1548 TEST_CONFLICTING_PACKAGES += $(foreach ver,$(PYTHON_VERSIONS),$(TEST_CONFLICTING_PACKAGES.python:%=%-$(subst .,,$(ver))))
1550 # This is useful for symlinks creation in the post-install step
1551 define create-symlinks
1552 for f in $(1:%=$(PROTO_DIR)/%) ; do \
1553 [ -e "$$f" ] || continue ; \
1554 t=$(PROTO_DIR)/$(2) ; \
1555 while true ; do \
1556 while [ "$${f#/}" != "$$f" ] ; do f=$${f#/} ; done ; \
1557 while [ "$${t#/}" != "$$t" ] ; do t=$${t#/} ; done ; \
1558 [ "$${f%%/*}" == "$${t%%/*}" ] || break ; \
1559 f=$${f#$${f%%/*}} ; \
1560 t=$${t#$${t%%/*}} ; \
1561 done ; \
1562 [ "$$t" ] && t=$$t/ ; \
1563 f=$$(echo $$t | $(GSED) -e 's|[^/]\{1,\}|..|g')$$f ; \
1564 $(MKDIR) $(PROTO_DIR)/$(2) ; \
1565 $(SYMLINK) $$f $(PROTO_DIR)/$(2)/$$(basename $$f) ; \
1566 done
1567 endef
1569 # Targets for some tools rarely used by the build framework. We do not add
1570 # these tools to USERLAND_REQUIRED_PACKAGES to do not pollute it.
1571 $(QUILT):
1572 @echo
1573 @echo "$(QUILT) is missing"
1574 @echo "Please install developer/quilt package"
1575 @echo
1576 @exit 1
1578 include $(WS_MAKE_RULES)/environment.mk
1579 include $(WS_MAKE_RULES)/depend.mk
1580 include $(WS_MAKE_RULES)/component.mk