From d6de84de6690d076caf2744ba3fda17ef267cabd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Wed, 9 Oct 2013 18:30:03 +0200 Subject: [PATCH] Allow stripping binaries when copying to image containers Currently only needed for boot floppy on some platforms. Disabled for now. Note we do not have a mean of knowing which file is a binary or not so we just try to strip, and silently continue when strip fails (like on the kernel settings file). Also note strip actually replaces the file, which means it looses both the resources and attributes, which shouldn't be a problem for the boot floppy drivers archive, but is not wanted for other images, so it's not usable elsewhere as such. Patch wanted. --- build/jam/BuildSetup | 2 ++ build/jam/ImageRules | 14 ++++++++++++++ build/jam/images/FloppyBootImage | 1 + 3 files changed, 17 insertions(+) diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index d77704418c..fff02c18fb 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -41,6 +41,8 @@ HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) = HAIKU_FLOPPY_BOOT_IMAGE_INSTALL_TARGETS ; HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) = system ; +#HAIKU_CONTAINER_STRIP_BINARIES on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) +# = 1 ; # boot CD image HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-cd-container ; diff --git a/build/jam/ImageRules b/build/jam/ImageRules index 172a766537..631bf6dda2 100644 --- a/build/jam/ImageRules +++ b/build/jam/ImageRules @@ -692,6 +692,8 @@ rule CreateContainerCopyFilesScript container : script local dummyTarget = $(script)-dummy-$(dir:G=)-$(target) ; NotFile $(dummyTarget) ; TARGET_DIR on $(dummyTarget) = $(dir:G=) ; + DO_STRIP on $(dummyTarget) = [ on $(container) + return $(HAIKU_CONTAINER_STRIP_BINARIES) ] ; local nameFunction = [ on $(destTarget) return $(NAME_FUNCTION) ] ; @@ -721,6 +723,8 @@ rule CreateContainerCopyFilesScript container : script local dummyTarget = $(script)-dummy-$(dir:G=) ; NotFile $(dummyTarget) ; TARGET_DIR on $(dummyTarget) = $(dir:G=) ; + DO_STRIP on $(dummyTarget) = [ on $(container) + return $(HAIKU_CONTAINER_STRIP_BINARIES) ] ; Depends $(dummyTarget) : $(initScript) $(targets) $(serializationDependency) ; @@ -763,6 +767,11 @@ actions piecemeal AppendToContainerCopyFilesScript bind OUTPUT_SCRIPT { echo \$cp "\"\${sPrefix}$(2)\"" "\"\${tPrefix}$(TARGET_DIR)\"" \ >> $(OUTPUT_SCRIPT) + + if [ -n "$(DO_STRIP:E)" ]; then + echo \$strip "\"\${tPrefix}$(TARGET_DIR)/$(2:BS)\"" "2>/dev/null" \ + "|| true" >> $(OUTPUT_SCRIPT) + fi } @@ -775,6 +784,11 @@ actions AppendToContainerCopyFilesScriptSingleFile echo \$cp "\"\${sPrefix}$(2[2])\"" \ "\"\${tPrefix}$(TARGET_DIR)/$(INSTALL_TARGET_NAME)\"" >> $(2[1]) + + if [ -n "$(DO_STRIP:E)" ]; then + echo \$strip "\"\${tPrefix}$(TARGET_DIR)/$(INSTALL_TARGET_NAME)\"" \ + "2>/dev/null" "|| true" >> $(2[1]) + fi } diff --git a/build/jam/images/FloppyBootImage b/build/jam/images/FloppyBootImage index b44f1ee2d6..61c16ff888 100644 --- a/build/jam/images/FloppyBootImage +++ b/build/jam/images/FloppyBootImage @@ -183,6 +183,7 @@ AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ; AddVariableToScript $(script) : addBuildCompatibilityLibDir : $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ; AddTargetVariableToScript $(script) : copyattr ; +AddTargetVariableToScript $(script) : $(HAIKU_STRIP_$(TARGET_ARCH)) : strip ; # create the other scripts local makeDirsScript = haiku-floppyboot-make-dirs ;