Refactored the stripping of debug symbols to be a per-archive basis.

Setting 'HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES = 1' will enable the
mechanism. By default all packages will be stripped. Passing anything
other than '1' or 'true' in the InstallOptionalHaikuImagePackage call
will disable it for a particular package.
This commit is contained in:
Matt Madia 2012-09-16 19:41:24 -04:00
parent f672eb2827
commit 1a53a4d3f5
4 changed files with 27 additions and 14 deletions

View File

@ -28,8 +28,6 @@ AddVariableToScript $(script) : isCD : 1 ;
AddVariableToScript $(script) : cdLabel : $(HAIKU_CD_LABEL) ;
AddVariableToScript $(script) : addBuildCompatibilityLibDir
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
AddVariableToScript $(script) : stripOptionalPackageDebugSymbols
: $(HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES) ;
AddTargetVariableToScript $(script) : <build>addattr ;
AddTargetVariableToScript $(script) : <build>copyattr ;
AddTargetVariableToScript $(script) : <build>rc ;

View File

@ -904,8 +904,6 @@ AddVariableToScript $(script) : addBuildCompatibilityLibDir
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
AddVariableToScript $(script) : dontClearImage : $(HAIKU_DONT_CLEAR_IMAGE) ;
AddVariableToScript $(script) : updateOnly : [ IsUpdateHaikuImageOnly ] ;
AddVariableToScript $(script) : stripOptionalPackageDebugSymbols
: $(HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES) ;
AddTargetVariableToScript $(script) : <build>addattr ;
AddTargetVariableToScript $(script) : <build>bfs_shell : bfsShell ;
AddTargetVariableToScript $(script) : <build>fs_shell_command : fsShellCommand ;

View File

@ -283,16 +283,17 @@ rule CopyDirectoryToContainer container : directoryTokens : sourceDirectory
}
rule ExtractArchiveToContainer container : directoryTokens : archiveFile
: extractedSubDir
: extractedSubDir : stripDebugSymbols
{
# ExtractArchiveToContainer <container> : <directory> : <archiveFile>
# : <extractedSubDir> ;
# : <extractedSubDir> : <stripDebugSymbols> ;
local directory = [ AddDirectoryToContainer $(container)
: $(directoryTokens) ] ;
ARCHIVE_FILES_TO_INSTALL on $(directory) += $(archiveFile) ;
ARCHIVE_SUBDIR_TO_INSTALL_FROM on $(archiveFile) = $(extractedSubDir) ;
ARCHIVE_FILES_TO_STRIP on $(archiveFile) = $(stripDebugSymbols) ;
}
rule AddDriversToContainer container : relativeDirectoryTokens : targets
@ -607,6 +608,11 @@ rule CreateContainerExtractFilesScript container : script
ARCHIVE_SUBDIR_TO_INSTALL_FROM on $(dummyTarget) =
$(extractedSubDir:E=.) ;
local stripDebugSymbols = [ on $(archiveFile)
return $(ARCHIVE_FILES_TO_STRIP) ] ;
STRIP_DEBUG_SYMBOLS_FROM_ARCHIVE on $(dummyTarget) =
$(stripDebugSymbols) ;
Depends $(dummyTarget) : $(initScript) $(archiveFile)
$(serializationDependency) ;
Depends $(script) : $(dummyTarget) ;
@ -622,7 +628,8 @@ rule CreateContainerExtractFilesScript container : script
actions AddExtractFileToContainerExtractFilesScript
{
echo extractFile "\"$(2[2])\"" "\"$(TARGET_DIR)\"" \
"\"$(ARCHIVE_SUBDIR_TO_INSTALL_FROM)\"" >> $(2[1])
"\"$(ARCHIVE_SUBDIR_TO_INSTALL_FROM)\"" \
"\"$(STRIP_DEBUG_SYMBOLS_FROM_ARCHIVE)\"" >> $(2[1])
}
@ -729,7 +736,7 @@ rule AddWifiFirmwareToHaikuImage driver : package : archive : extract
}
rule ExtractArchiveToHaikuImage dirTokens : archiveFile : alwaysUpdate
: extractedSubDir
: extractedSubDir : stripDebugSymbols
{
# ExtractArchiveToHaikuImage <dirTokens> : <archiveFile> : <alwaysUpdate>
# : <extractedSubDir> ;
@ -738,7 +745,7 @@ rule ExtractArchiveToHaikuImage dirTokens : archiveFile : alwaysUpdate
# requested.
if ! [ IsUpdateHaikuImageOnly ] || $(alwaysUpdate) {
ExtractArchiveToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(dirTokens)
: $(archiveFile) : $(extractedSubDir) ;
: $(archiveFile) : $(extractedSubDir) : $(stripDebugSymbols) ;
}
}
@ -825,6 +832,7 @@ rule InstallSourceArchive file : url
}
rule InstallOptionalHaikuImagePackage package : url : dirTokens : isCDPackage
: stripDebugSymbols
{
# download archive file
local archiveFile = [ DownloadFile $(package) : $(url) ] ;
@ -835,8 +843,17 @@ rule InstallOptionalHaikuImagePackage package : url : dirTokens : isCDPackage
# copy onto image
AddFilesToHaikuImage _packages_ : $(archiveFile) ;
} else {
if $(HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES) = 1 {
stripDebugSymbols ?= 1 ;
# The script will only test for = 1. This is in case someone
# manually set the flag 'true'
if $(stripDebugSymbols) = true {
stripDebugSymbols = 1 ;
}
}
# extract onto image
ExtractArchiveToHaikuImage $(dirTokens) : $(archiveFile) ;
ExtractArchiveToHaikuImage $(dirTokens) : $(archiveFile)
: : : $(stripDebugSymbols) ;
}
}
@ -1472,7 +1489,7 @@ actions BuildCDBootPPCImage1 bind MAPS
|| \
genisoimage -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg \
-V bootimg -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/ppc -prep-boot \
ppc/$(>[2]:D=) -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd
ppc/$(>[2]:D=) -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd
#$(RM) -R $(HAIKU_OUTPUT_DIR)/cd
}

View File

@ -16,7 +16,6 @@ set -o errexit
# dontClearImage
# isVMwareImage
# optionalPackageDescriptions
# stripOptionalPackageDebugSymbols
#
# addattr
# copyattr
@ -158,10 +157,11 @@ stripDebugInfo()
extractFile()
{
# extractFile <archive> <directory>
# extractFile <archive> <directory> <extractedSubDir> <stripDebugSymbols>
archiveFile=$1
targetExtractedDir=$2
extractedSubDir=$3
stripDebugSymbols=$4
echo "Extracting $archiveFile ..."
@ -188,7 +188,7 @@ extractFile()
rm $extractDir/.OptionalPackageDescription
fi
if [ "$stripOptionalPackageDebugSymbols" = "1" ]; then
if [ "$stripDebugSymbols" = "1" ]; then
# strip executables in common/bin
if [ -d $extractDir/common/bin ]; then
for file in `find $extractDir/common/bin -type f -a -perm +100 \