2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL)". You may
4 # only use this file in accordance with the terms of the CDDL.
6 # A full copy of the text of the CDDL should have accompanied this
7 # source. A copy of the CDDL is also available via the Internet at
8 # http://www.illumos.org/license/CDDL.
12 # Copyright 2013, Andrzej Szeszo
13 # Copyright 2016, Adam Stevko
16 include ..
/..
/..
/make-rules
/shared-macros.mk
18 COMPONENT_NAME
= illumos-gate
19 COMPONENT_SRC
= $(COMPONENT_NAME
)
22 GIT_REPO
=https
://github.com
/illumos
/illumos-gate.git
26 FETCH
=$(WS_TOOLS
)/userland-fetch
31 NIGHTLY_OPTIONS
=-nCDmpt
33 NIGHTLY_OPTIONS
=-nCmpt
35 ONNV_BUILDNUM
=$(BRANCHID
)
37 COMPONENT_REVISION
=$(shell cd
$(COMPONENT_SRC
); git rev-list HEAD
--count
)
39 ON_REPO.NON_DEBUG
=$(SOURCE_DIR
)/packages
/$(MACH
)/nightly-nd
/repo.redist
40 ON_REPO.DEBUG
=$(SOURCE_DIR
)/packages
/$(MACH
)/nightly
/repo.redist
42 CLEAN_PATHS
+= $(BUILD_DIR
)
43 CLOBBER_PATHS
+= $(SOURCE_DIR
)
52 $(GIT
) -c fetch.fsckobjects
=false \
53 clone
-b
$(GIT_BRANCH
) $(GIT_REPO
) $(SOURCE_DIR
)
55 $(SOURCE_DIR
)/.downloaded
: $(SOURCE_DIR
)
56 @cd
$(SOURCE_DIR
); $(GIT
) checkout
$(GIT_BRANCH
); $(GIT
) pull \
57 $(GIT_REPO
); $(GIT
) log
-1 --format
=%H
> .downloaded
60 cd
$(SOURCE_DIR
); $(GIT
) pull
$(GIT_REPO
); \
61 [ "$$($(GIT) log -1 --format=%H)" == "$$(cat .downloaded)" ] || \
62 $(GIT
) log
-1 --format
=%H
> .downloaded
64 download
:: $(SOURCE_DIR
)/.downloaded
67 PATCH_PATTERN ?
= *.patch
68 PATCHES
= $(shell find
$(PATCH_DIR
) -type f
-name
'$(PATCH_PATTERN)' \
71 $(SOURCE_DIR
)/.patched
: $(SOURCE_DIR
)/.downloaded
$(PATCHES
)
74 $(GIT
) checkout
-f
&& \
76 for p in
$(PATCHES
); do \
77 echo
"\nPatch: $$p:"; \
78 $(GPATCH
) -d
$(@D
) $(GPATCH_FLAGS
) < $$p; \
80 @cd
$(SOURCE_DIR
); $(GIT
) log
-1 --format
=%H
> .downloaded
83 prep
:: $(SOURCE_DIR
)/.patched
85 $(BUILD_DIR
)/runtime-perl.p5m
: $(WS_TOOLS
)/runtime-perl.p5m
89 $(BUILD_DIR
)/$(MACH
)/.built
: $(SOURCE_DIR
)/.patched
$(BUILD_DIR
)/runtime-perl.p5m
92 cat usr
/src
/tools
/env
/illumos.sh | \
94 -e
's|^export NIGHTLY_OPTIONS=.*|export NIGHTLY_OPTIONS=\"$(NIGHTLY_OPTIONS)\"|' \
95 -e
's|^export CODEMGR_WS=.*|export CODEMGR_WS=\"$$PWD\"|' \
96 -e
'/^export ENABLE_SMATCH=/d' \
97 -e
's|^export MULTI_PROTO=.*|export MULTI_PROTO=\"$(MULTI_PROTO)\"|' \
98 -e
'/^export SHADOW_CCS=/d' \
99 -e
'/^export SHADOW_CCCS=/d' ; \
100 echo
export PERL_VERSION
=\"$(PERL_VERSION
)\"; \
101 echo
export PERL_VARIANT
=\"-thread-multi
\" ; \
102 echo
export PERL_PKGVERS
=\"-$(subst .
,,$(PERL_VERSION
))\"; \
103 echo
export DEP_RUNTIME_PERL
="$(BUILD_DIR)/runtime-perl.p5m"; \
104 echo
export BUILDPERL32
=\"#\"; \
105 echo
export PKGVERS_BRANCH
=$(ONNV_BUILDNUM
); \
106 echo
export BOOTBANNER1
=\"$(DISTRIBUTION_NAME
) $(DISTRIBUTION_VERSION
) Version ^v ^w-bit
\") > \
108 time
$(ENV
) .
/usr
/src
/tools
/scripts
/nightly
-V
$(shell cd
$(SOURCE_DIR
) && git log
-1 --format
=illumos-
%h
) illumos.sh
111 build
install: $(BUILD_DIR
)/$(MACH
)/.built
113 $(BUILD_DIR
)/$(MACH
)/.overlay
: $(BUILD_DIR
)/$(MACH
)/.built
114 $(MKDIR
) $(BUILD_DIR
)/$(MACH
)/overlay
116 $(CP
) -RP
$(COMPONENT_DIR
)/overlay
$(BUILD_DIR
)/$(MACH
)
119 $(CP
) $(BUILD_DIR
)/$(MACH
)/overlay
/boot
/splashimage.xpm \
120 $(BUILD_DIR
)/$(MACH
)/overlay
/boot
/solaris.xpm || true
124 $(BUILD_DIR
)/$(MACH
)/publish.transforms
: packages.ignore.in
$(BUILD_DIR
)/$(MACH
)/.overlay
125 echo
"<transform set name=pkg.fmri -> edit value pkg://[^/]+/ pkg://$(PUBLISHER)/>" > \
126 $(BUILD_DIR
)/$(MACH
)/publish.transforms
128 echo
"<transform set name=pkg.fmri -> edit value ,.+: ,$(BUILD_VERSION):>" >> \
129 $(BUILD_DIR
)/$(MACH
)/publish.transforms
131 echo
"<transform set name=pkg.fmri -> emit set name=userland.info.git-remote value=$(USERLAND_GIT_REMOTE)>" >> \
132 $(BUILD_DIR
)/$(MACH
)/publish.transforms
133 echo
"<transform set name=pkg.fmri -> emit set name=userland.info.git-branch value=$(USERLAND_GIT_BRANCH)>" >> \
134 $(BUILD_DIR
)/$(MACH
)/publish.transforms
135 echo
"<transform set name=pkg.fmri -> emit set name=userland.info.git-rev value=$(USERLAND_GIT_REV)>" >> \
136 $(BUILD_DIR
)/$(MACH
)/publish.transforms
138 echo
"<transform set name=pkg.fmri -> emit set name=illumos-gate.info.git-remote value=$(GIT_REPO)>" >> \
139 $(BUILD_DIR
)/$(MACH
)/publish.transforms
140 echo
"<transform set name=pkg.fmri -> emit set name=illumos-gate.info.git-branch value=$(GIT_BRANCH)>" >> \
141 $(BUILD_DIR
)/$(MACH
)/publish.transforms
142 echo
"<transform set name=pkg.fmri -> emit set name=illumos-gate.info.git-rev value=$(shell cd $(COMPONENT_SRC); git rev-parse HEAD)>" >> \
143 $(BUILD_DIR
)/$(MACH
)/publish.transforms
145 echo
"<transform set name=pkg.fmri -> emit set name=pkg.human-version value=$(shell cd $(COMPONENT_SRC); git rev-parse HEAD | cut -c1-10)>" >> \
146 $(BUILD_DIR
)/$(MACH
)/publish.transforms
147 echo
"<transform set name=pkg.fmri -> emit set name=userland.info.component value=$(COMPONENT)>" >> \
148 $(BUILD_DIR
)/$(MACH
)/publish.transforms
150 # Drop man pages for sun-solaris perl module to avoid conflicts between different versions
151 echo
"<transform file path=usr/share/man/man3perl/.* -> drop>" >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
153 # Needed for MTA replacement
154 echo
"<transform depend type=require fmri=pkg:/service/network/smtp/sendmail@.* -> emit depend type=require fmri=pkg:/system/mta>" >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
155 echo
"<transform depend type=require fmri=pkg:/service/network/smtp/sendmail@.* -> drop>" >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
156 echo
"<transform depend type=require fmri=service/network/smtp/sendmail -> emit depend type=require fmri=pkg:/system/mta>" >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
157 echo
"<transform depend type=require fmri=service/network/smtp/sendmail -> drop>" >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
159 # We want to replace dependency on particular agpart version, but preserve dependency on any version
160 echo
"<transform depend type=require fmri=pkg:/driver/graphics/agpgart@.* -> emit depend type=require fmri=pkg:/driver/graphics/agpgart>" >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
161 echo
"<transform depend type=require fmri=pkg:/driver/graphics/agpgart@.* -> drop>" >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
164 echo
"<transform set name=pkg.fmri value=pkg://[^/]*/system/boot/loader@.* -> emit file path=boot/loader.conf group=sys mode=0644 owner=root preserve=true>" >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
165 echo
"<transform set name=pkg.fmri value=pkg://[^/]*/system/boot/loader@.* -> emit file path=boot/openindiana.png group=sys mode=0444 owner=root >" >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
166 echo
"<transform set name=pkg.fmri value=pkg://[^/]*/system/boot/loader@.* -> emit file path=boot/forth/brand-hipster.4th group=sys mode=0444 owner=root >" >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
167 echo
"<transform set name=pkg.fmri value=pkg://[^/]*/system/boot/loader@.* -> emit file path=boot/forth/logo-openindiana.4th group=sys mode=0444 owner=root >" >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
170 # Settings for tagged pointers - causes several UltraI and UltraII systems to panic.
171 echo
"<transform set name=pkg.fmri value=pkg://[^/]*/system/kernel@.* -> emit file path=etc/system.d/reserve_bits_for_tagged_pointers group=sys mode=0644 owner=root preserve=true>" >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
174 # Fix dependencies on renamed runtime/java and runtime/java/runtime64 packages
175 echo
'<transform depend fmri=runtime/java$$ -> set fmri runtime/java/openjdk8>' >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
176 echo
'<transform depend fmri=runtime/java/runtime64$$ -> set fmri runtime/java/openjdk8>' >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
178 # Drop dependency on GCC compat links
179 echo
'<transform depend fmri=pkg:/system/library/gcc-.*-compat-links -> drop>' >> $(BUILD_DIR
)/$(MACH
)/publish.transforms
181 # Drop dependency on ignored packages
182 $(GSED
) -e
's|^\(.*\)$$|<transform depend fmri=pkg:/\1@.* -> drop>|' $< >> $@
184 # Handle overlay files
185 for i in
$$(cd
$(BUILD_DIR
)/$(MACH
)/overlay
; find .
-type f | \
186 cut
-c
3- |
sort); do \
187 echo
"<transform file path=$$i -> set action.hash $$i >" >> \
188 $(BUILD_DIR
)/$(MACH
)/publish.transforms
; \
189 echo
"<transform file path=$$i -> delete chash .* >" >> \
190 $(BUILD_DIR
)/$(MACH
)/publish.transforms
; \
194 # Generate the sed script for ignoring packages by fully qualified FMRI from a
195 # list of bare package names (without publisher or version information, etc).
196 # The list of FMRIs to ignore is also useful for other things, and is easier to
197 # use when not phrased directly as a sed script.
199 $(BUILD_DIR
)/$(MACH
)/packages.ignore
: packages.ignore.in
201 sed
-e
's,/,\\/,g' -e
's,.*,/^pkg:\\/\\/on-nightly\\/&@.*/d,' $< > $@
203 packages.ignore
: $(BUILD_DIR
)/$(MACH
)/packages.ignore
205 $(BUILD_DIR
)/$(MACH
)/.published
: $(BUILD_DIR
)/$(MACH
)/packages.ignore
$(BUILD_DIR
)/$(MACH
)/publish.transforms
206 $(RM
) -r
$(@D
)/pkgrecv.
dir
207 $(MKDIR
) $(@D
)/pkgrecv.
dir
210 $(RM
) -r
$(@D
)/pkgrepo-merged.
dir
211 $(MKDIR
) $(@D
)/pkgrepo-merged.
dir
212 pkgrepo
-s
$(@D
)/pkgrepo-merged.
dir create
214 pkgmerge
-d
$(@D
)/pkgrepo-merged.
dir \
215 -s variant.debug.illumos
=true
,$(ON_REPO.DEBUG
) \
216 -s variant.debug.illumos
=false
,$(ON_REPO.NON_DEBUG
)
218 pkgrepo
-s
$(@D
)/pkgrepo-merged.
dir rebuild
219 pkgrecv
-s
$(@D
)/pkgrepo-merged.
dir -d
$(@D
)/pkgrecv.
dir --raw \
220 $$(pkgrecv
-s
$(@D
)/pkgrepo-merged.
dir --newest \
221 | sed
-f
$(BUILD_DIR
)/$(MACH
)/packages.ignore
)
223 pkgrepo
-s
$(ON_REPO.NON_DEBUG
) rebuild
224 pkgrecv
-s
$(ON_REPO.NON_DEBUG
) -d
$(@D
)/pkgrecv.
dir --raw \
225 $$(pkgrecv
-s
$(ON_REPO.NON_DEBUG
) --newest \
226 | sed
-f
$(BUILD_DIR
)/$(MACH
)/packages.ignore
)
229 for pkg in
$$(echo
$(@D
)/pkgrecv.
dir/*/*); do \
230 pkgmogrify
-O
$$pkg/manifest
$$pkg/manifest \
231 $(BUILD_DIR
)/$(MACH
)/publish.transforms
; \
232 pkgsend
-s
$(WS_REPO
) publish
--fmri-in-manifest \
233 -d
$(BUILD_DIR
)/$(MACH
)/overlay
-d
$$pkg $$pkg/manifest
; \
240 publish
: update
$(BUILD_DIR
)/$(MACH
)/.published
243 $(RM
) -r
$(CLEAN_PATHS
)
246 $(RM
) -r
$(CLOBBER_PATHS
)
249 # Ensure that when printing packages delivered by illumos, we ignore the
250 # packages that will be dropped when publishing to the userland repository.
252 # Note that the "pkg5.complete.fmris" cache file should contain all packages
253 # delivered by the gate, so that "packages.ignore.in" can be modified to apply
254 # a new filter without rebuilding the gate or the cached list.
257 if
test -d
$(ON_REPO.NON_DEBUG
); then \
258 pkgrepo list
-H
-F tsv
-s
$(ON_REPO.NON_DEBUG
) \
260 | LANG
=C LC_ALL
=C
sort -u \
261 > pkg5.complete.fmris
; \
263 grep
-v
-x
-F
-f packages.ignore.in pkg5.complete.fmris
> pkg5.fmris
267 # The build-essential package almost always brings superset of packages needed
268 # to build illumos-gate. The only known exception is described below.
270 REQUIRED_PACKAGES
+= metapackages
/build-essential
273 # When we are in the process of changing the default Perl version we need to
274 # make sure the new Perl is installed during the illumos-gate build. We need
275 # to specify it explicitly here because the unversioned runtime/perl required
276 # by build-essential still points to the old Perl runtime version.
278 # We need to build the new Perl support from illumos-gate first, and then
279 # switch the unversioned runtime/perl to the new Perl version. If we would do
280 # that the other way we will end up with missing Perl modules that comes from
281 # the illumos-gate and some parts of the system won't work as expected.
283 # We cannot switch both illumos-gate and the unversioned runtime/perl in one
284 # step because the illumos-gate component is always built separately from the
285 # rest of oi-userland.
287 REQUIRED_PACKAGES
+= runtime
/perl-
$(subst .
,,$(PERL_VERSION
))