-
Notifications
You must be signed in to change notification settings - Fork 16
/
meson.build
86 lines (75 loc) · 1.81 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
project('koji-osbuild', license: 'ASL 2.0')
srcdir = meson.source_root()
hub_plugins_path = get_option('hub-plugins-path')
builder_plugins_path = get_option('builder-plugins-path')
install_data(
'plugins/hub/osbuild.py',
install_dir: hub_plugins_path,
)
install_data(
'plugins/builder/osbuild.py',
install_dir: builder_plugins_path
)
git = find_program('git')
gitres = run_command(
git,
['--git-dir=@0@/.git'.format(srcdir), 'rev-parse', 'HEAD'],
check=True
)
commit = gitres.stdout().strip()
archive_name = meson.project_name() + '-' + gitrev
full_archive_name = archive_name + '.tar.gz'
archive = custom_target(
'tarball',
command: [
git,
'-C', meson.source_root(),
'archive',
'-o', join_paths(meson.build_root(), full_archive_name),
'--prefix', archive_name + '/',
commit
],
output: full_archive_name,
)
mkdir = find_program('mkdir')
rpmdirs_target = custom_target(
'rpmdirs',
command: [
mkdir, '-p',
'rpmbuild/BUILD',
'rpmbuild/RPMS',
'rpmbuild/SPECS',
'rpmbuild/SRPMS'],
output: 'rpmbuild',
)
rpmbuild = find_program('rpmbuild', required: false)
srpm_target = custom_target(
'srpm',
command: [
rpmbuild, '-bs',
spec_file,
'--define', '_sourcedir ' + meson.build_root(),
'--define', '_topdir ' + rpmdirs_target.full_path(),
'--define', 'commit ' + commit
],
output: 'srpms',
depends: [archive]
)
rpm_target = custom_target(
'rpm',
command: [
rpmbuild, '-ba',
spec_file,
'--define', '_sourcedir ' + meson.build_root(),
'--define', '_topdir ' + rpmdirs_target.full_path(),
'--define', 'commit ' + commit
],
output: 'rpms',
depends: [archive]
)
msg = ['',
'hub plugins path: @0@'.format(hub_plugins_path),
'builder plugins path: @0@'.format(builder_plugins_path),
'',
]
message('\n '.join(msg))