From b696213351b8461e78f4d2573fa65fc7a0ce897c Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 18 May 2007 16:50:47 +0000 Subject: [PATCH] Added rule AddFileDataAttribute to add an attribute to a file. The attribute value is read from another file. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21166 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/BeOSRules | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/build/jam/BeOSRules b/build/jam/BeOSRules index 0caba7c899..33ad59b287 100644 --- a/build/jam/BeOSRules +++ b/build/jam/BeOSRules @@ -1,5 +1,48 @@ # BeOS specific rules +rule AddFileDataAttribute target : attrName : attrType : dataFile +{ + # AddFileAttribute : : : ; + # Adds a single attribute to a file, retrieving the attribute data from + # a separate file. + # : The file to which the attribute shall be added. + # : The name of the attribute. + # : Attribute type as supported by addattr (string, int, etc.) + # : The data to be written to the attribute will be read from + # that file. + # Note that this is supposed to be a build target, not a path + # name - if you need to add a data file in a different path, + # you have to locate it first. + # + + # We need to create a temporary file in which we store the attribute name + # and type. Otherwise we wouldn't have these data available in the + # addattr actions. + local id = [ NextID ] ; + local attrMetaFile + = [ FGristFiles $(target:G=)-attr-$(attrName)-$(attrType)-$(id) ] ; + + ATTRIBUTE_NAME on $(attrMetaFile) = $(attrName) ; + ATTRIBUTE_TYPE on $(attrMetaFile) = $(attrType) ; + MakeLocateArch $(attrMetaFile) ; + CreateAttributeMetaFile $(attrMetaFile) ; + + Depends $(target) : addattr $(attrMetaFile) $(dataFile) ; + AddFileDataAttribute1 $(target) + : addattr $(attrMetaFile) $(dataFile) ; + + RmTemps $(target) : $(attrMetaFile) ; +} + +actions CreateAttributeMetaFile +{ + echo "-t $(ATTRIBUTE_TYPE)" "$(ATTRIBUTE_NAME)" > "$(1)" +} + +actions AddFileDataAttribute1 +{ + $(2[1]) -f $(2[3]) `cat $(2[2])` $(1) +} rule AddStringDataResource { @@ -37,7 +80,6 @@ actions together AddStringDataResource1 $(2[1]) -o "$(1)" $(RESOURCE_STRINGS) } - rule AddFileDataResource { # AddFileDataResource : : [ ]