1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
|
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
#
# Hammerhead: Added hammerhead.sh as primary env file
ENVFILES= \
hammerhead \
illumos
include ../Makefile.tools
FILEMODE= 644
CLOBBERFILES= $(ENVFILES)
.KEEP_STATE:
all: $(ENVFILES)
install: all .WAIT $(ROOTONBLDENVFILES)
clean:
clobber:
include ../Makefile.targ
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
# Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2016 RackTop Systems.
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2020 Joyent, Inc.
# Copyright 2024 Bill Sommerfeld <sommerfeld@hamachi.org>
# Copyright 2026 Zygaena Project - Hammerhead Build System
#
# Hammerhead Build Environment for Zygaena (OpenIndiana cross-build host)
#
# For building on an OpenIndiana VM with OI-packaged GCC 14 and tools.
# For building on a native Hammerhead/Zygaena host, use hammerhead.sh instead.
#
# - This file is sourced by "hh-env" (bldenv) and "hh-build" and
# should not be executed directly.
# - This script is only interpreted by ksh93 and explicitly allows the
# use of ksh93 language extensions.
# -----------------------------------------------------------------------------
# Parameters you are likely to want to change
# -----------------------------------------------------------------------------
# Hammerhead NIGHTLY_OPTIONS:
# -F Do NOT do a non-DEBUG build (DEBUG only)
# -n Do not bringover from parent (use local sources)
# -C Run 'make check' (cstyle/hdrchk)
# -D Do a DEBUG build
# -A Check for ABI discrepancies
# -m Send mail on completion
# -r Check ELF runpaths
# -t Build and use workspace tools
#
# Note: -p (package creation) removed - Hammerhead uses Coral packaging
export NIGHTLY_OPTIONS='-FnCDAmrt'
# Some scripts optionally send mail messages to MAILTO.
#export MAILTO=
# CODEMGR_WS - where is your workspace at
# Hammerhead repo structure: git root contains hammerhead/ subdirectory with source
# If CODEMGR_WS not set, detect from git root + /hammerhead
if [[ -z "$CODEMGR_WS" ]]; then
_gitroot=$(git rev-parse --show-toplevel 2>/dev/null)
if [[ -d "$_gitroot/base/usr/src" ]]; then
# Nested structure: repo/hammerhead/usr/src
export CODEMGR_WS="$_gitroot/base"
elif [[ -d "$_gitroot/usr/src" ]]; then
# Flat structure: repo/usr/src
export CODEMGR_WS="$_gitroot"
else
echo "Error: Cannot find usr/src directory" >&2
return 1
fi
unset _gitroot
else
export CODEMGR_WS
fi
# -----------------------------------------------------------------------------
# Compiler Configuration
# -----------------------------------------------------------------------------
#
# Hammerhead uses GCC 14 exclusively - no shadow compilation
#
# Each entry has the form <name>,<path to binary>,<style> where name is a
# free-form name (possibly used in the makefiles to guard options), path is
# the path to the executable. style is the 'style' of command line taken by
# the compiler, currently either gnu (or gcc) or sun (or cc).
#
export GNUC_ROOT=/usr/gcc/14
export PRIMARY_CC=gcc14,$GNUC_ROOT/bin/gcc,gnu
export PRIMARY_CCC=gcc14,$GNUC_ROOT/bin/g++,gnu
# OI's patched GCC 14 supports -msave-args for mdb stack debugging.
# Stock upstream GCC does not. Set here so OI builds get this feature.
export SAVEARGS='-msave-args'
# Shadow compilation disabled - single compiler only
export SHADOW_CCS=
export SHADOW_CCCS=
# Smatch disabled (simplifies build)
#export ENABLE_SMATCH=1
# Hammerhead: CUPS not in base OS — SMB printing disabled
# export ENABLE_SMB_PRINTING=
# -----------------------------------------------------------------------------
# Perl/Python Configuration
# -----------------------------------------------------------------------------
# If your distro uses certain versions of Perl, make sure either Makefile.master
# contains your new defaults OR your .env file sets them.
#export PERL_VERSION=5.28
#export PERL_VARIANT=-thread-multi
#export PERL_PKGVERS=
# Hammerhead: 64-bit only - disable 32-bit perl modules
export BUILDPERL32='#'
#export BUILDPERL64='#'
# If your distro uses certain versions of Python, make sure either
# Makefile.master contains your new defaults OR your .env file sets them.
#export PYTHON3_VERSION=3.9
#export PYTHON3_PKGVERS=-39
#export PYTHON3_SUFFIX=
# -----------------------------------------------------------------------------
# Console/Display Configuration
# -----------------------------------------------------------------------------
# Set console color scheme either by build type:
#
#export RELEASE_CONSOLE_COLOR="-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_BLACK \
# -DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_WHITE"
#
#export DEBUG_CONSOLE_COLOR="-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_RED \
# -DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_WHITE"
#
# or just one for any build type:
#
#export DEFAULT_CONSOLE_COLOR="-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_BLACK \
# -DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_WHITE"
# Skip Java 11 builds on distributions that don't support it
#export BLD_JAVA_11=
# POST_NIGHTLY can be any command to be run at the end of the build.
# See hh-build for interactions between environment variables and this command.
#POST_NIGHTLY=
# Populates /etc/versions/build on each build run
export BUILDVERSION_EXEC="git describe --all --long --dirty"
# -----------------------------------------------------------------------------
# Source Control / Bringover Configuration
# -----------------------------------------------------------------------------
#
# When the 'n' option is not present in NIGHTLY_OPTIONS, hh-build updates
# the build workspace from the sources identified by the following variables.
# Defaults are set in hh-build if the environment file leaves them unset.
#
# SCM in use. Defaults to "git"
#export BRINGOVER_SCM="git"
# URL or pathname to source workspace.
#export BRINGOVER_WS="${CLONE_WS}"
# Branch within BRINGOVER_WS; must be specified if BRINGOVER_WS is a URL
#export BRINGOVER_BRANCH=""
# Short name to use within CODEMGR_WS for BRINGOVER_WS (git-specific)
#export BRINGOVER_REMOTE=nightly_bringover_ws
# Command-line options to add to the clone operation
#export CLONE_OPTIONS=""
# -----------------------------------------------------------------------------
# Build System Configuration
# -----------------------------------------------------------------------------
# Maximum number of parallel make jobs, set to NCPUS.
# GNU Make's job server keeps all CPUs busy without needing extra padding.
function maxjobs
{
nameref maxjobs=$1
integer ncpu
integer -r min_mem_per_job=512 # minimum amount of memory for a job
ncpu=$(builtin getconf ; getconf 'NPROCESSORS_ONLN')
(( maxjobs=ncpu ))
# Throttle number of parallel jobs to a value which guarantees that
# all jobs have enough memory. This was added to avoid excessive
# paging/swapping in cases of virtual machine installations which
# have lots of CPUs but not enough memory assigned.
if [[ $(/usr/sbin/prtconf 2>'/dev/null') == ~(E)Memory\ size:\ ([[:digit:]]+)\ Megabytes ]] ; then
integer max_jobs_per_memory # parallel jobs which fit into physical memory
integer physical_memory # physical memory installed
# The array ".sh.match" contains the contents of capturing
# brackets in the last regex, .sh.match[1] will contain
# the value matched by ([[:digit:]]+), i.e. the amount of
# memory installed
physical_memory="10#${.sh.match[1]}"
((
max_jobs_per_memory=round(physical_memory/min_mem_per_job) ,
maxjobs=fmax(2, fmin(maxjobs, max_jobs_per_memory))
))
fi
return 0
}
# Hammerhead: parallelism control for GNU Make builds
# Reduced to -j4 for stability. Full parallelism (-j NCPU) exposes race
# conditions in kernel ctfmerge, _msg preprocessing, and locale data
# generation. Revisit after adding proper ordering constraints.
GMAKE_MAX_JOBS=4
export GMAKE_MAX_JOBS
# path to onbld tool binaries
ONBLD_BIN='/opt/onbld/bin'
# PARENT_WS is used to determine the parent of this workspace. This is
# for the options that deal with the parent workspace (such as where the
# proto area will go).
export PARENT_WS="${PARENT_WS:-}"
# CLONE_WS is the workspace hh-build should do a bringover from.
# The bringover, if any, is done as STAFFER.
export CLONE_WS="${CLONE_WS:-}"
# Set STAFFER to your own login as gatekeeper or developer
# The point is to use group "staff" and avoid referencing the parent
# workspace as root.
export STAFFER="$LOGNAME"
export MAILTO="${MAILTO:-$STAFFER}"
# If you wish the mail messages to be From: an arbitrary address, export
# MAILFROM.
#export MAILFROM="user@example.com"
# The project (see project(5)) under which to run this build. If not
# specified, the build is simply run in a new task in the current project.
export BUILD_PROJECT=''
# -----------------------------------------------------------------------------
# Architecture Configuration - Hammerhead is amd64-only
# -----------------------------------------------------------------------------
#
# MACH=i386 represents the x86 CPU family (used for Makefile directory selection)
# MACH64=amd64 is the actual 64-bit architecture we build
# BUILD32 is set to $(POUND_SIGN) in Makefile.master to disable 32-bit builds
#
export MACH=i386
export MACH64=amd64
# -----------------------------------------------------------------------------
# Path Configuration
# -----------------------------------------------------------------------------
export ATLOG="$CODEMGR_WS/log"
export LOGFILE="$ATLOG/build.log"
# Proto area - use MACH64 (amd64) since Hammerhead is 64-bit only
export ROOT="$CODEMGR_WS/proto/root_${MACH64}"
export SRC="$CODEMGR_WS/usr/src"
export MULTI_PROTO="no"
# REF_PROTO_LIST - for comparing the list of stuff in your proto area
# with. Generally this should be left alone, since you want to see differences
# from your parent (the gate).
export REF_PROTO_LIST="$PARENT_WS/usr/src/proto_list_${MACH64}"
# Proto area in parent for optionally depositing a copy of headers and
# libraries corresponding to the protolibs target
export PARENT_ROOT="$PARENT_WS/proto/root_${MACH64}"
export PARENT_TOOLS_ROOT="$PARENT_WS/usr/src/tools/proto/root_$MACH-nd"
# -----------------------------------------------------------------------------
# Version Configuration
# -----------------------------------------------------------------------------
# Build version (YYYYMMDD-NN format, auto-generated by hh-build/bldenv).
# NOT exported as VERSION to avoid polluting sub-builds (e.g. zsh autotools).
#export HAMMERHEAD_VERSION="20260301-01"
# The RELEASE and RELEASE_DATE variables are set in Makefile.master;
# there might be special reasons to override them here, but that
# should not be the case in general
# export RELEASE='5.11'
# export RELEASE_DATE='October 2007'
# -----------------------------------------------------------------------------
# Package Configuration (IPS - disabled for Hammerhead)
# -----------------------------------------------------------------------------
#
# Hammerhead uses Coral packaging instead of IPS.
# These variables are kept for compatibility but -p is not in NIGHTLY_OPTIONS.
#
# PKGARCHIVE determines where the repository will be created.
# PKGPUBLISHER_REDIST controls the publisher setting for the repository.
#
export PKGARCHIVE="${CODEMGR_WS}/packages/${MACH64}/build"
# export PKGPUBLISHER_REDIST='on-redist'
# Package manifest format version.
export PKGFMT_OUTPUT='v2'
# -----------------------------------------------------------------------------
# Make Configuration
# -----------------------------------------------------------------------------
# We want make to do as much as it can, just in case there's more than
# one problem.
# We also must set e in MAKEFLAGS as the makefiles depend on importing
# the environment variables set here.
export MAKEFLAGS='ke'
# Hammerhead: Use GNU Make instead of dmake
export MAKE=gmake
# -----------------------------------------------------------------------------
# Build Tools Configuration
# -----------------------------------------------------------------------------
# Build tools - don't change these unless you know what you're doing. These
# variables allows you to get the compilers and onbld files locally.
# Set BUILD_TOOLS to pull everything from one location.
# Alternately, you can set ONBLD_TOOLS to where you keep the contents of
# SUNWonbld.
export BUILD_TOOLS='/opt'
#export ONBLD_TOOLS='/opt/onbld'
# Set this flag to 'n' to disable the use of 'checkpaths'. The default,
# if the 'N' option is not specified, is to run this test.
#CHECK_PATHS='y'
# Smatch integration (disabled by default in Hammerhead)
if [[ "$ENABLE_SMATCH" == "1" ]]; then
SMATCHBIN=$CODEMGR_WS/usr/src/tools/proto/root_$MACH-nd/opt/onbld/bin/$MACH/smatch
export SHADOW_CCS="$SHADOW_CCS smatch,$SMATCHBIN,smatch"
fi
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
# Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2016 RackTop Systems.
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2020 Joyent, Inc.
# Copyright 2024 Bill Sommerfeld <sommerfeld@hamachi.org>
# Copyright 2026 Zygaena Project - Hammerhead Build System
#
# Hammerhead Build Environment for Zygaena (standalone / native)
#
# For building on a Hammerhead/Zygaena host with the bootstrap toolchain.
# For building on an OpenIndiana host, use hammerhead-oibuild.sh instead.
#
# - This file is sourced by "hh-env" (bldenv) and "hh-build" and
# should not be executed directly.
# - This script is only interpreted by ksh93 and explicitly allows the
# use of ksh93 language extensions.
#
# Key differences from hammerhead-oibuild.sh:
# - GNUC_ROOT=/usr (bootstrap GCC at /usr/bin/gcc, not /usr/gcc/14)
# - No -msave-args (stock GCC 14, not OI-patched)
# - Python 3.13 (bootstrap), not 3.9 (OI)
# - Flat filesystem layout (no /64/ subdirs)
# -----------------------------------------------------------------------------
# Parameters you are likely to want to change
# -----------------------------------------------------------------------------
# Hammerhead NIGHTLY_OPTIONS:
# -F Do NOT do a non-DEBUG build (DEBUG only)
# -n Do not bringover from parent (use local sources)
# -C Run 'make check' (cstyle/hdrchk)
# -D Do a DEBUG build
# -A Check for ABI discrepancies
# -m Send mail on completion
# -r Check ELF runpaths
# -t Build and use workspace tools
#
# Note: -p (package creation) removed - Hammerhead uses Coral packaging
# Note: -C (check) removed - hdrchk/cstyle not available without tools rebuild
# -t builds onbld tools from source (rpcgen, ctf*, install, lex, yacc, etc.)
# This eliminates the dependency on pre-seeded OI tools.
export NIGHTLY_OPTIONS='-FntDAmr'
# Some scripts optionally send mail messages to MAILTO.
#export MAILTO=
# CODEMGR_WS - where is your workspace at
# Hammerhead: Fixed source tree location (BSD convention).
# The source tree is always at /usr/src/hammerhead/base.
# Do NOT use git rev-parse or other tools to guess — a wrong guess
# causes ROOT to resolve to "/" and the build overwrites the live system.
export CODEMGR_WS="/usr/src/hammerhead/base"
# -----------------------------------------------------------------------------
# Compiler Configuration
# -----------------------------------------------------------------------------
#
# Hammerhead uses GCC 14 exclusively - no shadow compilation
#
# Each entry has the form <name>,<path to binary>,<style> where name is a
# free-form name (possibly used in the makefiles to guard options), path is
# the path to the executable. style is the 'style' of command line taken by
# the compiler, currently either gnu (or gcc) or sun (or cc).
#
# Standalone: GCC 14 installed at /usr (bootstrap flat layout)
export GNUC_ROOT=/usr
export PRIMARY_CC=gcc14,$GNUC_ROOT/bin/gcc,gnu
export PRIMARY_CCC=gcc14,$GNUC_ROOT/bin/g++,gnu
# Stock upstream GCC 14 does not support -msave-args (OI-patched extension).
# Leave empty so Makefile.master's ?= default takes effect.
export SAVEARGS=
# Hammerhead: LD_ALTEXEC for direct $(LD) invocations in Makefiles.
export LD_ALTEXEC=/usr/bin/gnu-ld-wrapper
# Onbld tools path — built from source via -t flag.
# On first boot, pre-seeded tools may be used; after first successful build
# with -t, the freshly-built tools replace them.
export ONBLD_TOOLS="$CODEMGR_WS/usr/src/tools/proto/root_i386-nd/opt/onbld"
# Hammerhead: illumos native linker for kernel module linking.
# On Hammerhead, /usr/bin/ld is GNU ld. Kernel Makefiles use SUNLD directly.
export SUNLD=/usr/bin/sunld
# Shadow compilation disabled - single compiler only
export SHADOW_CCS=
export SHADOW_CCCS=
# Smatch disabled (simplifies build)
#export ENABLE_SMATCH=1
# Hammerhead: CUPS not in base OS — SMB printing disabled
# export ENABLE_SMB_PRINTING=
# -----------------------------------------------------------------------------
# Perl/Python Configuration
# -----------------------------------------------------------------------------
# Hammerhead: Perl 5.40 from bootstrap toolchain
export PERL_VERSION=5.40
export PERL_PKGVERS=-540
# Hammerhead: 64-bit only - disable 32-bit perl modules
export BUILDPERL32='#'
#export BUILDPERL64='#'
# Standalone: Python 3.13 from bootstrap (Makefile.master defaults to 3.9)
export PYTHON3_VERSION=3.13
export PYTHON3_PKGVERS=-313
export PYTHON3_SUFFIX=
# -----------------------------------------------------------------------------
# Tool Path Configuration
# -----------------------------------------------------------------------------
#
# On Hammerhead, boot-essential commands live in /bin (not /usr/bin).
# These override Makefile.master defaults (which use /usr/bin for OI compat).
#
export ED=/bin/ed
export LN=/bin/ln
export SYMLINK="/bin/ln -s"
export MKDIR=/bin/mkdir
export CHMOD=/bin/chmod
export MV="/bin/mv -f"
export RM="/bin/rm -f"
export GREP=/bin/grep
export EGREP="/bin/grep -E"
export KSH93=/bin/ksh93
export SED=/bin/sed
export AWK=/usr/bin/nawk
export CP="/bin/cp -f"
export CAT=/bin/cat
export SH=/bin/sh
export SORT=/bin/sort
export TR=/bin/tr
export XARGS=/bin/xargs
# -----------------------------------------------------------------------------
# Console/Display Configuration
# -----------------------------------------------------------------------------
# Set console color scheme either by build type:
#
#export RELEASE_CONSOLE_COLOR="-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_BLACK \
# -DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_WHITE"
#
#export DEBUG_CONSOLE_COLOR="-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_RED \
# -DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_WHITE"
#
# or just one for any build type:
#
#export DEFAULT_CONSOLE_COLOR="-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_BLACK \
# -DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_WHITE"
# Skip Java 11 builds on distributions that don't support it
#export BLD_JAVA_11=
# POST_NIGHTLY can be any command to be run at the end of the build.
# See hh-build for interactions between environment variables and this command.
#POST_NIGHTLY=
# Populates /etc/versions/build on each build run. Only enable if git is
# present (it's a Coral Layer-2 package, not in base proto). Without git,
# the cmd/nsadmin Makefile falls back to `touch` to create an empty
# version file, which is fine.
if command -v git >/dev/null 2>&1; then
export BUILDVERSION_EXEC="git describe --all --long --dirty"
fi
# -----------------------------------------------------------------------------
# Source Control / Bringover Configuration
# -----------------------------------------------------------------------------
#
# When the 'n' option is not present in NIGHTLY_OPTIONS, hh-build updates
# the build workspace from the sources identified by the following variables.
# Defaults are set in hh-build if the environment file leaves them unset.
#
# SCM in use. Defaults to "git"
#export BRINGOVER_SCM="git"
# URL or pathname to source workspace.
#export BRINGOVER_WS="${CLONE_WS}"
# Branch within BRINGOVER_WS; must be specified if BRINGOVER_WS is a URL
#export BRINGOVER_BRANCH=""
# Short name to use within CODEMGR_WS for BRINGOVER_WS (git-specific)
#export BRINGOVER_REMOTE=nightly_bringover_ws
# Command-line options to add to the clone operation
#export CLONE_OPTIONS=""
# -----------------------------------------------------------------------------
# Build System Configuration
# -----------------------------------------------------------------------------
# Maximum number of parallel make jobs, set to NCPUS.
# GNU Make's job server keeps all CPUs busy without needing extra padding.
function maxjobs
{
nameref maxjobs=$1
integer ncpu
integer -r min_mem_per_job=512 # minimum amount of memory for a job
ncpu=$(builtin getconf ; getconf 'NPROCESSORS_ONLN')
(( maxjobs=ncpu ))
# Throttle number of parallel jobs to a value which guarantees that
# all jobs have enough memory. This was added to avoid excessive
# paging/swapping in cases of virtual machine installations which
# have lots of CPUs but not enough memory assigned.
if [[ $(/usr/sbin/prtconf 2>'/dev/null') == ~(E)Memory\ size:\ ([[:digit:]]+)\ Megabytes ]] ; then
integer max_jobs_per_memory # parallel jobs which fit into physical memory
integer physical_memory # physical memory installed
# The array ".sh.match" contains the contents of capturing
# brackets in the last regex, .sh.match[1] will contain
# the value matched by ([[:digit:]]+), i.e. the amount of
# memory installed
physical_memory="10#${.sh.match[1]}"
((
max_jobs_per_memory=round(physical_memory/min_mem_per_job) ,
maxjobs=fmax(2, fmin(maxjobs, max_jobs_per_memory))
))
fi
return 0
}
# Hammerhead: parallelism control for GNU Make builds
# Reduced to -j4 for stability. Full parallelism (-j NCPU) exposes race
# conditions in kernel ctfmerge, _msg preprocessing, and locale data
# generation. Revisit after adding proper ordering constraints.
GMAKE_MAX_JOBS=4
export GMAKE_MAX_JOBS
# path to onbld tool binaries
# On standalone, there is no pre-installed /opt/onbld — the -t flag in
# NIGHTLY_OPTIONS causes hh-build to self-bootstrap tools from source.
ONBLD_BIN='/opt/onbld/bin'
# PARENT_WS is used to determine the parent of this workspace. This is
# for the options that deal with the parent workspace (such as where the
# proto area will go).
export PARENT_WS="${PARENT_WS:-}"
# CLONE_WS is the workspace hh-build should do a bringover from.
# The bringover, if any, is done as STAFFER.
export CLONE_WS="${CLONE_WS:-}"
# Set STAFFER to your own login as gatekeeper or developer
# The point is to use group "staff" and avoid referencing the parent
# workspace as root.
export STAFFER="$LOGNAME"
export MAILTO="${MAILTO:-$STAFFER}"
# If you wish the mail messages to be From: an arbitrary address, export
# MAILFROM.
#export MAILFROM="user@example.com"
# The project (see project(5)) under which to run this build. If not
# specified, the build is simply run in a new task in the current project.
export BUILD_PROJECT=''
# -----------------------------------------------------------------------------
# Architecture Configuration - Hammerhead is amd64-only
# -----------------------------------------------------------------------------
#
# MACH=i386 represents the x86 CPU family (used for Makefile directory selection)
# MACH64=amd64 is the actual 64-bit architecture we build
# BUILD32 is set to $(POUND_SIGN) in Makefile.master to disable 32-bit builds
#
export MACH=i386
export MACH64=amd64
# -----------------------------------------------------------------------------
# Path Configuration
# -----------------------------------------------------------------------------
export ATLOG="$CODEMGR_WS/log"
export LOGFILE="$ATLOG/build.log"
# Proto area - separate from source tree to prevent RPATH contamination
# and accidental overwrite of live system files.
export ROOT="/usr/src/hammerhead-build/root_${MACH64}"
export SRC="$CODEMGR_WS/usr/src"
export MULTI_PROTO="no"
# REF_PROTO_LIST - for comparing the list of stuff in your proto area
# with. Generally this should be left alone, since you want to see differences
# from your parent (the gate).
export REF_PROTO_LIST="$PARENT_WS/usr/src/proto_list_${MACH64}"
# Proto area in parent for optionally depositing a copy of headers and
# libraries corresponding to the protolibs target
export PARENT_ROOT="$PARENT_WS/proto/root_${MACH64}"
export PARENT_TOOLS_ROOT="$PARENT_WS/usr/src/tools/proto/root_$MACH-nd"
# -----------------------------------------------------------------------------
# Version Configuration
# -----------------------------------------------------------------------------
# Build version (YYYYMMDD-NN format, auto-generated by hh-build/bldenv).
# NOT exported as VERSION to avoid polluting sub-builds (e.g. zsh autotools).
#export HAMMERHEAD_VERSION="20260301-01"
# The RELEASE and RELEASE_DATE variables are set in Makefile.master;
# there might be special reasons to override them here, but that
# should not be the case in general
# export RELEASE='5.11'
# export RELEASE_DATE='October 2007'
# -----------------------------------------------------------------------------
# Package Configuration (IPS - disabled for Hammerhead)
# -----------------------------------------------------------------------------
#
# Hammerhead uses Coral packaging instead of IPS.
# These variables are kept for compatibility but -p is not in NIGHTLY_OPTIONS.
#
# PKGARCHIVE determines where the repository will be created.
# PKGPUBLISHER_REDIST controls the publisher setting for the repository.
#
export PKGARCHIVE="${CODEMGR_WS}/packages/${MACH64}/build"
# export PKGPUBLISHER_REDIST='on-redist'
# Package manifest format version.
export PKGFMT_OUTPUT='v2'
# -----------------------------------------------------------------------------
# Make Configuration
# -----------------------------------------------------------------------------
# We want make to do as much as it can, just in case there's more than
# one problem.
# We also must set e in MAKEFLAGS as the makefiles depend on importing
# the environment variables set here.
export MAKEFLAGS='ke'
# Hammerhead: Use GNU Make instead of dmake
export MAKE=gmake
# -----------------------------------------------------------------------------
# Build Tools Configuration
# -----------------------------------------------------------------------------
# Build tools - don't change these unless you know what you're doing. These
# variables allows you to get the compilers and onbld files locally.
# Set BUILD_TOOLS to pull everything from one location.
# Alternately, you can set ONBLD_TOOLS to where you keep the contents of
# SUNWonbld.
export BUILD_TOOLS='/opt'
#export ONBLD_TOOLS='/opt/onbld'
# Set this flag to 'n' to disable the use of 'checkpaths'. The default,
# if the 'N' option is not specified, is to run this test.
#CHECK_PATHS='y'
# Smatch integration (disabled by default in Hammerhead)
if [[ "$ENABLE_SMATCH" == "1" ]]; then
SMATCHBIN=$CODEMGR_WS/usr/src/tools/proto/root_$MACH-nd/opt/onbld/bin/$MACH/smatch
export SHADOW_CCS="$SHADOW_CCS smatch,$SMATCHBIN,smatch"
fi
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
# Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2016 RackTop Systems.
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2020 Joyent, Inc.
# Copyright 2024 Bill Sommerfeld <sommerfeld@hamachi.org>
#
# - This file is sourced by "bldenv" and "nightly" and should not
# be executed directly.
# - This script is only interpreted by ksh93 and explicitly allows the
# use of ksh93 language extensions.
# -----------------------------------------------------------------------------
# Parameters you are likely to want to change
# -----------------------------------------------------------------------------
# DEBUG build only (-D, -F)
# do not bringover from the parent (-n)
# runs 'make check' (-C)
# checks for new interfaces in libraries (-A)
# sends mail on completion (-m and the MAILTO variable)
# creates packages for PIT/RE (-p)
# checks for changes in ELF runpaths (-r)
# build and use this workspace's tools in $SRC/tools (-t)
export NIGHTLY_OPTIONS='-FnCDAmprt'
# Some scripts optionally send mail messages to MAILTO.
#export MAILTO=
# CODEMGR_WS - where is your workspace at
# Hammerhead repo structure: git root contains hammerhead/ subdirectory with source
# If CODEMGR_WS not set, detect from git root + /hammerhead
if [[ -z "$CODEMGR_WS" ]]; then
_gitroot=$(git rev-parse --show-toplevel 2>/dev/null)
if [[ -d "$_gitroot/hammerhead/usr/src" ]]; then
# Nested structure: repo/hammerhead/usr/src
export CODEMGR_WS="$_gitroot/hammerhead"
elif [[ -d "$_gitroot/usr/src" ]]; then
# Flat structure: repo/usr/src
export CODEMGR_WS="$_gitroot"
else
echo "Error: Cannot find usr/src directory" >&2
return 1
fi
unset _gitroot
else
export CODEMGR_WS
fi
# Compilers may be specified using the following variables:
# PRIMARY_CC - primary C compiler
# PRIMARY_CCC - primary C++ compiler
#
# SHADOW_CCS - list of shadow C compilers
# SHADOW_CCCS - list of shadow C++ compilers
#
# Each entry has the form <name>,<path to binary>,<style> where name is a
# free-form name (possibly used in the makefiles to guard options), path is
# the path to the executable. style is the 'style' of command line taken by
# the compiler, currently either gnu (or gcc) or sun (or cc), which is also
# used by Makefiles to guard options.
#
# for example:
# export PRIMARY_CC=gcc10,/opt/gcc-10/bin/gcc,gnu
# export PRIMARY_CCC=gcc10,/opt/gcc-10/bin/g++,gnu
# export SHADOW_CCS=studio12,/opt/SUNWspro/bin/cc,sun
# export SHADOW_CCCS=studio12,/opt/SUNWspro/bin/CC,sun
#
# There can be several space-separated entries in SHADOW_* to run multiple
# shadow compilers.
#
# To disable shadow compilation, unset SHADOW_* or set them to the empty string.
#
# Hammerhead: Use GCC 14 as primary compiler
export GNUC_ROOT=/usr/gcc/14
export PRIMARY_CC=gcc14,$GNUC_ROOT/bin/gcc,gnu
export PRIMARY_CCC=gcc14,$GNUC_ROOT/bin/g++,gnu
# Disable shadow compilation - single compiler only
export SHADOW_CCS=
export SHADOW_CCCS=
# Hammerhead: Disable smatch (simplify build)
#export ENABLE_SMATCH=1
# Comment this out to disable support for SMB printing, i.e. if you
# don't want to bother providing the CUPS headers this needs.
export ENABLE_SMB_PRINTING=
# If your distro uses certain versions of Perl, make sure either Makefile.master
# contains your new defaults OR your .env file sets them.
# These are how you would override for building on OmniOS r151028, for example.
#export PERL_VERSION=5.28
#export PERL_VARIANT=-thread-multi
#export PERL_PKGVERS=
# To disable building of the 32-bit or 64-bit perl modules (or both),
# uncomment these lines:
#export BUILDPERL32='#'
#export BUILDPERL64='#'
# If your distro uses certain versions of Python, make sure either
# Makefile.master contains your new defaults OR your .env file sets them.
#export PYTHON3_VERSION=3.9
#export PYTHON3_PKGVERS=-39
#export PYTHON3_SUFFIX=
# Set console color scheme either by build type:
#
#export RELEASE_CONSOLE_COLOR="-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_BLACK \
# -DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_WHITE"
#
#export DEBUG_CONSOLE_COLOR="-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_RED \
# -DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_WHITE"
#
# or just one for any build type:
#
#export DEFAULT_CONSOLE_COLOR="-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_BLACK \
# -DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_WHITE"
# Set if your distribution has different package versioning
#export PKGVERS_BRANCH=2018.0.0.17900
# Skip Java 11 builds on distributions that don't support it
#export BLD_JAVA_11=
# POST_NIGHTLY can be any command to be run at the end of nightly. See
# nightly(1) for interactions between environment variables and this command.
#POST_NIGHTLY=
# Populates /etc/versions/build on each nightly run
export BUILDVERSION_EXEC="git describe --all --long --dirty"
# -----------------------------------------------------------------------------
# When the 'n' option is not present in NIGHTLY_OPTIONS, nightly updates
# the build workspace from the sources identified by the following
# variables. Defaults are set in nightly if the environment file
# leaves them unset.
# -----------------------------------------------------------------------------
# SCM in use. Defaults to "git"; others are undertested.
#export BRINGOVER_SCM="git"
# URL or pathname to source workspace.
#export BRINGOVER_WS="${CLONE_WS}"
# Branch within BRINGOVER_WS; must be specified if BRINGOVER_WS is a URL
#export BRINGOVER_BRANCH=""
# Short name to use within CODEMGR_WS for BRINGOVER_WS.
# This is git-specific.
#export BRINGOVER_REMOTE=nightly_bringover_ws
# Command-line options to add to the clone operation that creates a new
# workspace. If git is in use, adding "--reference /path/to/local/illumos-gate"
# can speed up clones and make them use less disk space.
#export CLONE_OPTIONS=""
# -----------------------------------------------------------------------------
# You are less likely to need to modify parameters below.
# -----------------------------------------------------------------------------
# Maximum number of dmake jobs. The recommended number is 2 + NCPUS,
# where NCPUS is the number of logical CPUs on your build system.
function maxjobs
{
nameref maxjobs=$1
integer ncpu
integer -r min_mem_per_job=512 # minimum amount of memory for a job
ncpu=$(builtin getconf ; getconf 'NPROCESSORS_ONLN')
(( maxjobs=ncpu + 2 ))
# Throttle number of parallel jobs launched by dmake to a value which
# gurantees that all jobs have enough memory. This was added to avoid
# excessive paging/swapping in cases of virtual machine installations
# which have lots of CPUs but not enough memory assigned to handle
# that many parallel jobs
if [[ $(/usr/sbin/prtconf 2>'/dev/null') == ~(E)Memory\ size:\ ([[:digit:]]+)\ Megabytes ]] ; then
integer max_jobs_per_memory # parallel jobs which fit into physical memory
integer physical_memory # physical memory installed
# The array ".sh.match" contains the contents of capturing
# brackets in the last regex, .sh.match[1] will contain
# the value matched by ([[:digit:]]+), i.e. the amount of
# memory installed
physical_memory="10#${.sh.match[1]}"
((
max_jobs_per_memory=round(physical_memory/min_mem_per_job) ,
maxjobs=fmax(2, fmin(maxjobs, max_jobs_per_memory))
))
fi
return 0
}
maxjobs DMAKE_MAX_JOBS # "DMAKE_MAX_JOBS" passed as ksh(1) name reference
export DMAKE_MAX_JOBS
# path to onbld tool binaries
ONBLD_BIN='/opt/onbld/bin'
# PARENT_WS is used to determine the parent of this workspace. This is
# for the options that deal with the parent workspace (such as where the
# proto area will go).
export PARENT_WS="${PARENT_WS:-}"
# CLONE_WS is the workspace nightly should do a bringover from.
# The bringover, if any, is done as STAFFER.
export CLONE_WS="${CLONE_WS:-}"
# Set STAFFER to your own login as gatekeeper or developer
# The point is to use group "staff" and avoid referencing the parent
# workspace as root.
export STAFFER="$LOGNAME"
export MAILTO="${MAILTO:-$STAFFER}"
# If you wish the mail messages to be From: an arbitrary address, export
# MAILFROM.
#export MAILFROM="user@example.com"
# The project (see project(5)) under which to run this build. If not
# specified, the build is simply run in a new task in the current project.
export BUILD_PROJECT=''
# You should not need to change the next three lines
export ATLOG="$CODEMGR_WS/log"
export LOGFILE="$ATLOG/nightly.log"
# Hammerhead: amd64-only build
# MACH=i386 represents the x86 CPU family (used for directory selection).
# MACH64=amd64 is used for 64-bit builds.
# BUILD32 is set to $(POUND_SIGN) in Makefile.master to disable 32-bit.
export MACH=i386
#
# The following macro points to the closed binaries. Once illumos has
# totally freed itself, we can remove this reference.
#
# Location of encumbered binaries.
export ON_CLOSED_BINS="/opt/onbld/closed"
# REF_PROTO_LIST - for comparing the list of stuff in your proto area
# with. Generally this should be left alone, since you want to see differences
# from your parent (the gate).
#
export REF_PROTO_LIST="$PARENT_WS/usr/src/proto_list_${MACH}"
export ROOT="$CODEMGR_WS/proto/root_${MACH}"
export SRC="$CODEMGR_WS/usr/src"
export MULTI_PROTO="no"
#
# build environment variables, including version info for mcs, motd,
# motd, uname and boot messages. Mostly you shouldn't change this except
# when the release slips (nah) or you move an environment file to a new
# release
#
#export VERSION="${VERSION:-`git describe --long --all HEAD | cut -d/ -f2-`}"
#
# the RELEASE and RELEASE_DATE variables are set in Makefile.master;
# there might be special reasons to override them here, but that
# should not be the case in general
#
# export RELEASE='5.11'
# export RELEASE_DATE='October 2007'
# proto area in parent for optionally depositing a copy of headers and
# libraries corresponding to the protolibs target
# not applicable given the NIGHTLY_OPTIONS
#
export PARENT_ROOT="$PARENT_WS/proto/root_$MACH"
export PARENT_TOOLS_ROOT="$PARENT_WS/usr/src/tools/proto/root_$MACH-nd"
# Package creation variables. You probably shouldn't change these,
# either.
#
# PKGARCHIVE determines where the repository will be created.
#
# PKGPUBLISHER_REDIST controls the publisher setting for the repository.
#
export PKGARCHIVE="${CODEMGR_WS}/packages/${MACH}/nightly"
# export PKGPUBLISHER_REDIST='on-redist'
# Package manifest format version.
export PKGFMT_OUTPUT='v2'
# We want make to do as much as it can, just in case there's more than
# one problem.
# We also must set e in MAKEFLAGS as the makefiles depend on importing
# the environment variables set here.
export MAKEFLAGS='ke'
# Hammerhead: Use GNU Make instead of dmake
export MAKE=gmake
# Build tools - don't change these unless you know what you're doing. These
# variables allows you to get the compilers and onbld files locally.
# Set BUILD_TOOLS to pull everything from one location.
# Alternately, you can set ONBLD_TOOLS to where you keep the contents of
# SUNWonbld.
export BUILD_TOOLS='/opt'
#export ONBLD_TOOLS='/opt/onbld'
# Set this flag to 'n' to disable the use of 'checkpaths'. The default,
# if the 'N' option is not specified, is to run this test.
#CHECK_PATHS='y'
if [[ "$ENABLE_SMATCH" == "1" ]]; then
SMATCHBIN=$CODEMGR_WS/usr/src/tools/proto/root_$MACH-nd/opt/onbld/bin/$MACH/smatch
export SHADOW_CCS="$SHADOW_CCS smatch,$SMATCHBIN,smatch"
fi
|