Codebase list i3-gaps / aba6ec3
add meson build files (#4094) Motivation: • faster builds (on an Intel Core i9-9900K): ( ../configure --disable-sanitizers && make -j8; ) 19,47s user 2,78s system 395% cpu 5,632 total ( meson .. -Dmans=true -Ddocs=true -Dprefix=/usr && ninja; ) 38,67s user 3,73s system 1095% cpu 3,871 total • more approachable build system configuration in the python-esque meson domain specific language instead of the autotools m4 macro language • built-in language server support thanks to ninja: the required compile_commands.json is built automatically and only needs to be linked from the source dir, e.g.: ln -s build/compile_commands.json . Changes: • the embedded vcs version info format changed from e.g. 4.18-282-gabe46f69 (2020-05-16, branch "next") to: 4.18-282-gabe46f69 I think it’s better to lose a little bit of detail for the gained cleanliness of using meson’s vcs_tag() • Drop unused xcb-event dependency. • We can no longer enable sanitizers and debug options based on whether we are in a release or non-release build, because our new version logic runs at ninja build time, not at meson configure time. The new behavior is probably for the better in terms of what people expect, and we can make the CI use address sanitizer explicitly to ensure it is still exercised. • We lose the AX_EXTEND_SRCDIR behavior, i.e. including the path component of the parent of the source dir in all paths. This was a trick we used for easier debugging, so that stack traces would contain e.g. ../i3-4.18.1/src/main.c, instead of just src/main.c. The other mechanism (_i3_version symbol) that we have for including the version number in the “backtrace full” (but not merely “backtrace”) output of gdb still works. • Release tarballs now use tar.xz. Why not. Migration plan This commit adds the meson build files to the tree, but does not remove autotools yet. For the development phase, we will keep both build systems functional (and built on travis). Then, just before the i3 v4.19 release, we will remove autotools from the tree and the release tarball will require meson to compile. This way, we incentivize maintainers to change, while also offering them an easy way out (if desired) by reverting the most recent commit. In practice, switching a distribution package from autotools to meson should only be a few line change, easier than applying the provided patch :). Take a look at the debian/ changes in this commit for an example. meson is broadly available everywhere that i3 is available: Both xorg-server and systemd gained meson build files in 2017, so we can follow suit: https://anholt.livejournal.com/52574.html https://in.waw.pl/~zbyszek/blog/systemd-meson.html How do I? For producing a coverage report, enable the b_coverage meson base option and run ninja coverage-html: % cd build % meson .. -Db_coverage=true % ninja % ninja test % ninja coverage-html See also https://mesonbuild.com/howtox.html#producing-a-coverage-report For using the address sanitizer, memory sanitizer or undefined behavior sanitizer, use the b_sanitize meson base option: % cd build % meson .. -Db_sanitize=address % ninja See also https://mesonbuild.com/Builtin-options.html#base-options related to #4086 Michael Stapelberg authored 3 years ago GitHub committed 3 years ago
20 changed file(s) with 735 addition(s) and 39 deletion(s). Raw diff Collapse all Expand all
3939 i3-command-parser.stamp
4040 i3-config-parser.stamp
4141 .clang_complete
42 compile_commands.json
43 /.ccls-cache
44 /.clangd
4245 LAST_VERSION
46
47 # We recommend building in a subdirectory called build.
48 # If you chose a different directory name,
49 # it is up to you to arrange for it to be ignored by git,
50 # e.g. by listing your directory in .git/info/exclude.
51 /build
52
53 # TODO(autotools-removal): remove autotools from .gitignore:
4354
4455 ################################################################################
4556 # https://raw.githubusercontent.com/github/gitignore/master/Autotools.gitignore
3030 script:
3131 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-safe-wrappers.sh
3232 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-formatting.sh
33 # # TODO(autotools-removal): autoconf build has to keep working until i3 4.19
34 # is released, so we keep building it in travis.
3335 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'autoreconf -fi && mkdir -p build && cd build && (../configure || (cat config.log; false)) && make -j CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Werror -fno-common"'
36 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'rm -rf build; mkdir -p build && cd build && CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Werror -fno-common" meson .. -Ddocs=true -Dmans=true -Db_sanitize=address && ninja -v'
3437 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-spelling.pl
3538 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} ./travis/run-tests.sh
3639 - ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/debian-build.sh deb/debian-amd64/DIST
44
55 This is i3 v4.19. This version is considered stable. All users of i3 are
66 strongly encouraged to upgrade.
7
8 In this release, we switched from the autotools build system to the meson build
9 system (https://mesonbuild.com/). Check https://github.com/i3/i3/issues/4086 for
10 details. If this causes problems for you, you can revert the commit which
11 removed autotools from the tree: we tried our best to keep both build systems
12 working. Please reach out to us in that case!
713
814 ┌────────────────────────────┐
915 │ Changes in i3 v4.19 │
11 Section: x11
22 Priority: extra
33 Maintainer: Michael Stapelberg <[email protected]>
4 Build-Depends: debhelper (>= 9),
5 dh-autoreconf,
4 Build-Depends: debhelper (>= 10),
5 meson,
66 libx11-dev,
77 libxcb-util0-dev (>= 0.3.8),
88 libxcb-keysyms1-dev,
2121 dh_builddeb -- -Zgzip
2222
2323 %:
24 dh $@ --parallel --builddirectory=build --with=autoreconf
24 dh $@ --buildsystem=meson+ninja
2222
2323 == Building i3
2424
25 You can build i3 like you build any other software package which uses autotools.
25 You can build i3 like you build any other software package which uses meson.
2626 Here’s a memory refresher:
2727
28 $ autoreconf -fi
2928 $ mkdir -p build && cd build
30 $ ../configure
31 $ make -j8
32
33 The autoreconf -fi step is unnecessary if you are building from a release
34 tarball, but shouldn’t hurt either.
29 $ meson ..
30 $ ninja
3531
3632 === Build system features
3733
100100 #if !defined(DLOG)
101101 void debuglog(char *fmt, ...)
102102 __attribute__((format(printf, 1, 2)));
103 #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, STRIPPED__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
103 #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
104104 #endif
105105
106106 /**
2525 is, delete the preceding comma */
2626 #define LOG(fmt, ...) verboselog(fmt, ##__VA_ARGS__)
2727 #define ELOG(fmt, ...) errorlog("ERROR: " fmt, ##__VA_ARGS__)
28 #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, STRIPPED__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
28 #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
2929
3030 extern char *errorfilename;
3131 extern char *shmlogname;
1515 */
1616 bool is_debug_build(void) {
1717 /* i3_version contains either something like this:
18 * "4.0.2 (2011-11-11, branch "release")".
19 * or: "4.0.2-123-gCOFFEEBABE (2011-11-11, branch "next")".
18 * "4.0.2 (2011-11-11)" (release version)
19 * or: "4.0.2-123-gC0FFEE" (debug version)
2020 *
2121 * So we check for the offset of the first opening round bracket to
2222 * determine whether this is a git version or a release version. */
23 if (strchr(I3_VERSION, '(') == NULL) {
24 return true; // e.g. 4.0.2-123-gC0FFEE
25 }
26 /* In practice, debug versions do not contain parentheses at all,
27 * but leave the logic as it was before so that we can re-add
28 * parentheses if we chose to. */
2329 return ((strchr(I3_VERSION, '(') - I3_VERSION) > 10);
2430 }
0 #!/bin/sh
1
2 set -eu
3
4 cd "${MESON_DIST_ROOT}"
5
6 # Delete everything we do not want to have in the release tarballs:
7 rm -rf \
8 contrib/banner.svg \
9 contrib/show-download-count.sh \
10 contrib/sticker-7x5cm-stickma.tif.lzma \
11 contrib/sticker_stickma_black.svg \
12 debian/ \
13 docs/GPN-2009-06-27/ \
14 docs/NoName-2009-03-12/ \
15 docs/slides-2012-01-25/ \
16 docs/slides-2012-03-16/ \
17 testcases/.gitignore \
18 travis/ \
19 .clang-format \
20 .editorconfig \
21 i3bar/.gitignore \
22 .travis.yml \
23 logo.svg \
24 README.md \
25 RELEASE-NOTES-next \
26 release.sh
27
28 mkdir build
29 cd build
30 meson .. -Dprefix=/usr -Ddocs=true -Dmans=true
31 ninja
32 cp *.1 ../man/
33 cp *.html ../docs/
34 cd ..
35 rm -rf build
0 #!/bin/sh
1 ln -sf "i3" "${MESON_INSTALL_DESTDIR_PREFIX}/$1/i3-with-shmlog"
0 # -*- mode: meson -*-
1
2 # Style objective: be consistent with what mesonbuild.com documents/uses, and/or
3 # the meson book: https://meson-manual.com/
4
5 project(
6 'i3',
7 'c',
8 version: '4.18.1',
9 default_options: [
10 'c_std=c11',
11 'warning_level=1', # enable all warnings (-Wall)
12 # TODO(https://github.com/i3/i3/issues/4087): switch to
13 # 'buildtype=debugoptimized',
14 ],
15 # Ubuntu 18.04 (supported until 2023) has meson 0.45.
16 # We can revisit our minimum supported meson version
17 # if it turns out to be too hard to maintain.
18 meson_version: '>=0.45.0',
19 )
20
21 cc = meson.get_compiler('c')
22 add_project_arguments(cc.get_supported_arguments(['-Wunused-value']), language: 'c')
23
24 if meson.version().version_compare('>=0.48.0')
25 # https://github.com/mesonbuild/meson/issues/2166#issuecomment-629696911
26 meson.add_dist_script('meson/meson-dist-script')
27 else
28 message('meson <0.48.0 detected, dist tarballs will not be filtered')
29 endif
30
31 ################################################################################
32 # Version handling
33 ################################################################################
34
35 cdata = configuration_data()
36
37 version_array = meson.project_version().split('.')
38 cdata.set('MAJOR_VERSION', version_array[0].to_int())
39 cdata.set('MINOR_VERSION', version_array[1].to_int())
40 if version_array.length() > 2
41 cdata.set('PATCH_VERSION', version_array[2].to_int())
42 else
43 cdata.set('PATCH_VERSION', 0)
44 endif
45 cdata.set_quoted('I3_VERSION', '@VCS_TAG@')
46 cdata.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir')))
47
48 if get_option('b_sanitize').split(',').contains('address')
49 cdata.set('I3_ASAN_ENABLED', 1)
50 endif
51
52 cdata.set('HAVE_STRNDUP', cc.has_function('strndup'))
53 cdata.set('HAVE_MKDIRP', cc.has_function('mkdirp'))
54
55 # Instead of generating config.h directly, make vcs_tag generate it so that
56 # @VCS_TAG@ is replaced.
57 config_h_in = configure_file(
58 output: 'config.h.in',
59 configuration: cdata,
60 )
61 config_h = declare_dependency(
62 sources: vcs_tag(
63 input: config_h_in,
64 output: 'config.h',
65 fallback: meson.project_version() + '-non-git',
66 )
67 )
68
69 ################################################################################
70 # docs generation
71 ################################################################################
72
73 if get_option('docs')
74 asciidoc = find_program('asciidoc')
75 doc_toc_inputs = [
76 'docs/hacking-howto',
77 'docs/userguide',
78 'docs/ipc',
79 'docs/multi-monitor',
80 'docs/wsbar',
81 'docs/testsuite',
82 'docs/i3bar-protocol',
83 'docs/layout-saving',
84 ]
85 foreach m : doc_toc_inputs
86 custom_target(
87 m.underscorify()+'_asciidoc',
88 input: m,
89 output: '@[email protected]',
90 command: [
91 asciidoc,
92 '-a', 'toc',
93 '-n',
94 '-o', '@OUTPUT@',
95 '@INPUT@',
96 ],
97 install: true,
98 install_dir: join_paths(get_option('datadir'), 'doc', 'i3'),
99 )
100 endforeach
101
102 doc_notoc_inputs = [
103 'docs/debugging',
104 ]
105 foreach m : doc_notoc_inputs
106 custom_target(
107 m.underscorify()+'_asciidoc',
108 input: m,
109 output: '@[email protected]',
110 command: [
111 asciidoc,
112 '-n',
113 '-o', '@OUTPUT@',
114 '@INPUT@',
115 ],
116 install: true,
117 install_dir: join_paths(get_option('datadir'), 'doc', 'i3'),
118 )
119 endforeach
120 endif
121
122 if meson.version().version_compare('>=0.53')
123 summary('build docs (-Ddocs)', get_option('docs'))
124 endif
125
126 ################################################################################
127 # manpages
128 ################################################################################
129
130 if get_option('mans')
131 asciidoc = find_program('asciidoc')
132 asciidoc_cdata = configuration_data()
133 asciidoc_cdata.set('PACKAGE_VERSION', meson.project_version())
134 asciidoc_conf = configure_file(
135 input: 'man/asciidoc.conf.in',
136 output: 'asciidoc.conf',
137 configuration: asciidoc_cdata,
138 )
139
140 xmlto = find_program('xmlto')
141
142 pod2man = find_program('pod2man')
143
144 man_inputs = [
145 'man/i3.man',
146 'man/i3bar.man',
147 'man/i3-msg.man',
148 'man/i3-input.man',
149 'man/i3-nagbar.man',
150 'man/i3-config-wizard.man',
151 'man/i3-migrate-config-to-v4.man',
152 'man/i3-sensible-editor.man',
153 'man/i3-sensible-pager.man',
154 'man/i3-sensible-terminal.man',
155 'man/i3-dump-log.man',
156 ]
157
158 foreach m : man_inputs
159 xml = custom_target(
160 m.underscorify()+'_asciidoc',
161 input: m,
162 output: '@[email protected]',
163 command: [
164 asciidoc,
165 '-d', 'manpage',
166 '-b', 'docbook',
167 '-f', asciidoc_conf,
168 '-o', '@OUTPUT@',
169 '@INPUT@',
170 ],
171 )
172
173 custom_target(
174 m.underscorify()+'_xmlto',
175 input: xml,
176 output: '@[email protected]',
177 command: [
178 xmlto,
179 'man',
180 '-o',
181 '@OUTDIR@',
182 '@INPUT@',
183 ],
184 # We should use install and install_dir instead of install_man as per:
185 # https://github.com/mesonbuild/meson/issues/4981#issuecomment-467084867
186 # https://github.com/mesonbuild/meson/issues/1550#issuecomment-370164307
187 install: true,
188 install_dir: join_paths(get_option('mandir'), 'man1'),
189 )
190 endforeach
191
192 pod2man_inputs = [
193 'i3-dmenu-desktop',
194 'i3-save-tree',
195 ]
196 foreach m : pod2man_inputs
197 custom_target(
198 m.underscorify()+'_pod2man',
199 input: m,
200 output: '@[email protected]',
201 command: [
202 pod2man,
203 '--utf8',
204 '@INPUT@',
205 '@OUTPUT@',
206 ],
207 # We should use install and install_dir instead of install_man as per:
208 # https://github.com/mesonbuild/meson/issues/4981#issuecomment-467084867
209 # https://github.com/mesonbuild/meson/issues/1550#issuecomment-370164307
210 install: true,
211 install_dir: join_paths(get_option('mandir'), 'man1'),
212 )
213 endforeach
214 endif
215
216 if meson.version().version_compare('>=0.53')
217 summary('build manpages (-Dmans)', get_option('docs'))
218 endif
219
220 # Required for e.g. struct ucred to be defined as per unix(7).
221 add_project_arguments('-D_GNU_SOURCE', language: 'c')
222
223 # https://mesonbuild.com/howtox.html#add-math-library-lm-portably
224 m_dep = cc.find_library('m', required: false)
225 rt_dep = cc.find_library('rt', required: false)
226 iconv_dep = cc.find_library('iconv', required: false)
227
228 libsn_dep = dependency('libstartup-notification-1.0', method: 'pkg-config')
229 xcb_dep = dependency('xcb', method: 'pkg-config')
230 xcb_xkb_dep = dependency('xcb-xkb', method: 'pkg-config')
231 xcb_xinerama_dep = dependency('xcb-xinerama', method: 'pkg-config')
232 xcb_randr_dep = dependency('xcb-randr', method: 'pkg-config')
233 xcb_shape_dep = dependency('xcb-shape', method: 'pkg-config')
234 xcb_util_dep = dependency('xcb-util', method: 'pkg-config')
235 xcb_util_cursor_dep = dependency('xcb-cursor', method: 'pkg-config')
236 xcb_util_keysyms_dep = dependency('xcb-keysyms', method: 'pkg-config')
237 xcb_util_wm_dep = dependency('xcb-icccm', method: 'pkg-config')
238 xcb_util_xrm_dep = dependency('xcb-xrm', method: 'pkg-config')
239 xkbcommon_dep = dependency('xkbcommon', method: 'pkg-config')
240 xkbcommon_x11_dep = dependency('xkbcommon-x11', method: 'pkg-config')
241 yajl_dep = dependency('yajl', method: 'pkg-config')
242 libpcre_dep = dependency('libpcre', version: '>=8.10', method: 'pkg-config')
243 cairo_dep = dependency('cairo', version: '>=1.14.4', method: 'pkg-config')
244 pangocairo_dep = dependency('pangocairo', method: 'pkg-config')
245 glib_dep = dependency('glib-2.0', method: 'pkg-config')
246 gobject_dep = dependency('gobject-2.0', method: 'pkg-config')
247
248 ev_dep = cc.find_library('ev')
249
250 inc = include_directories('include')
251
252 libi3srcs = [
253 'libi3/dpi.c',
254 'libi3/draw_util.c',
255 'libi3/fake_configure_notify.c',
256 'libi3/font.c',
257 'libi3/format_placeholders.c',
258 'libi3/get_colorpixel.c',
259 'libi3/get_config_path.c',
260 'libi3/get_exe_path.c',
261 'libi3/get_mod_mask.c',
262 'libi3/get_process_filename.c',
263 'libi3/get_visualtype.c',
264 'libi3/g_utf8_make_valid.c',
265 'libi3/ipc_connect.c',
266 'libi3/ipc_recv_message.c',
267 'libi3/ipc_send_message.c',
268 'libi3/is_debug_build.c',
269 'libi3/resolve_tilde.c',
270 'libi3/root_atom_contents.c',
271 'libi3/safewrappers.c',
272 'libi3/string.c',
273 'libi3/ucs2_conversion.c',
274 ]
275
276 if not cdata.get('HAVE_STRNDUP')
277 libi3srcs += 'libi3/strndup.c'
278 endif
279
280 if not cdata.get('HAVE_MKDIRP')
281 libi3srcs += 'libi3/mkdirp.c'
282 endif
283
284 libi3 = static_library(
285 'i3',
286 libi3srcs,
287 include_directories: inc,
288 dependencies: [
289 pangocairo_dep,
290 config_h,
291 ],
292 )
293
294 i3srcs = [
295 'src/assignments.c',
296 'src/bindings.c',
297 'src/click.c',
298 'src/commands.c',
299 'src/commands_parser.c',
300 'src/con.c',
301 'src/config.c',
302 'src/config_directives.c',
303 'src/config_parser.c',
304 'src/display_version.c',
305 'src/drag.c',
306 'src/ewmh.c',
307 'src/fake_outputs.c',
308 'src/floating.c',
309 'src/handlers.c',
310 'src/ipc.c',
311 'src/key_press.c',
312 'src/load_layout.c',
313 'src/log.c',
314 'src/main.c',
315 'src/manage.c',
316 'src/match.c',
317 'src/move.c',
318 'src/output.c',
319 'src/randr.c',
320 'src/regex.c',
321 'src/render.c',
322 'src/resize.c',
323 'src/restore_layout.c',
324 'src/scratchpad.c',
325 'src/sd-daemon.c',
326 'src/sighandler.c',
327 'src/startup.c',
328 'src/sync.c',
329 'src/tree.c',
330 'src/util.c',
331 'src/version.c',
332 'src/window.c',
333 'src/workspace.c',
334 'src/x.c',
335 'src/xcb.c',
336 'src/xcursor.c',
337 'src/xinerama.c',
338 ]
339
340 # Verify the perl interpreter is present for running parser_gen,
341 # ensuring a good error message when it isn’t:
342 perl = find_program('perl')
343 parser_gen = find_program('generate-command-parser.pl')
344
345 command_parser = custom_target(
346 'command_parser',
347 input: 'parser-specs/commands.spec',
348 output: [
349 'GENERATED_command_enums.h',
350 'GENERATED_command_tokens.h',
351 'GENERATED_command_call.h',
352 ],
353 command: [perl, parser_gen, '--input=@INPUT@', '--prefix=command'],
354 )
355
356 i3srcs += command_parser
357
358 config_parser = custom_target(
359 'config_parser',
360 input: 'parser-specs/config.spec',
361 output: [
362 'GENERATED_config_enums.h',
363 'GENERATED_config_tokens.h',
364 'GENERATED_config_call.h',
365 ],
366 command: [parser_gen, '--input=@INPUT@', '--prefix=config'],
367 )
368
369 i3srcs += config_parser
370
371 # src/log.c uses threading primitives for synchronization
372 thread_dep = dependency('threads')
373
374 common_deps = [
375 thread_dep,
376 m_dep,
377 iconv_dep,
378 rt_dep,
379 libsn_dep,
380 xcb_dep,
381 xcb_xkb_dep,
382 xcb_xinerama_dep,
383 xcb_randr_dep,
384 xcb_shape_dep,
385 xcb_util_dep,
386 xcb_util_cursor_dep,
387 xcb_util_keysyms_dep,
388 xcb_util_wm_dep,
389 xcb_util_xrm_dep,
390 xkbcommon_dep,
391 xkbcommon_x11_dep,
392 yajl_dep,
393 libpcre_dep,
394 cairo_dep,
395 pangocairo_dep,
396 glib_dep,
397 gobject_dep,
398 ev_dep,
399 config_h,
400 ]
401
402 executable(
403 'i3',
404 i3srcs,
405 install: true,
406 include_directories: inc,
407 dependencies: common_deps,
408 link_with: libi3,
409 )
410
411 # This is the only currently working way of installing a symbolic link:
412 meson.add_install_script(
413 'meson/meson-install-i3-with-shmlog',
414 get_option('bindir'),
415 )
416
417 executable(
418 'i3bar',
419 [
420 'i3bar/src/child.c',
421 'i3bar/src/config.c',
422 'i3bar/src/ipc.c',
423 'i3bar/src/main.c',
424 'i3bar/src/mode.c',
425 'i3bar/src/outputs.c',
426 'i3bar/src/parse_json_header.c',
427 'i3bar/src/workspaces.c',
428 'i3bar/src/xcb.c',
429 ],
430 install: true,
431 include_directories: include_directories('include', 'i3bar/include'),
432 dependencies: common_deps,
433 link_with: libi3,
434 )
435
436 executable(
437 'i3-config-wizard',
438 [
439 'i3-config-wizard/i3-config-wizard-atoms.xmacro.h',
440 'i3-config-wizard/main.c',
441 'i3-config-wizard/xcb.h',
442 ],
443 install: true,
444 include_directories: include_directories('include', 'i3-config-wizard'),
445 dependencies: common_deps,
446 link_with: libi3,
447 )
448
449 executable(
450 'i3-dump-log',
451 'i3-dump-log/main.c',
452 install: true,
453 include_directories: inc,
454 dependencies: common_deps,
455 link_with: libi3,
456 )
457
458 executable(
459 'i3-input',
460 [
461 'i3-input/i3-input.h',
462 'i3-input/keysym2ucs.h',
463 'i3-input/keysym2ucs.c',
464 'i3-input/main.c',
465 ],
466 install: true,
467 include_directories: inc,
468 dependencies: common_deps,
469 link_with: libi3,
470 )
471
472 executable(
473 'i3-msg',
474 'i3-msg/main.c',
475 install: true,
476 include_directories: inc,
477 dependencies: common_deps,
478 link_with: libi3,
479 )
480
481 executable(
482 'i3-nagbar',
483 [
484 'i3-nagbar/i3-nagbar-atoms.xmacro.h',
485 'i3-nagbar/main.c',
486 ],
487 install: true,
488 include_directories: include_directories('include', 'i3-nagbar'),
489 dependencies: common_deps,
490 link_with: libi3,
491 )
492
493 install_data(
494 [
495 'i3-dmenu-desktop',
496 'i3-migrate-config-to-v4',
497 'i3-save-tree',
498 'i3-sensible-editor',
499 'i3-sensible-pager',
500 'i3-sensible-terminal',
501 ],
502 install_dir: 'bin',
503 )
504
505 install_subdir(
506 'etc',
507 strip_directory: true,
508 install_dir: join_paths(get_option('sysconfdir'), 'i3'),
509 )
510
511 install_subdir(
512 'share/',
513 strip_directory: true,
514 install_dir: get_option('datadir'),
515 )
516
517 install_headers(
518 'include/i3/ipc.h',
519 subdir: 'i3',
520 )
521
522 # We cannot use configure_file for complete-run.pl.in and i3test.pm.in
523 # because configure_file strips the backslash in e.g. \@display,
524 # resulting in @display, breaking our Perl code:
525 # https://github.com/mesonbuild/meson/issues/7165
526 sed = find_program('sed')
527 replace_dirs = [
528 sed,
529 '-e',
530 's,@abs_top_builddir@,'+meson.current_build_dir()+',g;s,@abs_top_srcdir@,'+meson.current_source_dir()+',g',
531 '@INPUT@',
532 ]
533 complete_run = custom_target(
534 'complete-run',
535 input: ['testcases/complete-run.pl.in'],
536 output: ['complete-run.pl'],
537 capture: true,
538 command: replace_dirs,
539 )
540 i3test_pm = custom_target(
541 'i3test-pm',
542 input: ['testcases/lib/i3test.pm.in'],
543 output: ['i3test.pm'],
544 capture: true,
545 command: replace_dirs,
546 )
547
548 if get_option('docs')
549 i3_pod2html = find_program('docs/i3-pod2html')
550
551 custom_target(
552 'lib-i3test.html',
553 input: i3test_pm,
554 output: 'lib-i3test.html',
555 command: [
556 i3_pod2html,
557 '@INPUT@',
558 '@OUTPUT@',
559 ],
560 install: true,
561 install_dir: join_paths(get_option('datadir'), 'doc', 'i3'),
562 )
563
564 custom_target(
565 'lib-i3test-test.html',
566 input: 'testcases/lib/i3test/Test.pm',
567 output: 'lib-i3test-test.html',
568 command: [
569 i3_pod2html,
570 '@INPUT@',
571 '@OUTPUT@',
572 ],
573 install: true,
574 install_dir: join_paths(get_option('datadir'), 'doc', 'i3'),
575 )
576 endif
577
578 executable(
579 'test.inject_randr15',
580 'testcases/inject_randr1.5.c',
581 include_directories: inc,
582 dependencies: common_deps,
583 link_with: libi3,
584 )
585
586 executable(
587 'test.commands_parser',
588 'src/commands_parser.c',
589 include_directories: inc,
590 c_args: '-DTEST_PARSER',
591 dependencies: common_deps,
592 link_with: libi3,
593 )
594
595 executable(
596 'test.config_parser',
597 'src/config_parser.c',
598 include_directories: inc,
599 c_args: '-DTEST_PARSER',
600 dependencies: common_deps,
601 link_with: libi3,
602 )
603
604 anyevent_i3 = custom_target(
605 'anyevent-i3',
606 # Should be AnyEvent-I3/blib/lib/AnyEvent/I3.pm,
607 # but see https://github.com/mesonbuild/meson/issues/2320
608 output: 'AnyEvent-I3.stamp',
609 command: [
610 'sh',
611 '-c',
612 'cp -r @0@/AnyEvent-I3 . && cd AnyEvent-I3 && perl Makefile.PL && make && touch ../AnyEvent-I3.stamp'.format(meson.current_source_dir()),
613 ],
614 )
615
616 if meson.version().version_compare('>=0.46.0')
617 test(
618 'complete-run',
619 perl,
620 args: [complete_run],
621 depends: [
622 # i3test.pm is generated at meson configure time,
623 # so no explicit dependency is required.
624 anyevent_i3,
625 ],
626 )
627 else
628 # meson < 0.46.0 does not support the depends arg in test targets.
629 # Just hope for the best.
630 test(
631 'complete-run',
632 perl,
633 args: [complete_run],
634 )
635 message('meson < 0.46 detected, you might need to run ninja test twice')
636 endif
0 # -*- mode: meson -*-
1
2 option('docs', type: 'boolean', value: false,
3 description: 'Build documentation from source (release tarballs contain a generated copy)')
4
5 option('mans', type: 'boolean', value: false,
6 description: 'Build manpages from source (release tarballs contain a generated copy)')
5454 cp "${STARTDIR}/RELEASE-NOTES-${RELEASE_VERSION}" "RELEASE-NOTES-${RELEASE_VERSION}"
5555 git add RELEASE-NOTES-${RELEASE_VERSION}
5656 git rm RELEASE-NOTES-${PREVIOUS_VERSION}
57 sed -i "s,RELEASE-NOTES-${PREVIOUS_VERSION},RELEASE-NOTES-${RELEASE_VERSION},g" Makefile.am
58 sed -i "s/AC_INIT(\[i3\], \[${PREVIOUS_VERSION}\]/AC_INIT([i3], [${RELEASE_VERSION}]/" configure.ac
59 echo "${RELEASE_VERSION} ($(date +%F))" > I3_VERSION
60 git add I3_VERSION
57 sed -i "s/^\s*version: '${PREVIOUS_VERSION}'/ version: '${RELEASE_VERSION}'/" meson.build
6158 git commit -a -m "release i3 ${RELEASE_VERSION}"
6259 git tag "${RELEASE_VERSION}" -m "release i3 ${RELEASE_VERSION}" --sign --local-user=0x4AC8EE1D
6360
64 autoreconf -fi
6561 mkdir build
66 (cd build && ../configure && make dist-bzip2 -j8)
67 cp build/i3-${RELEASE_VERSION}.tar.bz2 .
62 (cd build && meson .. && ninja dist)
63 cp build/meson-build/i3-${RELEASE_VERSION}.tar.xz .
6864
6965 echo "Differences in the release tarball file lists:"
7066
7167 diff --color -u \
72 <(tar tf ../i3-${PREVIOUS_VERSION}.tar.bz2 | sed "s,i3-${PREVIOUS_VERSION}/,,g" | sort) \
73 <(tar tf i3-${RELEASE_VERSION}.tar.bz2 | sed "s,i3-${RELEASE_VERSION}/,,g" | sort)
74
75 gpg --armor -b i3-${RELEASE_VERSION}.tar.bz2
68 <(tar tf ../i3-${PREVIOUS_VERSION}.tar.xz | sed "s,i3-${PREVIOUS_VERSION}/,,g" | sort) \
69 <(tar tf i3-${RELEASE_VERSION}.tar.xz | sed "s,i3-${RELEASE_VERSION}/,,g" | sort)
70
71 gpg --armor -b i3-${RELEASE_VERSION}.tar.xz
7672
7773 echo "${RELEASE_VERSION}-non-git" > I3_VERSION
7874 git add I3_VERSION
112108 FROM debian:sid
113109 RUN sed -i 's,^deb \(.*\),deb \1\ndeb-src \1,g' /etc/apt/sources.list
114110 RUN apt-get update && apt-get install -y dpkg-dev devscripts
115 COPY i3/i3-${RELEASE_VERSION}.tar.bz2 /usr/src/i3-wm_${RELEASE_VERSION}.orig.tar.bz2
111 COPY i3/i3-${RELEASE_VERSION}.tar.xz /usr/src/i3-wm_${RELEASE_VERSION}.orig.tar.xz
116112 WORKDIR /usr/src/
117 RUN tar xf i3-wm_${RELEASE_VERSION}.orig.tar.bz2
113 RUN tar xf i3-wm_${RELEASE_VERSION}.orig.tar.xz
118114 WORKDIR /usr/src/i3-${RELEASE_VERSION}
119115 COPY i3/debian /usr/src/i3-${RELEASE_VERSION}/debian/
120116 RUN mkdir debian/source
158154 git add docs/${PREVIOUS_VERSION}
159155 git commit -a -m "save docs for ${PREVIOUS_VERSION}"
160156
161 cp ${TMPDIR}/i3/i3-${RELEASE_VERSION}.tar.bz2* downloads/
162 git add downloads/i3-${RELEASE_VERSION}.tar.bz2*
157 cp ${TMPDIR}/i3/i3-${RELEASE_VERSION}.tar.xz* downloads/
158 git add downloads/i3-${RELEASE_VERSION}.tar.xz*
163159 cp ${TMPDIR}/i3/RELEASE-NOTES-${RELEASE_VERSION} downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt
164160 git add downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt
165161 sed -i "s,<h2>Documentation for i3 v[^<]*</h2>,<h2>Documentation for i3 v${RELEASE_VERSION}</h2>,g" docs/index.html
166162 sed -i "s,<span style=\"margin-left: 2em; color: #c0c0c0\">[^<]*</span>,<span style=\"margin-left: 2em; color: #c0c0c0\">${RELEASE_VERSION}</span>,g" index.html
167163 sed -i "s,The current stable version is .*$,The current stable version is ${RELEASE_VERSION}.,g" downloads/index.html
168 sed -i "s,<tbody>,<tbody>\n <tr>\n <td>${RELEASE_VERSION}</td>\n <td><a href=\"/downloads/i3-${RELEASE_VERSION}.tar.bz2\">i3-${RELEASE_VERSION}.tar.bz2</a></td>\n <td>$(LC_ALL=en_US.UTF-8 ls -lh ../i3/i3-${RELEASE_VERSION}.tar.bz2 | awk -F " " {'print $5'} | sed 's/K$/ KiB/g' | sed 's/M$/ MiB/g')</td>\n <td><a href=\"/downloads/i3-${RELEASE_VERSION}.tar.bz2.asc\">signature</a></td>\n <td>$(date +'%Y-%m-%d')</td>\n <td><a href=\"/downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt\">release notes</a></td>\n </tr>\n,g" downloads/index.html
164 sed -i "s,<tbody>,<tbody>\n <tr>\n <td>${RELEASE_VERSION}</td>\n <td><a href=\"/downloads/i3-${RELEASE_VERSION}.tar.xz\">i3-${RELEASE_VERSION}.tar.xz</a></td>\n <td>$(LC_ALL=en_US.UTF-8 ls -lh ../i3/i3-${RELEASE_VERSION}.tar.xz | awk -F " " {'print $5'} | sed 's/K$/ KiB/g' | sed 's/M$/ MiB/g')</td>\n <td><a href=\"/downloads/i3-${RELEASE_VERSION}.tar.xz.asc\">signature</a></td>\n <td>$(date +'%Y-%m-%d')</td>\n <td><a href=\"/downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt\">release notes</a></td>\n </tr>\n,g" downloads/index.html
169165
170166 git commit -a -m "add ${RELEASE_VERSION} release"
171167
1717 use IO::Handle;
1818
1919 # these are shipped with the testsuite
20 use lib qw(@abs_top_builddir@/testcases/lib @abs_top_srcdir@/testcases/lib @abs_top_builddir@/AnyEvent-I3/blib/lib);
20 use lib qw(@abs_top_builddir@ @abs_top_builddir@/testcases/lib @abs_top_srcdir@/testcases/lib @abs_top_builddir@/AnyEvent-I3/blib/lib);
2121 use i3test::Util qw(slurp);
2222 use StartXServer;
2323 use StatusLine;
3131
3232 is(int($version->{minor}), $version->{minor}, 'minor version is an integer');
3333 is(int($version->{patch}), $version->{patch}, 'patch version is an integer');
34 like($version->{human_readable}, qr/branch/, 'human readable version contains branch name');
3534
3635 done_testing;
33
44 BASENAME=$1
55 DOCKERFILE=$2
6
7 # .dockerignore is created on demand so that release.sh and other scripts are
8 # not influenced by our travis setup.
9 echo .git > .dockerignore
106
117 docker build --pull --no-cache --rm -t=${BASENAME} -f ${DOCKERFILE} .
128 # For pull requests, travis does not add secure environment variables to the
2525
2626 # Try running the tests in parallel so that the common case (tests pass) is
2727 # quick, but fall back to running them in sequence to make debugging easier.
28 if ! make check
28 if ! ninja test
2929 then
30 ./testcases/complete-run.pl --parallel=1 || (cat latest/complete-run.log; false)
30 ./complete-run.pl --parallel=1 || (cat latest/complete-run.log; false)
3131 fi