[csw-devel] SF.net SVN: gar:[2999] csw/mgar/gar/v2-dynamiclicense

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Fri Feb 6 16:25:18 CET 2009


Revision: 2999
          http://gar.svn.sourceforge.net/gar/?rev=2999&view=rev
Author:   dmichelsen
Date:     2009-02-06 15:25:17 +0000 (Fri, 06 Feb 2009)

Log Message:
-----------
mGAR v2 dynamiclicense: Final commit

Modified Paths:
--------------
    csw/mgar/gar/v2-dynamiclicense/gar.conf.mk
    csw/mgar/gar/v2-dynamiclicense/gar.mk
    csw/mgar/gar/v2-dynamiclicense/gar.pkg.mk

Modified: csw/mgar/gar/v2-dynamiclicense/gar.conf.mk
===================================================================
--- csw/mgar/gar/v2-dynamiclicense/gar.conf.mk	2009-02-05 22:23:23 UTC (rev 2998)
+++ csw/mgar/gar/v2-dynamiclicense/gar.conf.mk	2009-02-06 15:25:17 UTC (rev 2999)
@@ -101,7 +101,6 @@
 mandir             ?= $(sharedstatedir)/man
 docdir             ?= $(sharedstatedir)/doc
 sourcedir          ?= $(prefix)/src
-licensedir         ?= $(prefix)/licenses
 sharedperl         ?= $(sharedstatedir)/perl
 perllib            ?= $(libdir)/perl
 perlcswlib         ?= $(perllib)/csw

Modified: csw/mgar/gar/v2-dynamiclicense/gar.mk
===================================================================
--- csw/mgar/gar/v2-dynamiclicense/gar.mk	2009-02-05 22:23:23 UTC (rev 2998)
+++ csw/mgar/gar/v2-dynamiclicense/gar.mk	2009-02-06 15:25:17 UTC (rev 2999)
@@ -433,7 +433,7 @@
 	fi
 
 # install		- Test and install the results of a build.
-INSTALL_TARGETS = $(addprefix install-,$(INSTALL_SCRIPTS)) $(addprefix install-license-,$(subst /, ,$(LICENSE)))
+INSTALL_TARGETS = $(addprefix install-,$(INSTALL_SCRIPTS))
 
 install: pre-install $(addprefix install-,$(MODULATIONS)) post-install
 	$(DONADA)
@@ -559,7 +559,7 @@
 _PAX_ARGS = $(_INC_EXT_RULE) $(EXTRA_PAX_ARGS)
 
 # The basic merge merges the compiles for all ISAs on the current architecture
-merge: checksum pre-merge $(addprefix merge-,$(MODULATIONS)) post-merge
+merge: checksum pre-merge $(addprefix merge-,$(MODULATIONS)) merge-license post-merge
 	@$(DONADA)
 
 # This merges the 

Modified: csw/mgar/gar/v2-dynamiclicense/gar.pkg.mk
===================================================================
--- csw/mgar/gar/v2-dynamiclicense/gar.pkg.mk	2009-02-05 22:23:23 UTC (rev 2998)
+++ csw/mgar/gar/v2-dynamiclicense/gar.pkg.mk	2009-02-06 15:25:17 UTC (rev 2999)
@@ -22,13 +22,67 @@
 PKGINFO ?= /usr/bin/pkginfo
 
 # You can use either PACKAGES with dynamic gspec-files or explicitly add gspec-files to DISTFILES.
-# Do "PACKAGES = " when you build a package whose GARNAME is not the package name.
-# The whole processing is done from SPKG_SPECS, which includes all packages to be build.
-# DO NOT USE $(PACKAGES) IN RULES!
+# Do "PACKAGES = CSWmypkg" when you build a package whose GARNAME is not the package name.
+# The whole processing is done from _SPKG_SPECS, which includes all packages to be build.
 PACKAGES ?= CSW$(GARNAME)
 SPKG_SPECS     ?= $(sort $(basename $(filter %.gspec,$(DISTFILES))) $(PACKAGES))
 _PKG_SPECS      = $(filter-out $(NOPACKAGE),$(SPKG_SPECS))
 
+define pkgname
+$(strip 
+  $(if $(filter $(1),$(PACKAGES)),
+    $(1),
+    $(shell perl -F'\s+' -ane 'print "$$F[2]" if( $$F[0] eq "%var" && $$F[1] eq "pkgname")' files/$(1).gspec)
+  )
+)
+endef
+
+define catalogname
+$(strip 
+  $(if $(filter $(1),$(PACKAGES)),
+    $(if $(CATALOGNAME_$(1)),
+      $(CATALOGNAME_$(1)),
+      $(patsubst CSW%,%,$(1))
+    ),
+    $(if $(realpath files/$(1).gspec),
+      $(shell perl -F'\s+' -ane 'print "$$F[2]" if( $$F[0] eq "%var" && $$F[1] eq "bitname")' files/$(1).gspec),
+      $(error The catalog name for the package '$1' could not be determined, because it was neither in PACKAGES nor was there a gspec-file)
+    )
+  )
+)
+endef
+
+ifeq ($(origin LICENSE_FULL), undefined)
+LICENSE ?= COPYING
+endif
+
+define findlicensefile
+$(strip 
+  $(if $(1),$(firstword $(realpath 
+    $(1) $(WORKDIR)/$(1) 
+    $(foreach D,$(foreach M,global $(MODULATIONS),build-$M),$(WORKROOTDIR)/$D/$(DISTNAME)/$(1)) 
+  ))) 
+)
+endef
+
+define licensefile
+$(strip 
+  $(or 
+    $(call findlicensefile,$(LICENSE_$(1))),
+    $(call findlicensefile,$(LICENSE_FULL_$(1))),
+    $(call findlicensefile,$(LICENSE)),
+    $(call findlicensefile,$(LICENSE_FULL))
+  )
+)
+endef
+
+ps:
+	@echo "L: $(call licensefile,CSWlibtool)"
+
+define licensedir
+$(docdir)/$(call catalogname,$(1))
+endef
+
 # Set this to your svn binary
 SVN  ?= /opt/csw/bin/svn
 GAWK ?= /opt/csw/bin/gawk
@@ -139,16 +193,19 @@
 
 # _PKGFILES_EXCLUDE_<spec> contains the files to be excluded from that package
 $(foreach SPEC,$(_PKG_SPECS), \
-  $(eval \
-      _PKGFILES_EXCLUDE_$(SPEC)= \
-      $(foreach S,$(filter-out $(SPEC),$(_PKG_SPECS)), \
-        $(PKGFILES_$(S))) \
-        $(EXTRA_PKGFILES_EXCLUDED) \
-        $(EXTRA_PKGFILES_EXCLUDED_$(SPEC) \
-        $(_EXTRA_PKGFILES_EXCLUDED) \
-       ) \
-   ) \
- )
+  $(eval _PKGFILES_EXCLUDE_$(SPEC)=$(strip \
+    $(foreach S,$(filter-out $(SPEC),$(_PKG_SPECS)), \
+      $(PKGFILES_$(S)) \
+      $(call licensedir,$(S))/.* \
+      $(EXTRA_PKGFILES_EXCLUDED) \
+      $(EXTRA_PKGFILES_EXCLUDED_$(SPEC)) \
+      $(_EXTRA_PKGFILES_EXCLUDED) \
+    ) \
+  )) \
+  $(eval _PKGFILES_INCLUDE_$(SPEC)=$(strip \
+    $(call licensedir,$(SPEC))/.* \
+  )) \
+)
 
 #
 # Targets
@@ -176,7 +233,8 @@
 	      -n "$(_PKGFILES_EXCLUDE_$*)" -o \
 	      -n "$(ISAEXEC_FILES_$*)" -o \
 	      -n "$(ISAEXEC_FILES)" ]; then \
-	  (pathfilter $(foreach FILE,$(PKGFILES_$*_SHARED) $(PKGFILES_$*),-i '$(FILE)') \
+	  (pathfilter $(foreach FILE,$(if $(or $(PKGFILES_$*_SHARED),$(PKGFILES_$*)),$(_PKGFILES_INCLUDE_$*)) \
+			$(PKGFILES_$*_SHARED) $(PKGFILES_$*),-i '$(FILE)') \
 	              $(foreach FILE,$(_PKGFILES_EXCLUDE_$*), -x '$(FILE)') \
 	              $(foreach IE,$(abspath $(ISAEXEC_FILES_$*) $(ISAEXEC_FILES)), \
 	                  -e '$(IE)=$(dir $(IE))$(ISA_DEFAULT)/$(notdir $(IE))' \
@@ -200,19 +258,17 @@
 		)\
 		$(foreach PKG,$(_EXTRA_GAR_PKGS) $(REQUIRED_PKGS_$*) $(REQUIRED_PKGS),\
 			$(if $(SPKG_DESC_$(PKG)), \
-				echo "P $(PKG) $(call _pkglist_catalogname,$(PKG)) - $(SPKG_DESC_$(PKG))";, \
+				echo "P $(PKG) $(call catalogname,$(PKG)) - $(SPKG_DESC_$(PKG))";, \
 				echo "$(shell /usr/bin/pkginfo $(PKG) | awk '{ $$1 = "P"; print } ')"; \
 			) \
 		)) >$@)
 
 
-$(foreach SPEC,$(_PKG_SPECS),$(eval CATALOGNAME_$(SPEC) ?= $(patsubst CSW%,%,$(SPEC))))
-
 # This rule dynamically generates gspec-files
 .PRECIOUS: $(WORKDIR)/%.gspec
 $(WORKDIR)/%.gspec: ARCHALL_$* ?= $(ARCHALL)
 $(WORKDIR)/%.gspec:
-	$(_DBG)(echo "%var            bitname $(CATALOGNAME_$*)"; \
+	$(_DBG)(echo "%var            bitname $(call catalogname,$*)"; \
 	echo "%var            pkgname $*"; \
 	$(if $(ARCHALL_$*),echo "%var            arch all";) \
 	echo "%include        url file://%{PKGLIB}/csw_dyndepend.gspec") >$@
@@ -220,30 +276,20 @@
 # This rule dynamically generates copyright files
 .PRECIOUS: $(WORKDIR)/copyright $(WORKDIR)/%.copyright
 # LICENSE may be a path starting with $(WORKROOTDIR) or a filename inside $(WORKSRC)
-LICENSE ?= COPYING
-_DEFAULT_LICENSE = $(firstword $(wildcard \
-			$(LICENSE) \
-			$(foreach D,$(foreach M,global $(MODULATIONS),build-$M), \
-				$(WORKROOTDIR)/$D/$(DISTNAME)/$(LICENSE) \
-			) \
-		))
 
-$(foreach SPEC,$(_PKG_SPECS),$(eval LICENSE_$(SPEC) ?= copyright))
+merge-license-%:
+	$(_DBG)LICENSEFILE=$(or $(call licensefile,$*),$(error Cannot find license file for package $*)); \
+		LICENSEDIR=$(call licensedir,$*); \
+		$(if $(or $(LICENSE_FULL),$(LICENSE_FULL_$*)), \
+		    if [ -f "$$LICENSEFILE" ]; then cp $$LICENSEFILE $(WORKDIR)/$*.copyright; fi;, \
+		    (echo "This software is copyrighted. Please see the full license at"; \
+		     echo "  $$LICENSEDIR/license") > $(WORKDIR)/$*.copyright; \
+		) \
+		  mkdir -p $(PKGROOT)$$LICENSEDIR && \
+		  cp $$LICENSEFILE $(PKGROOT)$$LICENSEDIR/license 
 
-$(WORKDIR)/%.copyright: | $(WORKDIR)/copyright
-	$(_DBG)cp $(WORKDIR)/copyright $@
+merge-license: $(foreach SPEC,$(_PKG_SPECS),merge-license-$(SPEC))
 
-merge-license:
-	$(_DBG)$(foreach SPEC,$(_PKG_SPECS),\
-		if [ -f $(WORKDIR)/$(LICENSE_$(SPEC)) ]; then \
-			LICENSEDIR=$(docdir)/$(CATALOGNAME_$(SPEC)); \
-			mkdir -p $(PKGROOT)$(LICENSEDIR) && \
-			cp $(WORKDIR)/$(LICENSE_$(SPEC)) $(PKGROOT)$(LICENSEDIR)/license; \
-			(echo "This software is copyrighted. Please see the full license at"; \
-			echo "  $(LICENSEDIR)/license") > $(PKGROOT)$(LICENSEDIR)/license; \
-		fi; \
-	)
-
 # package - Use the mkpackage utility to create Solaris packages
 #
 
@@ -330,16 +376,8 @@
 # pkglist - list the packages to be built with GAR pathname, catalog name and package name
 #
 
-define _pkglist_pkgname
-$(if $(filter $(1),$(PACKAGES)),$(filter $(1),$(PACKAGES)),$(shell perl -F'\s+' -ane 'print "$$F[2]" if( $$F[0] eq "%var" && $$F[1] eq "pkgname")' files/$(1).gspec))
-endef
-
-define _pkglist_catalogname
-$(if $(filter $(1),$(PACKAGES)),$(call catalogname,$(1)),$(shell perl -F'\s+' -ane 'print "$$F[2]" if( $$F[0] eq "%var" && $$F[1] eq "bitname")' files/$(1).gspec))
-endef
-
 define _pkglist_one
-$(shell /usr/bin/echo "$(shell pwd)\t$(call _pkglist_catalogname,$(1))\t$(call _pkglist_pkgname,$(1))")
+$(shell /usr/bin/echo "$(shell pwd)\t$(call catalogname,$(1))\t$(call pkgname,$(1))")
 endef
 
 pkglist:


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list