-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: set up macros for buildrequires generation
- Loading branch information
1 parent
e542901
commit 0d7f04b
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import subprocess | ||
import json | ||
import sys | ||
deps_json = json.loads(subprocess.run([sys.argv[0], "introspect", "--dependencies", "meson.build"], capture_output=True).stdout) | ||
deps = dict(zip([x['name'] for x in deps_json],[x['version'] for x in deps_json])) | ||
deps.pop('', None) | ||
for lib, versions in deps.items() : | ||
# Mapping for special cases | ||
pkg_map = { | ||
'qt6': 'cmake', | ||
'KF6WindowSystem': 'cmake', | ||
'gtk+-3.0': 'pkgconfig', | ||
'dbus-1': 'pkgconfig', | ||
'ncursesw': 'pkgconfig', | ||
'harfbuzz': 'pkgconfig', | ||
'fribidi': 'pkgconfig', | ||
# Add more mappings as needed | ||
} | ||
# Determine the prefix | ||
prefix = pkg_map.get(lib, 'pkgconfig') | ||
|
||
# Prepare version constraint | ||
version_str = ' ' + ' '.join(versions) if versions else '' | ||
|
||
# Generate BuildRequires line | ||
buildreq = (f"BuildRequires: {prefix}({lib}){version_str}") | ||
if buildreq.split('=')[-1] == '' and '=' in buildreq : | ||
buildreq = buildreq.split('=')[0] | ||
print(buildreq) |