From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "H. Dieter Wilhelm" Newsgroups: gmane.emacs.devel Subject: Re: Acquiring dependencies for Windows builds, was: Native compilation on Windows Date: Mon, 28 Feb 2022 22:51:57 +0100 Message-ID: References: <83tue0u8sh.fsf@gnu.org> <86sftk3evj.fsf@duenenhof-wilhelm.de> <83o848tc92.fsf@gnu.org> <86o8473k13.fsf@duenenhof-wilhelm.de> <83ee53ssbx.fsf@gnu.org> <86sft4c3ij.fsf@gnu.org> <87czk59b7p.fsf@russet.org.uk> <83k0ec5st1.fsf@gnu.org> <83v8x7tw4a.fsf@gnu.org> <834k4pu57x.fsf@gnu.org> <83mtico9e3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20175"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (windows-nt) Cc: arash@gnu.org, corwin@bru.st, phillip.lord@russet.org.uk, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Feb 28 22:52:46 2022 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 1nOnwi-00051u-Gt for ged-emacs-devel@m.gmane-mx.org; Mon, 28 Feb 2022 22:52:44 +0100 Original-Received: from localhost ([::1]:41848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOnwh-0005lJ-37 for ged-emacs-devel@m.gmane-mx.org; Mon, 28 Feb 2022 16:52:43 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:41060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOnw8-00056y-3r for emacs-devel@gnu.org; Mon, 28 Feb 2022 16:52:08 -0500 Original-Received: from mout.kundenserver.de ([212.227.126.130]:46001) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOnw6-0002vC-9V; Mon, 28 Feb 2022 16:52:07 -0500 Original-Received: from VSL7V7PW ([92.116.148.35]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mg6mM-1nr18b0W0U-00hbOA; Mon, 28 Feb 2022 22:51:59 +0100 In-Reply-To: <83mtico9e3.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 27 Feb 2022 13:07:32 +0200") X-Provags-ID: V03:K1:RsGG1AW88HO1OwxR6Zd5gDhZSMODJDkxnOgPCOg+RqAEfv9WdjI ApXWzXfsofJNPi2knY0eQEpdIC3VYmDbsqHA08L0fPP/hDgELjy9L21Uum/uuRE0oWK+dNU LQ4VayjFHjkXRk+GgSBp8ifEkz9XNFl/ALNThDu4Vtgfw9wma23vSI8mX7mTg0aEdTqdGWx E3fjV0B/OVbolm91NLODA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Sp8paVfyq2s=:nz2xSyyyQhCX4y3/yXFvZR OywuI79H6KnzTbjm40i3U1iS+FsXBrzNPBvTh0STnGlXxBJ4DvS0yWcbFWw10Msiim2SU+rYD SwEtjYkq8SRntdOdtVcijww6oLfY30qqHBRFk22Sm4nAL9dNmJQpniTjSz+s+wEU2tJtvTYLg c9iPwsHJT4TkVJ2ok7lx3gaWZ7r9E5cZWYFMDdAA37hK4ImXvdpERH48SiDKIY38H4PK+ZoNK H+SmGI+ZdjQZgytp2YBcoMAW6mB3gALcrvfA00s67mM9ItZNBWiUrt0lJEQwyD0nq0DR2Bal8 3ssOZbd6c5In5RX2s3jmCjqn3g4Oypj+u/4GtwSr/Su/Xx/gqHjl+Bg86KeEOWbyn+1ITvdEb jy10GPpL9eif1BxwTvepNxujWlmlT2Rl3pXlJ2WBU+/UpKj0YtOyCtzZCspq7skhFsGIfM1zg kRe9PoYV+rU9aGPPivkZXL+cpI1eew0p3C0MiG32pu02FlIKSfZlajuF4zoHZHyJhmX0i7ZIJ mopDtTc8/BrHGUi0KfRABkYGQz36EXzTkLu7PG0O+UUyzPBHtHyiLG2xAWio+pkDLv+PYCRIA MFuV49P6OG9FI2RpXSsiqd4+RO/jdXh2ENokrJnNn3JNIdbi9tPwjaVc2oPABoO98EDV3jVL3 MaekqkDrQyXCZFEIRGv+NbTVWQ6pM5leFmWa8ChjH2QEjTmtm32QNO3Uh8WelvVvoia9Fshk/ vUWN+pi4vrLew+CH Received-SPF: none client-ip=212.227.126.130; envelope-from=dieter@duenenhof-wilhelm.de; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:286739 Archived-At: Eli Zaretskii writes: > First, no need to hard-code the location of objdump.exe: > executable-find should be able to find it. Nice, thank you. :-) > Second, you change the default-directory in the wrong buffer, I think. > More importantly, I don't see where you have the list of all the DLLs > that Emacs loads. You need to start from that list. Indeed >> Which brings output into the Objdump-buffer but I'm not sure if above >> approach might miss the - possibly - necessary MinGW64 environment >> information, don't know if it makes a difference when objdump.exe is >> called from the MinGW64 shell or with shell-command . > > I don't think I follow your fears here. What exactly did you think > could go wrong? What do you mean by "necessary MinGW64 environment > information"? I thought, maybe, a call to objdump.exe needs further environment information than Emacs is providing.. >> It seems to me that all MSYS DLLs on which Emacs depends have a name >> component "lib", whereas the Windows libraries have no such substring. >> (So I can easily filter them out.) > > There are exceptions: zlib1.dll. For now, it's the only exception > AFAIK, but watch out for others. Luckily zlib1.dll contains also "lib". :-) In the following I'm using copy-file. But I'm wondering why the argument OK-IF-ALREADY-EXISTS can't be used to skip a copy process if the file exists? In the following some files will be multiple times overwritten.. Here's a further attempt (and it seems to work for me): (defun Copy-dll ( Dll) (let ((Build-folder "~/emacs-build/build/emacs-28.0.91/bin/") (Exists (file-exists-p Dll))) (if Exists (copy-file Dll Build-folder 'overwrite) (message (concat "[Info] Can't find " Dll))))) (let ((Objdump-buffer (get-buffer-create "*objdump*")) (Build-folder "~/emacs-build/build/emacs-28.0.91/bin/") (Dll-folder "d:/appl/MSYS2/mingw64/bin/") (Objdump (executable-find "objdump.exe")) ;mingw64 is in PATH ;; starting dependency list from dynamic-library-alist (Dependencies (add-to-list 'dynamic-library-alist '(harfbuzz "libharfbuzz-0.dll"))) ;add harfbuzz entry (Build-deps) ; current dlls in the build folder (Dll nil)) ; temp variable ;; prepare (flatten) dependency list (dolist (D Dependencies) (add-to-list 'Dll (cdr D))) (setq Dependencies (flatten-tree Dll)) ;; iterative proceedure: Add to Build-deps the dependencies (while (< (length Build-deps) (length Dependencies)) (message "Number of dependencies %s" (length Dependencies )) (dolist (D Dependencies) (setq D (concat Dll-folder D)) ;; Copy DLL from Dll-folder into build-folder (Copy-dll D)) ;; Check the dependencies of *.exe and *.dll in the build folder (with-current-buffer Objdump-buffer (setq default-directory Build-folder) (erase-buffer) (shell-command (concat Objdump " -p *.exe *.dll") Objdump-buffer) ;; filtering steps (keep-lines " DLL Name:") (keep-lines "lib") ;remove Windows DLLs (delete-duplicate-lines (point-min) (point-max)) (goto-char (point-min)) ;; remove cruft (while (re-search-forward "^[\t]DLL Name: " nil t) (replace-match "")) ;; Update dependencies in build folder (setq Dependencies (split-string ;default splitter is \n among others (buffer-substring-no-properties (point-min) (point-max))))) ;; Update Build-deps in Build-folder (setq Build-deps (directory-files Build-folder nil "dll$")))) Dieter