libppd: update to 2.1.0
[oi-userland.git] / make-rules / shared-macros.mk
blob51d007088d50c302bdac2b39adf562ddf9513d2d
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
726 USERLAND_REQUIRED_PACKAGES += $(if $(filter-out $(CLANG_DEFAULT),$(CLANG_VERSION)),$(CLANG_DEVELOPER_PKG))
728 # Python definitions
729 PYTHON.3.9.VENDOR_PACKAGES.64 = /usr/lib/python3.9/vendor-packages
730 PYTHON.3.9.VENDOR_PACKAGES.32 = /usr/lib/python3.9/vendor-packages
731 PYTHON.3.9.VENDOR_PACKAGES = $(PYTHON.3.9.VENDOR_PACKAGES.$(BITS))
733 CC = $(CC.$(COMPILER).$(BITS))
734 CXX = $(CXX.$(COMPILER).$(BITS))
735 F77 = $(F77.$(COMPILER).$(BITS))
736 FC = $(FC.$(COMPILER).$(BITS))
739 # We will start to obsolete major Ruby versions according the following table:
741 # +--------------+----------------+
742 # | Ruby version | Obsolete after |
743 # +--------------+----------------+
744 # | 2.3 | 2019-03-31 |
745 # | 3.2 | 2026-03-31 |
746 # +--------------+----------------+
748 # See https://www.ruby-lang.org/en/downloads/branches/
751 RUBY_VERSION = 3.2
753 RUBY_LIB_VERSION.2.3 = 2.3.0
754 RUBY_LIB_VERSION.3.2 = 3.2.0
756 RUBY.2.3 = /usr/ruby/2.3/bin/ruby
757 RUBY.3.2 = /usr/ruby/3.2/bin/ruby
759 RUBY = $(RUBY.$(RUBY_VERSION))
760 RUBY_LIB_VERSION = $(RUBY_LIB_VERSION.$(RUBY_VERSION))
762 # Transform Ruby scripts to call the supported
763 # version-specific ruby; used in multiple *.mk files
764 RUBY_SCRIPT_FIX_FUNC = \
765 $(GNU_GREP) -Rl '^\#! */usr/bin/env ruby' | \
766 /usr/bin/xargs -I\{\} $(GSED) -i -e \
767 '1s%^\#! */usr/bin/env ruby%\#!/usr/ruby/$(RUBY_VERSION)/bin/ruby%' \
768 \{\}
770 # Use the ruby lib versions to represent the RUBY_VERSIONS that
771 # need to get built. This is done because during package transformations
772 # both the ruby version and the ruby library version are needed.
773 RUBY_VERSIONS = $(RUBY_LIB_VERSION)
775 PYTHON_VENDOR_PACKAGES.32 = $(PYTHON.$(PYTHON_VERSION).VENDOR_PACKAGES.32)
776 PYTHON_VENDOR_PACKAGES.64 = $(PYTHON.$(PYTHON_VERSION).VENDOR_PACKAGES.64)
777 PYTHON_VENDOR_PACKAGES = $(PYTHON_VENDOR_PACKAGES.$(BITS))
779 # python2 was built for both 32- and 64-bits.
780 # python3 is built for 64-bits only.
782 PYTHON.3.9 = /usr/bin/python3.9
783 PYTHON.3.9.64 = $(PYTHON.3.9)
785 PYTHON.64 = $(PYTHON.$(PYTHON_VERSION).64)
786 PYTHON = $(PYTHON.$(PYTHON_VERSION))
788 TOX.3.9 = /usr/bin/tox-3.9
789 TOX = $(TOX.$(PYTHON_VERSION))
791 # The default is site-packages, but that directory belongs to the end-user.
792 # Modules which are shipped by the OS but not with the core Python distribution
793 # belong in vendor-packages.
794 PYTHON_DIR= /usr/lib/python$(PYTHON_VERSION)
795 PYTHON_LIB= $(PYTHON_DIR)/vendor-packages
796 PYTHON_DATA= $(PYTHON_LIB)
798 # If the component has python scripts then the first line should probably
799 # point at the python version currently set by the $(PYTHON) variable so
800 # as not to be influenced by the ips python mediator.
801 # In the component's Makefile define PYTHON_SCRIPTS with a list of files
802 # to be edited.
804 # Edit the leading #!/usr/bin/python line in python scripts to use the
805 # BUILD's $(PYTHON). The source file must be recompiled after that, as
806 # the corresponding .pyc file is outdated now.
807 PYTHON_SCRIPT_SHEBANG_FIX_FUNC = \
808 $(GSED) -i \
809 -e '1s@/usr/bin/python3\{0,1\}$$@$(PYTHON)@' \
810 -e '1s@/usr/bin/python3\{0,1\} @$(PYTHON) @' \
811 -e '1s@/usr/bin/env python3\.[0-9]\{1,\}@$(PYTHON)@' \
812 -e '1s@/usr/bin/env python3\{0,1\}@$(PYTHON)@' \
813 $(PROTO_DIR)/$(1); \
814 $(PYTHON) -m compileall $(PROTO_DIR)/$(1);
816 # PYTHON_SCRIPTS is a list of files from the calling Makefile.
817 PYTHON_SCRIPTS_PROCESS= \
818 $(foreach s,$(PYTHON_SCRIPTS), \
819 $(call PYTHON_SCRIPT_SHEBANG_FIX_FUNC,$(s)))
821 # Finally if PYTHON_SCRIPTS is defined in a Makefile then process them here.
822 # If multiple installs in the component then clear
823 # COMPONENT_POST_INSTALL_ACTION =
824 # and re-add $(PYTHON_SCRIPTS_PROCESS)
825 COMPONENT_POST_INSTALL_ACTION += $(PYTHON_SCRIPTS_PROCESS)
827 JAVA8_HOME = /usr/jdk/openjdk1.8.0
828 JAVA11_HOME = /usr/jdk/openjdk11
829 JAVA17_HOME = /usr/jdk/openjdk17
830 JAVA21_HOME = /usr/jdk/openjdk21
831 JAVA_HOME = $(JAVA17_HOME)
833 # QT macros
834 # We deliver version 5 in 32- and 64-bit variants.
835 QT5_VERSION = 5.15
836 QT5_BASEDIR = $(USRLIBDIR)/qt/$(QT5_VERSION)
837 QT5_BINDIR.32 = $(QT5_BASEDIR)/bin
838 QT5_LIBDIR.32 = $(QT5_BASEDIR)/lib
839 QT5_BINDIR.64 = $(QT5_BASEDIR)/bin/$(MACH64)
840 QT5_LIBDIR.64 = $(QT5_BASEDIR)/lib/$(MACH64)
841 QT5_BINDIR = $(QT5_BINDIR.$(BITS))
842 QT5_LIBDIR = $(QT5_LIBDIR.$(BITS))
843 QT5_INCDIR = $(QT5_BASEDIR)/include
844 QT5_PKG_CONFIG_PATH = $(QT5_LIBDIR)/pkgconfig
846 # We deliver version 6 only in a 64-bit variant.
847 QT6_VERSION = 6.6
848 QT6_BASEDIR = $(USRLIBDIR)/qt/$(QT6_VERSION)
849 QT6_BINDIR = $(QT6_BASEDIR)/bin/$(MACH64)
850 QT6_LIBDIR = $(QT6_BASEDIR)/lib/$(MACH64)
851 QT6_PKG_CONFIG_PATH = $(QT6_LIBDIR)/pkgconfig
854 # Upstream officially supports two recent major Perl versions. They also aim
855 # to provide critical security fixes for major Perl versions whose 5.x.0
856 # release was within the past three years.
858 # We support union of both sets. IOW, we will start to obsolete a major Perl
859 # version if its 5.x.0 was released longer than three years ago AND there are
860 # already released two newer major Perl versions.
862 # See https://perldoc.perl.org/perlpolicy
865 # We will start to obsolete major Perl versions according the following table:
867 # +--------------+----------------+
868 # | Perl version | Obsolete after |
869 # +--------------+----------------+
870 # | 5.36 | 2025-05-28 |
871 # | 5.38 | 2026-07-02 |
872 # | 5.40 | 2027-06-09 |
873 # +--------------+----------------+
875 # See https://www.cpan.org/src/README.html
878 # This is the default version of Perl
879 PERL_VERSION = 5.40
881 # The PERL_VERSIONS list should always be in ascending order (newest version
882 # last)
883 PERL_VERSIONS = 5.36 5.38 5.40
884 # Perl up to 5.22 was built 32-bit only. Starting with 5.24 the perl package
885 # is built 64-bit only. So now all PERL_VERSIONS are 64-bit only.
886 PERL_64_ONLY_VERSIONS = $(PERL_VERSIONS)
888 # List of perl versions we are currently obsoleting. We no longer build any
889 # packages for these perl versions, but there still might be hanging some not
890 # obsoleted yet versioned packages built for PERL_VERSIONS_OBSOLETING perl
891 # versions. Or there is just the versioned runtime/perl package still
892 # available.
894 # This list should be usually empty. Intersection of PERL_VERSIONS_OBSOLETING
895 # and PERL_VERSIONS lists MUST be always empty.
896 PERL_VERSIONS_OBSOLETING =
898 define perl-path-rule
899 PERL.$(1) = /usr/perl5/$(1)/bin/perl
900 POD2MAN.$(1) = /usr/perl5/$(1)/bin/pod2man
901 PERL5BINDIR.$(1) = /usr/perl5/$(1)/bin
902 endef
903 $(foreach perlver,$(PERL_VERSIONS),$(eval $(call perl-path-rule,$(perlver))))
905 PERL5BINDIR = $(PERL5BINDIR.$(PERL_VERSION))
906 PERL = $(PERL.$(PERL_VERSION))
907 POD2MAN = $(POD2MAN.$(PERL_VERSION))
909 PERL_ARCH := $(shell $(PERL) -e 'use Config; print $$Config{archname}')
910 PERL_ARCH_FUNC= $(shell $(1) -e 'use Config; print $$Config{archname}')
911 # Optimally we should ask perl which C compiler was used but it doesn't
912 # result in a full path name. Only "c" is being recorded
913 # inside perl builds while we actually need a full path to
914 # the compiler.
915 #PERL_CC := $(shell $(PERL) -e 'use Config; print $$Config{cc}')
917 PKG_MACROS += PERL_ARCH=$(PERL_ARCH)
918 PKG_MACROS += PERL_VERSION=$(PERL_VERSION)
921 # Upstream supports major PostgreSQL versions for 5 years after its initial
922 # release. After that one last minor version is released and then the major
923 # version is considered EOL.
925 # We will start to obsolete PostgreSQL versions according the following table:
927 # +--------------------+----------------+
928 # | PostgreSQL version | Obsolete after |
929 # +--------------------+----------------+
930 # | 12 | 2024-11-14 |
931 # | 14 | 2026-11-12 |
932 # | 15 | 2027-11-11 |
933 # | 16 | 2028-11-09 |
934 # +--------------------+----------------+
936 # See https://www.postgresql.org/support/versioning/
939 # Config magic for Postgres/EnterpriseDB/...
940 # Default DB version should be the newest one we do have so we detect any
941 # incompatibilities as soon as possible. Components could override this when
942 # they are not ready yet to compile with so new version.
943 PG_VERSION ?= 16
944 PG_IMPLEM ?= postgres
945 PG_VERNUM = $(subst .,,$(PG_VERSION))
946 # For dependencies, including REQUIRED_PACKAGES if needed
947 PG_BASEPKG = database/$(PG_IMPLEM)-$(PG_VERNUM)
948 PG_CLIENT_PKG = $(PG_BASEPKG)/client
949 PG_DEVELOPER_PKG = $(PG_BASEPKG)/developer
950 PG_LIBRARY_PKG = $(PG_BASEPKG)/library
951 PG_SERVICE_PKG = service/$(PG_BASEPKG)
953 REQUIRED_PACKAGES_SUBST+= PG_CLIENT_PKG
954 REQUIRED_PACKAGES_SUBST+= PG_DEVELOPER_PKG
955 REQUIRED_PACKAGES_SUBST+= PG_LIBRARY_PKG
956 REQUIRED_PACKAGES_SUBST+= PG_SERVICE_PKG
958 PG_HOME = $(USRDIR)/$(PG_IMPLEM)/$(PG_VERSION)
959 PG_BINDIR.32 = $(PG_HOME)/bin/$(MACH32)
960 PG_BINDIR.64 = $(PG_HOME)/bin
961 PG_BINDIR = $(PG_BINDIR.$(BITS))
962 PG_INCDIR = $(PG_HOME)/include
963 PG_MANDIR = $(PG_HOME)/man
964 PG_SHAREDIR = $(PG_HOME)/share
965 PG_DOCDIR = $(PG_HOME)/doc
966 PG_LIBDIR.32 = $(PG_HOME)/lib
967 PG_LIBDIR.64 = $(PG_HOME)/lib/$(MACH64)
968 PG_LIBDIR = $(PG_LIBDIR.$(BITS))
969 PG_CONFIG.32 = $(PG_BINDIR.32)/pg_config
970 PG_CONFIG.64 = $(PG_BINDIR.64)/pg_config
971 PG_CONFIG = $(PG_CONFIG.$(BITS))
972 PATH.prepend += $(PG_BINDIR)
974 PKG_MACROS += PG_VERSION=$(PG_VERSION)
975 PKG_MACROS += PG_VERNUM=$(PG_VERNUM)
976 PKG_MACROS += PG_BASEPKG=$(PG_BASEPKG)
979 # Upstream maintains long-term MariaDB releases for at least 5 years and
980 # short-term MariaDB releases for at least one year.
982 # We will start to obsolete MariaDB versions according the following table:
984 # +-----------------+----------------+
985 # | MariaDB version | Obsolete after |
986 # +-----------------+----------------+
987 # | 10.6 | 2026-07 |
988 # +-----------------+----------------+
990 # See https://mariadb.org/about/#maintenance-policy
993 # Config magic for MySQL/MariaDB/Percona/...
994 # Default DB version should be the newest one we do have so we detect any
995 # incompatibilities as soon as possible. Components could override this when
996 # they are not ready yet to compile with so new version.
997 # NOTE: At this time the gate does not provide a recipe for actual "mysql"
998 # The "/usr/mysql/*" trees are mediated to preferred MariaDB or Percona variant
999 MYSQL_VERSION ?= 10.6
1000 MYSQL_IMPLEM ?= mariadb
1001 MYSQL_VERNUM = $(subst .,,$(MYSQL_VERSION))
1002 MYSQL_MINOR = $(word 2,$(subst .,$(space),$(MYSQL_VERSION)))
1003 # Beginning with mariadb 10.6 we only ship 64 bit versions. That changes the paths.
1004 $(if $(shell [ $(MYSQL_MINOR) -ge 6 ] && echo "OK"), \
1005 $(eval MYSQL_64_BIT_ONLY := true), \
1006 $(eval MYSQL_64_BIT_ONLY := false))
1007 # For dependencies, including REQUIRED_PACKAGES if needed
1008 MYSQL_BASEPKG = database/$(MYSQL_IMPLEM)-$(MYSQL_VERNUM)
1009 MYSQL_CLIENT_PKG = $(MYSQL_BASEPKG)/client
1010 MYSQL_DEVELOPER_PKG = $(MYSQL_BASEPKG)/developer
1011 MYSQL_LIBRARY_PKG = $(MYSQL_BASEPKG)/library
1013 REQUIRED_PACKAGES_SUBST+= MYSQL_CLIENT_PKG
1014 REQUIRED_PACKAGES_SUBST+= MYSQL_DEVELOPER_PKG
1015 REQUIRED_PACKAGES_SUBST+= MYSQL_LIBRARY_PKG
1017 MYSQL_HOME = $(USRDIR)/$(MYSQL_IMPLEM)/$(MYSQL_VERSION)
1018 ifeq ($(strip $(MYSQL_64_BIT_ONLY)),false)
1019 MYSQL_BINDIR.32 = $(MYSQL_HOME)/bin
1020 MYSQL_BINDIR.64 = $(MYSQL_HOME)/bin/$(MACH64)
1021 else
1022 MYSQL_BINDIR.64 = $(MYSQL_HOME)/bin
1023 endif
1024 MYSQL_BINDIR = $(MYSQL_BINDIR.$(BITS))
1025 MYSQL_INCDIR = $(MYSQL_HOME)/include
1026 MYSQL_MANDIR = $(MYSQL_HOME)/man
1027 MYSQL_SHAREDIR = $(MYSQL_HOME)/share
1028 MYSQL_DOCDIR = $(MYSQL_HOME)/doc
1029 MYSQL_LIBDIR.32 = $(MYSQL_HOME)/lib
1030 MYSQL_LIBDIR.64 = $(MYSQL_HOME)/lib/$(MACH64)
1031 MYSQL_LIBDIR = $(MYSQL_LIBDIR.$(BITS))
1032 MYSQL_CONFIG.32 = $(MYSQL_BINDIR.32)/mysql_config
1033 MYSQL_CONFIG.64 = $(MYSQL_BINDIR.64)/mysql_config
1034 MYSQL_CONFIG = $(MYSQL_CONFIG.$(BITS))
1035 MYSQL_PKG_CONFIG_PATH = $(MYSQL_LIBDIR)/pkgconfig
1036 PATH.prepend += $(MYSQL_BINDIR)
1037 PKG_CONFIG_PATH.prepend += $(MYSQL_PKG_CONFIG_PATH)
1039 PKG_MACROS += MYSQL_VERSION=$(MYSQL_VERSION)
1040 PKG_MACROS += MYSQL_VERNUM=$(MYSQL_VERNUM)
1041 PKG_MACROS += MYSQL_BASEPKG=$(MYSQL_BASEPKG)
1043 # Default libjpeg implementation layout
1044 JPEG_DEFAULT = 8
1045 JPEG_VERSION ?= $(JPEG_DEFAULT)
1046 JPEG_IMPLEM = libjpeg$(JPEG_VERSION)-turbo
1047 JPEG_HOME = $(if $(filter $(JPEG_DEFAULT),$(JPEG_VERSION)),$(USRDIR),$(USRLIBDIR)/$(JPEG_IMPLEM))
1048 JPEG_INCDIR = $(if $(filter $(JPEG_DEFAULT),$(JPEG_VERSION)),$(USRINCDIR),$(USRINCDIR)/$(JPEG_IMPLEM))
1049 JPEG_LIBDIR.32 = $(JPEG_HOME)/lib
1050 JPEG_LIBDIR.64 = $(JPEG_HOME)/lib/$(MACH64)
1051 JPEG_LIBDIR = $(JPEG_LIBDIR.$(BITS))
1052 JPEG_CPPFLAGS = -I$(JPEG_INCDIR)
1053 JPEG_CFLAGS.32 = -Wl,-L$(JPEG_LIBDIR.32) -Wl,-R$(JPEG_LIBDIR.32)
1054 JPEG_CFLAGS.64 = -Wl,-L$(JPEG_LIBDIR.64) -Wl,-R$(JPEG_LIBDIR.64)
1055 JPEG_CFLAGS = $(JPEG_CFLAGS.$(BITS))
1056 JPEG_CXXFLAGS.32 = -Wl,-L$(JPEG_LIBDIR.32) -Wl,-R$(JPEG_LIBDIR.32)
1057 JPEG_CXXFLAGS.64 = -Wl,-L$(JPEG_LIBDIR.64) -Wl,-R$(JPEG_LIBDIR.64)
1058 JPEG_CXXFLAGS = $(JPEG_CXXFLAGS.$(BITS))
1059 JPEG_LDFLAGS.32 = -L$(JPEG_LIBDIR.32) -R$(JPEG_LIBDIR.32)
1060 JPEG_LDFLAGS.64 = -L$(JPEG_LIBDIR.64) -R$(JPEG_LIBDIR.64)
1061 JPEG_LDFLAGS = $(JPEG_LDFLAGS.$(BITS))
1063 PKG_CONFIG_PATH.prepend += $(if $(filter $(JPEG_DEFAULT),$(JPEG_VERSION)),,$(JPEG_LIBDIR)/pkgconfig)
1065 JPEG_IMPLEM_PKG = image/library/$(JPEG_IMPLEM)
1066 REQUIRED_PACKAGES_SUBST += JPEG_IMPLEM_PKG
1068 # This is the default BUILD version of tcl
1069 # Not necessarily the system's default version, i.e. /usr/bin/tclsh
1070 TCL_VERSION = 8.6
1071 TCLSH.8.6.i386.32 = /usr/bin/i86/tclsh8.6
1072 TCLSH.8.6.i386.64 = /usr/bin/amd64/tclsh8.6
1073 TCLSH.8.6.sparc.32 = /usr/bin/sparcv7/tclsh8.6
1074 TCLSH.8.6.sparc.64 = /usr/bin/sparcv9/tclsh8.6
1075 TCLSH = $(TCLSH.$(TCL_VERSION).$(MACH).$(BITS))
1077 # ICU library
1078 ICU_VERSION = 76
1079 ICU_LIBRARY_PKG = library/icu-$(ICU_VERSION)
1080 REQUIRED_PACKAGES_SUBST += ICU_LIBRARY_PKG
1082 # GNU readline
1083 READLINE_VERSION = 8
1084 READLINE_PKG = library/readline-$(READLINE_VERSION)
1085 REQUIRED_PACKAGES_SUBST += READLINE_PKG
1088 CCSMAKE = /usr/ccs/bin/make
1089 GMAKE = /usr/gnu/bin/make
1090 GPATCH = /usr/gnu/bin/patch
1091 PATCH_LEVEL = 1
1092 GPATCH_BACKUP = --backup --version-control=numbered
1093 GPATCH_FLAGS = -p$(PATCH_LEVEL) $(GPATCH_BACKUP)
1094 GSED = /usr/gnu/bin/sed
1095 GDIFF = /usr/gnu/bin/diff
1096 GSORT = /usr/gnu/bin/sort
1097 GUNZIP = /usr/bin/gunzip
1099 SORT = LC_ALL=C /usr/bin/sort
1101 PKGREPO = /usr/bin/pkgrepo
1102 PKGSEND = /usr/bin/pkgsend
1103 ifeq ($(strip $(PKGLINT_COMPONENT)),)
1104 PKGLINT = /usr/bin/python /usr/bin/pkglint
1105 else
1106 PKGLINT = ${WS_TOOLS}/pkglint
1107 endif
1109 ACLOCAL = /usr/bin/aclocal-1.16
1110 AUTOMAKE = /usr/bin/automake-1.16
1111 AUTORECONF = /usr/bin/autoreconf
1113 KSH93 = /usr/bin/ksh93
1114 TOUCH = /usr/bin/touch
1115 MKDIR = /bin/mkdir -p
1116 RM = /bin/rm -f
1117 CP = /bin/cp -f
1118 MV = /bin/mv -f
1119 LN = /bin/ln
1120 CAT = /bin/cat
1121 SYMLINK = /bin/ln -s
1122 ENV = /usr/bin/env -i
1123 FIND = /usr/bin/find
1124 INSTALL = /usr/bin/ginstall
1125 GNU_GREP = /usr/gnu/bin/grep
1126 CHMOD = /usr/bin/chmod
1127 NAWK = /usr/bin/nawk
1128 TEE = /usr/bin/tee
1129 GAS = /usr/gnu/bin/as
1130 GTAR = /usr/gnu/bin/tar
1131 STRIP = /usr/bin/strip
1132 IPS2TGZ = $(WS_TOOLS)/ips2tgz
1133 JQ = /usr/bin/jq
1134 DOS2UNIX = /usr/bin/dos2unix
1135 TAC = /usr/bin/tac
1136 QUILT = /usr/bin/quilt
1137 CTFCONVERT = /opt/onbld/bin/$(MACH)/ctfconvert
1138 ELFEDIT = /usr/bin/elfedit
1140 INS.dir= $(INSTALL) -d $@
1141 INS.file= $(INSTALL) -m 444 $< $(@D)
1143 # OpenSSL macros
1144 OPENSSL_DEFAULT = 3.1
1145 ifeq ($(strip $(USE_OPENSSL11)),yes)
1146 OPENSSL_VERSION = 1.1
1147 else
1148 ifeq ($(strip $(USE_OPENSSL10)),yes)
1149 OPENSSL_VERSION = 1.0
1150 else
1151 OPENSSL_VERSION ?= $(OPENSSL_DEFAULT)
1152 endif
1153 endif
1154 PATH.prepend+=$(OPENSSL_BINDIR)
1155 OPENSSL_PREFIX= $(USRDIR)/openssl/$(OPENSSL_VERSION)
1156 OPENSSL_BINDIR.64= $(OPENSSL_PREFIX)/bin
1157 OPENSSL_BINDIR.32= $(OPENSSL_PREFIX)/bin/$(MACH32)
1158 OPENSSL_BINDIR= $(OPENSSL_BINDIR.$(BITS))
1159 OPENSSL_LIBDIR.64= $(OPENSSL_PREFIX)/lib/64
1160 OPENSSL_LIBDIR.32= $(OPENSSL_PREFIX)/lib
1161 OPENSSL_LIBDIR= $(OPENSSL_LIBDIR.$(BITS))
1162 OPENSSL_PKG_CONFIG_PATH.32= $(OPENSSL_PREFIX)/lib/pkgconfig
1163 OPENSSL_PKG_CONFIG_PATH.64= $(OPENSSL_PREFIX)/lib/64/pkgconfig
1164 OPENSSL_PKG_CONFIG_PATH= $(OPENSSL_PKG_CONFIG_PATH.$(BITS))
1165 OPENSSL_INCDIR=$(OPENSSL_PREFIX)/include
1167 PKG_CONFIG_PATH.prepend += $(OPENSSL_PKG_CONFIG_PATH)
1169 # The OpenSSL 1.0 package is without the version suffix so it needs special handling
1170 OPENSSL_PKG = library/security/openssl$(subst -10,,-$(subst .,,$(OPENSSL_VERSION)))
1171 REQUIRED_PACKAGES_SUBST += OPENSSL_PKG
1173 # Pkg-config paths
1174 PKG_CONFIG_PATH.32 = /usr/lib/pkgconfig
1175 PKG_CONFIG_PATH.64 = /usr/lib/$(MACH64)/pkgconfig
1176 PKG_CONFIG_PATH = $(subst $(space),:,$(strip $(PKG_CONFIG_PATH.prepend))):$(PKG_CONFIG_PATH.$(BITS)):$(PKG_CONFIG_PATH.32)
1178 # Set default path for environment modules
1179 MODULE_VERSION = 3.2.10
1180 MODULE_PATH = /usr/share/Modules/modulefiles
1181 MODULE_VERSIONS_PATH = /usr/share/Modules/versions
1183 # Path to bash completions
1184 BASH_COMPLETIONS_PATH = /usr/share/bash-completion/completions
1187 # C preprocessor flag sets to ease feature selection. Add the required
1188 # feature to your Makefile with CPPFLAGS += $(FEATURE_MACRO) and add to
1189 # the component build with CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)" or
1190 # similiar.
1193 # Enables visibility of some c99 math functions that aren't visible by default.
1194 # What other side-effects are there?
1195 CPP_C99_EXTENDED_MATH = -D_STDC_99
1197 # Enables large file support for components that have no other means of doing
1198 # so. Use CPP_LARGEFILES and not the .32/.64 variety directly
1199 CPP_LARGEFILES.32 := $(shell getconf LFS_CFLAGS)
1200 CPP_LARGEFILES.64 := $(shell getconf LFS64_CFLAGS)
1201 CPP_LARGEFILES = $(CPP_LARGEFILES.$(BITS))
1203 # Enables some #pragma redefine_extname to POSIX-compliant Standard C Library
1204 # functions. Also avoids the component's #define _POSIX_C_SOURCE to some value
1205 # we currently do not support.
1206 CPP_POSIX = -D_POSIX_C_SOURCE=200112L -D_POSIX_PTHREAD_SEMANTICS
1208 # XPG8 mode. This option enables XPG8 conformance, plus extensions.
1209 CPP_XPG8MODE= -D_XOPEN_SOURCE=800 -D__EXTENSIONS__=1 -D_XPG8
1211 # XPG7 mode. This option enables XPG7 conformance, plus extensions.
1212 CPP_XPG7MODE= -D_XOPEN_SOURCE=700 -D__EXTENSIONS__=1 -D_XPG7
1214 # XPG6 mode. This option enables XPG6 conformance, plus extensions.
1215 # Amongst other things, this option will cause system calls like
1216 # popen (3C) and system (3C) to invoke the standards-conforming
1217 # shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh. Add CPP_XPG6MODE to
1218 # CFLAGS instead of using this directly
1219 CPP_XPG6MODE= -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 -D_XPG6
1221 # XPG5 mode. These options are specific for C++, where _XPG6,
1222 # _XOPEN_SOURCE=600 and C99 are illegal. -D__EXTENSIONS__=1 is legal in C++.
1223 CPP_XPG5MODE= -D_XOPEN_SOURCE=500 -D__EXTENSIONS__=1 -D_XPG5
1225 # Generate 32/64 bit objects
1226 CC_BITS = -m$(BITS)
1228 # Turn on C99 for gcc
1229 gcc_C99_ENABLE = -std=c99
1231 # Turn on C23 for gcc
1233 # Please note that gcc up to version 14 does not fully support C23 and so
1234 # __STDC_VERSION__ does not expand to 202311L there, but to 202000L instead.
1235 # This is not sufficient for turning on C23 in our headers and so we need to
1236 # define _STDC_C23 as well. See /usr/include/sys/feature_tests.h for details.
1238 # Although the -std=c2x option is deprecated (since gcc 14) and -std=c23 should
1239 # be used instead, it is not available for gcc 13 and older and so we opted to
1240 # use -std=c2x for compatibility.
1241 gcc_C23_ENABLE = -std=c2x -D_STDC_C23
1243 # Control register usage for generated code. SPARC ABI requires system
1244 # libraries not to use application registers.
1245 gcc_XREGS.sparc = -mno-app-regs
1246 gcc_XREGS.i386 =
1247 gcc_XREGS = $(gcc_XREGS.$(MACH))
1249 # See CPP_XPG8MODE comment above.
1250 XPG8MODE = $(CPP_XPG8MODE)
1252 # See CPP_XPG7MODE comment above.
1253 XPG7MODE = $(CPP_XPG7MODE)
1255 # See CPP_XPG6MODE comment above.
1256 XPG6MODE = $(CPP_XPG6MODE)
1258 # See CPP_XPG5MODE comment above. You can only use this in C++, not in C99.
1259 XPG5MODE = $(CPP_XPG5MODE)
1262 # GNU C compiler flag sets to ease feature selection. Add the required
1263 # feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
1264 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
1267 # Control the GCC optimization level.
1268 gcc_OPT.sparc.32 = -O3 -mcpu=ultrasparc -mvis -mfsmuld
1269 gcc_OPT.sparc.64 = -O3 -mcpu=ultrasparc -mvis -mfsmuld
1270 gcc_OPT.i386.32 = -O3
1271 gcc_OPT.i386.64 = -O3
1272 gcc_OPT = $(gcc_OPT.$(MACH).$(BITS))
1274 # GCC PIC code generation. Use CC_PIC instead to select PIC code generation.
1275 gcc_PIC = -fPIC -DPIC
1277 # Generic macro for PIC code generation. Use this macro instead of the
1278 # compiler specific variant.
1279 CC_PIC = $($(COMPILER)_PIC)
1282 # Default GNU C compiler flags. Add the required feature to your Makefile
1283 # with CFLAGS += $(FEATURE_MACRO) and add to the component build with
1284 # CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar. In most cases, it
1285 # should not be necessary to add CFLAGS to any environment other than the
1286 # configure environment.
1287 CFLAGS.gcc += $(gcc_OPT)
1288 CFLAGS.gcc += $(gcc_XREGS)
1290 # Default GNU C++ compiler flags. Add the required feature to your Makefile
1291 # with CXXFLAGS += $(FEATURE_MACRO) and add to the component build with
1292 # CONFIGURE_OPTIONS += CXXFLAGS="$(CXXFLAGS)" or similiar. In most cases, it
1293 # should not be necessary to add CXXFLAGS to any environment other than the
1294 # configure environment.
1295 CXXFLAGS.gcc += $(gcc_OPT)
1296 CXXFLAGS.gcc += $(gcc_XREGS)
1298 # Default GNU FORTRAN compiler flags. Add the required feature to your Makefile
1299 # with FCFLAGS += $(FEATURE_MACRO) and add to the component build with
1300 # CONFIGURE_OPTIONS += FCFLAGS="$(FCFLAGS)" or similiar. In most cases, it
1301 # should not be necessary to add FCFLAGS to any environment other than the
1302 # configure environment.
1303 FCFLAGS.gcc += $(gcc_OPT)
1304 FCFLAGS.gcc += $(gcc_XREGS)
1306 # Build 32 or 64 bit objects.
1307 CFLAGS += $(CC_BITS)
1309 # Add compiler specific 'default' features
1310 CFLAGS += $(CFLAGS.$(COMPILER))
1312 # Per-compiler CFLAGS to use when building for CTF. Currently only defined
1313 # for gcc; could be made to work with other compilers.
1315 # -gdwarf-4 is the newest DWARF revision understood by illumos libctf
1317 # -gstrict-dwarf prevents the compiler from including newer DWARF features
1318 CTF_CFLAGS.gcc = -g -gdwarf-4 -gstrict-dwarf
1319 # -msave-args makes it possible for debugging tools (specifically pstack and
1320 # mdb) to retrieve function arguments, and is required for the python pstack
1321 # hooks.
1322 CTF_CFLAGS.gcc += -msave-args
1323 # By default, GCC may put parts of functions in different named sub-sections
1324 # of .text based on their presumed or measured calling frequency. This is not
1325 # currently handled by libctf and other illumos tools which assume that a
1326 # function's text lies in a single contiguous range of virtual addresses.
1327 # Disable this optimization if building with CTF.
1328 CTF_CFLAGS.gcc += -fno-reorder-functions -fno-reorder-blocks-and-partition
1330 # Enable CTF if desired
1331 ifeq ($(strip $(USE_CTF)),yes)
1332 CFLAGS += $(if $(CTF_CFLAGS.$(COMPILER)), \
1333 $(CTF_CFLAGS.$(COMPILER)), \
1334 $(error Error: CTF_CFLAGS.$(COMPILER) must be defined to use CTF with $(COMPILER)))
1335 endif
1337 # Build 32 or 64 bit objects in C++ as well.
1338 CXXFLAGS += $(CC_BITS)
1340 # Add compiler specific 'default' features
1341 CXXFLAGS += $(CXXFLAGS.$(COMPILER))
1343 # Build 32 or 64 bit objects in FORTRAN as well.
1344 F77FLAGS += $(CC_BITS)
1345 FCFLAGS += $(CC_BITS)
1347 # Add compiler specific 'default' features
1348 F77FLAGS += $(FCFLAGS.$(COMPILER))
1349 FCFLAGS += $(FCFLAGS.$(COMPILER))
1352 # Solaris linker flag sets to ease feature selection. Add the required
1353 # feature to your Makefile with LDFLAGS += $(FEATURE_MACRO) and add to the
1354 # component build with CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)" or similiar.
1357 # set the bittedness that we want to link
1358 ccs.ld.64 = -64
1359 gcc.ld.32 = -m32
1360 gcc.ld.64 = -m64
1361 LD_BITS = $($(LINKER).ld.$(BITS))
1362 LDFLAGS = $(LD_BITS)
1364 # Reduce the symbol table size, effectively conflicting with -g. We should
1365 # get linker guidance here.
1366 LD_Z_REDLOCSYM = -z redlocsym
1368 # Cause the linker to rescan archive libraries and resolve remaining unresolved
1369 # symbols recursively until all symbols are resolved. Components should be
1370 # linking in the libraries they need, in the required order. This should
1371 # only be required if the component's native build is horribly broken.
1372 LD_Z_RESCAN_NOW = -z rescan-now
1374 LD_Z_TEXT = -z direct
1376 # make sure that -lc is always present when building shared objects.
1377 LD_DEF_LIBS += -lc
1379 # make sure all symbols are defined.
1380 LD_Z_DEFS = -z defs
1382 # eliminate unreferenced dynamic dependencies
1383 LD_Z_IGNORE = -z ignore
1385 # use direct binding
1386 LD_B_DIRECT = -Bdirect
1388 # use generic macro names for enabling/disabling ASLR
1389 ASLR_ENABLE = -z aslr=enable
1390 ASLR_DISABLE = -z aslr=disable
1391 ASLR_MODE = $(ASLR_DISABLE)
1393 # by default, turn off Address Space Layout Randomization for ELF executables;
1394 # to explicitly enable ASLR, set ASLR_MODE = $(ASLR_ENABLE)
1395 # in that component's Makefile
1396 LD_Z_ASLR = $(ASLR_MODE)
1398 # Define SSP library link flag for 32-bit objects
1399 LD_SSP.32 = -lssp_ns
1400 LD_SSP.64 =
1401 LD_SSP = $(LD_SSP.$(BITS))
1404 # More Solaris linker flags that we want to be sure that everyone gets. This
1405 # is automatically added to the calling environment during the 'build' and
1406 # 'install' phases of the component build. Each individual feature can be
1407 # turned off by adding FEATURE_MACRO= to the component Makefile.
1410 # Create a non-executable stack when linking.
1411 LD_MAP_NOEXSTK.i386 = -M /usr/lib/ld/map.noexstk
1412 LD_MAP_NOEXSTK.sparc = -M /usr/lib/ld/map.noexstk
1414 # Create a non-executable bss segment when linking.
1415 LD_MAP_NOEXBSS = -M /usr/lib/ld/map.noexbss
1417 # Create a non-executable data segment when linking. Due to PLT needs, the
1418 # data segment must be executable on sparc, but the bss does not.
1419 # see mapfile comments for more information
1420 LD_MAP_NOEXDATA.i386 = -M /usr/lib/ld/map.noexdata
1421 LD_MAP_NOEXDATA.sparc = $(LD_MAP_NOEXBSS)
1423 # Page alignment
1424 LD_MAP_PAGEALIGN = -M /usr/lib/ld/map.pagealign
1426 # Linker options to add when only building libraries
1427 LD_OPTIONS_SO += $(LD_Z_TEXT) $(LD_Z_DEFS) $(LD_DEF_LIBS)
1429 # Default linker options that everyone should get. Do not add additional
1430 # libraries to this macro, as it will apply to everything linked during the
1431 # component build.
1432 LD_OPTIONS += $(LD_MAP_NOEXSTK.$(MACH)) $(LD_MAP_NOEXDATA.$(MACH)) \
1433 $(LD_MAP_PAGEALIGN) $(LD_B_DIRECT) $(LD_Z_IGNORE)
1435 # only used on executables
1436 LD_EXEC_OPTIONS = $(LD_Z_ASLR)
1438 # Environment variables and arguments passed into the build and install
1439 # environment(s). These are the initial settings.
1440 COMPONENT_BUILD_ENV= \
1441 LD_OPTIONS="$(LD_OPTIONS)" \
1442 LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1443 COMPONENT_INSTALL_ENV= \
1444 LD_OPTIONS="$(LD_OPTIONS)" \
1445 LD_EXEC_OPTIONS="$(LD_EXEC_OPTIONS)"
1447 # PATH should be always set
1448 COMPONENT_BUILD_ENV += PATH="$(PATH)"
1449 COMPONENT_INSTALL_ENV += PATH="$(PATH)"
1450 COMPONENT_TEST_ENV += PATH="$(PATH)"
1452 # PERL options which depend on C options should be placed here
1453 PERL_OPTIMIZE := $(shell $(PERL) -e 'use Config; print $$Config{optimize}')
1455 # Rewrite absolute source-code paths into relative for ccache, so that any
1456 # workspace with a shared CCACHE_DIR can benefit when compiling a component
1457 ifneq ($(strip $(CCACHE)),)
1458 export CCACHE_BASEDIR = $(BUILD_DIR_$(BITS))
1459 COMPONENT_BUILD_ENV += CCACHE="$(CCACHE)"
1460 COMPONENT_INSTALL_ENV += CCACHE="$(CCACHE)"
1461 COMPONENT_TEST_ENV += CCACHE="$(CCACHE)"
1462 COMPONENT_BUILD_ENV += CC_gcc_32="$(CC_gcc_32)"
1463 COMPONENT_BUILD_ENV += CC_gcc_64="$(CC_gcc_64)"
1464 COMPONENT_BUILD_ENV += CXX_gcc_32="$(CXX_gcc_32)"
1465 COMPONENT_BUILD_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1466 COMPONENT_INSTALL_ENV += CC_gcc_32="$(CC_gcc_32)"
1467 COMPONENT_INSTALL_ENV += CC_gcc_64="$(CC_gcc_64)"
1468 COMPONENT_INSTALL_ENV += CXX_gcc_32="$(CXX_gcc_32)"
1469 COMPONENT_INSTALL_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1470 COMPONENT_TEST_ENV += CC_gcc_32="$(CC_gcc_32)"
1471 COMPONENT_TEST_ENV += CC_gcc_64="$(CC_gcc_64)"
1472 COMPONENT_TEST_ENV += CXX_gcc_32="$(CXX_gcc_32)"
1473 COMPONENT_TEST_ENV += CXX_gcc_64="$(CXX_gcc_64)"
1474 COMPONENT_BUILD_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1475 COMPONENT_INSTALL_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1476 COMPONENT_TEST_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
1478 ifneq ($(strip $(CCACHE_DIR)),)
1479 COMPONENT_BUILD_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1480 COMPONENT_INSTALL_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1481 COMPONENT_TEST_ENV += CCACHE_DIR="$(CCACHE_DIR)"
1482 endif
1484 ifneq ($(strip $(CCACHE_LOGFILE)),)
1485 COMPONENT_BUILD_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1486 COMPONENT_INSTALL_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1487 COMPONENT_TEST_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
1488 endif
1490 endif
1492 # Add any bit-specific settings
1493 COMPONENT_BUILD_ENV += $(COMPONENT_BUILD_ENV.$(BITS))
1494 COMPONENT_BUILD_ARGS += $(COMPONENT_BUILD_ARGS.$(BITS))
1495 COMPONENT_INSTALL_ENV += $(COMPONENT_INSTALL_ENV.$(BITS))
1496 COMPONENT_INSTALL_ARGS += $(COMPONENT_INSTALL_ARGS.$(BITS))
1498 # declare these phony so that we avoid filesystem conflicts.
1499 .PHONY: prep build install publish test clean clobber
1501 # If there are no tests to execute
1502 NO_TESTS = test-nothing
1503 test-nothing:
1504 @echo "There are no tests available at this time."
1506 # default behaviour for 'component-hook' target is to echo the component
1507 # name and version information, but more complex behaviour can be implemented
1508 # via command line setting of the COMPONENT_HOOK macro.
1509 COMPONENT_HOOK ?= echo $(COMPONENT_NAME) $(COMPONENT_VERSION)
1511 component-hook:
1512 @$(COMPONENT_HOOK)
1514 # We need shell/ksh93 to be able to run scripts in the tools directory
1515 USERLAND_REQUIRED_PACKAGES += shell/ksh93
1518 # Packages with tools that are required to build Userland components
1520 USERLAND_REQUIRED_PACKAGES += metapackages/build-essential
1522 # Define substitution rules for some packages.
1523 # Such package names may change and would be better defined with a macro to
1524 # avoid mass modification of the Makefiles.
1526 # Runtime package names are changed at compiler version major bumps.
1527 REQUIRED_PACKAGES_SUBST+= GCC_RUNTIME_PKG
1528 REQUIRED_PACKAGES_SUBST+= GXX_RUNTIME_PKG
1529 REQUIRED_PACKAGES_SUBST+= GCCGO_RUNTIME_PKG
1530 REQUIRED_PACKAGES_SUBST+= GFORTRAN_RUNTIME_PKG
1531 REQUIRED_PACKAGES_SUBST+= GOBJC_RUNTIME_PKG
1533 # Generate requirements on all built python version variants for given packages
1534 USERLAND_REQUIRED_PACKAGES += $(foreach ver,$(PYTHON_VERSIONS),$(USERLAND_REQUIRED_PACKAGES.python:%=%-$(subst .,,$(ver))))
1535 REQUIRED_PACKAGES += $(foreach ver,$(PYTHON_VERSIONS),$(PYTHON_REQUIRED_PACKAGES:%=%-$(subst .,,$(ver))))
1536 TEST_REQUIRED_PACKAGES += $(foreach ver,$(PYTHON_VERSIONS),$(TEST_REQUIRED_PACKAGES.python:%=%-$(subst .,,$(ver))))
1538 # Generate requirements on all built perl version variants for given packages
1539 USERLAND_REQUIRED_PACKAGES += $(foreach ver,$(PERL_VERSIONS),$(USERLAND_REQUIRED_PACKAGES.perl:%=%-$(subst .,,$(ver))))
1540 REQUIRED_PACKAGES += $(foreach ver,$(PERL_VERSIONS),$(PERL_REQUIRED_PACKAGES:%=%-$(subst .,,$(ver))))
1541 TEST_REQUIRED_PACKAGES += $(foreach ver,$(PERL_VERSIONS),$(TEST_REQUIRED_PACKAGES.perl:%=%-$(subst .,,$(ver))))
1543 # Generate conflicting packages for all built python version variants for given package
1544 TEST_CONFLICTING_PACKAGES += $(foreach ver,$(PYTHON_VERSIONS),$(TEST_CONFLICTING_PACKAGES.python:%=%-$(subst .,,$(ver))))
1546 # Targets for some tools rarely used by the build framework. We do not add
1547 # these tools to USERLAND_REQUIRED_PACKAGES to do not pollute it.
1548 $(QUILT):
1549 @echo
1550 @echo "$(QUILT) is missing"
1551 @echo "Please install developer/quilt package"
1552 @echo
1553 @exit 1
1555 include $(WS_MAKE_RULES)/environment.mk
1556 include $(WS_MAKE_RULES)/depend.mk
1557 include $(WS_MAKE_RULES)/component.mk