Bug 1331090 - Strip the gtest libxul prior to packaging. draft
authorChris Manchester <cmanchester@mozilla.com>
Fri, 13 Jan 2017 16:37:55 -0800
changeset 480678 94e61ddbe1b557542500e90a841675e0c81016ad
parent 480619 5e17f9181c6cb0968966280d1c1d96e725702af1
child 545027 11d7abb8ef187f3edda78ed4dd2f889588a3bce1
push id44625
push userbmo:cmanchester@mozilla.com
push dateWed, 08 Feb 2017 20:13:35 +0000
bugs1331090
milestone54.0a1
Bug 1331090 - Strip the gtest libxul prior to packaging. MozReview-Commit-ID: KC3Wgn0OsSM
testing/testsuite-targets.mk
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -198,49 +198,58 @@ stage-mach: make-stage-dir
 stage-mochitest: make-stage-dir
 ifeq ($(MOZ_BUILD_APP),mobile/android)
 	$(MAKE) -C $(DEPTH)/testing/mochitest stage-package
 endif
 
 stage-jstests: make-stage-dir
 	$(MAKE) -C $(DEPTH)/js/src/tests stage-package
 
+ifdef OBJCOPY
+ifneq ($(OBJCOPY), :) # see build/autoconf/toolchain.m4:102 for why this is necessary
+ifndef PKG_SKIP_STRIP
+STRIP_COMPILED_TESTS := 1
+endif
+endif
+endif
+
 stage-gtest: make-stage-dir
-	$(NSINSTALL) -D $(PKG_STAGE)/gtest/gtest_bin
+	$(NSINSTALL) -D $(PKG_STAGE)/gtest/gtest_bin/gtest
+ifdef STRIP_COMPILED_TESTS
+# The libxul file basename will vary per platform. Fortunately
+# dependentlibs.list always lists the library name as its final line, so we
+# can get the value from there.
+	LIBXUL_BASE=`tail -1 $(DIST)/bin/dependentlibs.list` && \
+        $(OBJCOPY) $(or $(STRIP_FLAGS),--strip-unneeded) \
+        $(DIST)/bin/gtest/$$LIBXUL_BASE $(PKG_STAGE)/gtest/gtest_bin/gtest/$$LIBXUL_BASE
+else
 	cp -RL $(DIST)/bin/gtest $(PKG_STAGE)/gtest/gtest_bin
+endif
 	cp -RL $(DEPTH)/_tests/gtest $(PKG_STAGE)
 	cp $(topsrcdir)/testing/gtest/rungtests.py $(PKG_STAGE)/gtest
 	cp $(DIST)/bin/dependentlibs.list.gtest $(PKG_STAGE)/gtest
 	cp $(DEPTH)/mozinfo.json $(PKG_STAGE)/gtest
 
 stage-android: make-stage-dir
 	$(NSINSTALL) $(topsrcdir)/mobile/android/fonts $(DEPTH)/_tests/reftest
 	$(NSINSTALL) $(topsrcdir)/mobile/android/fonts $(DEPTH)/_tests/testing/mochitest
 
 stage-jetpack: make-stage-dir
 	$(MAKE) -C $(DEPTH)/addon-sdk stage-tests-package
 
 CPP_UNIT_TEST_BINS=$(wildcard $(DIST)/cppunittests/*)
 
-ifdef OBJCOPY
-ifneq ($(OBJCOPY), :) # see build/autoconf/toolchain.m4:102 for why this is necessary
-ifndef PKG_SKIP_STRIP
-STRIP_CPP_TESTS := 1
-endif
-endif
-endif
-
 stage-cppunittests: make-stage-dir
 	$(NSINSTALL) -D $(PKG_STAGE)/cppunittest
-ifdef STRIP_CPP_TESTS
+ifdef STRIP_COMPILED_TESTS
 	$(foreach bin,$(CPP_UNIT_TEST_BINS),$(OBJCOPY) $(or $(STRIP_FLAGS),--strip-unneeded) $(bin) $(bin:$(DIST)/cppunittests/%=$(PKG_STAGE)/cppunittest/%);)
 else
 	cp -RL $(CPP_UNIT_TEST_BINS) $(PKG_STAGE)/cppunittest
 endif
-ifdef STRIP_CPP_TESTS
+ifdef STRIP_COMPILED_TESTS
 	$(OBJCOPY) $(or $(STRIP_FLAGS),--strip-unneeded) $(DIST)/bin/jsapi-tests$(BIN_SUFFIX) $(PKG_STAGE)/cppunittest/jsapi-tests$(BIN_SUFFIX)
 else
 	cp -RL $(DIST)/bin/jsapi-tests$(BIN_SUFFIX) $(PKG_STAGE)/cppunittest
 endif
 
 stage-steeplechase: make-stage-dir
 	$(NSINSTALL) -D $(PKG_STAGE)/steeplechase/
 	cp -RL $(DEPTH)/_tests/steeplechase $(PKG_STAGE)/steeplechase/tests