From patchwork Thu May 1 13:29:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= X-Patchwork-Id: 2079836 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4ZpFKX1njzz1yMy for ; Thu, 1 May 2025 23:30:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0A0ED41725; Thu, 1 May 2025 13:30:21 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id dP2LoHIn8mSw; Thu, 1 May 2025 13:30:20 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org EDCC441A6B Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id EDCC441A6B; Thu, 1 May 2025 13:30:19 +0000 (UTC) X-Original-To: buildroot@buildroot.org Delivered-To: buildroot@buildroot.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id 5483622D for ; Thu, 1 May 2025 13:30:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 4633E83DC2 for ; Thu, 1 May 2025 13:30:18 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id xqT3qkff2-PT for ; Thu, 1 May 2025 13:30:17 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::32f; helo=mail-wm1-x32f.google.com; envelope-from=raphael.melotte@essensium.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 53EDB83DC1 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 53EDB83DC1 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by smtp1.osuosl.org (Postfix) with ESMTPS id 53EDB83DC1 for ; Thu, 1 May 2025 13:30:15 +0000 (UTC) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-43d0618746bso5101875e9.2 for ; Thu, 01 May 2025 06:30:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746106214; x=1746711014; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oHaqgjfYPZGqGyNZaOo3UZ8ehWLOD24mjYUJFTHap0k=; b=Zg/HrEl/2NFwQ/PvpdcTmTaWh3cfClvtqhkHbv1bAKygM9ix6AIOsPF+TiHZMYdW/j 1OGdTwPHmJc8vXCIFbocEQorqTBF4fqaPY6vdJzWM31XZF80HboNDeTvBnTz8NaTT4cK +vxKum5PiV+9dM7SmcwVu52dtIc9uX2EwBg24BipJYgL6EGRFUZ+aLWNW6JHcLpnD18z NrEa+IQj3wkw7mWTQn3Umxot830bZCW8lgKxViqZK0qH3PUbD0t25dgxDD6c3vxAgx2U OHYf0jSAQ7kN/jUmyp+V1hqbtSWY+Wke/Ur827rqOCrBN6lLmHpMa84AtF4dELyfkHA4 8+lA== X-Gm-Message-State: AOJu0YwdjHT5uNbhass6igAjJK+BvUmq4Ehc82x9zVSJPe5ImvqtKdCa VnLkqVAU/TIf5JBr4NTDYZRbIaBCRConr5uQmr5FRlO9orKb+vAp4GUswCReBOau9/3x6txj+7c wxJU= X-Gm-Gg: ASbGncu0oJTlDi/d52yfkOMzOOHgI91GeNcKObMp+Y6Al5qcHe6u+UAfqu+OLjkhgeO drLGDmLBH5FwOHtt36ETCW0sEoJSccw3WLF/JDkQMXKxb7OWXkhp7Gh1DUf7SHw0GnwDCiNNtwt 8B4WdDVhxn1y+kAzuZT7ut9AY3StdknEnhLTX6dDxfUPnT+lvyVZ/tHz3kIuoG8D+Ct7gDwwGZL eTUyATcMO4Z614EgfcOPtWEUwe81W3lIlwdJaFG3SgfVZo7LRw6Hx96If7BqVMvN9R+MEjrkMnZ pkLA5fz3u+2SNPo6VhtlMRTDiSlnj9LaTlyma1qGi8Hp96imx7Iq/tjr7iipxSXjUpemXvdVNEx FT6O7ur2TvxsWoI/HCgoeSCr0wUM= X-Google-Smtp-Source: AGHT+IG13MKd73riwsZ5EMGP8q4xWvnhNmRRsfOJ0twSvDLW1y0fSv+RDdCEYXxgYsto66nu3tPO6A== X-Received: by 2002:a05:600c:3d08:b0:43d:46de:b0eb with SMTP id 5b1f17b1804b1-441b64f65e9mr24770825e9.12.1746106213630; Thu, 01 May 2025 06:30:13 -0700 (PDT) Received: from mind2.local.ess-mail.com (ip-94-140-185-241.reverse.destiny.be. [94.140.185.241]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-441b2af2922sm57867655e9.17.2025.05.01.06.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 May 2025 06:30:12 -0700 (PDT) To: buildroot@buildroot.org Cc: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= , Valentin Korenblit , Romain Naour , Joseph Kogut , Daniel Lang Date: Thu, 1 May 2025 13:29:55 +0000 Message-Id: <20250501133002.1408454-1-raphael.melotte@mind.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250407103959.2361659-2-raphael.melotte@mind.be> References: <20250407103959.2361659-2-raphael.melotte@mind.be> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind.be; s=google; t=1746106214; x=1746711014; darn=buildroot.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oHaqgjfYPZGqGyNZaOo3UZ8ehWLOD24mjYUJFTHap0k=; b=MhpvoqyTVJWQ4FaWl6XbeohEoixYDE92toOGHMkz6c2025wJCTI01E5zCERvH9wt1a B71FKtm500t7VX0PVhv4YPF6xwPQcjQYbbSEoSOZ9+lCN1/HfIH1KEveWD4ECJBs7vAP VMhNOp1Jp+ndwb8B+WlDro1eSE9VMVvD9HtqzqofaeNBkaqphLzujLXOnrARJwzVGYTs 5XKL6w2SrifkL7NF8F6redfKp2YBXFQaCm+6NoPGDMaUE5gDVWe69SMrj0uDcdytFJUv qEpkJLrndGHbUybvWGOBYxoBA9li+ncy/1AgArMAqxjAVvRupI4RxxtyPXitmf+7F+S8 ZVIg== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=mind.be X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=mind.be header.i=@mind.be header.a=rsa-sha256 header.s=google header.b=MhpvoqyT Subject: [Buildroot] [PATCH v2 1/3] package/llvm-project: add support for clang python bindings X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Rapha=C3=ABl_M=C3=A9lotte_via_buildroot?= From: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= Reply-To: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Add two upstream patches that were required for building and enable the bindings for our python version. It should be noted that because the python bindings have wrong default include dirs, they are useless if the includes are not provided externally. Signed-off-by: Raphaël Mélotte Reviewed-by: Daniel Lang Tested-by: El Mehdi YOUNES --- Changes v1 -> v2: - Remove BR2_PACKAGE_HOST_CLANG_PYTHON_BINDINGS (use BR2_PACKAGE_HOST_PYTHON3). --- ...sic-against-libatomic-when-necessary.patch | 48 ++++++++++ package/llvm-project/clang/clang.mk | 5 + ...LIB-variable-for-convenient-linking-.patch | 91 +++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 package/llvm-project/clang/0001-Link-libclangBasic-against-libatomic-when-necessary.patch create mode 100644 package/llvm-project/llvm/0001-Set-LLVM_ATOMIC_LIB-variable-for-convenient-linking-.patch diff --git a/package/llvm-project/clang/0001-Link-libclangBasic-against-libatomic-when-necessary.patch b/package/llvm-project/clang/0001-Link-libclangBasic-against-libatomic-when-necessary.patch new file mode 100644 index 0000000000..d3068ea28b --- /dev/null +++ b/package/llvm-project/clang/0001-Link-libclangBasic-against-libatomic-when-necessary.patch @@ -0,0 +1,48 @@ +From 20132d8eaa68a6c53e152718beda1dc0f4c9ff6c Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Wed, 19 Oct 2022 20:12:10 +0100 +Subject: [PATCH] Link libclangBasic against libatomic when necessary. + +This is necessary at least on PPC32. + +Depends on D136280. + +Bug: https://bugs.gentoo.org/874024 +Thanks-to: Arfrever Frehtes Taifersar Arahesis +Tested-by: erhard_f@mailbox.org + +Differential Revision: https://reviews.llvm.org/D136282 +Upstream: https://github.com/llvm/llvm-project/commit/20132d8eaa68a6c53e152718beda1dc0f4c9ff6c +Signed-off-by: Raphaël Mélotte +--- + CMakeLists.txt | 1 + + lib/Basic/CMakeLists.txt | 4 ++++ + 2 files changed, 5 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2ca81e506338..236e6fbaca28 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,6 +63,7 @@ if(CLANG_BUILT_STANDALONE) + include(TableGen) + include(HandleLLVMOptions) + include(VersionFromVCS) ++ include(CheckAtomic) + include(GetErrcMessages) + include(LLVMDistributionSupport) + +diff --git a/lib/Basic/CMakeLists.txt b//lib/Basic/CMakeLists.txt +index 5d197f59ac4f..f0f3839a7e2c 100644 +--- a/lib/Basic/CMakeLists.txt ++++ b/lib/Basic/CMakeLists.txt +@@ -111,3 +111,7 @@ add_clang_library(clangBasic + omp_gen + ) + ++target_link_libraries(clangBasic ++ PRIVATE ++ ${LLVM_ATOMIC_LIB} ++) +-- +2.45.2 + diff --git a/package/llvm-project/clang/clang.mk b/package/llvm-project/clang/clang.mk index 0bafd6461b..342f79ed24 100644 --- a/package/llvm-project/clang/clang.mk +++ b/package/llvm-project/clang/clang.mk @@ -105,6 +105,11 @@ ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)` endif +ifeq ($(BR2_PACKAGE_HOST_PYTHON3),y) +HOST_CLANG_DEPENDENCIES += host-python3 +HOST_CLANG_CONF_OPTS += -DCLANG_PYTHON_BINDINGS_VERSIONS=$(PYTHON3_VERSION_MAJOR) +endif + define HOST_CLANG_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS $(Q)cd $(HOST_DIR)/bin; \ rm -f clang-$(CLANG_VERSION_MAJOR).br_real; \ diff --git a/package/llvm-project/llvm/0001-Set-LLVM_ATOMIC_LIB-variable-for-convenient-linking-.patch b/package/llvm-project/llvm/0001-Set-LLVM_ATOMIC_LIB-variable-for-convenient-linking-.patch new file mode 100644 index 0000000000..07fca7710e --- /dev/null +++ b/package/llvm-project/llvm/0001-Set-LLVM_ATOMIC_LIB-variable-for-convenient-linking-.patch @@ -0,0 +1,91 @@ +From fa981b541365190ae646d2dce575706cd0626cf7 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Wed, 19 Oct 2022 19:50:20 +0100 +Subject: [PATCH] Set LLVM_ATOMIC_LIB variable for convenient linking against + libatomic + +* Set LLVM_ATOMIC_LIB to keep track of when we need to link against libatomic. +* Add detection of mold linker which is required for this. +* Use --as-needed when linking against libatomic as a bonus. On some platforms, + libatomic may be required only sometimes. + +Bug: https://bugs.gentoo.org/832675 +Thanks-to: Arfrever Frehtes Taifersar Arahesis +Tested-by: erhard_f@mailbox.org + +Differential Revision: https://reviews.llvm.org/D136280 +Upstream: https://github.com/llvm/llvm-project/commit/fa981b541365190ae646d2dce575706cd0626cf7 +Signed-off-by: Raphaël Mélotte +--- + cmake/modules/AddLLVM.cmake | 1 + + cmake/modules/CheckAtomic.cmake | 13 +++++++++++++ + lib/Support/CMakeLists.txt | 4 +--- + tools/dsymutil/CMakeLists.txt | 4 +--- + 4 files changed, 16 insertions(+), 6 deletions(-) + +diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake +index 30ac0040e565..428a22422e28 100644 +--- a/cmake/modules/AddLLVM.cmake ++++ b/cmake/modules/AddLLVM.cmake +@@ -219,6 +219,7 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32) + else() + if("${stdout}" MATCHES "^mold") + set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "") ++ set(LLVM_LINKER_IS_MOLD YES CACHE INTERNAL "") + message(STATUS "Linker detection: mold") + elseif("${stdout}" MATCHES "GNU gold") + set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "") +diff --git a/cmake/modules/CheckAtomic.cmake b/cmake/modules/CheckAtomic.cmake +index 3c5ba72993a3..f11cadf39ff6 100644 +--- a/cmake/modules/CheckAtomic.cmake ++++ b/cmake/modules/CheckAtomic.cmake +@@ -82,6 +82,19 @@ elseif(LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL") + endif() + endif() + ++# Set variable LLVM_ATOMIC_LIB specifying flags for linking against libatomic. ++if(HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB) ++ # Use options --push-state, --as-needed and --pop-state if linker is known to support them. ++ # Use single option -Wl of compiler driver to avoid incorrect re-ordering of options by CMake. ++ if(LLVM_LINKER_IS_GNULD OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD OR LLVM_LINKER_IS_MOLD) ++ set(LLVM_ATOMIC_LIB "-Wl,--push-state,--as-needed,-latomic,--pop-state") ++ else() ++ set(LLVM_ATOMIC_LIB "-latomic") ++ endif() ++else() ++ set(LLVM_ATOMIC_LIB) ++endif() ++ + ## TODO: This define is only used for the legacy atomic operations in + ## llvm's Atomic.h, which should be replaced. Other code simply + ## assumes C++11 works. +diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt +index bc19b5be2140..023d50793eff 100644 +--- a/lib/Support/CMakeLists.txt ++++ b/lib/Support/CMakeLists.txt +@@ -59,9 +59,7 @@ elseif( CMAKE_HOST_UNIX ) + if( LLVM_ENABLE_TERMINFO ) + set(imported_libs ${imported_libs} Terminfo::terminfo) + endif() +- if( LLVM_ENABLE_THREADS AND (HAVE_LIBATOMIC OR HAVE_CXX_LIBATOMICS64) ) +- set(system_libs ${system_libs} atomic) +- endif() ++ set(system_libs ${system_libs} ${LLVM_ATOMIC_LIB}) + set(system_libs ${system_libs} ${LLVM_PTHREAD_LIB}) + if( UNIX AND NOT (BEOS OR HAIKU) ) + set(system_libs ${system_libs} m) +diff --git a/tools/dsymutil/CMakeLists.txt b/tools/dsymutil/CMakeLists.txt +index a255c1c5daf5..38028cd3d80a 100644 +--- a/tools/dsymutil/CMakeLists.txt ++++ b/tools/dsymutil/CMakeLists.txt +@@ -40,6 +40,4 @@ if(APPLE) + target_link_libraries(dsymutil PRIVATE "-framework CoreFoundation") + endif(APPLE) + +-if(HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB) +- target_link_libraries(dsymutil PRIVATE atomic) +-endif() ++target_link_libraries(dsymutil PRIVATE ${LLVM_ATOMIC_LIB}) +-- +2.34.1 + From patchwork Thu May 1 13:29:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= X-Patchwork-Id: 2079838 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4ZpFKc3x6Lz1yMy for ; Thu, 1 May 2025 23:30:12 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8A0B640C4D; Thu, 1 May 2025 13:30:25 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id xZ95LJ3z4-Mg; Thu, 1 May 2025 13:30:22 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E609E41DCE Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id E609E41DCE; Thu, 1 May 2025 13:30:21 +0000 (UTC) X-Original-To: buildroot@buildroot.org Delivered-To: buildroot@buildroot.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id 7FD42113 for ; Thu, 1 May 2025 13:30:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6594883DC5 for ; Thu, 1 May 2025 13:30:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id wk8jYxr4Krdz for ; Thu, 1 May 2025 13:30:19 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::331; helo=mail-wm1-x331.google.com; envelope-from=raphael.melotte@essensium.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 6FA9983DC1 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6FA9983DC1 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by smtp1.osuosl.org (Postfix) with ESMTPS id 6FA9983DC1 for ; Thu, 1 May 2025 13:30:18 +0000 (UTC) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-440685d6afcso7012735e9.0 for ; Thu, 01 May 2025 06:30:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746106216; x=1746711016; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R+cZm4tRVvr3tvhP9fwGEsv0/N6g25LW26stXamLjHk=; b=uy9X4SsoM03wtEhUdmFI63X7WfRb7ag9j7ty8uKYvHkNYqLqclUXfk3BwpcEa9sh60 FOBvlyd75E+vihfQtzJfSXVZYm00qoPq+l0R6TdNe9ayWj9VzgbSE/EIGkrbX1Y36D5i K5M6G4JhUkgUkCMsDD/J+WhcZ6Pf8jtwi+S0ljw4bNxN4vzLYmGn5I/6aFXC4MA4XKWF wuVXB2Yt7LWNXCoZYCfomGPSmHpv6BDjV9Kj+rZbLFvImp+rXJfeq8t2SN5MoWuW0lVm XBVR2J+SP30bjj+ZxP8iDYQFIY3YxZiSELuLiBJtit1hr+eZREad7HnpjapHALxfpott GuVQ== X-Gm-Message-State: AOJu0YykaFGdavaTeHacmyPWweCETD8VqT0dRaFdJ0DP2/Lk4Rs9sQPg RXSz+IGvM/WP8DZIyNBygfW7Mif4d+IqOuiF5B2dq9SRqIcSNfEJK5EcWOCKq9/9eAoJ3javT8O 51z0= X-Gm-Gg: ASbGncuY/qHgdWDNiNCUhoVTRp8brNBwKrPmelBBfscBtaO0G8OnHwtYtm5/2bExQuC LsmP3jAsBehcFgkVwPWeyT5nzNKEEtPqgPMvF0/znFpVUmtNVr0ASMKOjVCedlcFEv0/msbMT6b 8+U3BCn5i52k8fPe+1k1JwHgsgLa96P4wVEIqaNcDMYRJTY427FRTUEMPaCyfAERV4RVeT/3W16 0GuushVPXUDqks0pNjyONMtz7Tnw+BXwycJswWnVdQojgOmqCq8U1B0DXL6RcrIDVeKax8Vj0hi inEvlpCjz6CrtFK92Tbvtnn7zvSXkMfdQvLNDODTAzyofoT797tbQoAm7BHyR9cLNJUu0DlL7Pe LP3UlJMqnATBKdI+wZI9h1Ucrg80= X-Google-Smtp-Source: AGHT+IGwcXDujszwOR6h3WQzFQTs+QmQGwVhq/bfoHFZZXdaOOdXRZh+wvouwSw7Skwum0e7iGKp1Q== X-Received: by 2002:a05:600c:3b03:b0:43d:fa59:be38 with SMTP id 5b1f17b1804b1-441b26983ebmr50650775e9.32.1746106216097; Thu, 01 May 2025 06:30:16 -0700 (PDT) Received: from mind2.local.ess-mail.com (ip-94-140-185-241.reverse.destiny.be. [94.140.185.241]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-441b2af2922sm57867655e9.17.2025.05.01.06.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 May 2025 06:30:14 -0700 (PDT) To: buildroot@buildroot.org Date: Thu, 1 May 2025 13:29:56 +0000 Message-Id: <20250501133002.1408454-2-raphael.melotte@mind.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250501133002.1408454-1-raphael.melotte@mind.be> References: <20250407103959.2361659-2-raphael.melotte@mind.be> <20250501133002.1408454-1-raphael.melotte@mind.be> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind.be; s=google; t=1746106216; x=1746711016; darn=buildroot.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R+cZm4tRVvr3tvhP9fwGEsv0/N6g25LW26stXamLjHk=; b=PhIVP0Am9hfz74wKhDnGX8DhHruCFTQW0CMfZkFvx6JUL1+zP7R6tBNHKSCnbLIzox IfTy+Wc6VUCXVGKGCmAz/rmLzVWPIt2WaLUNSHgSXjKkmAT2bpV9scBTD1s1WgB/da2/ Fi01fyiynBTkg60OiXXjKRwtV4yRWYRImf+tMwAvnf8OL3k5XcNFM8W0mNYMgmQ73KHW 7GGoirCW0Nq5FcW9zTjxMamJST73zMaszqZos4M+ZPEnDLuk/UMIzkhHC3oc3SqK08ry vrxl6I66N/hC46WKoDNp1FCZDnPSCGY84I5HZgs7+xbEMmMvybqCbdnt8roYdwe7CRsc eDQw== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=mind.be X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=mind.be header.i=@mind.be header.a=rsa-sha256 header.s=google header.b=PhIVP0Am Subject: [Buildroot] [PATCH v2 2/3] package/mupdf, python-pymupdf: bump to version 1.24.9, 1.24.10 X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Rapha=C3=ABl_M=C3=A9lotte_via_buildroot?= From: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= Reply-To: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= Cc: James Hilliard , =?utf-8?b?UmFwaGHDq2wgTcOp?= =?utf-8?b?bG90dGU=?= , Asaf Kahlon Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" With this new python-pymupdf (and mupdf) version, we can no longer build the old implementation (the 'a' implementation). We now need to build mupdf's python binding, which require host-clang (and its python bindings) to be built. Note that python-mupdf's version still needs to stay close to mupdf's version, they can only be updated together. A number of mupdf patches were needed: - To allow changing the build-time log level from an environment variable. - To be able to provide the libclang include directories. This is needed because our default libclang include directories are not properly set. - To be able to link against mupdf with no versioning number. In mupdf, we need to set a number of environment variables: - VENV_FLAG: to tell mupdf that it should not create a venv at build time. - MUPDF_LIBCLANG_ARGS: to provide the right include directories to clang's python bindings. - PIPCL_PYTHON_CONFIG: so that pipcl uses our python3-config and not the host one. - JLIB_log_levels: to get libclang's diagnostics when building. Setting JLIB_log_levels is not strictly necessary, but it greatly helps debugging build issues. It also only has an impact at build time anyway. To make it easier to debug potential future CI build failures, we enable it unconditionally. In python-pymupdf, !BR2_STATIC_LIBS is now required by mupdf anyway, so update the comment accordingly. The patch that is now upstream is also removed, and the test is updated to use the new implementation. These new versions no longer fit in a 120M rootfs, so double its size. Signed-off-by: Raphaël Mélotte --- Changes v1 -> v2: - Remove BR2_PACKAGE_HOST_CLANG_PYTHON_BINDINGS (select BR2_PACKAGE_HOST_PYTHON3 instead). --- ...-jlib-fix-setting-filename-log-level.patch | 48 +++++++ ...y-to-provide-libclang-include-dirs-e.patch | 53 ++++++++ ...e-non-versioned-symlink-to-the-build.patch | 35 +++++ ...-log-level-through-environement-vari.patch | 53 ++++++++ ...rted-operand-type-when-setting-log-l.patch | 44 ++++++ package/mupdf/Config.in | 8 ++ package/mupdf/mupdf.hash | 4 +- package/mupdf/mupdf.mk | 37 +++++- ...w-providing-python-config-externally.patch | 125 ------------------ package/python-pymupdf/Config.in | 3 +- package/python-pymupdf/python-pymupdf.hash | 4 +- package/python-pymupdf/python-pymupdf.mk | 7 +- .../tests/package/sample_python_pymupdf.py | 2 +- .../tests/package/test_python_pymupdf.py | 2 +- 14 files changed, 288 insertions(+), 137 deletions(-) create mode 100644 package/mupdf/0001-jlib-fix-setting-filename-log-level.patch create mode 100644 package/mupdf/0001-scripts-add-a-way-to-provide-libclang-include-dirs-e.patch create mode 100644 package/mupdf/0001-setup.py-add-the-non-versioned-symlink-to-the-build.patch create mode 100644 package/mupdf/0002-jlib-fix-setting-log-level-through-environement-vari.patch create mode 100644 package/mupdf/0003-jlib-fix-unsupported-operand-type-when-setting-log-l.patch delete mode 100644 package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch diff --git a/package/mupdf/0001-jlib-fix-setting-filename-log-level.patch b/package/mupdf/0001-jlib-fix-setting-filename-log-level.patch new file mode 100644 index 0000000000..2a0e62b870 --- /dev/null +++ b/package/mupdf/0001-jlib-fix-setting-filename-log-level.patch @@ -0,0 +1,48 @@ +From 553bb924e032646739362c586adbcd5e931f02b9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= +Date: Mon, 24 Feb 2025 13:06:00 +0100 +Subject: [PATCH] jlib: fix setting filename log level +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Building using JLIB_log_levels for filenames only currently fails. + +For example, building with the following command: +make JLIB_log_levels=cpp.py=-5 python + +... leads to the following trace: + + File "/home/rme/Documents/mupdf/scripts/jlib.py", line 427, in log + level += log_levels_find( caller) + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/home/rme/Documents/mupdf/scripts/jlib.py", line 350, in log_levels_find + if item_filename and not filename.startswith( item_filename): + +This is because ffl is always a list (unpacked in case len==2), and +the filename is the first element of this list. +To fix it, only keep the first element of ffl when there is exactly +one. + +Upstream: https://github.com/ArtifexSoftware/mupdf/pull/58 +Signed-off-by: Raphaël Mélotte +--- + scripts/jlib.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/jlib.py b/scripts/jlib.py +index 8d7ecc6cd..4c7e2a0f0 100644 +--- a/scripts/jlib.py ++++ b/scripts/jlib.py +@@ -509,7 +509,7 @@ def log_levels_add_env( name='JLIB_log_levels'): + if 0: # lgtm [py/unreachable-statement] + pass + elif len( ffl) == 1: +- filename = ffl ++ filename = ffl[0] + function = None + elif len( ffl) == 2: + filename, function = ffl +-- +2.48.1 + diff --git a/package/mupdf/0001-scripts-add-a-way-to-provide-libclang-include-dirs-e.patch b/package/mupdf/0001-scripts-add-a-way-to-provide-libclang-include-dirs-e.patch new file mode 100644 index 0000000000..588f2f004b --- /dev/null +++ b/package/mupdf/0001-scripts-add-a-way-to-provide-libclang-include-dirs-e.patch @@ -0,0 +1,53 @@ +From b2483d9d47c10895e94e54918ff6f2144f3ef5f9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= +Date: Thu, 20 Feb 2025 12:50:01 +0100 +Subject: [PATCH] scripts: add a way to provide libclang include dirs + externally +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When cross-compiling, libclang doesn't necessarily have the right +include directories configured by default. +See for example: https://bugs.ghostscript.com/show_bug.cgi?id=708041 + +Since we also have no way to figure out the right include directories +from our scripts, add a new environment variable that can be used to +provide them externally. + +Upstream: https://github.com/ArtifexSoftware/mupdf/pull/63 +Signed-off-by: Raphaël Mélotte +--- + scripts/wrap/cpp.py | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/scripts/wrap/cpp.py b/scripts/wrap/cpp.py +index 80ab2dfbe..cb0bbd220 100644 +--- a/scripts/wrap/cpp.py ++++ b/scripts/wrap/cpp.py +@@ -6,6 +6,7 @@ import io + import os + import pickle + import re ++import shlex + import textwrap + + import jlib +@@ -5311,6 +5312,14 @@ def cpp_source( + '-D', 'MUPDF_WRAP_LIBCLANG', + '-D', 'FZ_FUNCTION=', + ] ++ ++ # In some circumstances (e.g. when cross-compiling when ++ # libclang doesn't have the right include directories by ++ # default) the includes are provided externally: ++ libclang_args = os.environ.get('MUPDF_LIBCLANG_ARGS', '') ++ if libclang_args: ++ args += shlex.split(libclang_args) ++ + tu = index.parse( + temp_h, + args = args, +-- +2.48.1 + diff --git a/package/mupdf/0001-setup.py-add-the-non-versioned-symlink-to-the-build.patch b/package/mupdf/0001-setup.py-add-the-non-versioned-symlink-to-the-build.patch new file mode 100644 index 0000000000..e99ced9cdc --- /dev/null +++ b/package/mupdf/0001-setup.py-add-the-non-versioned-symlink-to-the-build.patch @@ -0,0 +1,35 @@ +From 0cb92558aeac286c058eae35a6bad0e2c8f0725e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= +Date: Tue, 3 Sep 2024 15:35:33 +0200 +Subject: [PATCH] setup.py: add the non-versioned symlink to the build +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Starting from bf1c28cc4f2dd4bd17e35783fa3c1f98ded22296, the generated +mupdf libraries are versioned. This means that if we want to link +against them without knowing their version number (i.e. using +'-lmupdf'), we also need to install the symlink to the wheel. + +Upstream: https://github.com/ArtifexSoftware/mupdf/pull/59 +Signed-off-by: Raphaël Mélotte +--- + setup.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/setup.py b/setup.py +index 5411bd34b..0709e2ef6 100755 +--- a/setup.py ++++ b/setup.py +@@ -354,6 +354,8 @@ def build(): + names = [ + pipcl.get_soname(f'{build_dir()}/libmupdf.so'), # C. + pipcl.get_soname(f'{build_dir()}/libmupdfcpp.so'), # C++. ++ f'{build_dir()}/libmupdf.so', # C symlink. ++ f'{build_dir()}/libmupdfcpp.so', # C++ symlink. + f'{build_dir()}/_mupdf.so', # Python internals. + f'{build_dir()}/mupdf.py', # Python. + ] +-- +2.45.2 + diff --git a/package/mupdf/0002-jlib-fix-setting-log-level-through-environement-vari.patch b/package/mupdf/0002-jlib-fix-setting-log-level-through-environement-vari.patch new file mode 100644 index 0000000000..386dd2050e --- /dev/null +++ b/package/mupdf/0002-jlib-fix-setting-log-level-through-environement-vari.patch @@ -0,0 +1,53 @@ +From e033e1a8b8a1674e1e7ee6638008bd005b511920 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= +Date: Mon, 24 Feb 2025 22:29:13 +0100 +Subject: [PATCH] jlib: fix setting log level through environement variable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Currently, setting a log level through the JLIB_log_levels environment +fails in this way: + File "/home/rme/Documents/mupdf/scripts/jlib.py", line 185, in __call__ + ret += ' (+%s)' % time_duration( time.time() - self.t0, s_format='%.1f') + ^^^^^^^^^^^^^ +This is because at the time log_levels_add_env() is invoked, +time_duration is not defined yet. + +To fix it, just move the invocation further down, after time_duration +is defined. + +Upstream: https://github.com/ArtifexSoftware/mupdf/pull/58 +Signed-off-by: Raphaël Mélotte +--- + scripts/jlib.py | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/scripts/jlib.py b/scripts/jlib.py +index 4c7e2a0f0..788a4bec8 100644 +--- a/scripts/jlib.py ++++ b/scripts/jlib.py +@@ -743,10 +743,6 @@ def text_split_last_of( text, substrings): + return text[ :pos], text[ pos:] + + +- +-log_levels_add_env() +- +- + def force_line_buffering(): + ''' + Ensure `sys.stdout` and `sys.stderr` are line-buffered. E.g. makes things +@@ -1246,6 +1242,9 @@ def time_duration( seconds, verbose=False, s_format='%i'): + return ret + + ++log_levels_add_env() ++ ++ + def date_time( t=None): + if t is None: + t = time.time() +-- +2.48.1 + diff --git a/package/mupdf/0003-jlib-fix-unsupported-operand-type-when-setting-log-l.patch b/package/mupdf/0003-jlib-fix-unsupported-operand-type-when-setting-log-l.patch new file mode 100644 index 0000000000..819f2d0a55 --- /dev/null +++ b/package/mupdf/0003-jlib-fix-unsupported-operand-type-when-setting-log-l.patch @@ -0,0 +1,44 @@ +From a568ae50e32e8b209edc9720360d873b10769f60 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= +Date: Mon, 24 Feb 2025 22:48:36 +0100 +Subject: [PATCH] jlib: fix unsupported operand type when setting log level +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes the following issue when log_levels_find() is used (for +example when setting a log level delta using JLIB_log_levels): +[...] + scripts/jlib.py:424:log(): level += log_levels_find( caller) + scripts/jlib.py:334:log_levels_find(): tb = traceback.extract_stack( None, 1+caller) +TypeError: unsupported operand type(s) for +: 'int' and 'FrameInfo' + +Note that this fix get JLIB_log_levels working, but it might be +incorrect. + +Upstream: https://github.com/ArtifexSoftware/mupdf/pull/58 +Signed-off-by: Raphaël Mélotte +--- + scripts/jlib.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/scripts/jlib.py b/scripts/jlib.py +index 788a4bec8..452b3ae00 100644 +--- a/scripts/jlib.py ++++ b/scripts/jlib.py +@@ -331,7 +331,11 @@ def log_levels_find( caller): + if not s_log_levels_items: + return 0 + +- tb = traceback.extract_stack( None, 1+caller) ++ if isinstance(caller, inspect.FrameInfo): ++ tb = traceback.extract_stack( None, 1) ++ else: ++ tb = traceback.extract_stack( None, 1+caller) ++ + if len(tb) == 0: + return 0 + filename, line, function, text = tb[0] +-- +2.48.1 + diff --git a/package/mupdf/Config.in b/package/mupdf/Config.in index 34c5e7d538..867cd40796 100644 --- a/package/mupdf/Config.in +++ b/package/mupdf/Config.in @@ -20,3 +20,11 @@ comment "mupdf needs a toolchain w/ C++, gcc >= 4.9" depends on BR2_TOOLCHAIN_HAS_SYNC_4 depends on !BR2_INSTALL_LIBSTDCPP || \ !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 + +config BR2_PACKAGE_MUPDF_PYTHON_BINDINGS + bool "python bindings for mupdf" + depends on !BR2_STATIC_LIBS + depends on BR2_PACKAGE_PYTHON3 + select BR2_PACKAGE_HOST_PYTHON3 + select BR2_PACKAGE_HOST_CLANG + select BR2_PACKAGE_HOST_SWIG diff --git a/package/mupdf/mupdf.hash b/package/mupdf/mupdf.hash index 580235eeca..ea739d2e33 100644 --- a/package/mupdf/mupdf.hash +++ b/package/mupdf/mupdf.hash @@ -1,8 +1,8 @@ # From https://mupdf.com/downloads/index.html: -sha1 d79600bccd70ab9d0e8ee19dae4e275f2af95ced mupdf-1.23.9-source.tar.lz +sha1 b7a876b7a9a7fff555f8fcc18184f767d120b03c mupdf-1.24.9-source.tar.lz # Locally computed: -sha256 2c2f89deb9f425ba637dac226191d547f2b40975c4d21a340965f52c001e15c5 mupdf-1.23.9-source.tar.lz +sha256 d87da097ae943ad0113003190ed370d39bde817383c59dc753dce23c7ba2b710 mupdf-1.24.9-source.tar.lz # Hash for license files: sha256 57c8ff33c9c0cfc3ef00e650a1cc910d7ee479a8bc509f6c9209a7c2a11399d6 COPYING diff --git a/package/mupdf/mupdf.mk b/package/mupdf/mupdf.mk index 9eecb84232..493d46f77a 100644 --- a/package/mupdf/mupdf.mk +++ b/package/mupdf/mupdf.mk @@ -5,7 +5,7 @@ ################################################################################ # python-pymupdf's version be compatible with mupdf's version -MUPDF_VERSION = 1.23.9 +MUPDF_VERSION = 1.24.9 MUPDF_SOURCE = mupdf-$(MUPDF_VERSION)-source.tar.lz MUPDF_SITE = https://mupdf.com/downloads/archive MUPDF_LICENSE = AGPL-3.0+ @@ -36,6 +36,41 @@ ifeq ($(BR2_STATIC_LIBS),y) MUPDF_MAKE_OPTS += shared=no else MUPDF_MAKE_OPTS += shared=yes + +ifeq ($(BR2_PACKAGE_MUPDF_PYTHON_BINDINGS),y) +MUPDF_DEPENDENCIES += \ + host-clang \ + host-swig \ + python3 + +MUPDF_MAKE_ENV += \ + VENV_FLAG="" \ + MUPDF_LIBCLANG_ARGS="-I$(STAGING_DIR)/usr/include -I$(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/include" \ + PIPCL_PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" + +# mupdf generates C++ code for its python bindings. As things can +# easily go wrong, increase the log level as much as we can so that we +# at least always see libclang's diagnostics: +MUPDF_MAKE_ENV += JLIB_log_levels="/:=-5" + +define MUPDF_BUILD_PYTHON_BINDINGS + $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) $(MUPDF_MAKE_OPTS) python +endef + +define MUPDF_INSTALL_PYTHON_BINDINGS_TO_STAGING + $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) $(MUPDF_MAKE_OPTS) \ + DESTDIR="$(STAGING_DIR)" pydir=/usr/lib/python$(PYTHON3_VERSION_MAJOR) install-shared-python \ + -o python -o c++ # skip rebuilding bindings +endef +define MUPDF_INSTALL_PYTHON_BINDINGS_TO_TARGET + $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) $(MUPDF_MAKE_OPTS) \ + DESTDIR="$(TARGET_DIR)" pydir=/usr/lib/python$(PYTHON3_VERSION_MAJOR) install-shared-python \ + -o python -o c++ # skip rebuilding bindings +endef +MUPDF_POST_BUILD_HOOKS += MUPDF_BUILD_PYTHON_BINDINGS +MUPDF_POST_INSTALL_STAGING_HOOKS += MUPDF_INSTALL_PYTHON_BINDINGS_TO_STAGING +MUPDF_POST_INSTALL_TARGET_HOOKS += MUPDF_INSTALL_PYTHON_BINDINGS_TO_TARGET +endif endif ifeq ($(BR2_PACKAGE_XLIB_LIBX11)$(BR2_PACKAGE_XLIB_LIBXEXT),yy) diff --git a/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch b/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch deleted file mode 100644 index 95aa3f7a21..0000000000 --- a/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch +++ /dev/null @@ -1,125 +0,0 @@ -From ca3417b8d605ccdb2e6c516c5e0c79180381627c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= -Date: Sun, 4 Feb 2024 16:13:45 +0100 -Subject: [PATCH] pipcl.py: allow providing python-config externally -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When cross-compiling (e.g. using Buildroot), the python-config -executable that resides next to the host python executable provides -incorrect includes (the ones for the host). - -Since the correct path to python-config cannot be guessed, add an -additional environment variable to allow setting the path to the -correct python-config executable externally. - -Signed-off-by: Raphaël Mélotte -Upstream: https://github.com/pymupdf/PyMuPDF/commit/3a214b0c144d86fd1329b26030f6b9f2a6b27020 ---- - pipcl.py | 72 +++++++++++++++++++++++++++++--------------------------- - setup.py | 3 +++ - 2 files changed, 40 insertions(+), 35 deletions(-) - -diff --git a/pipcl.py b/pipcl.py -index 209f660..c154774 100644 ---- a/pipcl.py -+++ b/pipcl.py -@@ -1789,43 +1789,45 @@ class PythonFlags: - self.ldflags = f'-L {_lib_dir}' - - else: -- # We use python-config which appears to work better than pkg-config -- # because it copes with multiple installed python's, e.g. -- # manylinux_2014's /opt/python/cp*-cp*/bin/python*. -- # -- # But... on non-macos it seems that we should not attempt to specify -- # libpython on the link command. The manylinux docker containers -- # don't actually contain libpython.so, and it seems that this -- # deliberate. And the link command runs ok. -- # -- python_exe = os.path.realpath( sys.executable) -- if darwin(): -- # Basic install of dev tools with `xcode-select --install` doesn't -- # seem to provide a `python3-config` or similar, but there is a -- # `python-config.py` accessible via sysconfig. -+ python_config = os.environ.get("PYMUPDF_PYTHON_CONFIG") -+ if not python_config: -+ # We use python-config which appears to work better than pkg-config -+ # because it copes with multiple installed python's, e.g. -+ # manylinux_2014's /opt/python/cp*-cp*/bin/python*. - # -- # We try different possibilities and use the last one that -- # works. -+ # But... on non-macos it seems that we should not attempt to specify -+ # libpython on the link command. The manylinux docker containers -+ # don't actually contain libpython.so, and it seems that this -+ # deliberate. And the link command runs ok. - # -- python_config = None -- for pc in ( -- f'python3-config', -- f'{sys.executable} {sysconfig.get_config_var("srcdir")}/python-config.py', -- f'{python_exe}-config', -- ): -- e = subprocess.run( -- f'{pc} --includes', -- shell=1, -- stdout=subprocess.DEVNULL, -- stderr=subprocess.DEVNULL, -- check=0, -- ).returncode -- log1(f'{e=} from {pc!r}.') -- if e == 0: -- python_config = pc -- assert python_config, f'Cannot find python-config' -- else: -- python_config = f'{python_exe}-config' -+ python_exe = os.path.realpath( sys.executable) -+ if darwin(): -+ # Basic install of dev tools with `xcode-select --install` doesn't -+ # seem to provide a `python3-config` or similar, but there is a -+ # `python-config.py` accessible via sysconfig. -+ # -+ # We try different possibilities and use the last one that -+ # works. -+ # -+ python_config = None -+ for pc in ( -+ f'python3-config', -+ f'{sys.executable} {sysconfig.get_config_var("srcdir")}/python-config.py', -+ f'{python_exe}-config', -+ ): -+ e = subprocess.run( -+ f'{pc} --includes', -+ shell=1, -+ stdout=subprocess.DEVNULL, -+ stderr=subprocess.DEVNULL, -+ check=0, -+ ).returncode -+ log1(f'{e=} from {pc!r}.') -+ if e == 0: -+ python_config = pc -+ assert python_config, f'Cannot find python-config' -+ else: -+ python_config = f'{python_exe}-config' - log1(f'Using {python_config=}.') - try: - self.includes = run( f'{python_config} --includes', capture=1).strip() -diff --git a/setup.py b/setup.py -index 23a5c78..4b3b5c7 100755 ---- a/setup.py -+++ b/setup.py -@@ -36,6 +36,9 @@ Environmental variables: - PYMUPDF_MUPDF_LIB - Directory containing MuPDF libraries, (libmupdf.so, - libmupdfcpp.so). -+ -+ PYMUPDF_PYTHON_CONFIG -+ Optional path to python-config. - - PYMUPDF_SETUP_IMPLEMENTATIONS - Must be one of 'a', 'b', 'ab'. If unset we use 'ab'. --- -2.41.0 - diff --git a/package/python-pymupdf/Config.in b/package/python-pymupdf/Config.in index e6e7c38c9e..810d642602 100644 --- a/package/python-pymupdf/Config.in +++ b/package/python-pymupdf/Config.in @@ -3,10 +3,11 @@ config BR2_PACKAGE_PYTHON_PYMUPDF depends on BR2_INSTALL_LIBSTDCPP # mupdf -> harfbuzz depends on BR2_TOOLCHAIN_HAS_SYNC_4 # mupdf -> harfbuzz depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # mupdf -> harfbuzz - depends on !BR2_STATIC_LIBS # runtime failure + depends on !BR2_STATIC_LIBS # mupdf python bindings select BR2_PACKAGE_HOST_SWIG select BR2_PACKAGE_FREETYPE select BR2_PACKAGE_MUPDF + select BR2_PACKAGE_MUPDF_PYTHON_BINDINGS select BR2_PACKAGE_PYTHON3_ZLIB # runtime help Python bindings for the PDF rendering library MuPDF. diff --git a/package/python-pymupdf/python-pymupdf.hash b/package/python-pymupdf/python-pymupdf.hash index 341366d46f..407491442c 100644 --- a/package/python-pymupdf/python-pymupdf.hash +++ b/package/python-pymupdf/python-pymupdf.hash @@ -1,5 +1,5 @@ # md5, sha256 from https://pypi.org/pypi/pymupdf/json -md5 5c219a0c4cb3d57b60e39cc901ebd220 PyMuPDF-1.23.22.tar.gz -sha256 c41cd91d83696cea67a4b6c65cc1951c2019ac0a561c5a3f543318ede30d3cd0 PyMuPDF-1.23.22.tar.gz +md5 44b7f3d1a0bd0c203d058a3580043128 PyMuPDF-1.24.10.tar.gz +sha256 bd3ebd6d3fb8a845582098362f885bfb0a31ae4272587efc2c55c5e29fe7327a PyMuPDF-1.24.10.tar.gz # Locally computed sha256 checksums sha256 57c8ff33c9c0cfc3ef00e650a1cc910d7ee479a8bc509f6c9209a7c2a11399d6 COPYING diff --git a/package/python-pymupdf/python-pymupdf.mk b/package/python-pymupdf/python-pymupdf.mk index 1d6ad78bce..ae0fd9ed00 100644 --- a/package/python-pymupdf/python-pymupdf.mk +++ b/package/python-pymupdf/python-pymupdf.mk @@ -5,9 +5,9 @@ ################################################################################ # python-pymupdf's version must be compatible with mupdf's version -PYTHON_PYMUPDF_VERSION = 1.23.22 +PYTHON_PYMUPDF_VERSION = 1.24.10 PYTHON_PYMUPDF_SOURCE = PyMuPDF-$(PYTHON_PYMUPDF_VERSION).tar.gz -PYTHON_PYMUPDF_SITE = https://files.pythonhosted.org/packages/05/20/a0d1221d8f379afcc12b4d1687a8f4adb69eef659e835d781c3fa331ff46 +PYTHON_PYMUPDF_SITE = https://files.pythonhosted.org/packages/83/57/da06ca4886afc71a624e4b463d05f45c8a822596ede939957295e229eb4e PYTHON_PYMUPDF_SETUP_TYPE = setuptools PYTHON_PYMUPDF_LICENSE = AGPL-3.0+ PYTHON_PYMUPDF_LICENSE_FILES = COPYING @@ -18,8 +18,7 @@ PYTHON_PYMUPDF_BUILD_OPTS = --skip-dependency-check PYTHON_PYMUPDF_ENV = \ PYMUPDF_INCLUDES="$(STAGING_DIR)/usr/include/freetype2:$(STAGING_DIR)/usr/include" \ PYMUPDF_MUPDF_LIB="$(STAGING_DIR)/usr/lib" \ - PYMUPDF_PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" \ - PYMUPDF_SETUP_IMPLEMENTATIONS=a \ + PIPCL_PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" \ PYMUPDF_SETUP_MUPDF_BUILD= $(eval $(python-package)) diff --git a/support/testing/tests/package/sample_python_pymupdf.py b/support/testing/tests/package/sample_python_pymupdf.py index ffcbfa1140..574bd27965 100644 --- a/support/testing/tests/package/sample_python_pymupdf.py +++ b/support/testing/tests/package/sample_python_pymupdf.py @@ -1,4 +1,4 @@ -import fitz_old as fitz +import fitz # Write a test PDF file outfile = "python-pymupdf.pdf" diff --git a/support/testing/tests/package/test_python_pymupdf.py b/support/testing/tests/package/test_python_pymupdf.py index 1af3efc8af..ac826f74ab 100644 --- a/support/testing/tests/package/test_python_pymupdf.py +++ b/support/testing/tests/package/test_python_pymupdf.py @@ -9,7 +9,7 @@ class TestPythonPy3PyMuPDF(TestPythonPackageBase): BR2_PACKAGE_PYTHON3=y BR2_PACKAGE_PYTHON_PYMUPDF=y BR2_TARGET_ROOTFS_EXT2=y - BR2_TARGET_ROOTFS_EXT2_SIZE="120M" + BR2_TARGET_ROOTFS_EXT2_SIZE="240M" """ sample_scripts = ["tests/package/sample_python_pymupdf.py"] timeout = 30 From patchwork Thu May 1 13:29:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= X-Patchwork-Id: 2079837 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4ZpFKZ0Ds8z1yMy for ; Thu, 1 May 2025 23:30:09 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id B7B276117D; Thu, 1 May 2025 13:30:24 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Qr_2FkmrdPPX; Thu, 1 May 2025 13:30:24 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org EE9D161198 Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id EE9D161198; Thu, 1 May 2025 13:30:23 +0000 (UTC) X-Original-To: buildroot@buildroot.org Delivered-To: buildroot@buildroot.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id 8E2BF22D for ; Thu, 1 May 2025 13:30:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 7B58483DC1 for ; Thu, 1 May 2025 13:30:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id gx_M1jKz28XU for ; Thu, 1 May 2025 13:30:20 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::32c; helo=mail-wm1-x32c.google.com; envelope-from=raphael.melotte@essensium.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org AACBA83DC2 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org AACBA83DC2 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by smtp1.osuosl.org (Postfix) with ESMTPS id AACBA83DC2 for ; Thu, 1 May 2025 13:30:19 +0000 (UTC) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-43cf0d787eeso8381115e9.3 for ; Thu, 01 May 2025 06:30:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746106218; x=1746711018; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S2fZ816QU08vhAda6qASJa49OQoe/A+OVFppmJ2CF3k=; b=bhuyV4EJKoclbgY8p8udxqZi7RSnYWmuYPAUnNBkZoi0/qBea1jpHVzHMKu6gKRTzD Pv1AjusWybBRrpagS5waUdnv34Xcaw2RDW9Ruxnxld7GxgLFjkk6pHiRNH/DvuzXLLZe tPtWMSqCPp+cBlYRRwirD06TQuPlWWT+LaLWGUnql2eY+LtKnrR9OziO+nROMFypZ+li fhflhZ8obZrS6mUbGuOPqGP3BsmcUzDyUGHOC2U6RipFo3NcbZLsuBnxArw2xbYGSjxw +DoRhA8ACyFQPiU1LuB9XH+Zfh8v98EzhWVGy3HlP2Vz1/pz2cth9Pl3OFwgY3VeDEwU aH8w== X-Gm-Message-State: AOJu0Ywl+s50SgxBEYRoTPYx8WmspJI5CA3kXSQisBLnBxv7KBR03JpE u/pkRZ2CTQEaduy5+omzuhY9VPY/EOJLFMCtNmPX32Et6NLFFmHgl1N4qWIcLmP13/FYF3sKM/Y hif8= X-Gm-Gg: ASbGncs/FdmUJojXVE0NawIyzNcXIqvHnv4ldvuwDkl5iLmKuXWoKy+rA6ijsfwFbk6 /XTu18Cs4ZwTvtrj67PBGA2Ii7fsI9Q+JBuJD/K74j1dE+oYTjvysTHVOeXnmCnII6/InQ26FPr iPpjuy7nHp8nWjww6IpHh+0hqaojQe9VQERSc/kF8CE/poS4b964nh1dYJDxWsnq/IukzJYK6qL bIBkjPF8wHo4cP8adWdFhwe9dGRWUPfB3vCQxTS14ueuQIkbafYpniG0EQQZV6wFOfoHGTQP0HA dQxF8/Ks+ubVlfweal34WwtwHIAy5mF4w6/YvW438BRllBkEUw1ZkwZo1QGEYaL88Ryc0CG1Xtb Jjsr6TzmZgGA86eNKPuCi3bukWsI= X-Google-Smtp-Source: AGHT+IHMbqsNBAOta+JXIM1/pMsEemStW/e6lhMT6iH5RShgVWmCWSwau5aeF7BiJfjtgCLjwxCIAw== X-Received: by 2002:a05:600c:b86:b0:43c:f63c:babb with SMTP id 5b1f17b1804b1-441b6feeb89mr18974835e9.1.1746106217691; Thu, 01 May 2025 06:30:17 -0700 (PDT) Received: from mind2.local.ess-mail.com (ip-94-140-185-241.reverse.destiny.be. [94.140.185.241]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-441b2af2922sm57867655e9.17.2025.05.01.06.30.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 May 2025 06:30:17 -0700 (PDT) To: buildroot@buildroot.org Cc: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= Date: Thu, 1 May 2025 13:29:57 +0000 Message-Id: <20250501133002.1408454-3-raphael.melotte@mind.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250501133002.1408454-1-raphael.melotte@mind.be> References: <20250407103959.2361659-2-raphael.melotte@mind.be> <20250501133002.1408454-1-raphael.melotte@mind.be> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind.be; s=google; t=1746106218; x=1746711018; darn=buildroot.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S2fZ816QU08vhAda6qASJa49OQoe/A+OVFppmJ2CF3k=; b=cCYqw8PD7tqCl6tOc80AMEsjvjQHONY+ta8L1d7BGjQWLrfN31BOXoZQNGoksT83Lz EQt6KcnwL85sJaO7/WGsuphEtuR5uy4S8NZcQF9qwsHVwxgT2hXh1QwonVVPdFSZtkCF L1PwSPnK2DW5i/uQF8fjDlPxGmpim1K02WXZUQGH38gSmwObmdGgKcKWb8Fsj5y9XFL4 eGtwwiT9kFNAauf+9WeYy1SSHXK737MZDDcp3uDlQVRSqFLllwyuoq52VdOc36YMaufH xhPK9bGIinin9lOB2XwbVDw1WkIPKCjJog/J4rJBa804PY6tHiU9vIBIyRZ0LhScbrQf tWxQ== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=mind.be X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=mind.be header.i=@mind.be header.a=rsa-sha256 header.s=google header.b=cCYqw8PD Subject: [Buildroot] [PATCH v2 3/3] package/mupdf: skip installing docs to the target X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Rapha=C3=ABl_M=C3=A9lotte_via_buildroot?= From: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= Reply-To: =?utf-8?b?UmFwaGHDq2wgTcOpbG90dGU=?= Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" The current 'install' target comprises 'install-libs', 'install-apps' and 'install-docs'. In our case we don't want to install documentation to the target, so just run the other two. Signed-off-by: Raphaël Mélotte --- package/mupdf/mupdf.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/mupdf/mupdf.mk b/package/mupdf/mupdf.mk index 493d46f77a..619f394497 100644 --- a/package/mupdf/mupdf.mk +++ b/package/mupdf/mupdf.mk @@ -97,7 +97,7 @@ endef define MUPDF_INSTALL_TARGET_CMDS $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) $(MUPDF_MAKE_OPTS) \ - DESTDIR="$(TARGET_DIR)" install + DESTDIR="$(TARGET_DIR)" install-libs install-apps endef $(eval $(generic-package))