git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v2] make: add INSTALL_STRIP variable
@ 2021-08-21 11:25 Bagas Sanjaya
  2021-08-22 14:37 ` Đoàn Trần Công Danh
  0 siblings, 1 reply; 2+ messages in thread
From: Bagas Sanjaya @ 2021-08-21 11:25 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Đoàn Trần Công Danh,
	Emily Shaffer, Eric Sunshine, Johannes Schindelin, Bagas Sanjaya

In some environments (most notably embedded systems and small production
servers), it is often desirable to have stripped Git binaries due to
tight disk space constraint.

Until now stripped Git can be built wih `make strip install`. Add
INSTALL_STRIP make variable so that they can install stripped Git
binaries with `make INSTALL_STRIP=yes install`.

Also document stripping and using INSTALL_STRIP in INSTALL.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 Changes from v1 [1]:

   - install target depends on strip when INSTALL_STRIP is defined
     (sugested by Đoàn)

 [1]: https://lore.kernel.org/git/YSDW3nsG2iWPGakF@danh.dev/T/#t

 INSTALL  | 8 ++++++++
 Makefile | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/INSTALL b/INSTALL
index 66389ce059..98e541ee4d 100644
--- a/INSTALL
+++ b/INSTALL
@@ -58,6 +58,14 @@ suite has to be run using only a single CPU.  In addition, the profile
 feedback build stage currently generates a lot of additional compiler
 warnings.
 
+You can also strip debug info from built binaries by:
+
+	$ make strip
+
+or for stripping and installing together:
+
+	$ make INSTALL_STRIP=yes install
+
 Issues of note:
 
  - Ancient versions of GNU Interactive Tools (pre-4.9.2) installed a
diff --git a/Makefile b/Makefile
index 9573190f1d..43c47f5560 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,8 @@ all::
 # Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
 # to PATH if your tools in /usr/bin are broken.
 #
+# Define INSTALL_STRIP if you want to install with stripped binaries.
+#
 # Define SOCKLEN_T to a suitable type (such as 'size_t') if your
 # system headers do not define a socklen_t type.
 #
@@ -3004,6 +3006,9 @@ profile-install: profile
 profile-fast-install: profile-fast
 	$(MAKE) install
 
+ifdef INSTALL_STRIP
+install: strip
+endif
 install: all
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'

base-commit: 225bc32a989d7a22fa6addafd4ce7dcd04675dbf
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] make: add INSTALL_STRIP variable
  2021-08-21 11:25 [PATCH v2] make: add INSTALL_STRIP variable Bagas Sanjaya
@ 2021-08-22 14:37 ` Đoàn Trần Công Danh
  0 siblings, 0 replies; 2+ messages in thread
From: Đoàn Trần Công Danh @ 2021-08-22 14:37 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: git, Junio C Hamano, Emily Shaffer, Eric Sunshine,
	Johannes Schindelin

On 2021-08-21 18:25:11+0700, Bagas Sanjaya <bagasdotme@gmail.com> wrote:
> In some environments (most notably embedded systems and small production
> servers), it is often desirable to have stripped Git binaries due to
> tight disk space constraint.
> 
> Until now stripped Git can be built wih `make strip install`. Add
> INSTALL_STRIP make variable so that they can install stripped Git
> binaries with `make INSTALL_STRIP=yes install`.
> 
> Also document stripping and using INSTALL_STRIP in INSTALL.
> 
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
> ---
>  Changes from v1 [1]:
> 
>    - install target depends on strip when INSTALL_STRIP is defined
>      (sugested by Đoàn)
> 
>  [1]: https://lore.kernel.org/git/YSDW3nsG2iWPGakF@danh.dev/T/#t

We may want to see this discussion[2] settled first, I think.

2: https://lore.kernel.org/git/YSBhPdK8jYIQUNhP@danh.dev/

-- Danh

> 
>  INSTALL  | 8 ++++++++
>  Makefile | 5 +++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/INSTALL b/INSTALL
> index 66389ce059..98e541ee4d 100644
> --- a/INSTALL
> +++ b/INSTALL
> @@ -58,6 +58,14 @@ suite has to be run using only a single CPU.  In addition, the profile
>  feedback build stage currently generates a lot of additional compiler
>  warnings.
>  
> +You can also strip debug info from built binaries by:
> +
> +	$ make strip
> +
> +or for stripping and installing together:
> +
> +	$ make INSTALL_STRIP=yes install
> +
>  Issues of note:
>  
>   - Ancient versions of GNU Interactive Tools (pre-4.9.2) installed a
> diff --git a/Makefile b/Makefile
> index 9573190f1d..43c47f5560 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -8,6 +8,8 @@ all::
>  # Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
>  # to PATH if your tools in /usr/bin are broken.
>  #
> +# Define INSTALL_STRIP if you want to install with stripped binaries.
> +#
>  # Define SOCKLEN_T to a suitable type (such as 'size_t') if your
>  # system headers do not define a socklen_t type.
>  #
> @@ -3004,6 +3006,9 @@ profile-install: profile
>  profile-fast-install: profile-fast
>  	$(MAKE) install
>  
> +ifdef INSTALL_STRIP
> +install: strip
> +endif
>  install: all
>  	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
>  	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
> 
> base-commit: 225bc32a989d7a22fa6addafd4ce7dcd04675dbf
> -- 
> 2.25.1
> 

-- 
Danh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-22 14:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-21 11:25 [PATCH v2] make: add INSTALL_STRIP variable Bagas Sanjaya
2021-08-22 14:37 ` Đoàn Trần Công Danh

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).