Simplify/fix the ExtractArchive rule and friends

* The call to the dummy actions isn't needed
* The calls to Extract{Zip,Tar,HPKG}Archive1 couldn't work like that.
  The directory has to be the main target, since ExtractArchive is
  potentially invoked multiple times with different extracted file
  targets and the Extract*Archive1 is only invoked the first time.
  Tested only with the HPKG actions, but they others should work as
  well.
This commit is contained in:
Ingo Weinhold 2013-04-02 17:17:46 +00:00
parent 7c29395824
commit bcdf492404

View File

@ -236,15 +236,15 @@ rule ExtractArchive directory : entries : archiveFile : grist
switch $(archiveFile:S)
{
case .zip :
ExtractZipArchive1 $(targets) : $(directory) $(archiveFile) ;
ExtractZipArchive1 $(directory) : $(archiveFile) ;
case .tgz :
ExtractTarArchive1 $(targets) : $(directory) $(archiveFile) ;
ExtractTarArchive1 $(directory) : $(archiveFile) ;
case .hpkg :
Depends $(targets) : <build>package ;
ExtractHPKGArchive1 $(targets)
: <build>package $(directory) $(archiveFile) ;
Depends $(directory) : <build>package ;
ExtractHPKGArchive1 $(directory)
: <build>package $(archiveFile) ;
case * :
Exit "ExtractArchive: Unhandled archive extension:"
@ -253,39 +253,32 @@ rule ExtractArchive directory : entries : archiveFile : grist
INITIALIZED on $(directory) = 1 ;
}
# Use a dummy rule so that it looks to jam like the targets are actually
# built from the directory target.
ExtractArchiveDummy $(targets) : $(directory) ;
return $(targets) ;
}
actions ExtractZipArchive1
{
mkdir -p $(2[1])
unzip -q -u -o -d $(2[1]) $(2[2])
mkdir -p $(1)
unzip -q -u -o -d $(1) $(2)
}
actions ExtractTarArchive1
{
mkdir -p $(2[1])
tar -C $(2[1]) -xf $(2[2])
mkdir -p $(1)
tar -C $(1) -xf $(2)
}
actions ExtractHPKGArchive1
{
mkdir -p "$(2[2])"
mkdir -p "$(1)"
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
$(2[1]) extract -C "$(2[2])" "$(2[3])"
$(2[1]) extract -C "$(1)" "$(2[2])"
}
actions ExtractArchiveDummy
{
}
rule ObjectReference
{
# ObjectReference <reference object> : <source object>