From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Juan =?utf-8?Q?Jos=C3=A9_Garc=C3=ADa-Ripoll?= Newsgroups: gmane.emacs.devel Subject: Avoid duplicate emacs.exe / emacs-$version.exe Date: Sat, 28 Mar 2020 17:53:00 +0100 Organization: Institute of Fundamental Physics, CSIC Message-ID: <865zeoctg3.fsf@csic.es> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="69383"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.90 (windows-nt) To: emacs-devel@gnu.org Cancel-Lock: sha1:2FeiumgOXVKtLR48jOV5sNVKojo= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 28 17:53:43 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jIEiN-000HxE-2M for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Mar 2020 17:53:43 +0100 Original-Received: from localhost ([::1]:57222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIEiM-0005sJ-4k for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Mar 2020 12:53:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56896) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIEhr-0005SD-LU for emacs-devel@gnu.org; Sat, 28 Mar 2020 12:53:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jIEhp-0000Uu-QO for emacs-devel@gnu.org; Sat, 28 Mar 2020 12:53:11 -0400 Original-Received: from ciao.gmane.io ([159.69.161.202]:42670) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jIEhp-0000UI-JI for emacs-devel@gnu.org; Sat, 28 Mar 2020 12:53:09 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1jIEhn-000HHJ-HH for emacs-devel@gnu.org; Sat, 28 Mar 2020 17:53:07 +0100 X-Injected-Via-Gmane: http://gmane.org/ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 159.69.161.202 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:245892 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Right now in my hard disk I have two copies of statically linked Emacs. ~/emacs-27/bin/emacs.exe ~/emacs-27/bin/emacs-27.0.90.exe (let me call it emacs-$version.exe) Each of them is 128Mb large and waste space. I understand the latter is only meant to be used when the version is required. runemacs.exe and tools actually seem to rely on emacs.exe, because if I delete emacs-$version.exe it still works fine. Same goes for earlier releases. I would suggest one of these options a) Remove emacs-$version.exe during installation. b) Same as a), but install a script emacs-$version.cmd containing just two lines @echo off %~dp0\emacs.exe %* c) Instead, remove emacs.exe and leave only emacs-$version.exe Make emacs.cmd a script @echo off %~dp0\emacs-$version.exe %* where $version is replaced with the current version. We also have to change runemacs.exe to look for emacs-$version.exe Option a) only invokes a change in Makefile.in. Option b) includes that change, plus the creation of the script. This is in a patch attached to this message. Option c) would be the most intrusive. I personally do not like it because it binds a general utility, runemacs.exe, to a particular version. After the patch: juanj@DESKTOP-3A8AAJ0 MINGW64 ~/emacs-build/build/juanjo $ du -smc ~/emacs-27/* 135 /c/Users/juanj/emacs-27/bin 1 /c/Users/juanj/emacs-27/include 1 /c/Users/juanj/emacs-27/lib 17 /c/Users/juanj/emacs-27/libexec 98 /c/Users/juanj/emacs-27/share 249 total Before the patch: juanj@DESKTOP-3A8AAJ0 MINGW64 ~/emacs-build/build/juanjo $ du -smc ~/emacs-27/* 252 /c/Users/juanj/emacs-27/bin 1 /c/Users/juanj/emacs-27/include 1 /c/Users/juanj/emacs-27/lib 17 /c/Users/juanj/emacs-27/libexec 98 /c/Users/juanj/emacs-27/share 366 total A 32% reduction in size. -- Juan José García Ripoll http://juanjose.garciaripoll.com http://quinfog.hbar.es --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=emacs-cmd.diff diff --git a/Makefile.in b/Makefile.in index 67e15cf..67c14f2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -499,10 +499,13 @@ install-arch-dep: endif -chmod 755 "$(DESTDIR)${bindir}/$(EMACSFULL)" ifndef NO_BIN_LINK +ifeq ($(NTDIR),nt) + cd "$(DESTDIR)${bindir}" && mv "$(EMACSFULL)" "$(EMACS)" +else rm -f "$(DESTDIR)${bindir}/$(EMACS)" cd "$(DESTDIR)${bindir}" && $(LN_S_FILEONLY) "$(EMACSFULL)" "$(EMACS)" endif -else +endif subdir=${ns_appresdir}/site-lisp && ${write_subdir} rm -rf ${ns_appresdir}/share endif diff --git a/nt/Makefile.in b/nt/Makefile.in index 6bdf824..7af6e78 100644 --- a/nt/Makefile.in +++ b/nt/Makefile.in @@ -167,7 +167,7 @@ LINK_CFLAGS = ## Unused. CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} -all: ${EXE_FILES} +all: ${EXE_FILES} emacs-$(version).cmd .PHONY: all @@ -194,6 +194,7 @@ install: for file in ${INSTALLABLES} ; do \ $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \ done + $(INSTALL_PROGRAM) emacs-$(version).cmd "$(DESTDIR)${bindir}" ${MKDIR_P} "$(DESTDIR)${datadir}/emacs/$(version)" $(INSTALL_DATA) ${srcdir}/README.W32 "$(DESTDIR)${datadir}/emacs/$(version)" @@ -251,6 +252,10 @@ cmdproxy${EXEEXT}: runemacs${EXEEXT}: ${srcdir}/runemacs.c $(EMACSRES) $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $^ -mwindows -o $@ +emacs-$(version).cmd: + echo '@echo off' > $@ + echo '%~dp0\emacs.exe %*' >> $@ + ## Also used in ../src/Makefile. emacs.res ../src/emacs.res: emacs.rc ${srcdir}/icons/emacs.ico \ ${srcdir}/icons/hand.cur ${srcdir}/$(EMACS_MANIFEST) --=-=-=--