guix_mirror_bot pushed a commit to branch master
in repository guix.

commit e276c1e9326ce5f9c7c64dc7fb3d18bac95ec233
Author: Maxim Cournoyer <[email protected]>
AuthorDate: Thu Sep 24 08:29:27 2026 +0900

    gnu: Add node-latest.
    
    * gnu/packages/node.scm (node-latest): New variable.
    * gnu/packages/patches/node-latest-i686.patch: New file.
    * gnu/packages/patches/node-latest-lief-1.0.0.patch: Likewise.
    * gnu/local.mk (dist_patch_DATA): Register them.
---
 gnu/local.mk                                      |   2 +
 gnu/packages/node.scm                             |  83 ++++++
 gnu/packages/patches/node-latest-i686.patch       |  24 ++
 gnu/packages/patches/node-latest-lief-1.0.0.patch | 314 ++++++++++++++++++++++
 4 files changed, 423 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index 7ac7872fdc5..6fe0f6bf0c4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2060,6 +2060,8 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/nlopt_CMake-Assume-working-c-compiler-597.patch \
   %D%/packages/patches/nnpack-system-libraries.patch           \
   %D%/packages/patches/noctalia-shell-system-libraries.patch   \
+  %D%/packages/patches/node-latest-i686.patch                   \
+  %D%/packages/patches/node-latest-lief-1.0.0.patch             \
   %D%/packages/patches/nsis-env-passthru.patch                 \
   %D%/packages/patches/nss-getcwd-nonnull.patch                        \
   %D%/packages/patches/nss-increase-test-timeout.patch         \
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 25b0fc67a94..0fe82d9df07 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -704,6 +704,89 @@ devices.")
                    . ,(format #f "https://nodejs.org/dist/latest-v~a.x/";
                               %current-node-lts-major-version))))))
 
+(define-public node-latest
+  (package
+    (inherit node-lts)
+    (version "26.10.0")
+    (source (origin
+              (inherit (package-source node-lts))
+              (uri (string-append "https://nodejs.org/dist/v"; version
+                                  "/node-v" version ".tar.xz"))
+              (sha256
+               (base32
+                "1i90pbq6cgh3430y9rjkqpzxapsxpvh5fynx7fj1aznb6dnm8fkv"))
+              (patches (search-patches "node-latest-i686.patch"
+                                       "node-latest-lief-1.0.0.patch"))))
+    (arguments
+     (substitute-keyword-arguments arguments
+       ((#:configure-flags flags ''())
+        #~(cons* "--shared-ffi"
+                 "--shared-lief"
+                 #$@(if (this-package-input "temporal-capi")
+                        #~("--shared-temporal_capi")
+                        #~("--v8-disable-temporal-support"))
+                 #$flags))
+       ((#:phases phases '%standard-phases)
+        #~(modify-phases #$phases
+            (add-before 'configure 'set-bootstrap-host-rpath
+              (lambda* (#:key native-inputs #:allow-other-keys)
+                (when native-inputs
+                  (let* ((safe-lookup (lambda (label)
+                                        (or (assoc-ref native-inputs label)
+                                            (error "could not find native 
input"
+                                                   label))))
+                         (host-inputs (map safe-lookup
+                                           '("brotli"
+                                             "c-ares"
+                                             "cpp-ada-url-parser"
+                                             "googletest"
+                                             "hdrhistogram-c"
+                                             "icu4c"
+                                             "libffi"
+                                             "libuv"
+                                             "lief"
+                                             "llhttpish"
+                                             "merve"
+                                             "nbytes"
+                                             "nghttp2"
+                                             "nghttp3"
+                                             "ngtcp2"
+                                             "openssl"
+                                             "simdjson"
+                                             "simdutf"
+                                             "sqlite"
+                                             "temporal-capi"
+                                             "uvwasi"
+                                             "zlib"
+                                             "zstd")))
+                         (host-binaries '("torque"
+                                          "bytecode_builtins_list_generator"
+                                          "gen-regexp-special-case"
+                                          "node_mksnapshot"
+                                          "mksnapshot"
+                                          "node_js2c")))
+                    (substitute* '("node.gyp" "tools/v8_gypfiles/v8.gyp")
+                      (((string-append "'target_name': '("
+                                       (string-join host-binaries "|")
+                                       ")',")
+                        target)
+                       (format #f "~a 'ldflags': ['-Wl,-rpath=~{~a/lib~^:~}'],"
+                               target host-inputs)))))))))))
+    (native-inputs
+     (append (if (supported-package? temporal-capi)
+                 (list `("temporal-capi" ,temporal-capi))
+                 '())
+             (modify-inputs native-inputs
+               (append libffi-next lief))))
+    (inputs
+     (append (if (supported-package? temporal-capi)
+                 (list `("temporal-capi" ,temporal-capi))
+                 '())
+             (modify-inputs inputs
+               (append libffi-next lief))))
+    (properties (alist-delete 'release-monitoring-url
+                              (package-properties node-lts)))))
+
 (define-public node node-lts)
 
 (define-deprecated-package libnode node-lts)
diff --git a/gnu/packages/patches/node-latest-i686.patch 
b/gnu/packages/patches/node-latest-i686.patch
new file mode 100644
index 00000000000..86965cbf253
--- /dev/null
+++ b/gnu/packages/patches/node-latest-i686.patch
@@ -0,0 +1,24 @@
+Upstream-status: <https://github.com/nodejs/node/issues/64021>
+
+diff --git a/deps/v8/src/strings/string-hasher.cc 
b/deps/v8/src/strings/string-hasher.cc
+index bea067c6f0..42dc676228 100644
+--- a/deps/v8/src/strings/string-hasher.cc
++++ b/deps/v8/src/strings/string-hasher.cc
+@@ -24,7 +24,7 @@ struct ConvertTo8BitHashReader {
+     DCHECK_LE(p[5], 0xff);
+     DCHECK_LE(p[6], 0xff);
+     DCHECK_LE(p[7], 0xff);
+-#ifdef __SSE2__
++#if defined(__SSE2__) && defined(V8_TARGET_ARCH_64_BIT)
+     __m128i x = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
+     return _mm_cvtsi128_si64(_mm_packus_epi16(x, x));
+ #elif defined(__ARM_NEON__)
+@@ -45,7 +45,7 @@ struct ConvertTo8BitHashReader {
+     DCHECK_LE(p[1], 0xff);
+     DCHECK_LE(p[2], 0xff);
+     DCHECK_LE(p[3], 0xff);
+-#ifdef __SSE2__
++#if defined(__SSE2__) && defined(V8_TARGET_ARCH_64_BIT)
+     __m128i x = _mm_loadu_si64(reinterpret_cast<const __m128i*>(p));
+     return _mm_cvtsi128_si64(_mm_packus_epi16(x, x));
+ #elif defined(__ARM_NEON__)
\ No newline at end of file
diff --git a/gnu/packages/patches/node-latest-lief-1.0.0.patch 
b/gnu/packages/patches/node-latest-lief-1.0.0.patch
new file mode 100644
index 00000000000..e53625f86c1
--- /dev/null
+++ b/gnu/packages/patches/node-latest-lief-1.0.0.patch
@@ -0,0 +1,314 @@
+From 3f5c0d07135e9635c0768db2f77f53195c5438c0 Mon Sep 17 00:00:00 2001
+From: Yuya Inoue <[email protected]>
+Date: Sun, 27 Sep 2026 17:09:47 +0900
+Subject: [PATCH] build: support LIEF 0.17.x and 1.x
+
+Keep bundled LIEF at 0.17.0 while selecting the Mach-O section API
+from the headers in use and the bundled build settings by version.
+Prepare the updater for Mbed TLS 4 and TF-PSA-Crypto so the vendor
+update can land separately.
+
+Assisted-by: Codex
+Signed-off-by: inoway46 <[email protected]>
+PR-URL: https://github.com/nodejs/node/pull/66240
+Fixes: https://github.com/nodejs/node/issues/66238
+Refs: https://github.com/nodejs/node/pull/66242
+Refs: https://github.com/nodejs/node/issues/63530
+Refs: https://github.com/nodejs/nodejs-dependency-vuln-assessments/issues/360
+Refs: https://github.com/nodejs/nodejs-dependency-vuln-assessments/issues/342
+Reviewed-By: Antoine du Hamel <[email protected]>
+Reviewed-By: Filip Skokan <[email protected]>
+---
+ deps/LIEF/lief.gyp    | 166 +++++++++++++++++++++++++++++++++++++++++-
+ src/node_sea_bin.cc   |  19 +++++
+ tools/prepare_lief.py |   9 +++
+ 3 files changed, 192 insertions(+), 2 deletions(-)
+
+diff --git a/deps/LIEF/lief.gyp b/deps/LIEF/lief.gyp
+index 783e97c181d8..288a4af03978 100644
+--- a/deps/LIEF/lief.gyp
++++ b/deps/LIEF/lief.gyp
+@@ -13,6 +13,8 @@
+     },
+   },
+   'variables': {
++    # Read the bundled version; shared LIEF is selected through its own 
headers.
++    'lief_version_major': '<!("<(python)" -c "print([line.split()[2] for line 
in open(\'include/LIEF/version.h\') if line.startswith(\'#define 
LIEF_VERSION_MAJOR \')][0])")',
+     'lief_sources': [
+       # Root
+       'src/Object.cpp',
+@@ -411,6 +413,117 @@
+       'third-party/mbedtls/library/x509write.c',
+       'third-party/mbedtls/library/x509write_crt.c',
+       'third-party/mbedtls/library/x509write_csr.c',
++    ],
++    'lief_1_third_party_sources': [
++      # Sources from upstream cmake/LIEFDependencies.cmake (Mbed TLS 4).
++      'third-party/mbedtls/library/debug.c',
++      'third-party/mbedtls/library/mps_reader.c',
++      'third-party/mbedtls/library/mps_trace.c',
++      'third-party/mbedtls/library/net_sockets.c',
++      'third-party/mbedtls/library/pkcs7.c',
++      'third-party/mbedtls/library/ssl_cache.c',
++      'third-party/mbedtls/library/ssl_ciphersuites.c',
++      'third-party/mbedtls/library/ssl_client.c',
++      'third-party/mbedtls/library/ssl_cookie.c',
++      'third-party/mbedtls/library/ssl_msg.c',
++      'third-party/mbedtls/library/ssl_ticket.c',
++      'third-party/mbedtls/library/ssl_tls.c',
++      'third-party/mbedtls/library/ssl_tls12_client.c',
++      'third-party/mbedtls/library/ssl_tls12_server.c',
++      'third-party/mbedtls/library/ssl_tls13_client.c',
++      'third-party/mbedtls/library/ssl_tls13_generic.c',
++      'third-party/mbedtls/library/ssl_tls13_keys.c',
++      'third-party/mbedtls/library/ssl_tls13_server.c',
++      'third-party/mbedtls/library/timing.c',
++      'third-party/mbedtls/library/version.c',
++      'third-party/mbedtls/library/error.c',
++      'third-party/mbedtls/library/x509.c',
++      'third-party/mbedtls/library/x509_create.c',
++      'third-party/mbedtls/library/x509_crl.c',
++      'third-party/mbedtls/library/x509_crt.c',
++      'third-party/mbedtls/library/x509_csr.c',
++      'third-party/mbedtls/library/x509_oid.c',
++      'third-party/mbedtls/library/x509write.c',
++      'third-party/mbedtls/library/x509write_crt.c',
++      'third-party/mbedtls/library/x509write_csr.c',
++      'third-party/mbedtls/tf-psa-crypto/core/psa_crypto.c',
++      'third-party/mbedtls/tf-psa-crypto/core/psa_crypto_client.c',
++      'third-party/mbedtls/tf-psa-crypto/core/psa_crypto_slot_management.c',
++      'third-party/mbedtls/tf-psa-crypto/core/psa_crypto_storage.c',
++      'third-party/mbedtls/tf-psa-crypto/core/psa_its_file.c',
++      'third-party/mbedtls/tf-psa-crypto/core/tf_psa_crypto_config.c',
++      'third-party/mbedtls/tf-psa-crypto/core/tf_psa_crypto_version.c',
++      
'third-party/mbedtls/tf-psa-crypto/core/psa_crypto_driver_wrappers_no_static.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/aes.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/aesce.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/aesni.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/aria.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/asn1parse.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/asn1write.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/base64.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_core.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_mod.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_mod_raw.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/block_cipher.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/camellia.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/ccm.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/chacha20.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/chachapoly.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/cipher.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/cipher_wrap.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/cmac.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/constant_time.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/ctr_drbg.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/ecdh.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/ecdsa.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/ecjpake.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/ecp.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/ecp_curves.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/ecp_curves_new.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/entropy.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/entropy_poll.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/gcm.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/hmac_drbg.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/lmots.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/lms.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/md.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/md5.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/memory_buffer_alloc.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/nist_kw.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/oid.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/pem.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/pk.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/pk_ecc.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/pk_rsa.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/pk_wrap.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/pkcs5.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/pkparse.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/pkwrite.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/platform.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/platform_util.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/poly1305.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_aead.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_cipher.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_ffdh.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_hash.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_mac.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_pake.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_rsa.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_util.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/ripemd160.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa_alt_helpers.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/sha1.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/sha256.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/sha3.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/sha512.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src/threading.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/everest/library/everest.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/everest/library/x25519.c',
++      'third-party/mbedtls/tf-psa-crypto/drivers/p256-m/p256-m/p256-m.c',
++      
'third-party/mbedtls/tf-psa-crypto/drivers/p256-m/p256-m_driver_entrypoints.c',
+     ]
+   },
+   'targets': [
+@@ -444,7 +557,6 @@
+       'defines': [
+         'LIEF_STATIC',
+         'MBEDTLS_CONFIG_FILE="config/mbedtls/config.h"',
+-        'MBEDTLS_NO_PLATFORM_ENTROPY',
+         'SPDLOG_DISABLE_DEFAULT_LOGGER',
+         'SPDLOG_NO_EXCEPTIONS',
+         'SPDLOG_FUNCTION=""',
+@@ -487,7 +599,57 @@
+       },
+       'sources': [
+         '<@(lief_sources)',
+-        '<@(lief_third_party_sources)',
++      ],
++      'conditions': [
++        ['lief_version_major >= 1', {
++          'sources': [
++            'src/DebugDeclOpt.cpp',
++            'src/mbedtls_init.cpp',
++            'src/threading_alt.cpp',
++            'src/BinaryStream/DumpStream.cpp',
++            'src/ELF/DynamicEntryAuxiliary.cpp',
++            'src/ELF/DynamicEntryFilter.cpp',
++            'src/ELF/elf_utils.cpp',
++            'src/ELF/layout_check.cpp',
++            'src/ELF/NoteDetails/properties/Needed.cpp',
++            'src/MachO/LazyLoadDylibInfo.cpp',
++            'src/MachO/ThreadLocalVariables.cpp',
++            # Stubs for disabled LIEF_RUNTIME_SUPPORT.
++            'src/runtime/android/no_runtime.cpp',
++            'src/runtime/disassembler/no_assembler.cpp',
++            'src/runtime/disassembler/no_disassembler.cpp',
++            'src/runtime/linux/no_runtime.cpp',
++            'src/runtime/linux_android_shared/no_runtime.cpp',
++            'src/runtime/no_runtime.cpp',
++            'src/runtime/osx/common.cpp',
++            'src/runtime/osx/no_runtime.cpp',
++            'src/runtime/windows/common.cpp',
++            'src/runtime/windows/no_runtime.cpp',
++            '<@(lief_1_third_party_sources)',
++          ],
++          'include_dirs': [
++            'src/runtime',
++            'third-party/mbedtls/tf-psa-crypto/include',
++            'third-party/mbedtls/tf-psa-crypto/drivers/builtin/include',
++            'third-party/mbedtls/tf-psa-crypto/core',
++            'third-party/mbedtls/tf-psa-crypto/drivers/builtin/src',
++            
'third-party/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest',
++            
'third-party/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlib',
++          ],
++          'defines': [
++            'TF_PSA_CRYPTO_USER_CONFIG_FILE="config/mbedtls/psa_config.h"',
++          ],
++          'conditions': [
++            ['OS=="win"', {
++              'link_settings': {
++                'libraries': [ '-lbcrypt' ],
++              },
++            }],
++          ],
++        }, {
++          'sources': [ '<@(lief_third_party_sources)' ],
++          'defines': [ 'MBEDTLS_NO_PLATFORM_ENTROPY' ],
++        }],
+       ],
+     }
+   ]
+diff --git a/src/node_sea_bin.cc b/src/node_sea_bin.cc
+index 30197b9bc3c3..e11d36576b56 100644
+--- a/src/node_sea_bin.cc
++++ b/src/node_sea_bin.cc
+@@ -11,6 +11,7 @@
+ #else  // defined(DEBUG)
+ #include "LIEF/LIEF.hpp"
+ #endif  // defined(DEBUG)
++#include "LIEF/version.h"
+ #endif  // HAVE_LIEF
+ 
+ #include "debug_utils-inl.h"
+@@ -175,8 +176,13 @@ InjectOutput InjectIntoMachO(const std::vector<uint8_t>& 
executable,
+           LIEF::MachO::SegmentCommand::VM_PROTECTIONS::READ));
+       new_segment.init_protection(static_cast<uint32_t>(
+           LIEF::MachO::SegmentCommand::VM_PROTECTIONS::READ));
++#if LIEF_VERSION_MAJOR >= 1
++      auto section = LIEF::MachO::Section::create(section_name, data);
++      new_segment.add_section(*section);
++#else
+       LIEF::MachO::Section section(section_name, data);
+       new_segment.add_section(section);
++#endif
+       binary.add(new_segment);
+     } else {
+       // Check if the section exists
+@@ -191,8 +197,13 @@ InjectOutput InjectIntoMachO(const std::vector<uint8_t>& 
executable,
+                         segment_name,
+                         section_name)};
+       }
++#if LIEF_VERSION_MAJOR >= 1
++      auto section = LIEF::MachO::Section::create(section_name, data);
++      binary.add_section(*segment, *section);
++#else
+       LIEF::MachO::Section section(section_name, data);
+       binary.add_section(*segment, section);
++#endif
+     }
+ 
+     // It will need to be signed again anyway, so remove the signature
+@@ -295,7 +306,15 @@ InjectOutput InjectIntoPE(const std::vector<uint8_t>& 
executable,
+   cfg.resources = true;
+   cfg.rsrc_section = ".rsrc";  // ensure section name
+   LIEF::PE::Builder builder(*binary, cfg);
++#if LIEF_VERSION_MAJOR >= 1
++  // LIEF 1.0.0 does not export the result's bool conversion in shared builds.
++  // TODO(inoway46): Remove this workaround once the upstream issue is fixed.
++  // https://github.com/lief-project/LIEF/issues/1387
++  builder.build();
++  if (builder.get_build().empty()) {
++#else
+   if (!builder.build()) {
++#endif
+     return {InjectResult::kError, {}, "Failed to build modified PE binary"};
+   }
+ 
+diff --git a/tools/prepare_lief.py b/tools/prepare_lief.py
+index 3da0d8f3df46..b60579d5b2e0 100644
+--- a/tools/prepare_lief.py
++++ b/tools/prepare_lief.py
+@@ -173,6 +173,9 @@ def main():
+             # Move the allow-listed directories from each lib in 
tmp_third_party to dst_third_party
+             src = tmp_third_party / lib
+             dst = dst_third_party / lib
++            if lib == 'mbedtls' and (src / 'tf-psa-crypto').is_dir():
++                included = included + ['tf-psa-crypto/core', 
'tf-psa-crypto/include',
++                                       'tf-psa-crypto/drivers', 
'tf-psa-crypto/LICENSE']
+             for subpath in included:
+                 src_item = src / subpath
+                 dst_item = dst / subpath
+@@ -187,6 +190,11 @@ def main():
+                         dst_item.unlink()
+                 print(f"Moving {src_item} -> {dst_item}")
+                 shutil.move(str(src_item), str(dst_item))
++                if lib == 'mbedtls' and subpath.startswith('tf-psa-crypto/') 
and dst_item.is_dir():
++                    # The release archive includes generated sources that 
must be
++                    # checked in, despite the upstream development ignore 
rules.
++                    for gitignore in dst_item.rglob('.gitignore'):
++                        gitignore.unlink()
+ 
+     # 2) Place internal headers expected by the project layout under src/
+     #    - third-party/expected/include/tl/expected.hpp
+@@ -269,6 +277,7 @@ def main():
+         'LIEF_DYLD_SHARED_CACHE_SUPPORT': 0,
+         'LIEF_ASM_SUPPORT': 0,
+         'LIEF_EXTENDED': 0,
++        'LIEF_RUNTIME_SUPPORT': 0,
+ 
+         'ENABLE_JSON_SUPPORT': 0,
+         'LIEF_JSON_SUPPORT': 0,

Reply via email to