forked from pool/meson
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/meson?expand=0&rev=337
62 lines
2.1 KiB
Diff
62 lines
2.1 KiB
Diff
From 8679ea9525672d74030303be062d9545c92b5840 Mon Sep 17 00:00:00 2001
|
|
From: solomoncyj <solomoncyj@gmail.com>
|
|
Date: Sun, 15 Dec 2024 21:00:42 +0800
|
|
Subject: [PATCH 1/2] feat: set up dependencies generation for fedora
|
|
|
|
---
|
|
data/macros.meson | 5 +++++
|
|
data/mesongenbuildreq.py | 16 ++++++++++++++++
|
|
2 files changed, 21 insertions(+)
|
|
create mode 100644 data/mesongenbuildreq.py
|
|
|
|
Index: meson-1.9.0/data/macros.meson
|
|
===================================================================
|
|
--- meson-1.9.0.orig/data/macros.meson
|
|
+++ meson-1.9.0/data/macros.meson
|
|
@@ -47,6 +47,11 @@
|
|
%{?qemu_user_space_build: -t 10} \
|
|
%{nil}}
|
|
|
|
+%meson_buildrequires \
|
|
+ %{shrink: python3 %{_rpmconfigdir}/mesongenbuildreq %{__meson} \
|
|
+ %{nil}}
|
|
+
|
|
+
|
|
# Declarative buildsystem, requires RPM 4.20+ to work
|
|
# https://rpm-software-management.github.io/rpm/manual/buildsystem.html
|
|
%buildsystem_meson_conf() %meson %*
|
|
Index: meson-1.9.0/data/mesongenbuildreq.py
|
|
===================================================================
|
|
--- /dev/null
|
|
+++ meson-1.9.0/data/mesongenbuildreq.py
|
|
@@ -0,0 +1,29 @@
|
|
+import subprocess
|
|
+import json
|
|
+import sys
|
|
+import os
|
|
+
|
|
+# Read ignored dependencies from ENV
|
|
+ignore_deps = set(os.environ.get("BUILDREQ_IGNORE_DEP", "").split())
|
|
+
|
|
+# Run introspection command
|
|
+deps_json = json.loads(
|
|
+ subprocess.run([sys.argv[1], "introspect", "--dependencies", "meson.build"],
|
|
+ capture_output=True, text=True).stdout
|
|
+)
|
|
+
|
|
+# Build deps dictionary while skipping ignored libraries
|
|
+deps = {entry['name']: entry['version'] for entry in deps_json if entry['name'] not in ignore_deps}
|
|
+
|
|
+# Output formatted build requirements
|
|
+for lib, versions in deps.items():
|
|
+ version_str = ' ' + ' '.join(versions) if versions else ''
|
|
+ line = []
|
|
+ for prefix in ["cmake", "pkgconfig", "qmake"]:
|
|
+ buildreq = f"{prefix}({lib}){version_str}"
|
|
+ # Strip trailing '=' if version was empty
|
|
+ if buildreq.split('=')[-1] == '' and '=' in buildreq:
|
|
+ buildreq = buildreq.split('=')[0]
|
|
+ line.append(buildreq)
|
|
+ print(f"({' or '.join(line)})")
|
|
+
|