| 1 |
# vim: ft=make ts=4 sw=4 noet |
| 2 |
# |
| 3 |
# $Id: gar.pkg.mk 25870 2016-08-03 15:09:13Z cgrzemba $ |
| 4 |
# |
| 5 |
# Copyright 2006 Cory Omand |
| 6 |
# |
| 7 |
# Redistribution and/or use, with or without modification, is |
| 8 |
# permitted. This software is without warranty of any kind. The |
| 9 |
# author(s) shall not be liable in the event that use of the |
| 10 |
# software causes damage. |
| 11 |
# |
| 12 |
# gar.pkg.mk - Build Solaris packages |
| 13 |
# |
| 14 |
# |
| 15 |
|
| 16 |
# use opencsw pakckage db for resolve dependencies for IPS packages |
| 17 |
IPS_USE_PKG_DB = |
| 18 |
IPS_GET_DEP = |
| 19 |
# to brake dependency cycles can packages which match pattern be published in a post cycle |
| 20 |
IPS_2PHASE_PUBLISH = |
| 21 |
IPS_2PHASE_PUBLISH_PATTERN = $(if $(IPS_2PHASE_PUBLISH),%utils %util %tools %tool) |
| 22 |
# prepend this to the package name |
| 23 |
IPS_PACKAGE_PREFIX ?= opencsw/ |
| 24 |
# on publish cleanup preexisting package in repo |
| 25 |
IPS_RM_SAME_VERS ?= 1 |
| 26 |
|
| 27 |
PKGFORMAT-5.8 ?= svr4 |
| 28 |
PKGFORMAT-5.9 ?= svr4 |
| 29 |
PKGFORMAT-5.10 ?= svr4 |
| 30 |
PKGFORMAT ?= svr4 |
| 31 |
PKGFORMAT = $(PKGFORMAT-$(GAROSREL)) |
| 32 |
|
| 33 |
ifeq ($(DEBUG_PACKAGING),) |
| 34 |
_DBG=@ |
| 35 |
DEBUG_FLAG = |
| 36 |
else |
| 37 |
_DBG= |
| 38 |
DEBUG_FLAG = --debug |
| 39 |
endif |
| 40 |
|
| 41 |
PKGINFO ?= /usr/bin/pkginfo |
| 42 |
|
| 43 |
# You can use either PACKAGES with dynamic gspec-files or explicitly add gspec-files to DISTFILES. |
| 44 |
# Do "PACKAGES = CSWmypkg" when you build a package whose NAME is not the package name. |
| 45 |
# If no explicit gspec-files have been defined the default name for the package is CSW$(NAME). |
| 46 |
# The whole processing is done from _PKG_SPECS, which includes all packages to be build. |
| 47 |
|
| 48 |
# SRCPACKAGE_BASE is the name of the package containing the sourcefiles for all packages |
| 49 |
# generated from this GAR recipe. It defaults to the first defined package name or gspec. |
| 50 |
# SRCPACKAGE is the name of the package containing the sources |
| 51 |
|
| 52 |
ifeq ($(origin PACKAGES), undefined) |
| 53 |
PACKAGES = $(if $(filter %.gspec,$(DISTFILES)),,OZSW$(subst _,-,$(NAME))) |
| 54 |
CATALOGNAME ?= $(if $(filter %.gspec,$(DISTFILES)),,$(subst -,_,$(NAME))) |
| 55 |
SRCPACKAGE_BASE = $(firstword $(basename $(filter %.gspec,$(DISTFILES))) $(PACKAGES)) |
| 56 |
SRCPACKAGE ?= $(SRCPACKAGE_BASE)-src |
| 57 |
SPKG_SPECS ?= $(basename $(filter %.gspec,$(DISTFILES))) $(PACKAGES) $(if $(NOSOURCEPACKAGE),,$(SRCPACKAGE)) |
| 58 |
else |
| 59 |
CATALOGNAME ?= $(if $(filter-out $(firstword $(PACKAGES)),$(PACKAGES)),,$(subst -,_,$(patsubst OZSW%,%,$(PACKAGES)))) |
| 60 |
SRCPACKAGE_BASE = $(firstword $(PACKAGES)) |
| 61 |
SRCPACKAGE ?= $(SRCPACKAGE_BASE)-src |
| 62 |
OBSOLETING_PKGS ?= $(sort $(PACKAGES) $(FOREIGN_PACKAGES)) |
| 63 |
OBSOLETED_PKGS ?= $(sort $(foreach P,$(OBSOLETING_PKGS),$(OBSOLETED_BY_$P))) |
| 64 |
SPKG_SPECS ?= $(sort $(basename $(filter %.gspec,$(DISTFILES))) $(PACKAGES) $(OBSOLETED_PKGS) $(if $(NOSOURCEPACKAGE),,$(SRCPACKAGE))) |
| 65 |
endif |
| 66 |
|
| 67 |
# For creating default pkgnames, e.g. CSWpy-$(DASHED_NAME) |
| 68 |
DASHED_NAME ?= $(subst _,-,$(patsubst OZSW%,%,$(NAME))) |
| 69 |
|
| 70 |
# Automatic definitions for source package |
| 71 |
CATALOGNAME_$(SRCPACKAGE) ?= $(patsubst OZSW%,%,$(SRCPACKAGE_BASE))_src |
| 72 |
SPKG_DESC_$(SRCPACKAGE) ?= $(SPKG_DESC_$(SRCPACKAGE_BASE)) Source Package |
| 73 |
ARCHALL_$(SRCPACKAGE) ?= 1 |
| 74 |
# XXX: Use Repository Root instead of fixed URL as base |
| 75 |
GARSYSTEMVERSION ?= $(shell $(SVN) propget svn:externals $(CURDIR) | perl -ane 'if($$F[0] eq "gar") { print ($$F[1]=~m(https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/gar/(.*))),"\n";}') |
| 76 |
GARPKG_v1 = OZSWgar-v1 |
| 77 |
GARPKG_v2 = OZSWgar-v2 |
| 78 |
RUNTIME_DEP_PKGS_$(SRCPACKAGE) ?= $(or $(GARPKG_$(GARSYSTEMVERSION)),$(error GAR version $(GARSYSTEMVERSION) unknown)) |
| 79 |
|
| 80 |
# Set the catalog release based on hostname. E.g. building on current9s will |
| 81 |
# set CATALOG_RELEASE to 'current'. Used by checkpkg to query the right branch |
| 82 |
# in the buildfarm pkgdb. For off-site usage this can default to unstable. |
| 83 |
HOSTNAME := $(shell hostname) |
| 84 |
CATALOG_RELEASE ?= $(shell echo $(HOSTNAME) | gsed -re 's/[0-9]{1,2}[sx]$$//') |
| 85 |
ifeq ($(HOSTNAME),$(CATALOG_RELEASE)) |
| 86 |
CATALOG_RELEASE=unstable |
| 87 |
endif |
| 88 |
|
| 89 |
# Handle uncompressed packages. We can't assume all packages have the .gz |
| 90 |
# suffix. |
| 91 |
ifeq "$(filter --nocompress,$(MKPACKAGE_ARGS))" "" |
| 92 |
COMPRESSION_SUFFIX = .gz |
| 93 |
else |
| 94 |
COMPRESSION_SUFFIX = |
| 95 |
endif |
| 96 |
|
| 97 |
define obsoleted_pkg |
| 98 |
# function 'catalogname' must not be used due to recursive calls to CATALOGNAME_* |
| 99 |
CATALOGNAME_$(1) ?= $(subst -,_,$(patsubst OZSW%,%,$(1)))_stub |
| 100 |
# The length of the description has been limited to 100 characters, |
| 101 |
# the string is cut (no longer on word boundaries). |
| 102 |
SPKG_DESC_$(1) ?= $(shell echo Transitional package. Content moved to $(foreach P,$(OBSOLETING_PKGS),$(if $(filter $(1),$(OBSOLETED_BY_$P)),$P)) | perl -npe 's/(.{100}).+/substr($$1,0,96) . " ..."/e') |
| 103 |
RUNTIME_DEP_PKGS_$(1) += $(foreach P,$(OBSOLETING_PKGS),$(if $(filter $(1),$(OBSOLETED_BY_$P)),$P)) |
| 104 |
PKGFILES_$(1) ?= NOFILES |
| 105 |
ARCHALL_$(1) ?= 1 |
| 106 |
# For legacy packages we know that the dependency is correct because we deliberately set it |
| 107 |
# A legacy dependency from another package may not have been released |
| 108 |
# The catalog name may not match for legacy packages |
| 109 |
# The overridden package may be a devel package, as it is empty it is ok to be archall |
| 110 |
$(foreach P,$(OBSOLETING_PKGS),$(if $(filter $(1),$(OBSOLETED_BY_$P)), |
| 111 |
CHECKPKG_OVERRIDES_$(1) += surplus-dependency|$P |
| 112 |
$(if $(filter $P,$(FOREIGN_PACKAGES)),CHECKPKG_OVERRIDES_$(1) += unidentified-dependency|$P) |
| 113 |
)) |
| 114 |
CHECKPKG_OVERRIDES_$(1) += catalogname-does-not-match-pkgname |
| 115 |
CHECKPKG_OVERRIDES_$(1) += archall-devel-package |
| 116 |
endef |
| 117 |
|
| 118 |
$(foreach P,$(OBSOLETED_PKGS),$(eval $(call obsoleted_pkg,$P))) |
| 119 |
|
| 120 |
_PKG_SPECS = $(filter-out $(NOPACKAGE),$(SPKG_SPECS)) |
| 121 |
$(if $(_PKG_SPECS),,$(error No packages for building defined)) |
| 122 |
|
| 123 |
# dev and doc represented as facet in IPS |
| 124 |
NOPACKAGE_IPS = $(if $(filter ips,$(PKGFORMAT)),%-dev %-doc) |
| 125 |
_PKG_SPECS_IPS = $(filter-out $(NOPACKAGE) $(NOPACKAGE_IPS),$(or $(PACKAGES_IPS),$(patsubst OZSW%,%,$(SPKG_SPECS)),$(NAME))) |
| 126 |
|
| 127 |
# The is the name of the package containing the sourcefiles for all packages generated from this GAR recipe. |
| 128 |
# It defaults to the first defined package name or gspec. SRCPACKAGE_BASE is guaranteed |
| 129 |
# to be one of the real packages built. |
| 130 |
SRCPACKAGE_BASE = $(if $(PACKAGES),$(firstword $(PACKAGES)),$(firstword $(SPKG_SPECS))) |
| 131 |
|
| 132 |
SRCPACKAGE ?= $(SRCPACKAGE_BASE)-src |
| 133 |
CATALOGNAME_$(SRCPACKAGE) ?= $(patsubst OZSW%,%,$(SRCPACKAGE_BASE))_src |
| 134 |
SPKG_DESC_$(SRCPACKAGE) ?= $(SPKG_DESC_$(SRCPACKAGE_BASE)) Source Package |
| 135 |
ARCHALL_$(SRCPACKAGE) ?= 1 |
| 136 |
GARSYSTEMVERSION ?= $(shell $(SVN) propget svn:externals $(CURDIR) | perl -ane 'if($$F[0] eq "gar") { print ($$F[1]=~m(https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/gar/(.*))),"\n";}') |
| 137 |
GARPKG_v1 = OZSWgar-v1 |
| 138 |
GARPKG_v2 = OZSWgar-v2 |
| 139 |
RUNTIME_DEP_PKGS_$(SRCPACKAGE) ?= $(or $(GARPKG_$(GARSYSTEMVERSION)),$(error GAR version $(GARSYSTEMVERSION) unknown)) |
| 140 |
|
| 141 |
# Sanity checks for r8335 |
| 142 |
$(if $(NO_ISAEXEC),$(error The deprecated variable 'NO_ISAEXEC' is defined, this is now the default, please remove the line)) |
| 143 |
$(if $(NOISAEXEC),$(error The deprecated variable 'NOISAEXEC' is defined, this is now the default, please remove the line)) |
| 144 |
$(if $(PREREQUISITE_PKGS),$(error The deprecated variable 'PREREQUISITE_PKGS' is defined, please replace it with BUILD_DEP_PKGS)) |
| 145 |
$(foreach P,$(SPKG_SPECS),$(if $(PREREQUISITE_PKGS_$P),$(error The deprecated variable 'PREREQUISITE_PKGS_$P' is defined, please replace it with BUILD_DEP_PKGS_$P))) |
| 146 |
$(if $(REQUIRED_PKGS),$(error The deprecated variable 'REQUIRED_PKGS' is defined, please replace it with RUNTIME_DEP_PKGS)) |
| 147 |
$(foreach P,$(SPKG_SPECS),$(if $(REQUIRED_PKGS_$P),$(error The deprecated variable 'REQUIRED_PACKAGES_$P' is defined, please replace it with RUNTIME_DEP_PKGS_$P))) |
| 148 |
|
| 149 |
BUNDLE ?= $(NAME) |
| 150 |
|
| 151 |
# pkgname - Get the name of a package from a gspec-name or package-name |
| 152 |
# |
| 153 |
# This is a safety function. In sane settings it should return the name |
| 154 |
# of the package given as argument. However, when gspec-files are in DISTFILES |
| 155 |
# it is possible to name the gspec-file differently from the package. This is |
| 156 |
# a very bad idea, but we can handle it! |
| 157 |
# |
| 158 |
# In: arg1 - name of gspec-file or package |
| 159 |
# Out: name of package |
| 160 |
# |
| 161 |
define pkgname |
| 162 |
$(strip |
| 163 |
$(if $(filter $(1),$(PACKAGES)), |
| 164 |
$(1), |
| 165 |
$(shell perl -F'\s+' -ane 'print "$$F[2]" if( $$F[0] eq "%var" && $$F[1] eq "pkgname")' files/$(1).gspec) |
| 166 |
) |
| 167 |
) |
| 168 |
endef |
| 169 |
|
| 170 |
# catalogname - Get the catalog-name for a package |
| 171 |
# |
| 172 |
# In: arg1 - name of package |
| 173 |
# Out: catalog-name for the package |
| 174 |
# |
| 175 |
define catalogname |
| 176 |
$(strip |
| 177 |
$(if $(CATALOGNAME_$(1)), |
| 178 |
$(CATALOGNAME_$(1)), |
| 179 |
$(if $(CATALOGNAME), |
| 180 |
$(CATALOGNAME), |
| 181 |
$(if $(filter $(1),$(PACKAGES) $(OBSOLETED_PKGS)), |
| 182 |
$(subst -,_,$(patsubst OZSW%,%,$(1))), |
| 183 |
$(if $(realpath files/$(1).gspec), |
| 184 |
$(shell perl -F'\s+' -ane 'print "$$F[2]" if( $$F[0] eq "%var" && $$F[1] eq "bitname")' files/$(1).gspec), |
| 185 |
$(error The catalog name for the package '$1' could not be determined, because it was neither in PACKAGES nor was there a gspec-file) |
| 186 |
) |
| 187 |
) |
| 188 |
) |
| 189 |
) |
| 190 |
) |
| 191 |
endef |
| 192 |
|
| 193 |
# We do not put this in $(docdir), as the prefix may have been reset to some |
| 194 |
# other location and the license should always be in a fixed location. |
| 195 |
define licensedir |
| 196 |
$(BUILD_PREFIX)/share/doc/$(call catalogname,$(1)) |
| 197 |
endef |
| 198 |
|
| 199 |
# Set this to your svn binary |
| 200 |
SVN ?= /opt/csw/bin/svn |
| 201 |
GAWK ?= /usr/bin/gawk |
| 202 |
|
| 203 |
# We have to deal with four cases here: |
| 204 |
# 1. There is no svn binary -> NOSVN |
| 205 |
# 2. There is a svn binary, but the directory does not belong to a repository -> NOTVERSIONED |
| 206 |
# 3. There is a svn binary, but not everything was committed properly -> UNCOMMITTED |
| 207 |
# 4. There is a svn binary and everything was committed -> r<revision> |
| 208 |
|
| 209 |
ifndef SPKG_PACKAGER |
| 210 |
$(warning Please set SPKG_PACKAGER in your .garrc file to your name) |
| 211 |
SPKG_PACKAGER = Unknown |
| 212 |
endif |
| 213 |
|
| 214 |
ifndef SPKG_EMAIL |
| 215 |
$(warning Please set SPKG_EMAIL in your .garrc file to your email address) |
| 216 |
SPKG_EMAIL = Unknown |
| 217 |
endif |
| 218 |
|
| 219 |
define ALLVERSIONFLAGS |
| 220 |
$(if $(VERSION_FLAG_PATCH),p) |
| 221 |
endef |
| 222 |
|
| 223 |
ifneq ($(call ALLVERSIONFLAGS),) |
| 224 |
SPKG_VERSION_FLAGS ?= ,$(call ALLVERSIONFLAGS) |
| 225 |
endif |
| 226 |
|
| 227 |
SPKG_DESC ?= $(DESCRIPTION) |
| 228 |
SPKG_VERSION ?= $(subst -,_,$(VERSION)$(SPKG_VERSION_FLAGS)) |
| 229 |
SPKG_CATEGORY ?= application |
| 230 |
SPKG_SOURCEURL ?= $(firstword $(VENDOR_URL) \ |
| 231 |
$(if $(filter $(GNU_MIRROR),$(MASTER_SITES)),http://www.gnu.org/software/$(GNU_PROJ)) \ |
| 232 |
$(MASTER_SITES) \ |
| 233 |
$(GIT_REPOS)) |
| 234 |
SPKG_VENDOR ?= $(SPKG_SOURCEURL) packaged for CSW by $(SPKG_PACKAGER) |
| 235 |
SPKG_PSTAMP ?= $(shell hostname)-$(call _REVISION)-$(shell date '+%Y%m%d%H%M%S') |
| 236 |
SPKG_BASEDIR ?= $(prefix) |
| 237 |
SPKG_OSNAME := $(if $(SPKG_OSNAME),$(SPKG_OSNAME),$(shell /usr/bin/uname -s)$(shell /usr/bin/uname -r)) |
| 238 |
|
| 239 |
SPKG_SPOOLROOT ?= /export/home/ai/ozsw-spool |
| 240 |
SPKG_SPOOLDIR ?= $(SPKG_SPOOLROOT)/spool.$(GAROSREL)-$(GARCH) |
| 241 |
ifdef SPKG_EXPORT |
| 242 |
# The definition may include variable parts like a call to "date". This would lead to different directory names |
| 243 |
# for multiple invocation in longs builds and a failing checkpkg due to lookup in wrong directories, so fixate |
| 244 |
# once what we have. |
| 245 |
SPKG_EXPORT := $(SPKG_EXPORT) |
| 246 |
else |
| 247 |
SPKG_EXPORT ?= /export/home/ai/ozsw-export |
| 248 |
endif |
| 249 |
SPKG_EXPORT_IPS ?= $(HOME)/staging/ips |
| 250 |
SPKG_PKGROOT ?= $(PKGROOT) |
| 251 |
SPKG_PKGBASE ?= $(PKGROOT) |
| 252 |
SPKG_WORKDIR ?= $(CURDIR)/$(WORKDIR) |
| 253 |
SPKG_TMPDIR ?= /tmp |
| 254 |
|
| 255 |
SPKG_DEPEND_DB = $(GARDIR)/csw/depend.db |
| 256 |
|
| 257 |
# These variables could change value transiently and need to be passed to subinvocations of GAR |
| 258 |
_PASS_GAR_SUBINVOCATION_EXPORTS += SPKG_EXPORT |
| 259 |
_PASS_GAR_ENV = $(foreach V,$(_PASS_GAR_SUBINVOCATION_EXPORTS),$V=$($V)) |
| 260 |
|
| 261 |
# This is the old specification being evaluated during mkpackage. The expansion of the SPKG_REVSTAMP leads to |
| 262 |
# problems later on when need the filename for checkpkg again and too much time has passed. In the new approach |
| 263 |
# the packagename is directly put in the gspec. |
| 264 |
# SPKG_PKGFILE ?= %{bitname}-%{SPKG_VERSION},%{SPKG_REVSTAMP}-%{SPKG_OSNAME}-%{arch}-$(or $(filter $(call _REVISION),UNCOMMITTED NOTVERSIONED NOSVN),CSW).pkg |
| 265 |
|
| 266 |
# The filename for a package |
| 267 |
define _pkgfile |
| 268 |
$(call catalogname,$(1))-$(call pkgvar,SPKG_VERSION,$(1)),$(call pkgvar,SPKG_REVSTAMP,$(1))-$(call pkgvar,SPKG_OSNAME,$(1))-$(if $(or $(ARCHALL),$(ARCHALL_$(1))),all,$(GARCH))-$(or $(filter $(call _REVISION),UNCOMMITTED NOTVERSIONED NOSVN),CSW).pkg |
| 269 |
endef |
| 270 |
|
| 271 |
MIGRATECONF ?= $(strip $(foreach S,$(filter-out $(OBSOLETED_PKGS),$(SPKG_SPECS)),$(if $(or $(MIGRATE_FILES_$S),$(MIGRATE_FILES)),/etc/opt/csw/pkg/$S/cswmigrateconf))) |
| 272 |
|
| 273 |
# It is NOT sufficient to change the pathes here, they must be adjusted in merge-* also |
| 274 |
_USERGROUP_FILES ?= $(strip $(foreach S,$(SPKG_SPECS),$(if $(value $(S)_usergroup),/etc/opt/csw/pkg/$S/cswusergroup))) |
| 275 |
_INETDCONF_FILES ?= $(strip $(foreach S,$(SPKG_SPECS),$(if $(value $(S)_inetdconf),/etc/opt/csw/pkg/$S/inetd.conf))) |
| 276 |
_ETCSERVICES_FILES ?= $(strip $(foreach S,$(SPKG_SPECS),$(if $(value $(S)_etcservices),/etc/opt/csw/pkg/$S/services))) |
| 277 |
|
| 278 |
USERGROUP += $(_USERGROUP_FILES) |
| 279 |
INETDCONF += $(_INETDCONF_FILES) |
| 280 |
ETCSERVICES += $(_ETCSERVICES_FILES) |
| 281 |
|
| 282 |
# This is the default path for texinfo pages to be picked up. Extend or replace as necessary. |
| 283 |
TEXINFO ?= $(infodir)/.*\.info(?:-\d+)? $(EXTRA_TEXINFO) |
| 284 |
|
| 285 |
# These are the default paths for TeX packages to be picked up. |
| 286 |
TEXHASH ?= $(texmfdir)/.* $(texmfconfigdir)/.* $(texmfdistdir)/.* $(texmflocaldir)/.* $(texmfvardir)/.* |
| 287 |
|
| 288 |
# These are the default paths for DICT server dictionaries packages to be picked up. |
| 289 |
DICTCONF ?= $(dictddir)/.* |
| 290 |
|
| 291 |
# if AP2_MODS is set, files matching this shell glob (passed to find) |
| 292 |
# will have 'build' set as their class |
| 293 |
AP2_MODFILES ?= opt/csw/apache2/libexec/*so $(EXTRA_AP2_MODFILES) |
| 294 |
PHP5_EXTFILES ?= *so $(EXTRA_PHP5_EXTFILES) |
| 295 |
|
| 296 |
# - set class for all config files |
| 297 |
_CSWCLASS_FILTER = | perl -ane '\ |
| 298 |
$(foreach FILE,$(MIGRATECONF),$$F[1] = "cswmigrateconf" if( $$F[2] =~ m(^$(FILE)$$) );)\ |
| 299 |
$(foreach FILE,$(SAMPLECONF:%\.CSW=%),$$F[1] = "cswcpsampleconf" if ( $$F[2] =~ m(^$(FILE)\.CSW$$) );)\ |
| 300 |
$(foreach FILE,$(PRESERVECONF:%\.CSW=%),$$F[1] = "cswpreserveconf" if( $$F[2] =~ m(^$(FILE)\.CSW$$) );)\ |
| 301 |
$(foreach FILE,$(ETCSERVICES),$$F[1] = "cswetcservices" if( $$F[2] =~ m(^$(FILE)$$) );)\ |
| 302 |
$(foreach FILE,$(INETDCONF),$$F[1] = "cswinetd" if( $$F[2] =~ m(^$(FILE)$$) );)\ |
| 303 |
$(foreach FILE,$(INITSMF),$$F[1] = "cswinitsmf" if( $$F[2] =~ m(^$(FILE)$$) );)\ |
| 304 |
$(foreach FILE,$(ETCSHELLS),$$F[1] = "cswetcshells" if( $$F[2] =~ m(^$(FILE)$$) );)\ |
| 305 |
$(foreach FILE,$(USERGROUP),$$F[1] = "cswusergroup" if( $$F[2] =~ m(^$(FILE)$$) );)\ |
| 306 |
$(foreach FILE,$(CRONTABS),$$F[1] = "cswcrontab" if( $$F[2] =~ m(^$(FILE)$$) );)\ |
| 307 |
$(if $(PYCOMPILE),$(foreach FILE,$(_PYCOMPILE_FILES),$$F[1] = "cswpycompile" if( $$F[2] =~ m(^$(FILE)$$) );))\ |
| 308 |
$(foreach FILE,$(TEXINFO),$$F[1] = "cswtexinfo" if( $$F[2] =~ m(^$(FILE)$$) );)\ |
| 309 |
$(foreach FILE,$(TEXHASH),$$F[1] = "cswtexhash" if( $$F[2] =~ m(^$(FILE)$$) );)\ |
| 310 |
$(foreach FILE,$(SSLCERT),$$F[1] = "cswsslcert" if( $$F[2] =~ m(^$(FILE)$$) );)\ |
| 311 |
$(foreach FILE,$(DICTCONF),$$F[1] = "cswdictconf" if( $$F[2] =~ m(^$(FILE)$$) );)\ |
| 312 |
$(if $(AP2_MODS),@F = ("e", "build", $$F[2], "?", "?", "?") if ($$F[2] =~ m(^/opt/csw/apache2/ap2mod/.*));) \ |
| 313 |
$(if $(PHP5_EXT),@F = ("e", "build", $$F[2], "?", "?", "?") if ($$F[2] =~ m(^/opt/csw/php5/extensions/.*));) \ |
| 314 |
$$F[1] = "cswcptemplates" if( $$F[2] =~ m(^/opt/csw/etc/templates/.+$$) and $$F[0] eq "f" ); \ |
| 315 |
print join(" ",@F),"\n";' |
| 316 |
|
| 317 |
# If you add another filter above, also add the class to this list. It is used |
| 318 |
# to detect if a package needs to depends on CSWcswclassutils by looking at |
| 319 |
# files belonging to one of these in the prototype. |
| 320 |
|
| 321 |
# NOTE: Order _can_ be important here. cswinitsmf and cswinetd should |
| 322 |
# always be the last two added. The reason for this is that |
| 323 |
# you need to ensure any binaries and config files are already on disk |
| 324 |
# and able to be consumed by a service that might be started. |
| 325 |
|
| 326 |
# NOTE: cswusergroup and ugfiles were moved to have higher priority |
| 327 |
# than the conf handling classes. this allows one to manually set the |
| 328 |
# user/group on conf files with prototype modifiers while still |
| 329 |
# leveraging the conf handler classes. this is a priority issue as |
| 330 |
# per the above note. (See bacula for an example of where this is |
| 331 |
# required.) |
| 332 |
|
| 333 |
# NOTE: ensure sslcert must run before initsmf/inetd. certs should be |
| 334 |
# in place before services are started. |
| 335 |
|
| 336 |
_CSWCLASSES = cswusergroup ugfiles |
| 337 |
_CSWCLASSES += cswmigrateconf cswcpsampleconf cswpreserveconf cswcptemplates |
| 338 |
_CSWCLASSES += cswetcservices |
| 339 |
_CSWCLASSES += cswetcshells |
| 340 |
_CSWCLASSES += cswcrontab |
| 341 |
_CSWCLASSES += cswpycompile |
| 342 |
_CSWCLASSES += cswsslcert |
| 343 |
_CSWCLASSES += cswinetd |
| 344 |
_CSWCLASSES += cswinitsmf |
| 345 |
_CSWCLASSES += cswtexinfo |
| 346 |
_CSWCLASSES += cswpostmsg |
| 347 |
_CSWCLASSES += cswtexhash |
| 348 |
_CSWCLASSES += cswdictconf |
| 349 |
|
| 350 |
# Make sure the configuration files always have a .CSW suffix and rename the |
| 351 |
# configuration files to this if necessary during merge. |
| 352 |
ifneq ($(PKGFORMAT),ips) |
| 353 |
_EXTRA_PAX_ARGS += $(foreach FILE,$(SAMPLECONF:%\.CSW=%) $(PRESERVECONF:%\.CSW=%),-s ",^\.\($(FILE)\)$$,.\1\.CSW,p") |
| 354 |
endif |
| 355 |
|
| 356 |
PKGGET_DESTDIR ?= |
| 357 |
|
| 358 |
DEPMAKER_EXTRA_ARGS = --noscript --nodep SUNW |
| 359 |
|
| 360 |
# Construct a revision stamp |
| 361 |
ifeq ($(GARFLAVOR),DBG) |
| 362 |
SPKG_FULL_REVSTAMP=1 |
| 363 |
endif |
| 364 |
|
| 365 |
ifeq ($(SPKG_FULL_REVSTAMP),1) |
| 366 |
$(call SETONCE,SPKG_REVSTAMP,REV=$(shell date '+%Y.%m.%d.%H.%M')) |
| 367 |
else |
| 368 |
$(call SETONCE,SPKG_REVSTAMP,REV=$(shell date '+%Y.%m.%d')) |
| 369 |
endif |
| 370 |
|
| 371 |
# Where we find our mkpackage global templates |
| 372 |
PKGLIB = $(GARDIR)/pkglib |
| 373 |
|
| 374 |
# These variables are for mkpackage and the gspec expansion |
| 375 |
PKG_EXPORTS = NAME VERSION DESCRIPTION CATEGORIES GARCH GARDIR GARBIN |
| 376 |
PKG_EXPORTS += CURDIR WORKDIR WORKDIR_FIRSTMOD WORKSRC WORKSRC_FIRSTMOD PKGROOT |
| 377 |
PKG_EXPORTS += SPKG_REVSTAMP SPKG_PKGNAME SPKG_DESC SPKG_VERSION SPKG_CATEGORY |
| 378 |
PKG_EXPORTS += SPKG_VENDOR SPKG_EMAIL SPKG_PSTAMP SPKG_BASEDIR SPKG_CLASSES |
| 379 |
PKG_EXPORTS += SPKG_OSNAME SPKG_SOURCEURL SPKG_PACKAGER SPKG_PKGFILE TIMESTAMP |
| 380 |
PKG_EXPORTS += DEPMAKER_EXTRA_ARGS PKGLIB DESTDIR |
| 381 |
|
| 382 |
define _PKG_ENV |
| 383 |
$(BUILD_ENV) $(foreach EXP,$(PKG_EXPORTS),$(EXP)="$(if $($(EXP)_$1),$($(EXP)_$1),$($(EXP)))") |
| 384 |
endef |
| 385 |
|
| 386 |
# Canned command for generating admin file names |
| 387 |
# Usage: $(call admfiles,SUNWpackage,depend copyright) |
| 388 |
# pkg.gspec is added by default. |
| 389 |
#admfiles = $(1).gspec $(foreach PKG,$(1),$(foreach ADM,$(2),$(PKG).$(ADM))) |
| 390 |
# The problem is that with the new ruleset the expansion of admfiles is too late leading to |
| 391 |
# files not be in the list of generated download URLs, deprecate use |
| 392 |
admfiles = $(error The use of admfiles is deprecated. Please use a manual list of files) |
| 393 |
|
| 394 |
# Standard sets of admin files for use with admfiles |
| 395 |
ADMSTANDARD = prototype depend |
| 396 |
ADMISCRIPTS = preinstall postinstall |
| 397 |
ADMUSCRIPTS = preremove postremove |
| 398 |
ADMSCRIPTS = $(ADMISCRIPTS) $(ADMUSCRIPTS) |
| 399 |
ADMFULLSTD = $(ADMSTANDARD) $(ADMSCRIPTS) space |
| 400 |
ADMADDON = $(ADMSTANDARD) postinstall preremove |
| 401 |
|
| 402 |
# This is a helper function which inserts subdirectories for each ISA |
| 403 |
# between the prefix and the suffix. |
| 404 |
# usage: $(call isadirs,<prefix>,<suffix>) |
| 405 |
# expands to <prefix>/<isa1>/<suffix> <prefix>/<isa2>/<suffix> ... |
| 406 |
isadirs = $(foreach ISA,$(ISALIST),$(1)/$(subst +,\+,$(subst -,\-,$(ISA)))/$(2)) |
| 407 |
|
| 408 |
# This is a helper function just like isadirs, but also contains the |
| 409 |
# prefix and suffix without an ISA subdirectories inserted. |
| 410 |
# usage: $(call isadirs,<prefix>,<suffix>) |
| 411 |
# expands to <prefix>/<suffix> <prefix>/<isa1>/<suffix> <prefix>/<isa2>/<suffix> ... |
| 412 |
baseisadirs = $(1)/$(2) $(call isadirs,$(1),$(2)) |
| 413 |
|
| 414 |
# PKGFILES_RT selects files belonging to a runtime package |
| 415 |
PKGFILES_RT += $(call baseisadirs,$(libdir),[^/]*\.so\.\d+(\.\d+)*) |
| 416 |
|
| 417 |
# PKGFILES_LIB selects just one library. The '.' will be escaped automatically! |
| 418 |
# Use PKGFILES_CSWlibfoo1 = $(call pkgfiles_lib,libfoo.so.1) |
| 419 |
pkgfiles_lib += $(call baseisadirs,$(libdir),$(subst .,\.,$(subst +,\+,$(1)))(\.\d+)*) |
| 420 |
|
| 421 |
IPS_PKGFILES_DEVEL := $(PKGFILES_DEVEL) |
| 422 |
# PKGFILES_DEVEL selects files belonging to a developer package |
| 423 |
PKGFILES_DEVEL_CONFIG ?= $(call baseisadirs,$(bindir),[^/]*-config) |
| 424 |
PKGFILES_DEVEL += $(PKGFILES_DEVEL_CONFIG) |
| 425 |
PKGFILES_DEVEL_SHAREDLIBLINK ?= $(call baseisadirs,$(libdir),[^/]*\.so) |
| 426 |
PKGFILES_DEVEL += $(PKGFILES_DEVEL_SHAREDLIBLINK) |
| 427 |
PKGFILES_DEVEL_STATICLIB ?= $(call baseisadirs,$(libdir),[^/]*\.a) |
| 428 |
PKGFILES_DEVEL += $(PKGFILES_DEVEL_STATICLIB) |
| 429 |
PKGFILES_DEVEL_LIBTOOL ?= $(call baseisadirs,$(libdir),[^/]*\.la) |
| 430 |
PKGFILES_DEVEL += $(PKGFILES_DEVEL_LIBTOOL) |
| 431 |
PKGFILES_DEVEL_PKGCONFIG ?= $(call baseisadirs,$(libdir),pkgconfig(/.*)?) |
| 432 |
PKGFILES_DEVEL += $(PKGFILES_DEVEL_PKGCONFIG) |
| 433 |
PKGFILES_DEVEL_INCLUDEDIR ?= $(includedir)/.* |
| 434 |
PKGFILES_DEVEL += $(PKGFILES_DEVEL_INCLUDEDIR) |
| 435 |
PKGFILES_DEVEL_ACLOCAL ?= $(sharedstatedir)/aclocal/.* |
| 436 |
PKGFILES_DEVEL += $(PKGFILES_DEVEL_ACLOCAL) |
| 437 |
PKGFILES_DEVEL_CONFIG_MANPAGE ?= $(mandir)/man1/.*-config\.1.* |
| 438 |
PKGFILES_DEVEL += $(PKGFILES_DEVEL_CONFIG_MANPAGE) |
| 439 |
PKGFILES_DEVEL_MAN3_MANPAGE ?= $(mandir)/man3/.*\.3.* |
| 440 |
PKGFILES_DEVEL += $(PKGFILES_DEVEL_MAN3_MANPAGE) |
| 441 |
|
| 442 |
# PKGFILES_DOC selects files beloging to a documentation package |
| 443 |
PKGFILES_DOC = $(docdir)/.* |
| 444 |
|
| 445 |
# PKGFILES_SRC selects the source archives for building the package |
| 446 |
PKGFILES_SRC = $(sourcedir)/$(call catalogname,$(SRCPACKAGE_BASE))/.* |
| 447 |
|
| 448 |
PKGFILES_$(SRCPACKAGE) ?= $(PKGFILES_SRC) |
| 449 |
|
| 450 |
# This function computes the files to be excluded from the package specified |
| 451 |
# as argument |
| 452 |
define _pkgfiles_exclude |
| 453 |
$(strip |
| 454 |
$(foreach S,$(filter-out $(1) $(if $(filter ips,$(PKGFORMAT)),$(NOPACKAGE_IPS),),$(_PKG_SPECS)), |
| 455 |
$(PKGFILES_$(S)) |
| 456 |
) |
| 457 |
) |
| 458 |
endef |
| 459 |
|
| 460 |
define _pkgfiles_include |
| 461 |
$(strip |
| 462 |
$(PKGFILES_$(1)_SHARED) |
| 463 |
$(PKGFILES_$(1)) |
| 464 |
) |
| 465 |
endef |
| 466 |
|
| 467 |
# This function takes a full path to a filename and returns the package it belongs to. |
| 468 |
# The package may be generated during this build or already installed on the system. |
| 469 |
# /etc/crypto/certs/SUNWObjectCA=../../../etc/certs/SUNWObjectCA l none SUNWcsr |
| 470 |
#perl -ane '$$f=quotemeta("$1");if($$F[0]=~/^$$f(=.*)?$$/){print join(" ",$$F[3..$$#F]),"\n";exit}'</var/sadm/install/contents |
| 471 |
#$(shell /usr/sbin/pkgchk -l -p $1 2>/dev/null | $(GAWK) '/^Current/ {p=0} p==1 {print} /^Referenced/ {p=1}' | perl -ane 'print join("\n",@F)') |
| 472 |
# 'pkchk -l -p' doesn't work as it concatenates package names with more than 14 characters, |
| 473 |
# e. g. SUNWgnome-base-libs-develSUNWgnome-calculatorSUNWgnome-freedb-libsSUNWgnome-cd-burnerSUNWgnome-character-map |
| 474 |
define file2pkg |
| 475 |
$(shell perl -ane '@l{"s","l","d","b","c","f","x","v","e"}=(3,3,6,8,8,9,6,9,9);$$f=quotemeta("$1");if($$F[0]=~/^$$f(=.*)?$$/){s/^\*// foreach @F;print join(" ",@F[$$l{$$F[1]}..$$#F]),"\n";exit}'</var/sadm/install/contents) |
| 476 |
endef |
| 477 |
|
| 478 |
define linktargets |
| 479 |
$(shell perl -ane 'if($$F[0] eq "l" && $$F[2]=~/=(.*)$$/){print $$1,"\n"}'<$1) |
| 480 |
endef |
| 481 |
|
| 482 |
_test-file2pkg: |
| 483 |
@echo $(call file2pkg,/etc) |
| 484 |
|
| 485 |
_test-linktargets: |
| 486 |
@echo $(call linktargets,work/build-global/CSWlinkbase.prototype) |
| 487 |
|
| 488 |
# |
| 489 |
# Targets |
| 490 |
# |
| 491 |
|
| 492 |
# prototype - Generate prototype for all installed files |
| 493 |
# This can be used to automatically distribute the files to different packages |
| 494 |
# |
| 495 |
|
| 496 |
$(foreach SPEC,$(_PKG_SPECS),$(if $(PROTOTYPE_FILTER_$(SPEC)),$(eval _PROTOTYPE_FILTER_$(SPEC) ?= | $(PROTOTYPE_FILTER_$(SPEC))))) |
| 497 |
$(foreach SPEC,$(_PKG_SPECS),$(if $(PROTOTYPE_FILTER),$(eval _PROTOTYPE_FILTER_$(SPEC) ?= | $(PROTOTYPE_FILTER)))) |
| 498 |
|
| 499 |
# Assemble prototype modifiers |
| 500 |
# PROTOTYPE_MODIFIERS = mytweaks |
| 501 |
# PROTOTYPE_FTYPE_mytweaks = e |
| 502 |
# PROTOTYPE_CLASS_mytweaks = cswconffile |
| 503 |
# PROTOTYPE_FILES_mytweaks = $(bindir)/.*\.conf |
| 504 |
# PROTOTYPE_PERMS_mytweaks = 0644 |
| 505 |
# PROTOTYPE_USER_mytweaks = somebody |
| 506 |
# PROTOTYPE_GROUP_mytweaks = somegroup |
| 507 |
|
| 508 |
_empty := |
| 509 |
_space = $(_empty) $(_empty) |
| 510 |
|
| 511 |
_PROTOTYPE_MODIFIERS = | perl -ane '\ |
| 512 |
$(foreach M,$(PROTOTYPE_MODIFIERS),\ |
| 513 |
$(if $(PROTOTYPE_FILES_$M),if( $$F[2] =~ m(^$(firstword $(PROTOTYPE_FILES_$M))$(subst $(_space),,$(foreach F,$(wordlist 2,$(words $(PROTOTYPE_FILES_$M)),$(PROTOTYPE_FILES_$M)),|$F))$$) ) {)\ |
| 514 |
$(if $(PROTOTYPE_FTYPE_$M),$$F[0] = "$(PROTOTYPE_FTYPE_$M)";)\ |
| 515 |
$(if $(PROTOTYPE_CLASS_$M),$$F[1] = "$(PROTOTYPE_CLASS_$M)";)\ |
| 516 |
$(if $(PROTOTYPE_PERMS_$M),$$F[3] = "$(PROTOTYPE_PERMS_$M)";)\ |
| 517 |
$(if $(PROTOTYPE_USER_$M),$$F[4] = "$(PROTOTYPE_USER_$M)";)\ |
| 518 |
$(if $(PROTOTYPE_GROUP_$M),$$F[5] = "$(PROTOTYPE_GROUP_$M)";)\ |
| 519 |
$(if $(PROTOTYPE_FILES_$M),})\ |
| 520 |
)\ |
| 521 |
$(foreach F,$(POSTMSG),$$F[1] = "cswpostmsg" if( $$F[2] eq "$F" );)\ |
| 522 |
$$F[1] = "cswalternatives" if( $$F[2] =~ m,^/opt/csw/share/alternatives/[^/]+$$, );\ |
| 523 |
print join(" ",@F),"\n";' |
| 524 |
|
| 525 |
define checkpkg_override_filter |
| 526 |
| ( cat; if test -f "$(WORKDIR_GLOBAL)/checkpkg_override.$(1)";then echo "i checkpkg_override=checkpkg_override.$(1)"; fi) |
| 527 |
endef |
| 528 |
|
| 529 |
define cswreleasenotes_filter |
| 530 |
| ( cat; if test -f "$(WORKDIR_GLOBAL)/$(1).cswreleasenotes";then echo "i cswreleasenotes=$(1).cswreleasenotes"; fi) |
| 531 |
endef |
| 532 |
|
| 533 |
define obsoleted_filter |
| 534 |
| ( cat; if test -f "$(WORKDIR_GLOBAL)/$(1).obsolete";then echo "i obsolete=$(1).obsolete"; fi) |
| 535 |
endef |
| 536 |
|
| 537 |
# This file contains all installed pathes. This can be used as a starting point |
| 538 |
# for distributing files to individual packages. |
| 539 |
PROTOTYPE = $(WORKDIR)/prototype |
| 540 |
|
| 541 |
define dontrelocate |
| 542 |
$(shell gsed -i -e 's,\(.\) .* \($(1)[\s/]*\),\1 norelocate /\2,g' $(2)) |
| 543 |
endef |
| 544 |
|
| 545 |
# Dynamic prototypes work like this: |
| 546 |
# - A prototype from DISTFILES takes precedence over |
| 547 |
|
| 548 |
# Pulled in from pkglib/csw_prototype.gspec |
| 549 |
$(PROTOTYPE): $(WORKDIR) merge |
| 550 |
$(_DBG)cswproto $(if $(INCLUDE_COMMONDIRS),,-c $(GARDIR)/etc/commondirs-$(GARCH)) -r $(PKGROOT) $(PKGROOT)=$(if $(ALLOW_RELOCATE),,'/') >$@ |
| 551 |
|
| 552 |
# pathfilter lives in bin/pathfilter and takes care of including/excluding paths from |
| 553 |
# a prototype (see "perldoc bin/pathfilter"). We employ it here to: |
| 554 |
# - include license for current package |
| 555 |
# - exclude licenses for all other packages |
| 556 |
# - if other includes are given, only include these files |
| 557 |
# - if no include is given ("catch all packages") include everything except what |
| 558 |
# is put in other packages |
| 559 |
.PRECIOUS: $(WORKDIR)/%.prototype $(WORKDIR)/%.prototype-$(GARCH) |
| 560 |
$(WORKDIR)/%.prototype: _PKGFILES_EXCLUDE=$(call _pkgfiles_exclude,$*) |
| 561 |
$(WORKDIR)/%.prototype: _PKGFILES_INCLUDE=$(call _pkgfiles_include,$*) |
| 562 |
$(WORKDIR)/%.prototype: | $(PROTOTYPE) |
| 563 |
$(_DBG)if [ -n "$(PKGFILES_$*_SHARED)" -o \ |
| 564 |
-n "$(PKGFILES_$*)" -o \ |
| 565 |
-n "$(_PKGFILES_EXCLUDE)" -o \ |
| 566 |
-n "$(ISAEXEC_FILES_$*)" -o \ |
| 567 |
-n "$(ISAEXEC_FILES)" -o \ |
| 568 |
-n "$(EXTRA_PKGFILES_EXCLUDED) $(EXTRA_PKGFILES_EXCLUDED_$*)" ]; then \ |
| 569 |
(pathfilter $(if $(or $(_PKGFILES_EXCLUDE),$(_PKGFILES_INCLUDE)),\ |
| 570 |
-I $(call licensedir,$*)/license \ |
| 571 |
-I /etc/opt/csw/pkg/$*/cswmigrateconf \ |
| 572 |
-I /opt/csw/share/alternatives/$(call catalogname,$*) \ |
| 573 |
)\ |
| 574 |
$(foreach S,$(filter-out $*,$(SPKG_SPECS)),\ |
| 575 |
-X $(call licensedir,$S)/license \ |
| 576 |
-X /etc/opt/csw/pkg/$S/cswmigrateconf \ |
| 577 |
-X /opt/csw/share/alternatives/$(call catalogname,$S) \ |
| 578 |
) \ |
| 579 |
$(foreach I,$(EXTRA_PKGFILES_INCLUDED) $(EXTRA_PKGFILES_INCLUDED_$*),-i '$I') \ |
| 580 |
$(foreach X,$(EXTRA_PKGFILES_EXCLUDED) $(EXTRA_PKGFILES_EXCLUDED_$*),-x '$X') \ |
| 581 |
$(foreach FILE,$(_PKGFILES_INCLUDE),-i '$(FILE)') \ |
| 582 |
$(if $(_PKGFILES_INCLUDE),-x '.*',$(foreach FILE,$(_PKGFILES_EXCLUDE),-x '$(FILE)')) \ |
| 583 |
$(foreach IE,$(abspath $(ISAEXEC_FILES_$*) $(ISAEXEC_FILES)), \ |
| 584 |
-e '$(IE)=$(dir $(IE))$(ISA_DEFAULT)/$(notdir $(IE))' \ |
| 585 |
) \ |
| 586 |
<$(PROTOTYPE); \ |
| 587 |
if [ -n "$(EXTRA_PKGFILES_$*)" ]; then echo "$(EXTRA_PKGFILES_$*)"; fi \ |
| 588 |
) $(call checkpkg_override_filter,$*) $(call cswreleasenotes_filter,$*) $(call obsoleted_filter,$*) $(_CSWCLASS_FILTER) $(_CATEGORY_FILTER) $(_PROTOTYPE_MODIFIERS) $(_PROTOTYPE_FILTER_$*) >$@; \ |
| 589 |
else \ |
| 590 |
cat $(PROTOTYPE) $(call checkpkg_override_filter,$*) $(call cswreleasenotes_filter,$*) $(call obsoleted_filter,$*) $(_CSWCLASS_FILTER) $(_CATEGORY_FILTER) $(_PROTOTYPE_MODIFIERS) $(_PROTOTYPE_FILTER_$*) >$@; \ |
| 591 |
fi |
| 592 |
$(if $(ALLOW_RELOCATE),$(call dontrelocate,opt,$(PROTOTYPE))) |
| 593 |
|
| 594 |
$(WORKDIR)/%.prototype-$(GARCH): | $(WORKDIR)/%.prototype |
| 595 |
$(_DBG)cat $(WORKDIR)/$*.prototype >$@ |
| 596 |
|
| 597 |
# Dynamic depends are constructed as follows: |
| 598 |
# - Packages the currently constructed one depends on can be specified with |
| 599 |
# RUNTIME_DEP_PKGS_<pkg> specifically, or RUNTIME_DEP_PKGS for all packages build. |
| 600 |
# These are flagged as 'P' in the depend file. |
| 601 |
# - If multiple packages are build at the same time it is valid to have |
| 602 |
# dependencies between them. In this case it is necessary to define the package |
| 603 |
# desciption for each package with SPKG_DESC_<pkg>, setting it in the gspec-file |
| 604 |
# does not work. |
| 605 |
# - Packages that are imcompatible to the currently constructed one can be specified |
| 606 |
# with INCOMPATIBLE_PKGS_<pkg> specifically or with INCOMPATIBLE_PKGS for all |
| 607 |
# packages build. |
| 608 |
# - A depend-file from DISTFILES takes precedence, it is not overwritten or |
| 609 |
# appended with dynamic depends. |
| 610 |
|
| 611 |
# $_EXTRA_GAR_PKGS is for dynamic dependencies added by GAR itself (like CSWisaexec or CSWcswclassutils) |
| 612 |
.PRECIOUS: $(WORKDIR)/%.depend |
| 613 |
|
| 614 |
# The texinfo filter has been taken out of the normal filters as TEXINFO has a default. |
| 615 |
# The dependencies to CSWcswclassutils and CSWtexinfo are only added if there are files |
| 616 |
# actually matching the _TEXINFO_FILTER. This is done at the prototype-level. |
| 617 |
$(WORKDIR)/%.depend: $(WORKDIR)/$*.prototype |
| 618 |
$(WORKDIR)/%.depend: _EXTRA_GAR_PKGS += $(_CATEGORY_RUNTIME_DEP_PKGS) |
| 619 |
$(WORKDIR)/%.depend: _EXTRA_GAR_PKGS += $(if $(strip $(shell cat $(WORKDIR)/$*.prototype | perl -ane '$(foreach I,$(ISAEXEC_FILES),print "yes" if( $$F[2] =~ m(^\Q$I\E(=.*)?$$));)')),CSWisaexec) |
| 620 |
$(WORKDIR)/%.depend: _EXTRA_GAR_PKGS += $(if $(strip $(shell cat $(WORKDIR)/$*.prototype | perl -ane 'print "yes" if( $$F[1] eq "cswalternatives")')),CSWalternatives) |
| 621 |
$(WORKDIR)/%.depend: _EXTRA_GAR_PKGS += $(foreach P,$(strip $(shell cat $(WORKDIR)/$*.prototype | perl -ane '$(foreach C,$(filter-out ugfiles,$(_CSWCLASSES)),print "$C " if( $$F[1] eq "$C");)')),CSWcas-$(subst csw,,$(P))) |
| 622 |
$(WORKDIR)/%.depend: _DEP_PKGS=$(or $(RUNTIME_DEP_PKGS_ONLY_$*),$(RUNTIME_DEP_PKGS_ONLY),$(sort $(_EXTRA_GAR_PKGS)) $(or $(RUNTIME_DEP_PKGS_$*),$(RUNTIME_DEP_PKGS),$(DEP_PKGS_$*),$(DEP_PKGS))) |
| 623 |
$(WORKDIR)/%.depend: $(WORKDIR) |
| 624 |
# The final "true" is for packages without dependencies to make the shell happy as "( )" is not allowed. |
| 625 |
$(WORKDIR)/%.depend: |
| 626 |
$(_DBG)$(if $(_DEP_PKGS)$(INCOMPATIBLE_PKGS)$(INCOMPATIBLE_PKGS_$*), \ |
| 627 |
($(foreach PKG,$(INCOMPATIBLE_PKGS_$*) $(INCOMPATIBLE_PKGS),\ |
| 628 |
echo "I $(PKG)";\ |
| 629 |
)\ |
| 630 |
$(foreach PKG,$(_DEP_PKGS),\ |
| 631 |
$(if $(SPKG_DESC_$(PKG)), \ |
| 632 |
echo "P $(PKG) $(call catalogname,$(PKG)) - $(SPKG_DESC_$(PKG))";, \ |
| 633 |
echo "$(shell (/usr/bin/pkginfo $(PKG) || echo "P $(PKG) - ") | $(GAWK) '{ $$1 = "P"; print } ')"; \ |
| 634 |
) \ |
| 635 |
) \ |
| 636 |
true) >$@) |
| 637 |
|
| 638 |
# Dynamic gspec-files are constructed as follows: |
| 639 |
# - Packages using dynamic gspec-files must be listed in PACKAGES |
| 640 |
# - There is a default of PACKAGES containing one packages named CSW |
| 641 |
# followed by the NAME. It can be changed by setting PACKAGES explicitly. |
| 642 |
# - The name of the generated package is always the same as listed in PACKAGES |
| 643 |
# - The catalog name defaults to the suffix following CSW of the package name, |
| 644 |
# but can be customized by setting CATALOGNAME_<pkg> = <catalogname-of-pkg> |
| 645 |
# - If only one package is build it is sufficient to set CATALOGNAME = <catalogname-of-pkg> |
| 646 |
# It is an error to set CATALOGNAME if more than one package is build. |
| 647 |
# - If the package is suitable for all architectures (sparc and x86) this can be |
| 648 |
# flagged with ARCHALL_<pkg> = 1 for a specific package or with ARCHALL = 1 |
| 649 |
# for all packages. |
| 650 |
|
| 651 |
_CATEGORY_GSPEC_INCLUDE ?= csw_dyngspec.gspec |
| 652 |
|
| 653 |
# This rule dynamically generates gspec-files |
| 654 |
.PRECIOUS: $(WORKDIR)/%.gspec |
| 655 |
$(WORKDIR)/%.gspec: |
| 656 |
$(_DBG)$(if $(filter $*.gspec,$(DISTFILES)),,\ |
| 657 |
(echo "%var bitname $(call catalogname,$*)"; \ |
| 658 |
echo "%var pkgname $*"; \ |
| 659 |
echo "%var pkgfile $(call _pkgfile,$*)"; \ |
| 660 |
$(if $(or $(ARCHALL),$(ARCHALL_$*)),echo "%var arch all";) \ |
| 661 |
$(if $(_CATEGORY_GSPEC_INCLUDE),echo "%include url file://%{PKGLIB}/$(_CATEGORY_GSPEC_INCLUDE)")) >$@\ |
| 662 |
) |
| 663 |
|
| 664 |
|
| 665 |
# Dynamic licenses are selected in the following way: |
| 666 |
# - Dynamic licenses are only activated for packages listed in PACKAGES or |
| 667 |
# packages which don't have %copyright in their gspec-file. This way the |
| 668 |
# behaviour on existing gspec-files is preserved. |
| 669 |
# - The default name for the license is COPYING and it will not be fully printed |
| 670 |
# - If no license is explicitly specified in the Makefile and the default can not |
| 671 |
# be found no license will be included |
| 672 |
# - If a license is specified it must be found or an error is issued |
| 673 |
# - Either LICENSE_<pkg> or LICENSE_FULL_<pkg> may be specified, it is an error |
| 674 |
# to specify both. |
| 675 |
# - There is an automatic rule to include only the license for each package that |
| 676 |
# belongs to it. |
| 677 |
# - Package-specific defines have precedence over general defines (CATALOGNAME_<pkg> |
| 678 |
# before CATALOGNAME etc.) |
| 679 |
|
| 680 |
# LICENSE may be a path starting with $(WORKROOTDIR) or a filename inside $(WORKSRC) |
| 681 |
ifeq ($(origin LICENSE_FULL), undefined) |
| 682 |
ifeq ($(origin LICENSE), undefined) |
| 683 |
LICENSE = COPYING |
| 684 |
_LICENSE_IS_DEFAULT = 1 |
| 685 |
endif |
| 686 |
endif |
| 687 |
|
| 688 |
# Dynamic pkginfo |
| 689 |
|
| 690 |
# Calculating the revision can be time consuming, so we do this on demand |
| 691 |
define _REVISION |
| 692 |
$(if $(shell if test -x $(SVN); then echo yes; fi),$(if $(shell $(SVN) info >/dev/null 2>&1; if test $$? -eq 0; then echo YES; fi),$(if $(shell $(SVN) status --ignore-externals 2>/dev/null | grep -v '^X'),UNCOMMITTED,$(shell $(SVN) info --recursive 2>/dev/null | $(GAWK) '$$1 == "Revision:" && MAX < $$2 { MAX = $$2 } END {print MAX }')),NOTVERSIONED),NOSVN) |
| 693 |
endef |
| 694 |
|
| 695 |
# URL: https://gar.svn.sf.net/svnroot/gar/csw/mgar/pkg/pcre/trunk |
| 696 |
define _URL |
| 697 |
$(if $(shell if test -x $(SVN); then echo yes; fi),$(shell $(SVN) info . 2>/dev/null | $(GAWK) '$$1 == "URL:" { print $$2 }')) |
| 698 |
endef |
| 699 |
|
| 700 |
# XXX: It is possible that a package is flagged as /isaexec, even |
| 701 |
# if the isaexec'ed files are in another package created from the Makefile. |
| 702 |
# There should be a warning issued if there is more than one package build and |
| 703 |
# it has not explicitly been set. |
| 704 |
define mode64 |
| 705 |
$(shell echo |
| 706 |
$(if $(MODE64_$(1)),$(MODE64_$(1)), |
| 707 |
$(if $(filter 32,$(foreach I,$(NEEDED_ISAS),$(MEMORYMODEL_$I))),32) |
| 708 |
$(if $(filter 64,$(foreach I,$(NEEDED_ISAS),$(MEMORYMODEL_$I))),64) |
| 709 |
$(if $(abspath $(ISAEXEC_FILES_$*) $(ISAEXEC_FILES)),isaexec) |
| 710 |
) | perl -lne 'print join("/", split)' |
| 711 |
) |
| 712 |
endef |
| 713 |
|
| 714 |
define pkgvar |
| 715 |
$(strip $(or $(_CATEGORY_$(1)_$(2)),$(_CATEGORY_$(1)),$($(1)_$(2)),$($(1)))) |
| 716 |
endef |
| 717 |
|
| 718 |
# Make sure every producable package contains specific descriptions. |
| 719 |
# We explicitly ignore NOPACKAGE here to disallow circumventing the check. |
| 720 |
$(if $(filter-out $(firstword $(SPKG_SPECS)),$(SPKG_SPECS)),\ |
| 721 |
$(foreach P,$(SPKG_SPECS),\ |
| 722 |
$(if $(SPKG_DESC_$(P)),,$(error Multiple packages defined and SPKG_DESC_$(P) is not set.)))) |
| 723 |
|
| 724 |
# There was a bug here. |
| 725 |
# http://sourceforge.net/apps/trac/gar/ticket/56 |
| 726 |
# The workaround was to add an additional check whether the strings are the |
| 727 |
# same or not. |
| 728 |
$(foreach P,$(SPKG_SPECS),\ |
| 729 |
$(foreach Q,$(filter-out $(P) $(OBSOLETED_PKGS),$(SPKG_SPECS)),\ |
| 730 |
$(if $(filter-out $(subst ,_,$(SPKG_DESC_$(P))),$(subst ,_,$(SPKG_DESC_$(Q)))),\ |
| 731 |
,\ |
| 732 |
$(if $(shell if [ "$(SPKG_DESC_$(P))" = "$(SPKG_DESC_$(Q))" ]; then echo bad; fi),\ |
| 733 |
$(error The package descriptions for $(P) [$(if $(SPKG_DESC_$(P)),$(SPKG_DESC_$(P)),<not set>)] and $(Q) [$(if $(SPKG_DESC_$(Q)),$(SPKG_DESC_$(Q)),<not set>)] are identical. Please make sure that all descriptions are unique by setting SPKG_DESC_<pkg> for each package.),)))) |
| 734 |
|
| 735 |
# Check that package names are 32 characters or less as reported in |
| 736 |
# https://sourceforge.net/apps/trac/gar/ticket/69 |
| 737 |
$(foreach P,$(SPKG_SPECS),\ |
| 738 |
$(if $(shell perl -e 'print "toolong" if( length("$P")>32)'),$(error The package name $P is too long, maximum is 32 characters))\ |
| 739 |
) |
| 740 |
|
| 741 |
.PRECIOUS: $(WORKDIR)/%.pkginfo |
| 742 |
|
| 743 |
# The texinfo filter has been taken out of the normal filters as TEXINFO has a default. |
| 744 |
$(WORKDIR)/%.pkginfo: $(WORKDIR)/%.prototype |
| 745 |
$(WORKDIR)/%.pkginfo: SPKG_CLASSES = $(shell cat $(WORKDIR)/$*.prototype | perl -e 'while(<>){@F=split;$$c{$$F[1]}++ if($$F[0] ne "i")};$(foreach C,none cswalternatives build $(_CSWCLASSES),print "$C\n" if( delete $$c{$C});)print join("\n",keys %c);') |
| 746 |
|
| 747 |
$(WORKDIR)/%.pkginfo: $(WORKDIR) |
| 748 |
$(_DBG)(echo "PKG=$*"; \ |
| 749 |
echo "NAME=$(call catalogname,$*) - $(call pkgvar,SPKG_DESC,$*)"; \ |
| 750 |
echo "ARCH=$(if $(or $(ARCHALL),$(ARCHALL_$*)),all,$(call pkgvar,GARCH,$*))"; \ |
| 751 |
echo "VERSION=$(call pkgvar,SPKG_VERSION,$*),$(call pkgvar,SPKG_REVSTAMP,$*)"; \ |
| 752 |
echo "CATEGORY=$(call pkgvar,SPKG_CATEGORY,$*)"; \ |
| 753 |
echo "VENDOR=$(call pkgvar,SPKG_VENDOR,$*)"; \ |
| 754 |
echo "EMAIL=$(call pkgvar,SPKG_EMAIL,$*)"; \ |
| 755 |
echo "PSTAMP=$(shell hostname)-$(shell date '+%Y%m%d%H%M%S')"; \ |
| 756 |
$(if $(ALLOW_RELOCATE),echo "CLASSES=$(call pkgvar,SPKG_CLASSES,$*) norelocate"; \ |
| 757 |
,echo "CLASSES=$(call pkgvar,SPKG_CLASSES,$*)";) \ |
| 758 |
echo "HOTLINE=http://operz.coralcmd.net/viewvc/index.cgi/ozone/"; \ |
| 759 |
echo "OPENCSW_CATALOGNAME=$(call catalogname,$*)"; \ |
| 760 |
echo "OPENCSW_MODE64=$(call mode64,$*)"; \ |
| 761 |
echo "OPENCSW_REPOSITORY=$(call _URL)@$(call _REVISION)"; \ |
| 762 |
echo "OPENCSW_BUNDLE=$(BUNDLE)"; \ |
| 763 |
echo "OPENCSW_OS_RELEASE=$(SPKG_OSNAME)"; \ |
| 764 |
echo "OPENCSW_OS_ARCH=$(GARCH)"; \ |
| 765 |
$(if $(OBSOLETED_BY_$*),echo "OPENCSW_OBSOLETES=$(OBSOLETED_BY_$*)";) \ |
| 766 |
$(_CATEGORY_PKGINFO) \ |
| 767 |
) >$@ |
| 768 |
$(if $(ALLOW_RELOCATE),echo "BASEDIR=$(RELOCATE_PREFIX)" >>$@) |
| 769 |
|
| 770 |
# findlicensefile - Find an existing file for a given relative license file name |
| 771 |
# Arguments: |
| 772 |
# $(1) A filename to be used for licenses |
| 773 |
define findlicensefile |
| 774 |
$(strip |
| 775 |
$(if $(1),$(firstword $(realpath |
| 776 |
$(1) $(WORKDIR)/$(1) |
| 777 |
$(foreach M,global $(MODULATIONS),$(WORKROOTDIR)/build-$M/$(1) $(WORKROOTDIR)/build-$M/$(DISTNAME)/$(1)) |
| 778 |
))) |
| 779 |
) |
| 780 |
endef |
| 781 |
|
| 782 |
# licensefile - Find an existing license file for a given package name |
| 783 |
define licensefiles |
| 784 |
$(foreach L,$(or $(LICENSE_$(1)),$(LICENSE_FULL_$(1)),$(LICENSE),$(LICENSE_FULL)),\ |
| 785 |
$(or $(call findlicensefile,$L),$(if $(_LICENSE_IS_DEFAULT),,$(error Cannot find license file $L for package $(1))))\ |
| 786 |
) |
| 787 |
endef |
| 788 |
|
| 789 |
merge-license-%: $(WORKDIR) |
| 790 |
$(_DBG)$(if $(and $(LICENSE_$*),$(LICENSE_FULL_$*)),$(error Both LICENSE_$* and LICENSE_FULL_$* have been specified where only one is allowed)) \ |
| 791 |
$(if $(and $(filter $*,$(_PKG_SPECS)),$(or $(LICENSE),$(LICENSE_FULL),$(LICENSE_$*),$(LICENSE_FULL_$*))), \ |
| 792 |
LICENSEFILES="$(call licensefiles,$*)"; \ |
| 793 |
LICENSEDIR=$(call licensedir,$*); \ |
| 794 |
$(if $(or $(LICENSE_TEXT_$*),$(LICENSE_TEXT)),\ |
| 795 |
umask 022 && mkdir -p $(PKGROOT)$$LICENSEDIR && \ |
| 796 |
echo "$(or $(LICENSE_TEXT_$*),$(LICENSE_TEXT))" > $(PKGROOT)$$LICENSEDIR/license;\ |
| 797 |
echo "$(or $(LICENSE_TEXT_$*),$(LICENSE_TEXT))" > $(WORKDIR)/$*.copyright;\ |
| 798 |
,\ |
| 799 |
if [ -n "$$LICENSEFILES" ]; then \ |
| 800 |
$(if $(or $(LICENSE_FULL),$(LICENSE_FULL_$*)), \ |
| 801 |
catlicense $LICENSEFILES > $(WORKDIR)/$*.copyright;, \ |
| 802 |
echo "Please see $$LICENSEDIR/license for license information." > $(WORKDIR)/$*.copyright; \ |
| 803 |
) \ |
| 804 |
umask 022 && mkdir -p $(PKGROOT)$$LICENSEDIR && \ |
| 805 |
rm -f $(PKGROOT)$$LICENSEDIR/license && \ |
| 806 |
catlicense $$LICENSEFILES > $(PKGROOT)$$LICENSEDIR/license; \ |
| 807 |
fi \ |
| 808 |
) \ |
| 809 |
) |
| 810 |
@$(MAKECOOKIE) |
| 811 |
|
| 812 |
merge-license: $(foreach SPEC,$(_PKG_SPECS),merge-license-$(SPEC)) |
| 813 |
@$(DONADA) |
| 814 |
|
| 815 |
reset-merge-license: |
| 816 |
@rm -f $(COOKIEDIR)/merge-license $(foreach SPEC,$(_PKG_SPECS),$(COOKIEDIR)/merge-license-$(SPEC)) |
| 817 |
|
| 818 |
merge-README.CSW: $(WORKDIR) |
| 819 |
$(_DBG)if test -f $(WORKDIR)/README.CSW; then \ |
| 820 |
$(foreach P,$(_PKG_SPECS),mkdir -p $(PKGROOT)$(docdir)/$(call catalogname,$P);) \ |
| 821 |
$(foreach P,$(_PKG_SPECS),cp $(WORKDIR)/README.CSW $(PKGROOT)$(docdir)/$(call catalogname,$P)/README.CSW;) \ |
| 822 |
|
| 823 |
merge-distfile-%: $(DOWNLOADDIR) |
| 824 |
$(_DBG_MERGE)if test -f $(DOWNLOADDIR)/$*; then \ |
| 825 |
$(foreach P,$(_PKG_SPECS),mkdir -p $(PKGROOT)$(docdir)/$(call catalogname,$P);) \ |
| 826 |
$(foreach P,$(_PKG_SPECS),cp $(DOWNLOADDIR)/$* $(PKGROOT)$(docdir)/$(call catalogname,$P)/$*;) \ |
| 827 |
fi |
| 828 |
@$(MAKECOOKIE) |
| 829 |
|
| 830 |
.PHONY: reset-merge-distfile-% |
| 831 |
reset-merge-distfile-%: |
| 832 |
$(_DBG_MERGE)rm -f $(COOKIEDIR)/merge-distfile-$* $(foreach SPEC,$(_PKG_SPECS),$(PKGROOT)$(docdir)/$(call catalogname,$(SPEC))/$*) |
| 833 |
|
| 834 |
merge-obsolete: $(WORKDIR_GLOBAL) |
| 835 |
$(_DBG_MERGE)$(foreach P,$(OBSOLETED_PKGS),($(foreach Q,$(OBSOLETING_PKGS),$(if $(filter $P,$(OBSOLETED_BY_$Q)), \ |
| 836 |
$(if $(filter $Q,$(FOREIGN_PACKAGES)), \ |
| 837 |
echo "$Q";, \ |
| 838 |
$(if $(SPKG_DESC_$Q), \ |
| 839 |
echo "$Q $(call catalogname,$Q) - $(SPKG_DESC_$Q)";, \ |
| 840 |
echo "$(shell (/usr/bin/pkginfo $Q || echo "$Q - ") | perl -npe 's/^\S*\s//;s/\s+/ /')"; \ |
| 841 |
))))) > $(WORKDIR_GLOBAL)/$P.obsolete; \ |
| 842 |
) |
| 843 |
@$(MAKECOOKIE) |
| 844 |
|
| 845 |
.PHONY: reset-merge-obsolete |
| 846 |
reset-merge-obsolete: |
| 847 |
$(_DBG)rm -f $(COOKIEDIR)/merge-obsolete $(WORKDIR_GLOBAL)/.*.obsolete |
| 848 |
|
| 849 |
merge-classutils: merge-migrateconf merge-usergroup merge-inetdconf merge-etcservices |
| 850 |
|
| 851 |
reset-merge-classutils: reset-merge-migrateconf reset-merge-usergroup reset-merge-inetdconf reset-merge-etcservices |
| 852 |
|
| 853 |
reset-merge-ap2mod: |
| 854 |
@rm -f $(COOKIEDIR)/post-merge-ap2mod |
| 855 |
|
| 856 |
reset-merge-php5ext: |
| 857 |
@rm -f $(COOKIEDIR)/post-merge-php5ext |
| 858 |
|
| 859 |
merge-migrateconf: $(foreach S,$(filter-out $(OBSOLETED_PKGS),$(SPKG_SPECS)),$(if $(or $(MIGRATE_FILES_$S),$(MIGRATE_FILES)),merge-migrateconf-$S)) |
| 860 |
@$(MAKECOOKIE) |
| 861 |
|
| 862 |
merge-migrateconf-%: |
| 863 |
@echo "[ Generating cswmigrateconf for package $* ]" |
| 864 |
@echo "X: $(MIGRATE_FILES_$*) Y: $(MIGRATE_FILES)" |
| 865 |
$(_DBG)ginstall -d $(PKGROOT)/etc/opt/csw/pkg/$* |
| 866 |
$(_DBG)(echo "MIGRATE_FILES=\"$(or $(MIGRATE_FILES_$*),$(MIGRATE_FILES))\"";\ |
| 867 |
$(if $(or $(MIGRATE_SOURCE_DIR_$*),$(MIGRATE_SOURCE_DIR)),echo "SOURCE_DIR___default__=\"$(or $(MIGRATE_SOURCE_DIR_$*),$(MIGRATE_SOURCE_DIR))\"";)\ |
| 868 |
$(if $(or $(MIGRATE_DEST_DIR_$*),$(MIGRATE_DEST_DIR)),echo "DEST_DIR___default__=\"$(or $(MIGRATE_DEST_DIR_$*),$(MIGRATE_DEST_DIR))\"";)\ |
| 869 |
$(foreach F,$(or $(MIGRATE_FILES_$*),$(MIGRATE_FILES)),\ |
| 870 |
$(if $(MIGRATE_SOURCE_DIR_$F),echo "SOURCE_DIR_$(subst .,_,$F)=\"$(MIGRATE_SOURCE_DIR_$F)\"";)\ |
| 871 |
$(if $(MIGRATE_DEST_DIR_$F),echo "DEST_DIR_$(subst .,_,$F)=\"$(MIGRATE_DEST_DIR_$F)\"";)\ |
| 872 |
)\ |
| 873 |
) >$(PKGROOT)/etc/opt/csw/pkg/$*/cswmigrateconf |
| 874 |
@$(MAKECOOKIE) |
| 875 |
|
| 876 |
reset-merge-migrateconf: |
| 877 |
@rm -f $(COOKIEDIR)/merge-migrateconf $(foreach SPEC,$(_PKG_SPECS),$(COOKIEDIR)/merge-migrateconf-$(SPEC)) |
| 878 |
|
| 879 |
_show_classutilvar//%: |
| 880 |
$($*) |
| 881 |
|
| 882 |
merge-usergroup: $(foreach S,$(SPKG_SPECS),$(if $(value $(S)_usergroup),merge-usergroup-$S)) |
| 883 |
@$(MAKECOOKIE) |
| 884 |
|
| 885 |
merge-usergroup-%: |
| 886 |
@echo "[ Generating cswusergroup for package $* ]" |
| 887 |
$(_DBG)ginstall -d $(PKGROOT)/etc/opt/csw/pkg/$* |
| 888 |
$(_DBG)$(MAKE) --no-print-directory -n _show_classutilvar//$*_usergroup >$(PKGROOT)/etc/opt/csw/pkg/$*/cswusergroup |
| 889 |
@$(MAKECOOKIE) |
| 890 |
|
| 891 |
reset-merge-usergroup: |
| 892 |
@rm -f $(COOKIEDIR)/merge-usergroup $(foreach SPEC,$(_PKG_SPECS),$(COOKIEDIR)/merge-usergroup-$(SPEC)) |
| 893 |
|
| 894 |
merge-inetdconf: $(foreach S,$(SPKG_SPECS),$(if $(value $(S)_inetdconf),merge-inetdconf-$S)) |
| 895 |
|
| 896 |
merge-inetdconf-%: |
| 897 |
@echo "[ Generating inetd.conf for package $* ]" |
| 898 |
$(_DBG)ginstall -d $(PKGROOT)/etc/opt/csw/pkg/$* |
| 899 |
$(_DBG)$(MAKE) --no-print-directory -n _show_classutilvar//$*_inetdconf >$(PKGROOT)/etc/opt/csw/pkg/$*/inetd.conf |
| 900 |
@$(MAKECOOKIE) |
| 901 |
|
| 902 |
reset-merge-inetdconf: |
| 903 |
@rm -f $(COOKIEDIR)/merge-inetdconf $(foreach SPEC,$(_PKG_SPECS),$(COOKIEDIR)/merge-inetdconf-$(SPEC)) |
| 904 |
|
| 905 |
merge-etcservices: $(foreach S,$(SPKG_SPECS),$(if $(value $(S)_etcservices),merge-etcservices-$S)) |
| 906 |
|
| 907 |
merge-etcservices-%: |
| 908 |
@echo "[ Generating services for package $* ]" |
| 909 |
$(_DBG)ginstall -d $(PKGROOT)/etc/opt/csw/pkg/$* |
| 910 |
$(_DBG)$(MAKE) --no-print-directory -n _show_classutilvar//$*_etcservices >$(PKGROOT)/etc/opt/csw/pkg/$*/services |
| 911 |
@$(MAKECOOKIE) |
| 912 |
|
| 913 |
reset-merge-etcservices: |
| 914 |
@rm -f $(COOKIEDIR)/merge-etcservices $(foreach SPEC,$(_PKG_SPECS),$(COOKIEDIR)/merge-etcservices-$(SPEC)) |
| 915 |
|
| 916 |
merge-checkpkgoverrides-%: |
| 917 |
@echo "[ Generating checkpkg override for package $* ]" |
| 918 |
$(_DBG)($(foreach O,$(or $(CHECKPKG_OVERRIDES_$*),$(CHECKPKG_OVERRIDES)) $(_CATEGORY_CHECKPKG_OVERRIDES),echo "$O";)) | \ |
| 919 |
perl -F'\|' -ane 'unshift @F,"$*"; $$F[0].=":"; print join(" ",@F );' \ |
| 920 |
> $(WORKDIR_GLOBAL)/checkpkg_override.$* |
| 921 |
@$(MAKECOOKIE) |
| 922 |
|
| 923 |
merge-checkpkgoverrides: $(foreach S,$(SPKG_SPECS),$(if $(or $(CHECKPKG_OVERRIDES_$S),$(CHECKPKG_OVERRIDES),$(_CATEGORY_CHECKPKG_OVERRIDES)),merge-checkpkgoverrides-$S)) |
| 924 |
|
| 925 |
reset-merge-checkpkgoverrides: |
| 926 |
@rm -f $(COOKIEDIR)/merge-checkpkgoverrides $(foreach SPEC,$(_PKG_SPECS),$(COOKIEDIR)/merge-checkpkgoverrides-$(SPEC)) |
| 927 |
@rm -f $(foreach S,$(SPKG_SPECS),$(WORKDIR_GLOBAL)/checkpkg_override.$S) |
| 928 |
|
| 929 |
merge-alternatives-%: |
| 930 |
@echo "[ Generating alternatives for package $* ]" |
| 931 |
$(_DBG)ginstall -d $(PKGROOT)/opt/csw/share/alternatives |
| 932 |
$(_DBG)($(if $(ALTERNATIVE),echo "$(ALTERNATIVE)";) \ |
| 933 |
$(foreach A,$(or $(ALTERNATIVES_$*),$(ALTERNATIVES)), \ |
| 934 |
$(if $(ALTERNATIVE_$A), \ |
| 935 |
echo "$(ALTERNATIVE_$A)";, \ |
| 936 |
$(error The variable 'ALTERNATIVE_$A' is empty, but must contain an alternative) \ |
| 937 |
))) > $(PKGROOT)/opt/csw/share/alternatives/$(call catalogname,$*) |
| 938 |
@$(MAKECOOKIE) |
| 939 |
|
| 940 |
merge-alternatives: $(foreach S,$(SPKG_SPECS),$(if $(or $(ALTERNATIVES_$S),$(ALTERNATIVES),$(ALTERNATIVE)),merge-alternatives-$S)) |
| 941 |
|
| 942 |
reset-merge-alternatives: |
| 943 |
@rm -f $(COOKIEDIR)/merge-alternatives $(foreach SPEC,$(_PKG_SPECS),$(COOKIEDIR)/merge-alternatives-$(SPEC)) |
| 944 |
|
| 945 |
merge-src: _SRCDIR=$(PKGROOT)$(sourcedir)/$(call catalogname,$(SRCPACKAGE_BASE)) |
| 946 |
merge-src: fetch |
| 947 |
$(_DBG)mkdir -p $(_SRCDIR)/files |
| 948 |
$(_DBG)-rm -f $(addprefix $(_SRCDIR)/files/,$(DISTFILES) $(PATCHFILES)) |
| 949 |
$(_DBG)(cd $(DOWNLOADDIR); cp $(DISTFILES) $(PATCHFILES) $(_SRCDIR)/files) |
| 950 |
$(_DBG)-rm -f $(addprefix $(_SRCDIR)/,Makefile checksums gar) |
| 951 |
$(_DBG)(cd $(CURDIR); cp Makefile checksums $(_SRCDIR)) |
| 952 |
$(_DBG)ln -s ../gar/$(GARSYSTEMVERSION) $(_SRCDIR)/gar |
| 953 |
$(MAKECOOKIE) |
| 954 |
|
| 955 |
reset-merge-src: |
| 956 |
@rm -f $(COOKIEDIR)/merge-src |
| 957 |
|
| 958 |
|
| 959 |
# package - Use the mkpackage utility to create Solaris packages |
| 960 |
# |
| 961 |
|
| 962 |
PACKAGE_TARGETS = $(foreach SPEC,$(_PKG_SPECS), package-$(SPEC)) |
| 963 |
|
| 964 |
PACKAGE_TARGETS_IPS = $(foreach SPEC,$(_PKG_SPECS_IPS),packageips-$(SPEC)) |
| 965 |
|
| 966 |
SPKG_DESTDIRS = $(SPKG_SPOOLDIR) $(SPKG_EXPORT) |
| 967 |
|
| 968 |
$(SPKG_DESTDIRS): |
| 969 |
ginstall -d $@ |
| 970 |
|
| 971 |
$(SPKG_EXPORT_IPS): |
| 972 |
pkgrepo create -s $(SPKG_EXPORT_IPS) |
| 973 |
pkgrepo set -s $(SPKG_EXPORT_IPS) publisher/prefix=opencsw |
| 974 |
|
| 975 |
# This is a target used to generate all prototypes for debugging purposes. |
| 976 |
# On a normal packaging workflow this is not used. |
| 977 |
prototypes: extract merge $(SPKG_DESTDIRS) pre-package $(foreach SPEC,$(_PKG_SPECS),$(WORKDIR)/$(SPEC).prototype-$(GARCH)) |
| 978 |
|
| 979 |
# Verify that the host on we are currently packaging is one of the platform |
| 980 |
# hosts. If there are no platform hosts defined the test is skipped. |
| 981 |
validateplatform: |
| 982 |
$(if $(strip $(foreach P,$(PACKAGING_PLATFORMS),$(PACKAGING_HOST_$P))),\ |
| 983 |
$(if $(filter $(THISHOST),$(foreach P,$(PACKAGING_PLATFORMS),$(PACKAGING_HOST_$P))),\ |
| 984 |
@$(MAKECOOKIE),\ |
| 985 |
$(warning *** You are building this package on a non-requested platform host '$(THISHOST)'. The following platforms were requested:)\ |
| 986 |
$(foreach P,$(PACKAGING_PLATFORMS),\ |
| 987 |
$(warning *** - $P $(if $(PACKAGING_HOST_$P),to be build on host '$(PACKAGING_HOST_$P)',with no suitable host available))\ |
| 988 |
)\ |
| 989 |
$(error You can execute '$(MAKE) platforms' to automatically build on all necessary platforms.)\ |
| 990 |
),@$(MAKECOOKIE)) |
| 991 |
|
| 992 |
# We depend on extract as the additional package files (like .gspec) must be |
| 993 |
# unpacked to global/ for packaging. E. g. 'merge' depends only on the specific |
| 994 |
# modulations and does not fill global/. |
| 995 |
ENABLE_CHECK ?= 1 |
| 996 |
|
| 997 |
# The files in ISAEXEC_FILES get relocated and will be replaced by the isaexec-wrapper. |
| 998 |
# The trick is to delay the calculcation of the variable values until that time |
| 999 |
# when PKGROOT has already been populated. |
| 1000 |
ISAEXEC_EXCLUDE_FILES ?= $(bindir)/%-config $(bindir)/%/%-config |
| 1001 |
_buildpackage: _ISAEXEC_FILES=$(filter-out $(foreach F,$(ISAEXEC_EXCLUDE_FILES) $(EXTRA_ISAEXEC_EXCLUDE_FILES),$(PKGROOT)$(F)), \ |
| 1002 |
$(wildcard $(foreach D,$(ISAEXEC_DIRS),$(PKGROOT)$(D)/* )) \ |
| 1003 |
) |
| 1004 |
_buildpackage: ISAEXEC_FILES ?= $(if $(_ISAEXEC_FILES),$(patsubst $(PKGROOT)%,%, \ |
| 1005 |
$(shell for F in $(_ISAEXEC_FILES); do \ |
| 1006 |
if test -f "$$F" -a \! -h "$$F"; then echo $$F; fi; \ |
| 1007 |
done)),) |
| 1008 |
_buildpackage: pre-package $(PACKAGE_TARGETS) post-package $(if $(filter-out 0,$(ENABLE_CHECK)),pkgcheck) |
| 1009 |
|
| 1010 |
# _buildpackage-ips: pre-package $(PACKAGE_TARGETS_IPS) post-package $(if $(filter-out 0,$(ENABLE_CHECK)),pkgcheck) |
| 1011 |
_buildpackage-ips: pre-package $(PACKAGE_TARGETS_IPS) post-package package-publish-lib package-publish-other |
| 1012 |
|
| 1013 |
# generates p5m from proto and publishs |
| 1014 |
# if IPS_2PHASE_PUBLISH publish util and tool packages in a post step |
| 1015 |
# package-publish-lib: nowpublish = $(filter-out %utils %util %tools %tool,$(filter lib%,$(_PKG_SPECS_IPS))) |
| 1016 |
# package-publish-other: nowpublish = $(filter-out $(filter-out %utils %util %tool %tools,$(filter lib%,$(_PKG_SPECS_IPS))),$(_PKG_SPECS_IPS)) |
| 1017 |
package-publish-lib: nowpublish = $(filter-out $(IPS_2PHASE_PUBLISH_PATTERN),$(_PKG_SPECS_IPS)) |
| 1018 |
package-publish-other: nowpublish = $(filter-out $(filter-out $(IPS_2PHASE_PUBLISH_PATTERN),$(_PKG_SPECS_IPS)),$(_PKG_SPECS_IPS)) |
| 1019 |
package-publish-%: |
| 1020 |
@echo "PUBLISH: $(nowpublish)" |
| 1021 |
$(if $(IPS_USE_PKG_DB), \ |
| 1022 |
$(foreach SPEC,$(nowpublish),\ |
| 1023 |
$(GARBIN)/pkg_resolve $(DEBUG_FLAG) \ |
| 1024 |
--arch "$(GARCH)" \ |
| 1025 |
--os-release "$(SPKG_OSNAME)" \ |
| 1026 |
--catalog-release "$(CATALOG_RELEASE)" \ |
| 1027 |
--pkg-root "$(PKGROOT)" $(SPEC).proto > $(SPEC).p5p, \ |
| 1028 |
cp $@.proto $@.p5p)) |
| 1029 |
$(if $(IPS_RM_SAME_VERS),\ |
| 1030 |
$(foreach SPEC,$(nowpublish),\ |
| 1031 |
pkgrepo remove -s $(SPKG_EXPORT_IPS) $(IPS_PACKAGE_PREFIX)$(SPEC)@$(IPS_VERSION) || true;)) |
| 1032 |
@echo "Resolve dependencies for $(nowpublish)" |
| 1033 |
$(_DBG)cd $(WORKDIR) && pkgdepend resolve -m $(foreach SPEC,$(nowpublish),$(SPEC).p5p ) |
| 1034 |
$(foreach SPEC,$(nowpublish),\ |
| 1035 |
( cd $(WORKDIR) && pkgmogrify -I $(GARDIR)transforms remove-os-version $(SPEC).p5p.res > $(SPEC).p5m && \ |
| 1036 |
pkglint -f $(GARDIR)/pkglintrc -c /var/tmp/build_$(LOGNAME)/lint-cache -r $(SPKG_EXPORT_IPS) $(SPEC).p5m ) && \ |
| 1037 |
pkgsend publish -s $(SPKG_EXPORT_IPS) -d $(SPKG_PKGROOT) $(WORKDIR)/$(SPEC).p5m; ) |
| 1038 |
|
| 1039 |
_package: validateplatform extract-global merge $(SPKG_DESTDIRS) _buildpackage |
| 1040 |
@$(MAKECOOKIE) |
| 1041 |
|
| 1042 |
package: package-$(PKGFORMAT-$(GAROSREL)) |
| 1043 |
|
| 1044 |
package-svr4: _package |
| 1045 |
@echo |
| 1046 |
@echo "The following packages have been built:" |
| 1047 |
@echo |
| 1048 |
@$(MAKE) -s $(_PASS_GAR_ENV) GAR_PLATFORM=$(GAR_PLATFORM) _pkgshow |
| 1049 |
@echo |
| 1050 |
@$(DONADA) |
| 1051 |
|
| 1052 |
package-ips: validateplatform extract-global merge $(SPKG_DESTDIRS) _buildpackage-ips |
| 1053 |
@echo |
| 1054 |
@echo "The following packages have been built:" |
| 1055 |
@echo |
| 1056 |
@$(MAKE) -s $(_PASS_GAR_ENV) GAR_PLATFORM=$(GAR_PLATFORM) _pkgshow-ips |
| 1057 |
@echo |
| 1058 |
@$(DONADA) |
| 1059 |
|
| 1060 |
dirpackage: _DIRPACKAGE=1 |
| 1061 |
dirpackage: ENABLE_CHECK= |
| 1062 |
dirpackage: _package |
| 1063 |
@echo "The following packages have been built:" |
| 1064 |
@echo |
| 1065 |
@$(MAKE) -s $(_PASS_GAR_ENV) GAR_PLATFORM=$(GAR_PLATFORM) _dirpkgshow |
| 1066 |
@echo |
| 1067 |
@$(DONADA) |
| 1068 |
|
| 1069 |
_dirpkgshow: |
| 1070 |
@$(foreach SPEC,$(_PKG_SPECS),echo " $(SPKG_SPOOLDIR)/$(SPEC)";) |
| 1071 |
|
| 1072 |
_pkgshow: |
| 1073 |
@$(foreach SPEC,$(_PKG_SPECS),printf " %-20s %s\n" $(SPEC) $(SPKG_EXPORT)/$(shell $(call _PKG_ENV,$(SPEC)) $(GARBIN)/mkpackage -qs $(WORKDIR)/$(SPEC).gspec -D pkgfile)$(COMPRESSION_SUFFIX) ;) |
| 1074 |
|
| 1075 |
_pkgshow-ips: |
| 1076 |
@pkgrepo list -s $(SPKG_EXPORT_IPS) $(_PKG_SPECS_IPS) |
| 1077 |
|
| 1078 |
# The dynamic pkginfo is only generated for dynamic gspec-files |
| 1079 |
package-%: $(WORKDIR)/%.gspec $(WORKDIR)/%.prototype-$(GARCH) $(WORKDIR)/%.depend $(if $(findstring %.gspec,$(DISTFILES)),,$(WORKDIR)/%.pkginfo) |
| 1080 |
@echo " ==> Processing $*.gspec" |
| 1081 |
$(_DBG)( $(call _PKG_ENV,$*) mkpackage \ |
| 1082 |
--spec $(WORKDIR)/$*.gspec \ |
| 1083 |
--spooldir $(SPKG_SPOOLDIR) \ |
| 1084 |
--tmpdir $(SPKG_TMPDIR) \ |
| 1085 |
--destdir $(SPKG_EXPORT) \ |
| 1086 |
--workdir $(SPKG_WORKDIR) \ |
| 1087 |
--pkgbase $(SPKG_PKGBASE) \ |
| 1088 |
--pkgroot $(SPKG_PKGROOT) \ |
| 1089 |
$(EXTRA_MKPACKAGE_OPTS) \ |
| 1090 |
-v WORKDIR_FIRSTMOD=../build-$(firstword $(MODULATIONS)) \ |
| 1091 |
$(if $(_DIRPACKAGE),--notransfer --nocompress,--compress) \ |
| 1092 |
$(MKPACKAGE_ARGS) ) || exit 2 |
| 1093 |
@$(MAKECOOKIE) |
| 1094 |
|
| 1095 |
package-p: |
| 1096 |
@$(foreach COOKIEFILE,$(PACKAGE_TARGETS), test -e $(COOKIEDIR)/$(COOKIEFILE) ;) |
| 1097 |
|
| 1098 |
# -- IPS Packaging -- |
| 1099 |
define _pkgfiles_include_dev |
| 1100 |
$(strip |
| 1101 |
$(if $(filter $(PKGFORMAT-$(GAROSREL)),ips), |
| 1102 |
$(if $(filter $(IPS_DEVPKG),$(1)), |
| 1103 |
$(PKGFILES_$(filter %-dev,$(_PKG_SPECS))) |
| 1104 |
) |
| 1105 |
) |
| 1106 |
) |
| 1107 |
endef |
| 1108 |
|
| 1109 |
.PRECIOUS: $(WORKDIR)/%.proto |
| 1110 |
$(WORKDIR)/%.proto: _PKGFILES_EXCLUDE=$(call _pkgfiles_exclude,CSW$*) |
| 1111 |
$(WORKDIR)/%.proto: _PKGFILES_INCLUDE=$(call _pkgfiles_include,CSW$*) |
| 1112 |
$(WORKDIR)/%.proto: _PKGFILES_INCLUDE_DEV=$(call _pkgfiles_include_dev,CSW$*) |
| 1113 |
$(WORKDIR)/%.proto: $(WORKDIR) |
| 1114 |
$(_DBG) @echo "\nPKG: $(IPS_PACKAGE_PREFIX)$*" |
| 1115 |
$(_DBG) pkgsend generate $(PKGROOT) >$@.gen |
| 1116 |
$(_DBG)if [ -n "$(_PKGFILES_INCLUDE)" -o \ |
| 1117 |
-n "$(_PKGFILES_EXCLUDE)" -o \ |
| 1118 |
-n "$(ISAEXEC_FILES_CSW$*)" -o \ |
| 1119 |
-n "$(ISAEXEC_FILES)" -o \ |
| 1120 |
-n "$(EXTRA_PKGFILES_EXCLUDED) $(EXTRA_PKGFILES_EXCLUDED_$*)" ]; then \ |
| 1121 |
($(GARBIN)/pathfilter.py $(if $(or $(_PKGFILES_EXCLUDE),$(_PKGFILES_INCLUDE)),\ |
| 1122 |
-I $(call licensedir,CSW$*)/license \ |
| 1123 |
-I /etc/opt/csw/pkg/CSW$*/cswmigrateconf \ |
| 1124 |
-I /opt/csw/share/alternatives/$(call catalogname,CSW$*) \ |
| 1125 |
)\ |
| 1126 |
$(foreach S,$(filter-out CSW$*,$(SPKG_SPECS)),\ |
| 1127 |
-X $(call licensedir,$S)/license \ |
| 1128 |
-X /etc/opt/csw/pkg/$S/cswmigrateconf \ |
| 1129 |
-X /opt/csw/share/alternatives/$(call catalogname,$S) \ |
| 1130 |
) \ |
| 1131 |
$(foreach I,$(EXTRA_PKGFILES_INCLUDED) $(EXTRA_PKGFILES_INCLUDED_CSW$*),-i '$I') \ |
| 1132 |
$(foreach X,$(EXTRA_PKGFILES_EXCLUDED) $(EXTRA_PKGFILES_EXCLUDED_CSW$*),-x '$X') \ |
| 1133 |
$(foreach FILE,$(_PKGFILES_INCLUDE),-i '$(FILE)') \ |
| 1134 |
$(if $(_PKGFILES_INCLUDE),$(foreach FILE,$(_PKGFILES_INCLUDE_DEV),-i '$(FILE)') -x '.*',$(foreach FILE,$(_PKGFILES_EXCLUDE),-x '$(FILE)')) \ |
| 1135 |
$(foreach IE,$(abspath $(ISAEXEC_FILES_CSW$*) $(ISAEXEC_FILES)), \ |
| 1136 |
-e '$(IE)=$(dir $(IE))$(ISA_DEFAULT)/$(notdir $(IE))' \ |
| 1137 |
) \ |
| 1138 |
-f $@.gen; \ |
| 1139 |
if [ -n "$(EXTRA_PKGFILES_$*)" ]; then echo "$(EXTRA_PKGFILES_$*)"; fi \ |
| 1140 |
) >$@.filtered; \ |
| 1141 |
else \ |
| 1142 |
cp $@.gen $@.filtered; \ |
| 1143 |
fi |
| 1144 |
$(if $(and $(INITSMF),$(filter $(shell cat $@.filtered),$(patsubst /%,%,$(INITSMF)))), \ |
| 1145 |
ginstall -d $(PKGROOT)/var/svc/manifest/site; \ |
| 1146 |
svcbundle -o $(PKGROOT)/var/svc/manifest/site/$(notdir $(INITSMF)).xml -s service-name=$(notdir $(INITSMF)) -s model=daemon -s start-method="$(INITSMF) start" -s stop-method="$(INITSMF) stop"; \ |
| 1147 |
@echo "<transform pkg -> emit file owner=root group=sys mode=755 path=var/svc/manifest/site/$(notdir $(INITSMF)).xml>" >> $@.filtered; ) |
| 1148 |
$(_DBG)$(foreach DFILE,$(IPS_PKGFILES_DEVEL), echo "<transform file path=$(patsubst /%,%,$(DFILE)) -> default facet.devel true>" >> $@.filtered; ) |
| 1149 |
$(foreach BIT,$(IPS_BYPASS_GENERATE_DEP), echo "<transform file path=$(patsubst /%,%,$(BIT)) -> default pkg.depend.bypass-generate .*>" >> $@.filtered; ) |
| 1150 |
$(foreach BIT,$(PKGFILES_CSW$*_SHARED), \ |
| 1151 |
echo "<transform file path=$(patsubst /%,%,$(BIT)) -> default overlay allow>" >> $@.filtered; \ |
| 1152 |
echo "<transform file path=$(patsubst /%,%,$(BIT)) -> default preserve legacy>" >> $@.filtered ) |
| 1153 |
$(if $(IPS_GET_DEP), \ |
| 1154 |
$(foreach PKG,$(filter-out $(_PKG_SPECS),$(RUNTIME_DEP_PKGS_CSW$*)), echo "<transform pkg -> emit depend fmri=pkg:/$(patsubst OZSW%,%,$(PKG)) type=require>" >> $@.filtered; )) |
| 1155 |
$(foreach CONF,$(PRESERVECONF), echo "<transform file path=$(patsubst /%,%,$(CONF)) -> default preserve renamenew>" >> $@.filtered; ) |
| 1156 |
mv $@.filtered $@ |
| 1157 |
|
| 1158 |
|
| 1159 |
|
| 1160 |
IPS_META_CLASSIFICATION ?= Applications/Accessories |
| 1161 |
IPS_META_SUMMARY ?= $(if $(SPKG_DESC_CSW$*),$(SPKG_DESC_CSW$*),$(DESCRIPTION)) |
| 1162 |
IPS_META_DESCRIPTION ?= $(DESCRIPTION) |
| 1163 |
IPS_VERSION ?= $(VERSION) |
| 1164 |
|
| 1165 |
.PRECIOUS: $(WORKDIR)/%.meta |
| 1166 |
$(WORKDIR)/%.meta: cswpkgname = CSW$(subst _,-,$*) |
| 1167 |
$(WORKDIR)/%.meta: $(WORKDIR) |
| 1168 |
$(if $(PKGFILES_$(filter %-dev, $(_PKG_SPECS))),,$(error dev package is catch all package, since IPS we do not provide devel and doc packages, you have to specify witch packages gets the devel files by remove there PKGFILES_CSW definitions)) |
| 1169 |
$(if $(IPS_DEVPKG),,$(error Assign development files to a package, by setting IPS_DEVPKG = CSWpackagename)) |
| 1170 |
$(foreach P,$(filter-out $(IPS_DEVPKG) %-dev, $(_PKG_SPECS)), $(if $(PKGFILES_$(P)),,$(error $(P) is catch all package, since IPS we do not provide devel and doc packages, only the IPS_DEVPKG can be a catchall package))) |
| 1171 |
$(if $(filter %/,$(IPS_PACKAGE_PREFIX)),,$(error IPS_PACKAGE_PREFIX must ending in a / wheres this did not: $(IPS_PACKAGE_PREFIX))) |
| 1172 |
$(_DBG)(echo "set name=pkg.fmri value=$(IPS_PACKAGE_PREFIX)$*@$(IPS_VERSION)"; \ |
| 1173 |
echo "set name=pkg.summary value=\"$(IPS_META_SUMMARY)\""; \ |
| 1174 |
echo "set name=pkg.description value=\"$(IPS_META_DESCRIPTION)\""; \ |
| 1175 |
echo "set name=info.classification value=org.opensolaris.category.2008:$(IPS_META_CLASSIFICATION)"; \ |
| 1176 |
echo "<transform pkg -> emit legacy arch=$(GARCH) category=\"$(if $(CATEGORY),$(CATEGORY),application)\" desc=\"$(SPKG_DESC_$(cswpkgname))\" name=\"$(cswpkgname)\" pkg=$(cswpkgname) variant.arch=$(GARCH) vendor=\"$(call pkgvar,SPKG_VENDOR,$(cswpkgname))\" version=$(call pkgvar,SPKG_VERSION,$(cswpkgname)),$(call pkgvar,SPKG_REVSTAMP,$(cswpkgname)) hotline=\"http://www.opencsw.org/bugtrack/\">"; \ |
| 1177 |
$(if $(filter $(IPS_DEVPKG),$(cswpkgname)), \ |
| 1178 |
$(foreach D,$(filter %-dev, $(_PKG_SPECS)), \ |
| 1179 |
echo "<transform pkg -> emit legacy arch=$(GARCH) category=\"$(if $(CATEGORY),$(CATEGORY),application)\" desc=\"$(SPKG_DESC_$(cswpkgname)), developer\" name=\"$(D)\" pkg=$(D) variant.arch=$(GARCH) vendor=\"$(call pkgvar,SPKG_VENDOR,$(cswpkgname))\" version=$(call pkgvar,SPKG_VERSION,$(cswpkgname)),$(call pkgvar,SPKG_REVSTAMP,$(cswpkgname)) hotline=\"http://www.opencsw.org/bugtrack/\">"; )) \ |
| 1180 |
echo "<transform pkg -> emit license $(call licensedir,CSW$(subst _,-,$*))/license license=\"see license file\">"; \ |
| 1181 |
$(_CATEGORY_IPS_META) ; \ |
| 1182 |
) >$@ |
| 1183 |
$(if $(or $(ARCHALL_$(cswpkgname)),$(ARCHALL)), echo "set name=variant.arch value=sparc value=i386", echo "set name=variant.arch value=$(GARCH)") >> $@; |
| 1184 |
$(if $(findstring $(cswpkgname)/,$(USERGROUP)), (cat $(WORKDIR)/cswusergroup | while read line; do \ |
| 1185 |
echo $$line | awk -F':' '{ print "group groupname="$$2; }'; \ |
| 1186 |
echo $$line | awk -F':' '{ print "user username="$$1" group="$$2" gecos-filed=\""$$3"\" home-dir="$$4" login-shell="$$5; }'; \ |
| 1187 |
done ) >> $@ ) |
| 1188 |
|
| 1189 |
|
| 1190 |
packageips-%: $(WORKDIR)/%.proto $(WORKDIR)/%.meta $(SPKG_EXPORT_IPS) |
| 1191 |
cd $(WORKDIR) && cat $*.meta $*.proto > $*.premog |
| 1192 |
pkgmogrify -I $(GARDIR)transforms -I $(WORKDIR) $*.premog defaults | pkgfmt > $(WORKDIR)/$*.mogrified |
| 1193 |
pkgdepend generate $(foreach I,$(shell isainfo),-D ISALIST=$I) -md $(PKGROOT) $(WORKDIR)/$*.mogrified > $(WORKDIR)/$*.depend |
| 1194 |
pkgmogrify -I $(GARDIR)transforms -I $(WORKDIR) $*.depend unneeded-deps | pkgfmt > $(WORKDIR)/$*.p5p |
| 1195 |
# --- |
| 1196 |
|
| 1197 |
# pkgcheck - check if the package is compliant |
| 1198 |
# |
| 1199 |
pkgcheck: $(foreach SPEC,$(_PKG_SPECS),package-$(SPEC)) |
| 1200 |
$(_DBG)( LC_ALL=C $(GARBIN)/checkpkg \ |
| 1201 |
$(DEBUG_FLAG) \ |
| 1202 |
--catalog-architecture "$(GARCH)" \ |
| 1203 |
--os-releases "$(SPKG_OSNAME)" \ |
| 1204 |
--catalog-release "$(CATALOG_RELEASE)" \ |
| 1205 |
$(foreach SPEC,$(_PKG_SPECS),$(SPKG_EXPORT)/`$(call _PKG_ENV,$(SPEC)) mkpackage --tmpdir $(SPKG_TMPDIR) -qs $(WORKDIR)/$(SPEC).gspec -D pkgfile`$(COMPRESSION_SUFFIX) ) || exit 2;) |
| 1206 |
@$(MAKECOOKIE) |
| 1207 |
|
| 1208 |
pkgcheck-p: |
| 1209 |
@$(foreach COOKIEFILE,$(PKGCHECK_TARGETS), test -e $(COOKIEDIR)/$(COOKIEFILE) ;) |
| 1210 |
|
| 1211 |
# pkgreset - reset working directory for repackaging |
| 1212 |
# |
| 1213 |
pkgreset: $(addprefix pkgreset-,$(SPKG_SPECS)) |
| 1214 |
@rm -f $(COOKIEDIR)/extract |
| 1215 |
@rm -f $(COOKIEDIR)/extract-archive-* |
| 1216 |
|
| 1217 |
reset-package: pkgreset |
| 1218 |
|
| 1219 |
# Make sure we don't delete files we deliberately added with DISTFILES. They |
| 1220 |
# will not be copied to WORKDIR again. |
| 1221 |
pkgreset-%: |
| 1222 |
@echo " ==> Reset packaging state for $* ($(DESTIMG))" |
| 1223 |
$(_DBG)rm -rf $(foreach T,extract checksum package package-ips pkgcheck,$(COOKIEDIR)/*$(T)-$**) |
| 1224 |
$(_DBG)rm -rf $(COOKIEDIR)/pre-package $(COOKIEDIR)/post-package |
| 1225 |
$(_DBG)rm -rf $(addprefix $(WORKDIR)/,$(filter-out $(DISTFILES),$(patsubst $(WORKDIR)/%,%,$(wildcard $(WORKDIR)/$*.*)) prototype copyright $*.copyright)) |
| 1226 |
$(_DBG)rm -rf $(WORKDIR)/$(patsubst OZSW%,%,$*).* |
| 1227 |
|
| 1228 |
repackage: pkgreset package |
| 1229 |
|
| 1230 |
redirpackage: pkgreset dirpackage |
| 1231 |
|
| 1232 |
# This rule automatically logs into every host where a package for this software should |
| 1233 |
# be built. It is especially suited for automated build bots. |
| 1234 |
|
| 1235 |
# Heads up: Don't use MAKEFLAGS to propagate -I to remote GAR invocations as |
| 1236 |
# this will also make it visible to the build environment. Some software builds |
| 1237 |
# use hard-coded non-GNU make which then errs out on -I (unknown option). |
| 1238 |
|
| 1239 |
_PROPAGATE_ENV += PARALLELMFLAGS |
| 1240 |
_PROPAGATE_ENV += PARALLELMODULATIONS |
| 1241 |
_PROPAGATE_ENV += PATH |
| 1242 |
_PROPAGATE_ENV += SKIPTEST |
| 1243 |
|
| 1244 |
platforms: _PACKAGING_PLATFORMS=$(if $(ARCHALL),$(firstword $(PACKAGING_PLATFORMS)),$(PACKAGING_PLATFORMS)) |
| 1245 |
platforms: |
| 1246 |
$(foreach P,$(_PACKAGING_PLATFORMS),\ |
| 1247 |
$(if $(PACKAGING_HOST_$P),\ |
| 1248 |
$(if $(filter $(THISHOST),$(PACKAGING_HOST_$P)),\ |
| 1249 |
$(MAKE) $(_PASS_GAR_ENV) GAR_PLATFORM=$P _package && ,\ |
| 1250 |
$(SSH) -t $(PACKAGING_HOST_$P) "$(foreach V,$(_PROPAGATE_ENV),$(if $($V),$V=\"$($V)\")) $(MAKE) -I $(GARDIR) -C $(CURDIR) $(_PASS_GAR_ENV) GAR_PLATFORM=$P _package" && \ |
| 1251 |
),\ |
| 1252 |
$(error *** No host has been defined for platform $P)\ |
| 1253 |
)\ |
| 1254 |
) true |
| 1255 |
@echo |
| 1256 |
@echo "The following packages have been built during this invocation:" |
| 1257 |
@echo |
| 1258 |
@$(foreach P,$(_PACKAGING_PLATFORMS),\ |
| 1259 |
echo "* Platform $P\c";\ |
| 1260 |
$(if $(ARCHALL),echo " (suitable for all architectures)\c";) \ |
| 1261 |
$(if $(filter $(THISHOST),$(PACKAGING_HOST_$P)),\ |
| 1262 |
echo " (built on this host)";\ |
| 1263 |
$(MAKE) -s $(_PASS_GAR_ENV) GAR_PLATFORM=$P _pkgshow;echo;,\ |
| 1264 |
echo " (built on host '$(PACKAGING_HOST_$P)')";\ |
| 1265 |
$(SSH) $(PACKAGING_HOST_$P) "PATH=$$PATH:/opt/csw/bin $(MAKE) -I $(GARDIR) -C $(CURDIR) -s $(_PASS_GAR_ENV) GAR_PLATFORM=$P _pkgshow";echo;\ |
| 1266 |
)\ |
| 1267 |
) |
| 1268 |
@$(MAKECOOKIE) |
| 1269 |
|
| 1270 |
platforms-%: _PACKAGING_PLATFORMS=$(if $(ARCHALL),$(firstword $(PACKAGING_PLATFORMS)),$(PACKAGING_PLATFORMS)) |
| 1271 |
platforms-%: |
| 1272 |
$(foreach P,$(_PACKAGING_PLATFORMS),\ |
| 1273 |
$(if $(PACKAGING_HOST_$P),\ |
| 1274 |
$(if $(filter $(THISHOST),$(PACKAGING_HOST_$P)),\ |
| 1275 |
$(MAKE) -s $(_PASS_GAR_ENV) GAR_PLATFORM=$P $* && ,\ |
| 1276 |
$(SSH) -t $(PACKAGING_HOST_$P) "PATH=$$PATH:/opt/csw/bin $(MAKE) -I $(GARDIR) -C $(CURDIR) $(_PASS_GAR_ENV) GAR_PLATFORM=$P $*" && \ |
| 1277 |
),\ |
| 1278 |
$(error *** No host has been defined for platform $P)\ |
| 1279 |
)\ |
| 1280 |
) true |
| 1281 |
|
| 1282 |
replatforms: spotless platforms |
| 1283 |
|
| 1284 |
# Print relecant informations about the platform |
| 1285 |
platformenv: |
| 1286 |
@$(foreach P,$(PACKAGING_PLATFORMS),\ |
| 1287 |
echo "* Platform '$P'";\ |
| 1288 |
$(if $(PACKAGING_HOST_$P),\ |
| 1289 |
$(if $(filter $(THISHOST),$(PACKAGING_HOST_$P)),\ |
| 1290 |
echo " - Package built on this host";,\ |
| 1291 |
echo " - Package built on host '$(PACKAGING_HOST_$P)'";\ |
| 1292 |
),\ |
| 1293 |
echo "Package can not be built for this platform as there is no host defined";\ |
| 1294 |
)\ |
| 1295 |
) |
| 1296 |
|
| 1297 |
submitpkg: |
| 1298 |
@echo "The 'submitpkg' target has been removed." |
| 1299 |
@echo "Subversion information is now part of the package," |
| 1300 |
@echo "as the OPENCSW_REPOSITORY entry in pkginfo." |
| 1301 |
|
| 1302 |
# dependb - update the dependency database |
| 1303 |
# |
| 1304 |
dependb: |
| 1305 |
@dependb --db $(SPKG_DEPEND_DB) \ |
| 1306 |
--parent $(CATEGORIES)/$(NAME) \ |
| 1307 |
--add $(DEPENDS) |
| 1308 |
|
| 1309 |
# pkgenv - dump the packaging environment |
| 1310 |
# |
| 1311 |
pkgenv: |
| 1312 |
@$(foreach SPEC,$(_PKG_SPECS),echo "$(SPEC)";echo;$(call _PKG_ENV,$(SPEC)) env;) |
| 1313 |
|
| 1314 |
|
| 1315 |
# pkglist - list the packages to be built with GAR pathname, catalog name and package name |
| 1316 |
# |
| 1317 |
|
| 1318 |
define _pkglist_one |
| 1319 |
$(shell /usr/bin/echo "$(shell pwd)\t$(call catalogname,$(1))\t$(call pkgname,$(1))") |
| 1320 |
endef |
| 1321 |
|
| 1322 |
pkglist: |
| 1323 |
@$(foreach SPEC,$(SPKG_SPECS),echo "$(call _pkglist_one,$(SPEC))";) |