Support extracting archives to the packages we build
* BuildHaikuPackage rule: Create the script that contains the extraction commands. * build_haiku_package: Add extractFile() function (stripped down version from build_haiku_image). In build_haiku_image the functionality was mainly used to extract the optional packages, which is no longer done. We still need it e.g. for the Wifi firmware packages that want to be extracted.
This commit is contained in:
@@ -334,14 +334,16 @@ rule BuildHaikuPackage package : packageInfo
|
|||||||
# create the other scripts
|
# create the other scripts
|
||||||
local makeDirsScript = <$(grist)>haiku.package-make-dirs ;
|
local makeDirsScript = <$(grist)>haiku.package-make-dirs ;
|
||||||
local copyFilesScript = <$(grist)>haiku.package-copy-files ;
|
local copyFilesScript = <$(grist)>haiku.package-copy-files ;
|
||||||
|
local extractFilesScript = <$(grist)>haiku.package-extract-files ;
|
||||||
|
|
||||||
MakeLocate $(makeDirsScript) $(copyFilesScript) : $(scriptDir) ;
|
MakeLocate $(makeDirsScript) $(copyFilesScript) : $(scriptDir) ;
|
||||||
|
|
||||||
CreateContainerMakeDirectoriesScript $(package) : $(makeDirsScript) ;
|
CreateContainerMakeDirectoriesScript $(package) : $(makeDirsScript) ;
|
||||||
CreateContainerCopyFilesScript $(package) : $(copyFilesScript) ;
|
CreateContainerCopyFilesScript $(package) : $(copyFilesScript) ;
|
||||||
|
CreateContainerExtractFilesScript $(package) : $(extractFilesScript) ;
|
||||||
|
|
||||||
local scripts = $(initVariablesScript) $(makeDirsScript)
|
local scripts = $(initVariablesScript) $(makeDirsScript)
|
||||||
$(copyFilesScript) ;
|
$(copyFilesScript) $(extractFilesScript) ;
|
||||||
|
|
||||||
# call the build actions
|
# call the build actions
|
||||||
local mainScript = build_haiku_package ;
|
local mainScript = build_haiku_package ;
|
||||||
|
|||||||
@@ -56,6 +56,51 @@ rm=$rmAttrs
|
|||||||
mkindex=mkindex
|
mkindex=mkindex
|
||||||
|
|
||||||
|
|
||||||
|
extractFile()
|
||||||
|
{
|
||||||
|
# extractFile <archive> <directory> <extractedSubDir> <stripDebugSymbols>
|
||||||
|
archiveFile=$1
|
||||||
|
targetExtractedDir=$2
|
||||||
|
extractedSubDir=$3
|
||||||
|
# Ignore stripDebugSymbols. It's not relevant here, since executables and
|
||||||
|
# libraries shouldn't come from zip files or other archives anymore.
|
||||||
|
|
||||||
|
extractDir=$tmpDir/extract
|
||||||
|
$rmAttrs -rf "$extractDir"
|
||||||
|
mkdir -p "$extractDir"
|
||||||
|
|
||||||
|
case "$archiveFile" in
|
||||||
|
*.zip)
|
||||||
|
echo "Extracting $archiveFile ..."
|
||||||
|
$unzip -q -d "$extractDir" "$archiveFile"
|
||||||
|
;;
|
||||||
|
*.tgz|*.tar.gz)
|
||||||
|
echo "Extracting $archiveFile ..."
|
||||||
|
tar -C "$extractDir" -xf "$archiveFile"
|
||||||
|
;;
|
||||||
|
*.hpkg)
|
||||||
|
echo "Extracting $archiveFile ..."
|
||||||
|
if [ -n "$extractedSubDir" ]; then
|
||||||
|
$package extract -C "$extractDir" "$archiveFile" \
|
||||||
|
"$extractedSubDir"
|
||||||
|
else
|
||||||
|
$package extract -C "$extractDir" "$archiveFile"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unhandled archive extension in build_haiku_image" \
|
||||||
|
"extractFile()"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
$cp -r "${sPrefix}$extractDir/$extractedSubDir/." \
|
||||||
|
"${tPrefix}$targetExtractedDir"
|
||||||
|
|
||||||
|
$rmAttrs -rf "$extractDir"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# execute the scripts preparing the package contents
|
# execute the scripts preparing the package contents
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
. $1
|
. $1
|
||||||
|
|||||||
Reference in New Issue
Block a user