perl/Module-Build-Tiny: update to 0.051 for Perl 5.36 and 5.38
[oi-userland.git] / components / openindiana / pkg / Makefile
blob611d226e2f8b80c360f23bdc7ad53eee60d601c1
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 Adam Stevko. All rights reserved.
15 include ../../../make-rules/shared-macros.mk
17 COMPONENT_NAME= pkg
18 COMPONENT_SRC= $(COMPONENT_NAME)
20 COMPONENT_REVISION=$(shell cd $(COMPONENT_SRC); git rev-list HEAD --count)
22 GIT=git
23 GIT_REPO=https://github.com/OpenIndiana/pkg5.git
24 GIT_BRANCH=oi
25 GIT_CHANGESET=HEAD
27 MAKE=/usr/bin/make
29 PKG_REPO=$(SOURCE_DIR)/packages/$(MACH)/repo
31 DEVBOOK=$(SOURCE_DIR)/proto/dev-guide/book.pdf
33 CLEAN_PATHS += $(BUILD_DIR)
34 CLOBBER_PATHS += $(SOURCE_DIR)
36 COMPONENT_PREP_GIT=no
37 include $(WS_TOP)/make-rules/prep.mk
39 $(SOURCE_DIR)/.downloaded: component-environment-prep $(ARCHIVES:%=$(USERLAND_ARCHIVES)%)
40 @[ -d $(SOURCE_DIR) ] || \
41 $(GIT) clone -b $(GIT_BRANCH) $(GIT_REPO) $(SOURCE_DIR)
42 @cd $(SOURCE_DIR); $(GIT) checkout $(GIT_BRANCH); $(GIT) pull \
43 $(GIT_REPO); $(GIT) log -1 --format=%H > .downloaded
45 update:
46 @[ -d $(SOURCE_DIR) ] || \
47 $(GIT) clone -b $(GIT_BRANCH) $(GIT_REPO) $(SOURCE_DIR)
48 cd $(SOURCE_DIR); $(GIT) pull $(GIT_REPO); \
49 [ $$($(GIT) log -1 --format=%H) == $$(cat .downloaded) ] || \
50 $(GIT) log -1 --format=%H > .downloaded
52 download:: $(SOURCE_DIR)/.downloaded
54 $(BUILD_DIR)/$(MACH)/.built: $(SOURCE_DIR)/.downloaded
55 $(MKDIR) $(@D) && \
56 cd $(SOURCE_DIR)/src && \
57 PATH=$(PATH) $(MAKE) && PATH=$(PATH) $(MAKE) install && \
58 cd pkg && \
59 $(MAKE) clobber && \
60 $(MAKE) BUILD_VERSION=$(BUILD_VERSION) && \
61 $(MAKE) publish-pkgs BUILD_VERSION=$(BUILD_VERSION) && \
62 $(MAKE) repository-metadata && \
63 $(TOUCH) $@
65 # Target to generate developer's guide
66 devbook: $(DEVBOOK)
68 $(DEVBOOK): $(SOURCE_DIR)/.downloaded
69 cd $(SOURCE_DIR)/doc/dev-guide && \
70 $(MAKE)
72 build install: $(BUILD_DIR)/$(MACH)/.built
74 $(BUILD_DIR)/$(MACH)/publish.transforms: $(BUILD_DIR)/$(MACH)/.built
75 echo "<transform set name=pkg.fmri -> edit value pkg://[^/]+/ pkg://$(PUBLISHER)/>" > \
76 $(BUILD_DIR)/$(MACH)/publish.transforms
77 echo "<transform set name=pkg.fmri -> edit value ,.+: ,$(BUILD_VERSION):>" >> \
78 $(BUILD_DIR)/$(MACH)/publish.transforms
79 echo "<transform set name=pkg.fmri -> emit set name=pkg5.info.git-remote value=$(GIT_REPO)>" >> \
80 $(BUILD_DIR)/$(MACH)/publish.transforms
81 echo "<transform set name=pkg.fmri -> emit set name=pkg5.info.git-branch value=$(GIT_BRANCH)>" >> \
82 $(BUILD_DIR)/$(MACH)/publish.transforms
83 echo "<transform set name=pkg.fmri -> emit set name=pkg5.info.git-rev value=$(shell cd $(COMPONENT_SRC); git rev-parse HEAD)>" >> \
84 $(BUILD_DIR)/$(MACH)/publish.transforms
86 echo "<transform set name=pkg.fmri -> emit set name=pkg.human-version value=$(shell cd $(COMPONENT_SRC); git rev-parse HEAD | cut -c1-8)>" >> \
87 $(BUILD_DIR)/$(MACH)/publish.transforms
88 echo "<transform set name=pkg.fmri -> emit set name=userland.info.component value=$(COMPONENT)>" >> \
89 $(BUILD_DIR)/$(MACH)/publish.transforms
92 $(BUILD_DIR)/$(MACH)/.published: $(BUILD_DIR)/$(MACH)/publish.transforms
93 if [ -d $(@D)/pkgrecv.dir ]; then $(RM) -r $(@D)/pkgrecv.dir; fi
94 $(MKDIR) $(@D)/pkgrecv.dir
96 pkgrecv -s $(PKG_REPO) -d $(@D)/pkgrecv.dir --raw \
97 $$(pkgrecv -s $(PKG_REPO) --newest)
99 for pkg in $$(echo $(@D)/pkgrecv.dir/*/*); do \
100 pkgmogrify -O $$pkg/manifest $$pkg/manifest \
101 $(BUILD_DIR)/$(MACH)/publish.transforms; \
102 pkgsend -s $(WS_REPO) publish --fmri-in-manifest \
103 -d $(BUILD_DIR)/$(MACH)/overlay -d $$pkg $$pkg/manifest; \
104 done
106 $(TOUCH) $@
108 .NOTPARALLEL:
110 publish: update $(BUILD_DIR)/$(MACH)/.published update-metadata
112 print-package-names:
113 if test -d $(PKG_REPO); then \
114 pkgrepo list -H -F tsv -s $(PKG_REPO) \
115 | cut -f 2 \
116 | $(SORT) -u ; \
119 # Manually added dependencies
120 REQUIRED_PACKAGES += developer/opensolaris/pkg5
121 REQUIRED_PACKAGES += system/zones/internal
122 REQUIRED_PACKAGES += library/python/cherrypy-39
123 REQUIRED_PACKAGES += library/python/python-rapidjson-39
124 REQUIRED_PACKAGES += library/python/jsonschema-39
125 REQUIRED_PACKAGES += library/python/jsonrpclib-pelix-39
126 REQUIRED_PACKAGES += library/python/six-39