| 1 | # $HeadURL$ |
|---|
| 2 | |
|---|
| 3 | NAME = cswclassutils |
|---|
| 4 | VERSION = 1.47 |
|---|
| 5 | CATEGORIES = utils |
|---|
| 6 | GARTYPE = v2 |
|---|
| 7 | |
|---|
| 8 | # a few handy functions for defining 'generic' things dynamically |
|---|
| 9 | set = $(eval $1 := $2) |
|---|
| 10 | |
|---|
| 11 | define cas_shortname |
|---|
| 12 | $(subst csw,,$(1)) |
|---|
| 13 | endef |
|---|
| 14 | |
|---|
| 15 | define csw_pkgname |
|---|
| 16 | CSWcas-$(call cas_shortname,$(1)) |
|---|
| 17 | endef |
|---|
| 18 | |
|---|
| 19 | define var_name |
|---|
| 20 | $(1)_$(call csw_pkgname,$(2)) |
|---|
| 21 | endef |
|---|
| 22 | |
|---|
| 23 | define spkg_desc_val |
|---|
| 24 | Class action script $(call cas_shortname,$(1)) |
|---|
| 25 | endef |
|---|
| 26 | |
|---|
| 27 | define pkgfiles_val |
|---|
| 28 | /usr/sadm/install/scripts/.*$(1) |
|---|
| 29 | endef |
|---|
| 30 | |
|---|
| 31 | define catname_val |
|---|
| 32 | cas_$(call cas_shortname,$(1)) |
|---|
| 33 | endef |
|---|
| 34 | |
|---|
| 35 | define spkg_desc |
|---|
| 36 | $(call set,$(call var_name,SPKG_DESC,$(1)),$(call spkg_desc_val,$(1))) |
|---|
| 37 | endef |
|---|
| 38 | |
|---|
| 39 | define pkg_files |
|---|
| 40 | $(call set,$(call var_name,PKGFILES,$(1)),$(call pkgfiles_val,$(1))) |
|---|
| 41 | endef |
|---|
| 42 | |
|---|
| 43 | define catname |
|---|
| 44 | $(call set,$(call var_name,CATALOGNAME,$(1)),$(call catname_val,$(1))) |
|---|
| 45 | endef |
|---|
| 46 | |
|---|
| 47 | # checkpkg understands this relationship now, so no need to override it |
|---|
| 48 | # any more. keep it here in case it ever becomes useful for something else |
|---|
| 49 | # define surplus_dep |
|---|
| 50 | # $(eval CHECKPKG_OVERRIDES_CSWcswclassutils += surplus-dependency|$(call csw_pkgname,$(1))) |
|---|
| 51 | # endef |
|---|
| 52 | |
|---|
| 53 | define bad_location |
|---|
| 54 | $(eval CHECKPKG_OVERRIDES_CSWcas-$(1) += bad-location-of-file|file=/usr/sadm/install/scripts/$(2).csw$(1)) |
|---|
| 55 | endef |
|---|
| 56 | |
|---|
| 57 | # end of handy functions |
|---|
| 58 | |
|---|
| 59 | DESCRIPTION = CSW class action utilities |
|---|
| 60 | |
|---|
| 61 | MASTER_SITES = |
|---|
| 62 | DISTFILES = COPYING CSWcas-initsmf.cswreleasenotes |
|---|
| 63 | |
|---|
| 64 | ARCHALL = 1 |
|---|
| 65 | |
|---|
| 66 | CONFIGURE_SCRIPTS = |
|---|
| 67 | BUILD_SCRIPTS = |
|---|
| 68 | TEST_SCRIPTS = |
|---|
| 69 | INSTALL_SCRIPTS = custom |
|---|
| 70 | |
|---|
| 71 | SPKG_SOURCEURL = http://www.opencsw.org |
|---|
| 72 | |
|---|
| 73 | FILEDIR = files |
|---|
| 74 | |
|---|
| 75 | CASFILES = $(wildcard $(FILEDIR)/CSW$(NAME).[ir].*) |
|---|
| 76 | CASLIST = $(foreach F,$(CASFILES), $(subst $(FILEDIR)/CSW$(NAME).,,$(F))) |
|---|
| 77 | CSWCLASSES = $(subst .,,$(sort $(suffix $(CASLIST)))) |
|---|
| 78 | |
|---|
| 79 | DISTFILES += $(subst $(FILEDIR)/,,$(CASFILES)) |
|---|
| 80 | |
|---|
| 81 | CASPACKAGES += $(foreach C,$(CSWCLASSES),CSWcas-$(call cas_shortname,$(C))) |
|---|
| 82 | |
|---|
| 83 | PACKAGES = CSWcswclassutils |
|---|
| 84 | PACKAGES += $(CASPACKAGES) |
|---|
| 85 | |
|---|
| 86 | RUNTIME_DEP_PKGS_CSWcswclassutils = $(CASPACKAGES) |
|---|
| 87 | |
|---|
| 88 | PROTOTYPE_MODIFIERS = cas |
|---|
| 89 | PROTOTYPE_FILES_cas = /usr/sadm/install/scripts/.* |
|---|
| 90 | PROTOTYPE_USER_cas = bin |
|---|
| 91 | PROTOTYPE_GROUP_cas = sys |
|---|
| 92 | |
|---|
| 93 | # set a unique description for each CAS |
|---|
| 94 | $(foreach C,$(CSWCLASSES),$(call spkg_desc,$(C))) |
|---|
| 95 | SPKG_DESC_CSWcswclassutils = $(DESCRIPTION) |
|---|
| 96 | |
|---|
| 97 | # and add the base set of files belonging to the CAS |
|---|
| 98 | $(foreach C,$(CSWCLASSES),$(call pkg_files,$(C))) |
|---|
| 99 | # and the catalog names |
|---|
| 100 | $(foreach C,$(CSWCLASSES),$(call catname,$(C))) |
|---|
| 101 | |
|---|
| 102 | # tell checkpkg to ignore the surplus dep on the subpkgs |
|---|
| 103 | #$(foreach C,$(CSWCLASSES),$(call surplus_dep,$(C))) |
|---|
| 104 | |
|---|
| 105 | # tell checkpkg to ignore the bad file location in the subpackages |
|---|
| 106 | $(foreach C,$(CSWCLASSES),$(call bad_location,$(call cas_shortname,$(C)),i)) |
|---|
| 107 | $(foreach C,$(CSWCLASSES),$(call bad_location,$(call cas_shortname,$(C)),r)) |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | # Add non-auto changes to checkpkg overrides, pkg files, etc. |
|---|
| 111 | |
|---|
| 112 | PKGFILES_CSWcas-cptemplates += /opt/csw/etc/templates |
|---|
| 113 | PKGFILES_CSWcas-initsmf += /opt/csw/etc/init.d/.* |
|---|
| 114 | PKGFILES_CSWcas-initsmf += /etc/opt/csw/init.d.* |
|---|
| 115 | PKGFILES_CSWcas-initsmf += /var/opt/csw/svc/.* |
|---|
| 116 | |
|---|
| 117 | # Mark these as _extra_ so they're applied after the excludes, which would |
|---|
| 118 | # include files from the other packages and thus clash. |
|---|
| 119 | PKGFILES_CSWcas-inetd_SHARED += /var/opt/csw/cswclassutils |
|---|
| 120 | PKGFILES_CSWcas-pycompile_SHARED += /var/opt/csw/cswclassutils |
|---|
| 121 | |
|---|
| 122 | CHECKPKG_OVERRIDES_CSWcas-initsmf += init-file-missing-cswinitsmf-class |
|---|
| 123 | CHECKPKG_OVERRIDES_CSWcas-initsmf += init-file-wrong-location |
|---|
| 124 | CHECKPKG_OVERRIDES_CSWcas-initsmf += init-file-wrong-location|/opt/csw/etc/init.d/csw.smf.sample |
|---|
| 125 | |
|---|
| 126 | # the doctype string |
|---|
| 127 | CHECKPKG_OVERRIDES_CSWcas-initsmf += file-with-bad-content|/usr/share|root/usr/sadm/install/scripts/i.cswinitsmf |
|---|
| 128 | |
|---|
| 129 | include gar/category.mk |
|---|
| 130 | |
|---|
| 131 | install-custom: |
|---|
| 132 | @echo " ==> Installing $(NAME) (custom)" |
|---|
| 133 | @rm -rf $(DESTDIR) |
|---|
| 134 | @ginstall -m 0755 -d $(DESTDIR)/opt/csw/etc/init.d |
|---|
| 135 | @ginstall -m 0755 -d $(DESTDIR)/etc/opt/csw/init.d |
|---|
| 136 | @ginstall -m 0755 -d $(DESTDIR)/opt/csw/etc/templates |
|---|
| 137 | @ginstall -m 0755 -d $(DESTDIR)$(docdir)/$(NAME) |
|---|
| 138 | @ginstall -m 0755 -d $(DESTDIR)/usr/sadm/install/scripts |
|---|
| 139 | @ginstall -m 0755 -d $(DESTDIR)/var/opt/csw/svc/manifest |
|---|
| 140 | @ginstall -m 0755 -d $(DESTDIR)/var/opt/csw/svc/method |
|---|
| 141 | @ginstall -m 0755 -d $(DESTDIR)/var/opt/csw/cswclassutils |
|---|
| 142 | @ginstall -m 0755 $(FILEDIR)/CSW$(NAME).csw.smf.sample $(DESTDIR)/opt/csw/etc/init.d/csw.smf.sample |
|---|
| 143 | @ginstall -m 0444 $(FILEDIR)/CSW$(NAME).README.CSW $(DESTDIR)$(docdir)/$(NAME)/README.CSW |
|---|
| 144 | @$(foreach CAS,$(CASLIST),ginstall -m 0555 $(FILEDIR)/CSW$(NAME).$(CAS) $(DESTDIR)/usr/sadm/install/scripts/$(CAS);) |
|---|
| 145 | @$(MAKECOOKIE) |
|---|