Skip to content

Commit 4e5faa1

Browse files
djbwstellarhopper
authored andcommitted
build: Add meson build infrastructure
Build times improve from 10s of seconds to sub-second builds especially when ccache gets involved and the only change is a git version bump. Recall that every time the version changes with autotools it does a reconfigure. With meson only the objects that depend on the version string are rebuilt. So the primary motivation is to make the ndctl project more enjoyable to develop. Tools, libraries, documentation, and tests all seem to be working. The remaining work is to redo the rpm build infrastructure, and validate that installation is working as expected. Given the long standing momentum on the old build system it is still kept functional for now. The only compatibility hack when moving from an autotools build to a meson build is to delete the config.h files generated by the old system in favor of the unified configuration header build from the config.h.meson template. Link: https://lore.kernel.org/r/164141837329.3990253.11664056350173402543.stgit@dwillia2-desk3.amr.corp.intel.com Tested-by: Vaibhav Jain <[email protected]> Tested-by: Alison Schofield <[email protected]> Signed-off-by: Dan Williams <[email protected]> Signed-off-by: Vishal Verma <[email protected]>
1 parent 7912cb0 commit 4e5faa1

21 files changed

+1414
-1
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Makefile.in
99
/aclocal.m4
1010
/autom4te.cache
1111
/build-aux
12-
/config.*
12+
/config.h
13+
/config.log
14+
/config.status
1315
/configure
1416
/libtool
1517
/stamp-h1
@@ -24,6 +26,7 @@ Documentation/ndctl/asciidoctor-extensions.rb
2426
Documentation/cxl/asciidoctor-extensions.rb
2527
Documentation/cxl/lib/asciidoctor-extensions.rb
2628
.dirstamp
29+
build/
2730
daxctl/config.h
2831
daxctl/daxctl
2932
daxctl/lib/libdaxctl.la

Documentation/cxl/lib/meson.build

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
if get_option('asciidoctor').enabled()
2+
asciidoc_conf = custom_target('asciidoctor-extensions.rb',
3+
command : [
4+
'sed', '-e', 's,@Utility@,Libcxl,g', '-e', 's,@utility@,cxl,g', '@INPUT@'
5+
],
6+
input : '../../asciidoctor-extensions.rb.in',
7+
output : 'asciidoctor-extensions.rb',
8+
capture : true,
9+
)
10+
else
11+
asciidoc_conf = custom_target('asciidoc.conf',
12+
command : [
13+
'sed', '-e', 's,UTILITY,libcxl,g',
14+
],
15+
input : '../../asciidoc.conf.in',
16+
output : 'asciidoc.conf',
17+
capture : true,
18+
)
19+
endif
20+
21+
filedeps = [
22+
'../../copyright.txt',
23+
]
24+
25+
libcxl_manpages = [
26+
'libcxl.txt',
27+
'cxl_new.txt',
28+
]
29+
30+
foreach man : libcxl_manpages
31+
name = man.split('.')[0]
32+
output = name + '.3'
33+
output_xml = name + '.xml'
34+
if get_option('asciidoctor').enabled()
35+
custom_target(name,
36+
command : [
37+
asciidoc,
38+
'-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@',
39+
'-rasciidoctor-extensions', '-amansource=libcxl',
40+
'-amanmanual=libcxl Manual',
41+
'-andctl_version=@0@'.format(meson.project_version()),
42+
'-o', '@OUTPUT@', '@INPUT@'
43+
],
44+
input : man,
45+
output : output,
46+
depend_files : filedeps,
47+
depends : asciidoc_conf,
48+
install : get_option('docs').enabled(),
49+
install_dir : join_paths(get_option('mandir'), 'man3'),
50+
)
51+
else
52+
xml = custom_target(output_xml,
53+
command : [
54+
asciidoc,
55+
'-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe',
56+
'-andctl_version=@0@'.format(meson.project_version()),
57+
'-o', '@OUTPUT@', '@INPUT@',
58+
],
59+
input : man,
60+
output : output_xml,
61+
depend_files : filedeps,
62+
depends : asciidoc_conf,
63+
)
64+
65+
xsl = files('../../manpage-normal.xsl')
66+
67+
custom_target(name,
68+
command : [
69+
xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@'
70+
],
71+
depends : xml,
72+
depend_files : xsl,
73+
input : xml,
74+
output : output,
75+
install : get_option('docs').enabled(),
76+
install_dir : join_paths(get_option('mandir'), 'man3'),
77+
)
78+
endif
79+
endforeach

Documentation/cxl/meson.build

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
if get_option('asciidoctor').enabled()
2+
asciidoc_conf = custom_target('asciidoctor-extensions.rb',
3+
command : [
4+
'sed', '-e', 's,@Utility@,Cxl,g', '-e', 's,@utility@,cxl,g', '@INPUT@'
5+
],
6+
input : '../asciidoctor-extensions.rb.in',
7+
output : 'asciidoctor-extensions.rb',
8+
capture : true,
9+
)
10+
else
11+
asciidoc_conf = custom_target('asciidoc.conf',
12+
command : [
13+
'sed', '-e', 's,UTILITY,cxl,g',
14+
],
15+
input : '../asciidoc.conf.in',
16+
output : 'asciidoc.conf',
17+
capture : true,
18+
)
19+
endif
20+
21+
filedeps = [
22+
'../copyright.txt',
23+
]
24+
25+
cxl_manpages = [
26+
'cxl.txt',
27+
'cxl-list.txt',
28+
'cxl-read-labels.txt',
29+
'cxl-write-labels.txt',
30+
'cxl-zero-labels.txt',
31+
]
32+
33+
foreach man : cxl_manpages
34+
name = man.split('.')[0]
35+
output = name + '.1'
36+
output_xml = name + '.xml'
37+
if get_option('asciidoctor').enabled()
38+
custom_target(name,
39+
command : [
40+
asciidoc,
41+
'-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@',
42+
'-rasciidoctor-extensions', '-amansource=cxl',
43+
'-amanmanual=cxl Manual',
44+
'-andctl_version=@0@'.format(meson.project_version()),
45+
'-o', '@OUTPUT@', '@INPUT@'
46+
],
47+
input : man,
48+
output : output,
49+
depend_files : filedeps,
50+
depends : asciidoc_conf,
51+
install : get_option('docs').enabled(),
52+
install_dir : join_paths(get_option('mandir'), 'man1'),
53+
)
54+
else
55+
xml = custom_target(output_xml,
56+
command : [
57+
asciidoc,
58+
'-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe',
59+
'-andctl_version=@0@'.format(meson.project_version()),
60+
'-o', '@OUTPUT@', '@INPUT@',
61+
],
62+
input : man,
63+
output : output_xml,
64+
depend_files : filedeps,
65+
depends : asciidoc_conf,
66+
)
67+
68+
xsl = files('../manpage-normal.xsl')
69+
70+
custom_target(name,
71+
command : [
72+
xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@'
73+
],
74+
depends : xml,
75+
depend_files : xsl,
76+
input : xml,
77+
output : output,
78+
install : get_option('docs').enabled(),
79+
install_dir : join_paths(get_option('mandir'), 'man1'),
80+
)
81+
endif
82+
endforeach
83+
84+
subdir('lib')

Documentation/daxctl/meson.build

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
if get_option('asciidoctor').enabled()
2+
asciidoc_conf = custom_target('asciidoctor-extensions.rb',
3+
command : [
4+
'sed', '-e', 's,@Utility@,Daxctl,g', '-e', 's,@utility@,daxctl,g', '@INPUT@'
5+
],
6+
input : '../asciidoctor-extensions.rb.in',
7+
output : 'asciidoctor-extensions.rb',
8+
capture : true,
9+
)
10+
else
11+
asciidoc_conf = custom_target('asciidoc.conf',
12+
command : [
13+
'sed', '-e', 's,UTILITY,daxctl,g',
14+
],
15+
input : '../asciidoc.conf.in',
16+
output : 'asciidoc.conf',
17+
capture : true,
18+
)
19+
endif
20+
21+
filedeps = [
22+
'human-option.txt',
23+
'../copyright.txt',
24+
]
25+
26+
daxctl_manpages = [
27+
'daxctl.txt',
28+
'daxctl-list.txt',
29+
'daxctl-migrate-device-model.txt',
30+
'daxctl-reconfigure-device.txt',
31+
'daxctl-online-memory.txt',
32+
'daxctl-offline-memory.txt',
33+
'daxctl-disable-device.txt',
34+
'daxctl-enable-device.txt',
35+
'daxctl-create-device.txt',
36+
'daxctl-destroy-device.txt',
37+
]
38+
39+
foreach man : daxctl_manpages
40+
name = man.split('.')[0]
41+
output = name + '.1'
42+
output_xml = name + '.xml'
43+
if get_option('asciidoctor').enabled()
44+
custom_target(name,
45+
command : [
46+
asciidoc,
47+
'-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@',
48+
'-rasciidoctor-extensions', '-amansource=daxctl',
49+
'-amanmanual=daxctl Manual',
50+
'-adaxctl_confdir=@0@'.format(daxctlconf_dir),
51+
'-adaxctl_conf=@0@'.format(daxctlconf),
52+
'-andctl_keysdir=@0@'.format(ndctlkeys_dir),
53+
'-andctl_version=@0@'.format(meson.project_version()),
54+
'-o', '@OUTPUT@', '@INPUT@'
55+
],
56+
input : man,
57+
output : output,
58+
depend_files : filedeps,
59+
depends : asciidoc_conf,
60+
install : get_option('docs').enabled(),
61+
install_dir : join_paths(get_option('mandir'), 'man1'),
62+
)
63+
else
64+
xml = custom_target(output_xml,
65+
command : [
66+
asciidoc,
67+
'-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe',
68+
'-adaxctl_confdir=@0@'.format(daxctlconf_dir),
69+
'-adaxctl_conf=@0@'.format(daxctlconf),
70+
'-andctl_keysdir=@0@'.format(ndctlkeys_dir),
71+
'-andctl_version=@0@'.format(meson.project_version()),
72+
'-o', '@OUTPUT@', '@INPUT@',
73+
],
74+
input : man,
75+
output : output_xml,
76+
depend_files : filedeps,
77+
depends : asciidoc_conf,
78+
)
79+
80+
xsl = files('../manpage-normal.xsl')
81+
82+
custom_target(name,
83+
command : [
84+
xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@'
85+
],
86+
depends : xml,
87+
depend_files : xsl,
88+
input : xml,
89+
output : output,
90+
install : get_option('docs').enabled(),
91+
install_dir : join_paths(get_option('mandir'), 'man1'),
92+
)
93+
endif
94+
endforeach

0 commit comments

Comments
 (0)