mirror of
https://github.com/git/git.git
synced 2026-01-28 19:41:36 +00:00
mingw: Use the Git wrapper for builtins
This reduces the disk footprint of a full Git for Windows setup dramatically because on Windows, one cannot assume that hard links are supported. The net savings are calculated easily: the 32-bit `git.exe` file weighs in with 7662 kB while the `git-wrapper.exe` file (modified to serve as a drop-in replacement for builtins) weighs a scant 21 kB. At this point, there are 109 builtins which results in a total of 813 MB disk space being freed up by this commit. Yes, that is really more than half a gigabyte. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
34
Makefile
34
Makefile
@@ -1724,11 +1724,17 @@ version.sp version.s version.o: EXTRA_CPPFLAGS = \
|
||||
'-DGIT_VERSION="$(GIT_VERSION)"' \
|
||||
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)'
|
||||
|
||||
ifeq (,$(BUILT_IN_WRAPPER))
|
||||
$(BUILT_INS): git$X
|
||||
$(QUIET_BUILT_IN)$(RM) $@ && \
|
||||
ln $< $@ 2>/dev/null || \
|
||||
ln -s $< $@ 2>/dev/null || \
|
||||
cp $< $@
|
||||
else
|
||||
$(BUILT_INS): $(BUILT_IN_WRAPPER)
|
||||
$(QUIET_BUILT_IN)$(RM) $@ && \
|
||||
cp $< $@
|
||||
endif
|
||||
|
||||
common-cmds.h: generate-cmdlist.sh command-list.txt
|
||||
|
||||
@@ -2297,6 +2303,24 @@ profile-install: profile
|
||||
profile-fast-install: profile-fast
|
||||
$(MAKE) install
|
||||
|
||||
ifeq (,$(BUILT_IN_WRAPPER))
|
||||
LN_OR_CP_BUILT_IN_BINDIR = \
|
||||
test -z "$(NO_INSTALL_HARDLINKS)" && \
|
||||
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
|
||||
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
|
||||
cp "$$bindir/git$X" "$$bindir/$$p" || exit;
|
||||
LN_OR_CP_BUILT_IN_EXECDIR = \
|
||||
test -z "$(NO_INSTALL_HARDLINKS)" && \
|
||||
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
|
||||
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
|
||||
cp "$$execdir/git$X" "$$execdir/$$p" || exit;
|
||||
else
|
||||
LN_OR_CP_BUILT_IN_BINDIR = \
|
||||
cp "$(BUILT_IN_WRAPPER)" "$$bindir/$$p" || exit;
|
||||
LN_OR_CP_BUILT_IN_EXECDIR = \
|
||||
cp "$(BUILT_IN_WRAPPER)" "$$execdir/$$p" || exit;
|
||||
endif
|
||||
|
||||
install: all
|
||||
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
|
||||
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
|
||||
@@ -2335,17 +2359,11 @@ endif
|
||||
} && \
|
||||
for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
|
||||
$(RM) "$$bindir/$$p" && \
|
||||
test -z "$(NO_INSTALL_HARDLINKS)" && \
|
||||
ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
|
||||
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
|
||||
cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
|
||||
$(LN_OR_CP_BUILT_IN_BINDIR) \
|
||||
done && \
|
||||
for p in $(BUILT_INS); do \
|
||||
$(RM) "$$execdir/$$p" && \
|
||||
test -z "$(NO_INSTALL_HARDLINKS)" && \
|
||||
ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
|
||||
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
|
||||
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
|
||||
$(LN_OR_CP_BUILT_IN_EXECDIR) \
|
||||
done && \
|
||||
remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
|
||||
for p in $$remote_curl_aliases; do \
|
||||
|
||||
@@ -573,6 +573,7 @@ else
|
||||
NO_CURL = YesPlease
|
||||
endif
|
||||
OTHER_PROGRAMS += git-wrapper$(X)
|
||||
BUILT_IN_WRAPPER = git-wrapper$(X)
|
||||
|
||||
git-wrapper$(X): compat/win32/git-wrapper.o git.res
|
||||
$(QUIET_LINK)$(CC) $(ALL_LDFLAGS) $(COMPAT_CFLAGS) \
|
||||
|
||||
Reference in New Issue
Block a user