Added support for unzipping archives onto the Haiku image. The new rule
to do that is UnzipArchiveToHaikuImage. Cf. UserBuildConfig.sample for a usage example. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22173 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5e1d6fb269
commit
0d469404ed
@ -449,6 +449,7 @@ AddTargetVariableToScript $(script) : <build>copyattr ;
|
||||
AddTargetVariableToScript $(script) : <build>makebootable ;
|
||||
AddTargetVariableToScript $(script) : <build>rc ;
|
||||
AddTargetVariableToScript $(script) : <build>resattr ;
|
||||
AddTargetVariableToScript $(script) : <build>unzip ;
|
||||
#AddTargetVariableToScript $(script) : $(HAIKU_IMAGE) : imagePath ;
|
||||
# causes a cyclic dependency
|
||||
AddVariableToScript $(script) : imagePath
|
||||
@ -459,11 +460,13 @@ AddVariableToScript $(script) : sourceDirsToCopy
|
||||
# create the other scripts
|
||||
HAIKU_IMAGE_MAKE_DIRS_SCRIPT = <HaikuImage>haiku.image-make-dirs ;
|
||||
HAIKU_IMAGE_COPY_FILES_SCRIPT = <HaikuImage>haiku.image-copy-files ;
|
||||
HAIKU_IMAGE_UNZIP_FILES_SCRIPT = <HaikuImage>haiku.image-unzip-files ;
|
||||
MakeLocate $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) $(HAIKU_IMAGE_COPY_FILES_SCRIPT)
|
||||
: $(HAIKU_OUTPUT_DIR) ;
|
||||
$(HAIKU_IMAGE_UNZIP_FILES_SCRIPT) : $(HAIKU_OUTPUT_DIR) ;
|
||||
|
||||
CreateHaikuImageMakeDirectoriesScript $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) ;
|
||||
CreateHaikuImageCopyFilesScript $(HAIKU_IMAGE_COPY_FILES_SCRIPT) ;
|
||||
CreateHaikuImageUnzipFilesScript $(HAIKU_IMAGE_UNZIP_FILES_SCRIPT) ;
|
||||
|
||||
# Convenience wrapper rule around BuildHaikuImage.
|
||||
rule _BuildHaikuImage
|
||||
@ -481,6 +484,7 @@ rule _BuildHaikuImage
|
||||
$(HAIKU_IMAGE_EARLY_USER_SCRIPTS)
|
||||
$(HAIKU_IMAGE_MAKE_DIRS_SCRIPT)
|
||||
$(HAIKU_IMAGE_COPY_FILES_SCRIPT)
|
||||
$(HAIKU_IMAGE_UNZIP_FILES_SCRIPT)
|
||||
$(HAIKU_IMAGE_LATE_USER_SCRIPTS)
|
||||
: $(isImage)
|
||||
;
|
||||
@ -490,6 +494,7 @@ rule _BuildHaikuImage
|
||||
$(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT)
|
||||
$(HAIKU_IMAGE_MAKE_DIRS_SCRIPT)
|
||||
$(HAIKU_IMAGE_COPY_FILES_SCRIPT)
|
||||
$(HAIKU_IMAGE_UNZIP_FILES_SCRIPT)
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -202,6 +202,17 @@ rule AddSymlinkToContainer container : directoryTokens : linkTarget : linkName
|
||||
SYMLINKS_TO_INSTALL on $(directory) += $(link) ;
|
||||
}
|
||||
|
||||
rule UnzipArchiveToContainer container : directoryTokens : zipFile
|
||||
{
|
||||
# UnzipArchiveToContainer <container> : <directory> : <zipFile> ] ;
|
||||
#
|
||||
|
||||
local directory = [ AddDirectoryToContainer $(container)
|
||||
: $(directoryTokens) ] ;
|
||||
|
||||
ZIP_FILES_TO_INSTALL on $(directory) += $(zipFile) ;
|
||||
}
|
||||
|
||||
rule AddDriversToContainer container : relativeDirectoryTokens : targets
|
||||
{
|
||||
# AddDriversToContainer <container> : <relative directory> : <targets> ;
|
||||
@ -441,6 +452,45 @@ actions AddSymlinkToContainerCopyFilesScript
|
||||
}
|
||||
|
||||
|
||||
rule CreateContainerUnzipFilesScript container : script
|
||||
{
|
||||
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
||||
Always $(script) ;
|
||||
|
||||
local initScript = [ InitScript $(script) ] ;
|
||||
|
||||
local scriptBody
|
||||
= [ FSameTargetWithPrependedGrist $(script) : script-body ] ;
|
||||
LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ;
|
||||
Depends $(scriptBody) : $(initScript) ;
|
||||
Depends $(script) : $(scriptBody) ;
|
||||
|
||||
local dir ;
|
||||
for dir in [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] {
|
||||
local zipFiles = [ on $(dir) return $(ZIP_FILES_TO_INSTALL) ] ;
|
||||
local zipFile ;
|
||||
for zipFile in $(zipFiles) {
|
||||
# use a unique dummy target for this file, on which we
|
||||
# can define the TARGET_DIR variable
|
||||
local dummyTarget = $(script)-dummy-$(dir:G=)-$(zipFile) ;
|
||||
NotFile $(dummyTarget) ;
|
||||
TARGET_DIR on $(dummyTarget) = $(dir:G=) ;
|
||||
|
||||
Depends $(dummyTarget) : $(initScript) $(zipFile) ;
|
||||
Depends $(script) : $(dummyTarget) ;
|
||||
|
||||
AddUnzipFileToContainerUnzipFilesScript $(dummyTarget)
|
||||
: $(initScript) $(zipFile) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actions AddUnzipFileToContainerUnzipFilesScript
|
||||
{
|
||||
echo unzipFile "\"$(2[2])\"" "\"$(TARGET_DIR)\"" >> $(2[1])
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Haiku Image rules
|
||||
|
||||
rule SetUpdateHaikuImageOnly flag
|
||||
@ -496,6 +546,18 @@ rule AddSourceDirectoryToHaikuImage dirTokens : alwaysUpdate
|
||||
}
|
||||
}
|
||||
|
||||
rule UnzipArchiveToHaikuImage dirTokens : zipFile : alwaysUpdate
|
||||
{
|
||||
# UnzipArchiveToHaikuImage <dirTokens> : <zipFile> : <alwaysUpdate> ;
|
||||
|
||||
# If the image shall only be updated, we unzip only, if explicitely
|
||||
# requested.
|
||||
if ! [ IsUpdateHaikuImageOnly ] || $(alwaysUpdate) {
|
||||
UnzipArchiveToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(dirTokens)
|
||||
: $(zipFile) ;
|
||||
}
|
||||
}
|
||||
|
||||
rule AddDriversToHaikuImage relativeDirectoryTokens : targets
|
||||
{
|
||||
# AddDriversToHaikuImage <relative directory> : <targets> ;
|
||||
@ -531,6 +593,11 @@ rule CreateHaikuImageCopyFilesScript script
|
||||
CreateContainerCopyFilesScript $(HAIKU_IMAGE_CONTAINER_NAME) : $(script) ;
|
||||
}
|
||||
|
||||
rule CreateHaikuImageUnzipFilesScript script
|
||||
{
|
||||
CreateContainerUnzipFilesScript $(HAIKU_IMAGE_CONTAINER_NAME) : $(script) ;
|
||||
}
|
||||
|
||||
rule BuildHaikuImage haikuImage : scripts : isImage
|
||||
{
|
||||
# BuildHaikuImage <haiku image> : <scripts> : <is image> ;
|
||||
|
@ -63,6 +63,10 @@ AddSymlinkToHaikuImage home config bin : /beos/bin/crashing_app : crash ;
|
||||
AddSourceDirectoryToHaikuImage src/kits/storage ;
|
||||
AddSourceDirectoryToHaikuImage src/tests/servers/debug : 1 ;
|
||||
|
||||
# Unzips the given zip archive onto the image under /boot/develop/tools.
|
||||
UnzipArchiveToHaikuImage develop tools
|
||||
: /home/bonefish/develop/haiku/misc/gcc-2.95.3-beos-070218/gcc-2.95.3_binutils-2.17_rel-070218.zip ;
|
||||
|
||||
# Specify scripts that shall be run when populating the image/installation
|
||||
# directory. The "early" script is run before anything has been copied onto
|
||||
# the image/into the installation directory. The "late" script is run after
|
||||
|
@ -18,6 +18,7 @@
|
||||
# makebootable
|
||||
# resattr
|
||||
# rc
|
||||
# unzip
|
||||
#
|
||||
if [ $# -gt 0 ]; then
|
||||
. $1
|
||||
@ -53,6 +54,30 @@ else
|
||||
mkindex=mkindex
|
||||
fi
|
||||
|
||||
|
||||
unzipFile()
|
||||
{
|
||||
# unzipFile <archive> <directory>
|
||||
zipFile=$1
|
||||
targetUnzipDir=$2
|
||||
|
||||
echo "Unzipping $zipFile ..."
|
||||
|
||||
if [ $isImage ]; then
|
||||
unzipDir=$tmpDir/unzip
|
||||
rm -rf $unzipDir
|
||||
mkdir -p $unzipDir
|
||||
|
||||
$unzip -q -d $unzipDir $zipFile
|
||||
$cp -r ${sPrefix}$unzipDir/. ${tPrefix}$targetUnzipDir
|
||||
|
||||
rm -rf $unzipDir
|
||||
else
|
||||
$unzip -q -d ${tPrefix}$targetUnzipDir ${sPrefix}$zipFile
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# create the image and mount it
|
||||
if [ $isImage ]; then
|
||||
echo
|
||||
|
Loading…
Reference in New Issue
Block a user