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
)
23 GIT_REPO
=git
://github.com
/illumos
/gfx-drm.git
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 $(SOURCE_DIR
)/.downloaded
:
38 @
[ -d
$(SOURCE_DIR
) ] || \
39 $(GIT
) clone
-b
$(GIT_BRANCH
) $(GIT_REPO
) $(SOURCE_DIR
)
40 @cd
$(SOURCE_DIR
); $(GIT
) checkout
$(GIT_BRANCH
); $(GIT
) pull
--rebase \
41 $(GIT_REPO
) $(GIT_BRANCH
); $(GIT
) log
-1 --format
=%H
> .downloaded
44 @
[ -d
$(SOURCE_DIR
) ] || \
45 $(GIT
) clone
-b
$(GIT_BRANCH
) $(GIT_REPO
) $(SOURCE_DIR
)
46 cd
$(SOURCE_DIR
); $(GIT
) pull
--rebase
$(GIT_REPO
) $(GIT_BRANCH
); \
47 [ "$$($(GIT) log -1 --format=%H)" == "$$(cat .downloaded)" ] || \
48 $(GIT
) log
-1 --format
=%H
> .downloaded
50 download
:: $(SOURCE_DIR
)/.downloaded
53 PATCH_PATTERN?
= *.patch
54 PATCHES
= # please don't patch -- update gfx-drm instead
56 $(SOURCE_DIR
)/.patched
: $(SOURCE_DIR
)/.downloaded
$(PATCHES
)
59 $(GIT
) checkout
-f
&& \
63 prep
:: $(SOURCE_DIR
)/.patched
65 $(BUILD_DIR
)/$(MACH
)/.built
: $(SOURCE_DIR
)/.patched
66 @
[ -d
$(BUILD_DIR
)/$(MACH
) ] ||
$(MKDIR
) $(BUILD_DIR
)/$(MACH
)
70 -e
's|^export NIGHTLY_OPTIONS=.*|export NIGHTLY_OPTIONS=\"$(NIGHTLY_OPTIONS)\"|' \
71 -e
's|^export VERSION=.*|export VERSION=\"$$(git log -1 --format=illumos-%h)\"|' \
72 -e
's|^export CODEMGR_WS=.*|export CODEMGR_WS=\"$$PWD\"|' \
73 -e
's|^export ON_CLOSED_BINS=.*|export ON_CLOSED_BINS=\"/opt/onbld/closed\"|'; \
74 echo
export PYTHON_VERSION
=\"$(PYTHON_VERSION
)\"; \
75 echo
export ONNV_BUILDNUM
=$(ONNV_BUILDNUM
); \
76 echo
export PKGVERS_BRANCH
=$(ONNV_BUILDNUM
); \
79 $(ENV
) -i
/opt
/onbld
/bin
/bldenv env.sh
"cd usr/src; make install"
81 $(ENV
) -i
/opt
/onbld
/bin
/bldenv env.sh
"cd usr/src/pkg; make install"
84 PROTO_DIR
=$(SOURCE_DIR
)/proto
/root_i386
/
86 build
install: $(BUILD_DIR
)/$(MACH
)/.built
88 # Could we just provide a transforms directory here instead?
89 # BTW, what ../illumos-gate does here is gross.
90 $(BUILD_DIR
)/$(MACH
)/publish.transforms
: $(BUILD_DIR
)/$(MACH
)/.built
91 echo
"<transform set name=pkg.fmri -> edit value pkg://[^/]+/ pkg://$(PUBLISHER)/>" > \
92 $(BUILD_DIR
)/$(MACH
)/publish.transforms
93 echo
"<transform set name=pkg.fmri -> edit value ,.+: ,$(BUILD_VERSION):>" >> \
94 $(BUILD_DIR
)/$(MACH
)/publish.transforms
95 echo
"<transform set name=pkg.fmri -> emit set name=pkg.tmp.noincorporate value=true>">> \
96 $(BUILD_DIR
)/$(MACH
)/publish.transforms
97 echo
"<transform set name=pkg.fmri -> emit set name=userland.info.git-remote value=$(USERLAND_GIT_REMOTE)>" >> \
98 $(BUILD_DIR
)/$(MACH
)/publish.transforms
99 echo
"<transform set name=pkg.fmri -> emit set name=userland.info.git-branch value=$(USERLAND_GIT_BRANCH)>" >> \
100 $(BUILD_DIR
)/$(MACH
)/publish.transforms
101 echo
"<transform set name=pkg.fmri -> emit set name=userland.info.git-rev value=$(USERLAND_GIT_REV)>" >> \
102 $(BUILD_DIR
)/$(MACH
)/publish.transforms
103 echo
"<transform set name=pkg.fmri -> emit set name=gfx-drm.info.git-remote value=$(GIT_REPO)>" >> \
104 $(BUILD_DIR
)/$(MACH
)/publish.transforms
105 echo
"<transform set name=pkg.fmri -> emit set name=gfx-drm.info.git-branch value=$(GIT_BRANCH)>" >> \
106 $(BUILD_DIR
)/$(MACH
)/publish.transforms
107 echo
"<transform set name=pkg.fmri -> emit set name=gfx-drm.info.git-rev value=$(shell cd $(COMPONENT_SRC); git rev-parse HEAD)>" >> \
108 $(BUILD_DIR
)/$(MACH
)/publish.transforms
110 $(BUILD_DIR
)/$(MACH
)/.published
: $(BUILD_DIR
)/$(MACH
)/publish.transforms
111 $(RM
) -r
$(@D
)/pkgrecv.
dir
112 $(MKDIR
) $(@D
)/pkgrecv.
dir
113 pkgrepo
-s
$(GFX_DRM_REPO
) rebuild
114 pkgrecv
-s
$(GFX_DRM_REPO
) -d
$(@D
)/pkgrecv.
dir --raw \
115 $$(pkgrecv
-s
$(GFX_DRM_REPO
) --newest | sed
-f packages.ignore
)
116 for pkg in
$$(echo
$(@D
)/pkgrecv.
dir/*/*); do \
117 pkgmogrify
-O
$$pkg/manifest
$$pkg/manifest \
118 $(BUILD_DIR
)/$(MACH
)/publish.transforms
; \
119 pkgsend
-s
$(WS_REPO
) publish
--fmri-in-manifest \
120 -d
$(BUILD_DIR
)/$(MACH
)/overlay
-d
$$pkg $$pkg/manifest
; \
126 publish
: update
$(BUILD_DIR
)/$(MACH
)/.published
129 $(RM
) -r
$(CLEAN_PATHS
)
132 $(RM
) -r
$(CLOBBER_PATHS
)
134 REQUIRED_PACKAGES
+= developer
/build
/onbld
135 REQUIRED_PACKAGES
+= diagnostic
/scanpci
136 REQUIRED_PACKAGES
+= system
/library