Skip to content

Commit

Permalink
feat: set up dependencies generation for fedora
Browse files Browse the repository at this point in the history
  • Loading branch information
solomoncyj committed Dec 15, 2024
1 parent e542901 commit 8679ea9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions data/macros.meson
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@
--num-processes %{_smp_build_ncpus} \
--print-errorlogs \
%{nil}}

%meson_buildrequires \
%{shrink: python3 %{_rpmconfigdir}/mesongenbuildreq %{__meson} \
%{nil}}

16 changes: 16 additions & 0 deletions data/mesongenbuildreq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import subprocess
import json
import sys
deps_json = json.loads(subprocess.run([sys.argv[1], "introspect", "--dependencies", "meson.build"], capture_output=True).stdout)
deps = dict(sorted(zip([x['name'] for x in deps_json],[x['version'] for x in deps_json])))
deps.pop('', None)
for lib, versions in deps.items() :
# Prepare version constraint
version_str = ' ' + ' '.join(versions) if versions else ''
line = []
for prefix in ["cmake", "pkgconfig", "qmake"] :
buildreq = (f"{prefix}({lib}){version_str}")
if buildreq.split('=')[-1] == '' and '=' in buildreq :
buildreq = buildreq.split('=')[0]
line.append(buildreq)
print(f"({' or '.join(line)})")

0 comments on commit 8679ea9

Please sign in to comment.