all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#65206: 29.1; [windows][patch] build-deps-zips.py is broken and hard to maintain
@ 2023-08-10 12:40 Corwin Brust
  2023-08-10 13:29 ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Corwin Brust @ 2023-08-10 12:40 UTC (permalink / raw)
  To: 65206

[-- Attachment #1: Type: text/plain, Size: 4286 bytes --]

The script nt/admin/dist-build/build-deps-zips.py needs help.  This is
the script that I use to collect and package dependencies and sources
for dependencies on Microsoft Windows, as part of releasing Emacs
binaries for Windows.  It is a python script that runs under MSYS2
MSYS console (not MinGW).

Neither the version currently in the emacs-29 nor in the master
branches will work for the given Emacs version without changes.  The
attached patch would make emacs-29 match what I am using locally.

In addition to other changes, the patch reflects my current "transformation map"
approach to deal with MSYS source package paths change, which seems to
be happening quite a bit upstream.

In case it may not be clear, my process is to run the script
after updating local MSYS packages that are dependencies (optional or
no), or edit and run it when Emacs' dependencies have changed.

The patch reflects the script as I have been using it during the Emacs
29 release process.  I'm sure there's general room for improvement
(editing this script is literally my only python coding credit), I'm
opening this bug report because bug#65188 (a packaging error preventing
WEBP from working for people using the Windows binaries) has called
attention to the importance of having additional eyes on build tooling
(especially when it so far contains hard-coded lists of upstream deps).

In GNU Emacs 29.1 (build 2, x86_64-w64-mingw32) of 2023-08-02 built on
 AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.19045
System Description: Microsoft Windows 10 Home (v10.0.2009.19045.3324)

Configured using:
 'configure --with-modules --without-dbus --with-native-compilation=aot
 --without-compress-install --with-tree-sitter CFLAGS=-O2'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1252

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra
help-mode bytecomp byte-compile cl-lib sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win
w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads w32notify w32 lcms2 multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 80415 13861)
 (symbols 48 7175 0)
 (strings 32 21269 1764)
 (string-bytes 1 617449)
 (vectors 16 16398)
 (vector-slots 8 334731 15794)
 (floats 8 29 46)
 (intervals 56 238 0)
 (buffers 984 10))

[-- Attachment #2: 0001-Fix-Windows-build-dependancy-packaging-for-Emacs-29-.patch --]
[-- Type: application/octet-stream, Size: 5790 bytes --]

From 932320cda4d7633cb48bb89163fb9cf62c5e208d Mon Sep 17 00:00:00 2001
From: Corwin Brust <corwin@bru.st>
Date: Thu, 10 Aug 2023 07:19:41 -0500
Subject: [PATCH] ; Fix Windows build dependancy packaging for Emacs 29 and 30

* nt/admin/dist-build/build-deps-zips.py (script): add webp,
Xpm, Xpm-noX4, treesitter, and sqlite4, bump EMACS_MAJOR_VERSION,
remove unneeded imports, change vendor slug from msys64 to mingw64,
skip some ancient certificates, add SRC_EXT to map transformation
source package name transformations vs historical convention.
---
 admin/nt/dist-build/build-dep-zips.py | 84 ++++++++++++++++++---------
 1 file changed, 57 insertions(+), 27 deletions(-)

diff --git a/admin/nt/dist-build/build-dep-zips.py b/admin/nt/dist-build/build-dep-zips.py
index 71105a071ec..a7c116d9b41 100755
--- a/admin/nt/dist-build/build-dep-zips.py
+++ b/admin/nt/dist-build/build-dep-zips.py
@@ -20,13 +20,11 @@
 import os
 import shutil
 import re
-import functools
-import operator
 
 from subprocess import check_output
 
 ## Constants
-EMACS_MAJOR_VERSION="28"
+EMACS_MAJOR_VERSION="29"
 
 # This list derives from the features we want Emacs to compile with.
 PKG_REQ='''mingw-w64-x86_64-giflib
@@ -37,9 +35,13 @@
 mingw-w64-x86_64-libjpeg-turbo
 mingw-w64-x86_64-libpng
 mingw-w64-x86_64-librsvg
+mingw-w64-x86_64-libwebp
 mingw-w64-x86_64-libtiff
 mingw-w64-x86_64-libxml2
-mingw-w64-x86_64-xpm-nox'''.split()
+mingw-w64-x86_64-gmp
+mingw-w64-x86_64-xpm-nox
+mingw-w64-x86_64-tree-sitter
+mingw-w64-x86_64-sqlite3'''.split()
 
 DLL_REQ='''libgif
 libgnutls
@@ -49,9 +51,14 @@
 libturbojpeg
 libpng
 librsvg
+libwebp
 libtiff
 libxml
-libXpm'''.split()
+libgmp
+libXpm
+libXpm-noX4
+libtree-sitter
+libsqlite3-0'''.split()
 
 
 ## Options
@@ -103,7 +110,7 @@ def ntldd_munge(out):
 
         ## if it's the former, we want it, if its the later we don't
         splt = dep.split()
-        if len(splt) > 2 and "msys64" in splt[2]:
+        if len(splt) > 2 and "mingw64" in splt[2]:
             print("Adding dep", splt[0])
             rtn.append(splt[0].split(".")[0])
 
@@ -114,26 +121,45 @@ def ntldd_munge(out):
 ## Packages to fiddle with
 ## Source for gcc-libs is part of gcc
 SKIP_SRC_PKGS=["mingw-w64-gcc-libs"]
-SKIP_DEP_PKGS=frozenset(["mingw-w64-x86_64-glib2"])
+SKIP_DEP_PKGS=["mingw-w64-glib2" "mingw-w64-ca-certificates-20211016-3"]
 MUNGE_SRC_PKGS={"mingw-w64-libwinpthread-git":"mingw-w64-winpthreads-git"}
 MUNGE_DEP_PKGS={
     "mingw-w64-x86_64-libwinpthread":"mingw-w64-x86_64-libwinpthread-git",
     "mingw-w64-x86_64-libtre": "mingw-w64-x86_64-libtre-git",
 }
+SRC_EXT={
+    "mingw-w64-freetype": ".src.tar.zst",
+    "mingw-w64-fribidi": ".src.tar.zst",
+    "mingw-w64-glib2": ".src.tar.zst",
+    "mingw-w64-harfbuzz": ".src.tar.zst",
+    "mingw-w64-libunistring": ".src.tar.zst",
+    "mingw-w64-winpthreads-git": ".src.tar.zst",
+    "mingw-w64-ca-certificates": ".src.tar.zst",
+    "mingw-w64-libxml2": ".src.tar.zst",
+    "mingw-w64-ncurses": ".src.tar.zst",
+    "mingw-w64-openssl": ".src.tar.zst",
+    "mingw-w64-pango": ".src.tar.zst",
+    "mingw-w64-python": ".src.tar.zst",
+    "mingw-w64-sqlite3": ".src.tar.zst",
+    "mingw-w64-xpm-nox": ".src.tar.zst",
+    "mingw-w64-xz": ".src.tar.zst",
+}
 
 ## Currently no packages seem to require this!
 ARCH_PKGS=[]
 SRC_REPO="https://repo.msys2.org/mingw/sources"
 
 
-def immediate_deps(pkgs):
-    package_info = check_output(["pacman", "-Si"] + pkgs).decode("utf-8").splitlines()
+def immediate_deps(pkg):
+    package_info = check_output(["pacman", "-Si", pkg]).decode("utf-8").split("\n")
+
+    ## Extract the "Depends On" line
+    depends_on = [x for x in package_info if x.startswith("Depends On")][0]
+    ## Remove "Depends On" prefix
+    dependencies = depends_on.split(":")[1]
 
-    ## Extract the packages listed for "Depends On:" lines.
-    dependencies = [line.split(":")[1].split() for line in package_info
-                    if line.startswith("Depends On")]
-    ## Flatten dependency lists from multiple packages into one list.
-    dependencies = functools.reduce(operator.iconcat, dependencies, [])
+    ## Split into dependencies
+    dependencies = dependencies.strip().split(" ")
 
     ## Remove > signs TODO can we get any other punctuation here?
     dependencies = [d.split(">")[0] for d in dependencies if d]
@@ -149,18 +175,16 @@ def extract_deps():
     print( "Extracting deps" )
 
     # Get a list of all dependencies needed for packages mentioned above.
-    pkgs = set(PKG_REQ)
-    newdeps = pkgs
-    print("adding...")
-    while True:
-        subdeps = frozenset(immediate_deps(list(newdeps)))
-        newdeps = subdeps - SKIP_DEP_PKGS - pkgs
-        if not newdeps:
-            break
-        print('\n'.join(newdeps))
-        pkgs |= newdeps
+    pkgs = PKG_REQ[:]
+    n = 0
+    while n < len(pkgs):
+        subdeps = immediate_deps(pkgs[n])
+        for p in subdeps:
+            if not (p in pkgs or p in SKIP_DEP_PKGS):
+                pkgs.append(p)
+        n = n + 1
 
-    return list(pkgs)
+    return sorted(pkgs)
 
 
 def download_source(tarball):
@@ -208,7 +232,13 @@ def gather_source(deps):
         ## Switch names if necessary
         pkg_name = MUNGE_SRC_PKGS.get(pkg_name,pkg_name)
 
-        tarball = "{}-{}.src.tar.gz".format(pkg_name,pkg_version)
+        ## src archive is usually a .tar.gz
+        if pkg_name in SRC_EXT.keys():
+            src_ext = SRC_EXT[pkg_name]
+        else:
+            src_ext = ".src.tar.gz"
+
+        tarball = "{}-{}{}".format(pkg_name,pkg_version,src_ext)
 
         download_source(tarball)
 
@@ -257,7 +287,7 @@ def clean():
 
 if( args.l ):
     print("List of dependencies")
-    print( deps )
+    print( extract_deps() )
     exit(0)
 
 if args.s:
-- 
2.41.0.windows.1


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

end of thread, other threads:[~2023-08-17 13:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-10 12:40 bug#65206: 29.1; [windows][patch] build-deps-zips.py is broken and hard to maintain Corwin Brust
2023-08-10 13:29 ` Eli Zaretskii
2023-08-10 21:09   ` Corwin Brust
2023-08-15  7:39   ` Corwin Brust
2023-08-15 15:43     ` Eli Zaretskii
2023-08-15 15:53       ` Corwin Brust
2023-08-15 16:01         ` Eli Zaretskii
2023-08-16  1:23           ` Corwin Brust
2023-08-16 12:08             ` Eli Zaretskii
2023-08-16 13:41               ` Corwin Brust
2023-08-16 14:49                 ` Eli Zaretskii
2023-08-17  7:25                   ` Corwin Brust
2023-08-17  9:55                     ` Eli Zaretskii
2023-08-17 13:31                       ` Corwin Brust

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.