component(developer/golang-123): Add Component
[oi-userland.git] / components / openindiana / gfx-drm / Makefile
blobd7ea6fcfa8c9abe78436147ae9d7b01920cb1704
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 2016 Alexander Pyhalov
13 # Copyright 2016 Aurelien Larcher
14 # Copyright 2016 Gordon Ross
17 include ../../../make-rules/shared-macros.mk
19 COMPONENT_NAME= gfx-drm
20 COMPONENT_SRC= $(COMPONENT_NAME)
22 GIT=git
23 GIT_REPO=https://github.com/openindiana/gfx-drm.git
24 GIT_BRANCH=master
25 GIT_CHANGESET=HEAD
27 ONNV_BUILDNUM=$(BRANCHID)
28 NIGHTLY_OPTIONS=-nmrtN
30 COMPONENT_REVISION=$(shell cd $(COMPONENT_SRC); git rev-list HEAD --count)
32 GFX_DRM_REPO=$(SOURCE_DIR)/packages/$(MACH)/nightly-nd/repo.drm
34 CLEAN_PATHS += $(BUILD_DIR)
35 CLOBBER_PATHS += $(SOURCE_DIR)
37 COMPONENT_PREP_GIT=no
38 include $(WS_MAKE_RULES)/prep.mk
40 $(SOURCE_DIR)/.downloaded:
41 @[ -d $(SOURCE_DIR) ] || \
42 $(GIT) clone -b $(GIT_BRANCH) $(GIT_REPO) $(SOURCE_DIR)
43 @cd $(SOURCE_DIR); $(GIT) checkout $(GIT_BRANCH); $(GIT) pull --rebase \
44 $(GIT_REPO) $(GIT_BRANCH); $(GIT) log -1 --format=%H > .downloaded
46 update:
47 @[ -d $(SOURCE_DIR) ] || \
48 $(GIT) clone -b $(GIT_BRANCH) $(GIT_REPO) $(SOURCE_DIR)
49 cd $(SOURCE_DIR); $(GIT) pull --rebase $(GIT_REPO) $(GIT_BRANCH); \
50 [ "$$($(GIT) log -1 --format=%H)" == "$$(cat .downloaded)" ] || \
51 $(GIT) log -1 --format=%H > .downloaded
53 download:: $(SOURCE_DIR)/.downloaded
55 $(BUILD_DIR)/$(MACH)/.built: $(SOURCE_DIR)/.downloaded
56 $(MKDIR) $(@D)
57 cd $(SOURCE_DIR) && \
58 cat myenv.sh | \
59 (sed \
60 -e 's|^export NIGHTLY_OPTIONS=.*|export NIGHTLY_OPTIONS=\"$(NIGHTLY_OPTIONS)\"|' \
61 -e 's|^export VERSION=.*|export VERSION=\"$$(git log -1 --format=illumos-%h)\"|' \
62 -e 's|^export CODEMGR_WS=.*|export CODEMGR_WS=\"$$PWD\"|' \
63 -e 's|^export ON_CLOSED_BINS=.*|export ON_CLOSED_BINS=\"/opt/onbld/closed\"|'; \
64 echo export PYTHON_VERSION=\"$(PYTHON_VERSION)\"; \
65 echo export ONNV_BUILDNUM=$(ONNV_BUILDNUM); \
66 echo export PKGVERS_BRANCH=$(ONNV_BUILDNUM); \
67 echo export USERLAND_ARCHIVES=\"$(USERLAND_ARCHIVES)\"; \
68 ) > env.sh && \
69 cp tools/bldenv $(BUILD_DIR)/$(MACH)/bldenv && \
70 BLDENV=$(BUILD_DIR)/$(MACH)/bldenv && \
71 chmod u+wx $(BUILD_DIR)/$(MACH)/bldenv && \
72 cd $(SOURCE_DIR) && \
73 $(ENV) -i $${BLDENV} env.sh "cd usr/src; make install" && \
74 cd $(SOURCE_DIR) && \
75 $(ENV) -i $${BLDENV} env.sh "cd usr/src/pkg; make install"
76 $(TOUCH) $@
78 PROTO_DIR=$(SOURCE_DIR)/proto/root_i386/
80 build install: $(BUILD_DIR)/$(MACH)/.built
82 # Could we just provide a transforms directory here instead?
83 # BTW, what ../illumos-gate does here is gross.
84 $(BUILD_DIR)/$(MACH)/publish.transforms: $(BUILD_DIR)/$(MACH)/.built
85 echo "<transform set name=pkg.fmri -> edit value pkg://[^/]+/ pkg://$(PUBLISHER)/>" > \
86 $(BUILD_DIR)/$(MACH)/publish.transforms
87 echo "<transform set name=pkg.fmri -> edit value ,.+: ,$(BUILD_VERSION):>" >> \
88 $(BUILD_DIR)/$(MACH)/publish.transforms
89 echo "<transform set name=pkg.fmri -> emit set name=pkg.tmp.noincorporate value=true>">> \
90 $(BUILD_DIR)/$(MACH)/publish.transforms
91 echo "<transform set name=pkg.fmri -> emit set name=userland.info.git-remote value=$(USERLAND_GIT_REMOTE)>" >> \
92 $(BUILD_DIR)/$(MACH)/publish.transforms
93 echo "<transform set name=pkg.fmri -> emit set name=userland.info.git-branch value=$(USERLAND_GIT_BRANCH)>" >> \
94 $(BUILD_DIR)/$(MACH)/publish.transforms
95 echo "<transform set name=pkg.fmri -> emit set name=userland.info.git-rev value=$(USERLAND_GIT_REV)>" >> \
96 $(BUILD_DIR)/$(MACH)/publish.transforms
97 echo "<transform set name=pkg.fmri -> emit set name=gfx-drm.info.git-remote value=$(GIT_REPO)>" >> \
98 $(BUILD_DIR)/$(MACH)/publish.transforms
99 echo "<transform set name=pkg.fmri -> emit set name=gfx-drm.info.git-branch value=$(GIT_BRANCH)>" >> \
100 $(BUILD_DIR)/$(MACH)/publish.transforms
101 echo "<transform set name=pkg.fmri -> emit set name=gfx-drm.info.git-rev value=$(shell cd $(COMPONENT_SRC); git rev-parse HEAD)>" >> \
102 $(BUILD_DIR)/$(MACH)/publish.transforms
104 $(BUILD_DIR)/$(MACH)/.published: $(BUILD_DIR)/$(MACH)/publish.transforms
105 $(RM) -r $(@D)/pkgrecv.dir
106 $(MKDIR) $(@D)/pkgrecv.dir
107 pkgrepo -s $(GFX_DRM_REPO) rebuild
108 pkgrecv -s $(GFX_DRM_REPO) -d $(@D)/pkgrecv.dir --raw \
109 $$(pkgrecv -s $(GFX_DRM_REPO) --newest | sed -f packages.ignore)
110 for pkg in $$(echo $(@D)/pkgrecv.dir/*/*); do \
111 pkgmogrify -O $$pkg/manifest $$pkg/manifest \
112 $(BUILD_DIR)/$(MACH)/publish.transforms; \
113 pkgsend -s $(WS_REPO) publish --fmri-in-manifest \
114 -d $(BUILD_DIR)/$(MACH)/overlay -d $$pkg $$pkg/manifest; \
115 done
116 $(TOUCH) $@
118 .NOTPARALLEL:
120 publish: update $(BUILD_DIR)/$(MACH)/.published
122 clean::
123 $(RM) -r $(CLEAN_PATHS)
125 clobber:: clean
126 $(RM) -r $(CLOBBER_PATHS)
129 # Ensure that when printing packages delivered by gfx-drm, we ignore the
130 # packages that will be dropped when publishing to the userland repository.
132 # Note that the "pkg5.complete.fmris" cache file should contain all packages
133 # delivered by the gate, so that "packages.ignore.in" can be modified to apply
134 # a new filter without rebuilding the gate or the cached list.
136 print-package-names:
137 if test -d $(GFX_DRM_REPO); then \
138 pkgrepo list -H -F tsv -s $(GFX_DRM_REPO) \
139 | cut -f 2 \
140 | LANG=C LC_ALL=C sort -u \
141 > pkg5.complete.fmris; \
143 grep -v -x -F -f packages.ignore.in pkg5.complete.fmris > pkg5.fmris
144 cat pkg5.fmris
146 REQUIRED_PACKAGES += developer/build/onbld
147 REQUIRED_PACKAGES += diagnostic/scanpci
148 REQUIRED_PACKAGES += system/library
149 # Build requirements
150 REQUIRED_PACKAGES += developer/debug/mdb