{"thread":{"id":"56394","subject":"[PATCH v2] make: add install-stripped target","startedAt":"2021-08-28T12:22:08Z","lastAt":"2021-08-28T12:22:08Z","messageCount":1,"participants":["Bagas Sanjaya"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"434017","messageId":"20210828122118.56283-1-bagasdotme@gmail.com","threadId":"56394","inReplyTo":null,"subject":"[PATCH v2] make: add install-stripped target","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2021-08-28T12:21:19Z","receivedAt":"2021-08-28T12:22:08Z","isPatch":true,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"Add the target that install Git with stripped executables.\n\ninstall and install-stripped share the almost-same recipe, with the\ndifference only on passing arguments to $(INSTALL). In order for this to\nwork properly, installing all programs ($(ALL_PROGRAMS) and\n$(install_bindir_programs)) must be splitted into compiled programs and\nscripts install portion. For compiled programs, pass $(INSTALL_OPTS),\nsince stripping is only meaningful for them and not scripts.\n\nSigned-off-by: Bagas Sanjaya <bagasdotme@gmail.com>\n---\n\n Changes from v1:\n - Share recipes between install-stripped and install targets (suggested\n   by Junio)\n - Don't delete 'strip' target. There may exist scripts that depend on\n   that target. Once this patch is integrated, deprecation notice can\n   be displayed when running the target, but it is done in separate\n   patch.\n\n [1]:\nhttps://lore.kernel.org/git/20210826113824.50078-1-bagasdotme@gmail.com/T/#t\n\n Makefile | 18 ++++++++++++++----\n 1 file changed, 14 insertions(+), 4 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex d1feab008f..73a97d952c 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3004,7 +3004,8 @@ mergetools_instdir = $(prefix)/$(mergetoolsdir)\n endif\n mergetools_instdir_SQ = $(subst ','\\'',$(mergetools_instdir))\n \n-install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)\n+install_bindir_xprograms := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X))\n+install_bindir_programs := $(install_bindir_xprograms) $(BINDIR_PROGRAMS_NO_X)\n \n .PHONY: profile-install profile-fast-install\n profile-install: profile\n@@ -3013,12 +3014,21 @@ profile-install: profile\n profile-fast-install: profile-fast\n \t$(MAKE) install\n \n-install: all\n+INSTALL_OPTS :=\n+\n+.PHONY: install-stripped\n+\n+install-stripped: INSTALL_OPTS = -s --strip-program=$(STRIP)\n+\n+install-stripped install: all\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n-\t$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n+\t$(INSTALL) $(INSTALL_OPTS) $(PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n+\t$(INSTALL) $(SCRIPTS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n \t$(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n-\t$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'\n+\t$(INSTALL) $(INSTALL_OPTS) $(install_bindir_xprograms) '$(DESTDIR_SQ)$(bindir_SQ)'\n+\t$(INSTALL) $(BINDIR_PROGRAMS_NO_X) '$(DESTDIR_SQ)$(bindir_SQ)'\n+\n ifdef MSVC\n \t# We DO NOT install the individual foo.o.pdb files because they\n \t# have already been rolled up into the exe's pdb file.\n\nbase-commit: c4203212e360b25a1c69467b5a8437d45a373cac\n-- \n2.25.1\n\n"}]}