[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Acquiring dependencies for Windows builds, was: Native compilation o
From: |
H. Dieter Wilhelm |
Subject: |
Re: Acquiring dependencies for Windows builds, was: Native compilation on Windows |
Date: |
Mon, 28 Feb 2022 22:51:57 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (windows-nt) |
Eli Zaretskii <eliz@gnu.org> 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
- Re: Native compilation on Windows, was Re: Bootstrap Compilation Speed, (continued)
- Re: Native compilation on Windows, was Re: Bootstrap Compilation Speed, Eli Zaretskii, 2022/02/03
- Re: Native compilation on Windows, was Re: Bootstrap Compilation Speed, H. Dieter Wilhelm, 2022/02/21
- Re: Native compilation on Windows, was Re: Bootstrap Compilation Speed, Eli Zaretskii, 2022/02/21
- Re: Native compilation on Windows, was Re: Bootstrap Compilation Speed, H. Dieter Wilhelm, 2022/02/23
- Re: Native compilation on Windows, was Re: Bootstrap Compilation Speed, Arash Esbati, 2022/02/23
- Re: Native compilation on Windows, was Re: Bootstrap Compilation Speed, H. Dieter Wilhelm, 2022/02/23
- Re: Native compilation on Windows, was Re: Bootstrap Compilation Speed, Eli Zaretskii, 2022/02/23
- Re: Acquiring dependencies for Windows builds, was: Native compilation on Windows, H. Dieter Wilhelm, 2022/02/27
- Re: Acquiring dependencies for Windows builds, was: Native compilation on Windows, Eli Zaretskii, 2022/02/27
- Re: Acquiring dependencies for Windows builds, was: Native compilation on Windows,
H. Dieter Wilhelm <=
Re: Native compilation on Windows, was Re: Bootstrap Compilation Speed, Phillip Lord, 2022/02/02