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
This commit is contained in:
Michael Stapelberg 2020-05-19 14:45:06 +02:00 committed by GitHub
parent ef8935b1db
commit aba6ec3e52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 734 additions and 38 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
.git

11
.gitignore vendored
View File

@ -40,8 +40,19 @@ docs/*.html
i3-command-parser.stamp
i3-config-parser.stamp
.clang_complete
compile_commands.json
/.ccls-cache
/.clangd
LAST_VERSION
# We recommend building in a subdirectory called build.
# If you chose a different directory name,
# it is up to you to arrange for it to be ignored by git,
# e.g. by listing your directory in .git/info/exclude.
/build
# TODO(autotools-removal): remove autotools from .gitignore:
################################################################################
# https://raw.githubusercontent.com/github/gitignore/master/Autotools.gitignore
################################################################################

View File

@ -31,7 +31,10 @@ install:
script:
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-safe-wrappers.sh
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-formatting.sh
# # TODO(autotools-removal): autoconf build has to keep working until i3 4.19
# is released, so we keep building it in travis.
- 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"'
- 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'
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-spelling.pl
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} ./travis/run-tests.sh
- ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/debian-build.sh deb/debian-amd64/DIST

View File

@ -6,6 +6,12 @@
This is i3 v4.19. This version is considered stable. All users of i3 are
strongly encouraged to upgrade.
In this release, we switched from the autotools build system to the meson build
system (https://mesonbuild.com/). Check https://github.com/i3/i3/issues/4086 for
details. If this causes problems for you, you can revert the commit which
removed autotools from the tree: we tried our best to keep both build systems
working. Please reach out to us in that case!
┌────────────────────────────┐
│ Changes in i3 v4.19 │
└────────────────────────────┘

2
debian/compat vendored
View File

@ -1 +1 @@
9
10

4
debian/control vendored
View File

@ -2,8 +2,8 @@ Source: i3-wm
Section: x11
Priority: extra
Maintainer: Michael Stapelberg <stapelberg@debian.org>
Build-Depends: debhelper (>= 9),
dh-autoreconf,
Build-Depends: debhelper (>= 10),
meson,
libx11-dev,
libxcb-util0-dev (>= 0.3.8),
libxcb-keysyms1-dev,

2
debian/rules vendored
View File

@ -22,4 +22,4 @@ override_dh_builddeb:
dh_builddeb -- -Zgzip
%:
dh $@ --parallel --builddirectory=build --with=autoreconf
dh $@ --buildsystem=meson+ninja

View File

@ -23,16 +23,12 @@ outdated information.
== Building i3
You can build i3 like you build any other software package which uses autotools.
You can build i3 like you build any other software package which uses meson.
Heres a memory refresher:
$ autoreconf -fi
$ mkdir -p build && cd build
$ ../configure
$ make -j8
The autoreconf -fi step is unnecessary if you are building from a release
tarball, but shouldnt hurt either.
$ meson ..
$ ninja
=== Build system features

View File

@ -101,7 +101,7 @@ void errorlog(char *fmt, ...)
#if !defined(DLOG)
void debuglog(char *fmt, ...)
__attribute__((format(printf, 1, 2)));
#define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, STRIPPED__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
/**

View File

@ -26,7 +26,7 @@
is, delete the preceding comma */
#define LOG(fmt, ...) verboselog(fmt, ##__VA_ARGS__)
#define ELOG(fmt, ...) errorlog("ERROR: " fmt, ##__VA_ARGS__)
#define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, STRIPPED__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
extern char *errorfilename;
extern char *shmlogname;

View File

@ -16,10 +16,16 @@
*/
bool is_debug_build(void) {
/* i3_version contains either something like this:
* "4.0.2 (2011-11-11, branch "release")".
* or: "4.0.2-123-gCOFFEEBABE (2011-11-11, branch "next")".
* "4.0.2 (2011-11-11)" (release version)
* or: "4.0.2-123-gC0FFEE" (debug version)
*
* So we check for the offset of the first opening round bracket to
* determine whether this is a git version or a release version. */
if (strchr(I3_VERSION, '(') == NULL) {
return true; // e.g. 4.0.2-123-gC0FFEE
}
/* In practice, debug versions do not contain parentheses at all,
* but leave the logic as it was before so that we can re-add
* parentheses if we chose to. */
return ((strchr(I3_VERSION, '(') - I3_VERSION) > 10);
}

637
meson.build Normal file
View File

@ -0,0 +1,637 @@
# -*- mode: meson -*-
# Style objective: be consistent with what mesonbuild.com documents/uses, and/or
# the meson book: https://meson-manual.com/
project(
'i3',
'c',
version: '4.18.1',
default_options: [
'c_std=c11',
'warning_level=1', # enable all warnings (-Wall)
# TODO(https://github.com/i3/i3/issues/4087): switch to
# 'buildtype=debugoptimized',
],
# Ubuntu 18.04 (supported until 2023) has meson 0.45.
# We can revisit our minimum supported meson version
# if it turns out to be too hard to maintain.
meson_version: '>=0.45.0',
)
cc = meson.get_compiler('c')
add_project_arguments(cc.get_supported_arguments(['-Wunused-value']), language: 'c')
if meson.version().version_compare('>=0.48.0')
# https://github.com/mesonbuild/meson/issues/2166#issuecomment-629696911
meson.add_dist_script('meson/meson-dist-script')
else
message('meson <0.48.0 detected, dist tarballs will not be filtered')
endif
################################################################################
# Version handling
################################################################################
cdata = configuration_data()
version_array = meson.project_version().split('.')
cdata.set('MAJOR_VERSION', version_array[0].to_int())
cdata.set('MINOR_VERSION', version_array[1].to_int())
if version_array.length() > 2
cdata.set('PATCH_VERSION', version_array[2].to_int())
else
cdata.set('PATCH_VERSION', 0)
endif
cdata.set_quoted('I3_VERSION', '@VCS_TAG@')
cdata.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir')))
if get_option('b_sanitize').split(',').contains('address')
cdata.set('I3_ASAN_ENABLED', 1)
endif
cdata.set('HAVE_STRNDUP', cc.has_function('strndup'))
cdata.set('HAVE_MKDIRP', cc.has_function('mkdirp'))
# Instead of generating config.h directly, make vcs_tag generate it so that
# @VCS_TAG@ is replaced.
config_h_in = configure_file(
output: 'config.h.in',
configuration: cdata,
)
config_h = declare_dependency(
sources: vcs_tag(
input: config_h_in,
output: 'config.h',
fallback: meson.project_version() + '-non-git',
)
)
################################################################################
# docs generation
################################################################################
if get_option('docs')
asciidoc = find_program('asciidoc')
doc_toc_inputs = [
'docs/hacking-howto',
'docs/userguide',
'docs/ipc',
'docs/multi-monitor',
'docs/wsbar',
'docs/testsuite',
'docs/i3bar-protocol',
'docs/layout-saving',
]
foreach m : doc_toc_inputs
custom_target(
m.underscorify()+'_asciidoc',
input: m,
output: '@BASENAME@.html',
command: [
asciidoc,
'-a', 'toc',
'-n',
'-o', '@OUTPUT@',
'@INPUT@',
],
install: true,
install_dir: join_paths(get_option('datadir'), 'doc', 'i3'),
)
endforeach
doc_notoc_inputs = [
'docs/debugging',
]
foreach m : doc_notoc_inputs
custom_target(
m.underscorify()+'_asciidoc',
input: m,
output: '@BASENAME@.html',
command: [
asciidoc,
'-n',
'-o', '@OUTPUT@',
'@INPUT@',
],
install: true,
install_dir: join_paths(get_option('datadir'), 'doc', 'i3'),
)
endforeach
endif
if meson.version().version_compare('>=0.53')
summary('build docs (-Ddocs)', get_option('docs'))
endif
################################################################################
# manpages
################################################################################
if get_option('mans')
asciidoc = find_program('asciidoc')
asciidoc_cdata = configuration_data()
asciidoc_cdata.set('PACKAGE_VERSION', meson.project_version())
asciidoc_conf = configure_file(
input: 'man/asciidoc.conf.in',
output: 'asciidoc.conf',
configuration: asciidoc_cdata,
)
xmlto = find_program('xmlto')
pod2man = find_program('pod2man')
man_inputs = [
'man/i3.man',
'man/i3bar.man',
'man/i3-msg.man',
'man/i3-input.man',
'man/i3-nagbar.man',
'man/i3-config-wizard.man',
'man/i3-migrate-config-to-v4.man',
'man/i3-sensible-editor.man',
'man/i3-sensible-pager.man',
'man/i3-sensible-terminal.man',
'man/i3-dump-log.man',
]
foreach m : man_inputs
xml = custom_target(
m.underscorify()+'_asciidoc',
input: m,
output: '@BASENAME@.xml',
command: [
asciidoc,
'-d', 'manpage',
'-b', 'docbook',
'-f', asciidoc_conf,
'-o', '@OUTPUT@',
'@INPUT@',
],
)
custom_target(
m.underscorify()+'_xmlto',
input: xml,
output: '@BASENAME@.1',
command: [
xmlto,
'man',
'-o',
'@OUTDIR@',
'@INPUT@',
],
# We should use install and install_dir instead of install_man as per:
# https://github.com/mesonbuild/meson/issues/4981#issuecomment-467084867
# https://github.com/mesonbuild/meson/issues/1550#issuecomment-370164307
install: true,
install_dir: join_paths(get_option('mandir'), 'man1'),
)
endforeach
pod2man_inputs = [
'i3-dmenu-desktop',
'i3-save-tree',
]
foreach m : pod2man_inputs
custom_target(
m.underscorify()+'_pod2man',
input: m,
output: '@BASENAME@.1',
command: [
pod2man,
'--utf8',
'@INPUT@',
'@OUTPUT@',
],
# We should use install and install_dir instead of install_man as per:
# https://github.com/mesonbuild/meson/issues/4981#issuecomment-467084867
# https://github.com/mesonbuild/meson/issues/1550#issuecomment-370164307
install: true,
install_dir: join_paths(get_option('mandir'), 'man1'),
)
endforeach
endif
if meson.version().version_compare('>=0.53')
summary('build manpages (-Dmans)', get_option('docs'))
endif
# Required for e.g. struct ucred to be defined as per unix(7).
add_project_arguments('-D_GNU_SOURCE', language: 'c')
# https://mesonbuild.com/howtox.html#add-math-library-lm-portably
m_dep = cc.find_library('m', required: false)
rt_dep = cc.find_library('rt', required: false)
iconv_dep = cc.find_library('iconv', required: false)
libsn_dep = dependency('libstartup-notification-1.0', method: 'pkg-config')
xcb_dep = dependency('xcb', method: 'pkg-config')
xcb_xkb_dep = dependency('xcb-xkb', method: 'pkg-config')
xcb_xinerama_dep = dependency('xcb-xinerama', method: 'pkg-config')
xcb_randr_dep = dependency('xcb-randr', method: 'pkg-config')
xcb_shape_dep = dependency('xcb-shape', method: 'pkg-config')
xcb_util_dep = dependency('xcb-util', method: 'pkg-config')
xcb_util_cursor_dep = dependency('xcb-cursor', method: 'pkg-config')
xcb_util_keysyms_dep = dependency('xcb-keysyms', method: 'pkg-config')
xcb_util_wm_dep = dependency('xcb-icccm', method: 'pkg-config')
xcb_util_xrm_dep = dependency('xcb-xrm', method: 'pkg-config')
xkbcommon_dep = dependency('xkbcommon', method: 'pkg-config')
xkbcommon_x11_dep = dependency('xkbcommon-x11', method: 'pkg-config')
yajl_dep = dependency('yajl', method: 'pkg-config')
libpcre_dep = dependency('libpcre', version: '>=8.10', method: 'pkg-config')
cairo_dep = dependency('cairo', version: '>=1.14.4', method: 'pkg-config')
pangocairo_dep = dependency('pangocairo', method: 'pkg-config')
glib_dep = dependency('glib-2.0', method: 'pkg-config')
gobject_dep = dependency('gobject-2.0', method: 'pkg-config')
ev_dep = cc.find_library('ev')
inc = include_directories('include')
libi3srcs = [
'libi3/dpi.c',
'libi3/draw_util.c',
'libi3/fake_configure_notify.c',
'libi3/font.c',
'libi3/format_placeholders.c',
'libi3/get_colorpixel.c',
'libi3/get_config_path.c',
'libi3/get_exe_path.c',
'libi3/get_mod_mask.c',
'libi3/get_process_filename.c',
'libi3/get_visualtype.c',
'libi3/g_utf8_make_valid.c',
'libi3/ipc_connect.c',
'libi3/ipc_recv_message.c',
'libi3/ipc_send_message.c',
'libi3/is_debug_build.c',
'libi3/resolve_tilde.c',
'libi3/root_atom_contents.c',
'libi3/safewrappers.c',
'libi3/string.c',
'libi3/ucs2_conversion.c',
]
if not cdata.get('HAVE_STRNDUP')
libi3srcs += 'libi3/strndup.c'
endif
if not cdata.get('HAVE_MKDIRP')
libi3srcs += 'libi3/mkdirp.c'
endif
libi3 = static_library(
'i3',
libi3srcs,
include_directories: inc,
dependencies: [
pangocairo_dep,
config_h,
],
)
i3srcs = [
'src/assignments.c',
'src/bindings.c',
'src/click.c',
'src/commands.c',
'src/commands_parser.c',
'src/con.c',
'src/config.c',
'src/config_directives.c',
'src/config_parser.c',
'src/display_version.c',
'src/drag.c',
'src/ewmh.c',
'src/fake_outputs.c',
'src/floating.c',
'src/handlers.c',
'src/ipc.c',
'src/key_press.c',
'src/load_layout.c',
'src/log.c',
'src/main.c',
'src/manage.c',
'src/match.c',
'src/move.c',
'src/output.c',
'src/randr.c',
'src/regex.c',
'src/render.c',
'src/resize.c',
'src/restore_layout.c',
'src/scratchpad.c',
'src/sd-daemon.c',
'src/sighandler.c',
'src/startup.c',
'src/sync.c',
'src/tree.c',
'src/util.c',
'src/version.c',
'src/window.c',
'src/workspace.c',
'src/x.c',
'src/xcb.c',
'src/xcursor.c',
'src/xinerama.c',
]
# Verify the perl interpreter is present for running parser_gen,
# ensuring a good error message when it isnt:
perl = find_program('perl')
parser_gen = find_program('generate-command-parser.pl')
command_parser = custom_target(
'command_parser',
input: 'parser-specs/commands.spec',
output: [
'GENERATED_command_enums.h',
'GENERATED_command_tokens.h',
'GENERATED_command_call.h',
],
command: [perl, parser_gen, '--input=@INPUT@', '--prefix=command'],
)
i3srcs += command_parser
config_parser = custom_target(
'config_parser',
input: 'parser-specs/config.spec',
output: [
'GENERATED_config_enums.h',
'GENERATED_config_tokens.h',
'GENERATED_config_call.h',
],
command: [parser_gen, '--input=@INPUT@', '--prefix=config'],
)
i3srcs += config_parser
# src/log.c uses threading primitives for synchronization
thread_dep = dependency('threads')
common_deps = [
thread_dep,
m_dep,
iconv_dep,
rt_dep,
libsn_dep,
xcb_dep,
xcb_xkb_dep,
xcb_xinerama_dep,
xcb_randr_dep,
xcb_shape_dep,
xcb_util_dep,
xcb_util_cursor_dep,
xcb_util_keysyms_dep,
xcb_util_wm_dep,
xcb_util_xrm_dep,
xkbcommon_dep,
xkbcommon_x11_dep,
yajl_dep,
libpcre_dep,
cairo_dep,
pangocairo_dep,
glib_dep,
gobject_dep,
ev_dep,
config_h,
]
executable(
'i3',
i3srcs,
install: true,
include_directories: inc,
dependencies: common_deps,
link_with: libi3,
)
# This is the only currently working way of installing a symbolic link:
meson.add_install_script(
'meson/meson-install-i3-with-shmlog',
get_option('bindir'),
)
executable(
'i3bar',
[
'i3bar/src/child.c',
'i3bar/src/config.c',
'i3bar/src/ipc.c',
'i3bar/src/main.c',
'i3bar/src/mode.c',
'i3bar/src/outputs.c',
'i3bar/src/parse_json_header.c',
'i3bar/src/workspaces.c',
'i3bar/src/xcb.c',
],
install: true,
include_directories: include_directories('include', 'i3bar/include'),
dependencies: common_deps,
link_with: libi3,
)
executable(
'i3-config-wizard',
[
'i3-config-wizard/i3-config-wizard-atoms.xmacro.h',
'i3-config-wizard/main.c',
'i3-config-wizard/xcb.h',
],
install: true,
include_directories: include_directories('include', 'i3-config-wizard'),
dependencies: common_deps,
link_with: libi3,
)
executable(
'i3-dump-log',
'i3-dump-log/main.c',
install: true,
include_directories: inc,
dependencies: common_deps,
link_with: libi3,
)
executable(
'i3-input',
[
'i3-input/i3-input.h',
'i3-input/keysym2ucs.h',
'i3-input/keysym2ucs.c',
'i3-input/main.c',
],
install: true,
include_directories: inc,
dependencies: common_deps,
link_with: libi3,
)
executable(
'i3-msg',
'i3-msg/main.c',
install: true,
include_directories: inc,
dependencies: common_deps,
link_with: libi3,
)
executable(
'i3-nagbar',
[
'i3-nagbar/i3-nagbar-atoms.xmacro.h',
'i3-nagbar/main.c',
],
install: true,
include_directories: include_directories('include', 'i3-nagbar'),
dependencies: common_deps,
link_with: libi3,
)
install_data(
[
'i3-dmenu-desktop',
'i3-migrate-config-to-v4',
'i3-save-tree',
'i3-sensible-editor',
'i3-sensible-pager',
'i3-sensible-terminal',
],
install_dir: 'bin',
)
install_subdir(
'etc',
strip_directory: true,
install_dir: join_paths(get_option('sysconfdir'), 'i3'),
)
install_subdir(
'share/',
strip_directory: true,
install_dir: get_option('datadir'),
)
install_headers(
'include/i3/ipc.h',
subdir: 'i3',
)
# We cannot use configure_file for complete-run.pl.in and i3test.pm.in
# because configure_file strips the backslash in e.g. \@display,
# resulting in @display, breaking our Perl code:
# https://github.com/mesonbuild/meson/issues/7165
sed = find_program('sed')
replace_dirs = [
sed,
'-e',
's,@abs_top_builddir@,'+meson.current_build_dir()+',g;s,@abs_top_srcdir@,'+meson.current_source_dir()+',g',
'@INPUT@',
]
complete_run = custom_target(
'complete-run',
input: ['testcases/complete-run.pl.in'],
output: ['complete-run.pl'],
capture: true,
command: replace_dirs,
)
i3test_pm = custom_target(
'i3test-pm',
input: ['testcases/lib/i3test.pm.in'],
output: ['i3test.pm'],
capture: true,
command: replace_dirs,
)
if get_option('docs')
i3_pod2html = find_program('docs/i3-pod2html')
custom_target(
'lib-i3test.html',
input: i3test_pm,
output: 'lib-i3test.html',
command: [
i3_pod2html,
'@INPUT@',
'@OUTPUT@',
],
install: true,
install_dir: join_paths(get_option('datadir'), 'doc', 'i3'),
)
custom_target(
'lib-i3test-test.html',
input: 'testcases/lib/i3test/Test.pm',
output: 'lib-i3test-test.html',
command: [
i3_pod2html,
'@INPUT@',
'@OUTPUT@',
],
install: true,
install_dir: join_paths(get_option('datadir'), 'doc', 'i3'),
)
endif
executable(
'test.inject_randr15',
'testcases/inject_randr1.5.c',
include_directories: inc,
dependencies: common_deps,
link_with: libi3,
)
executable(
'test.commands_parser',
'src/commands_parser.c',
include_directories: inc,
c_args: '-DTEST_PARSER',
dependencies: common_deps,
link_with: libi3,
)
executable(
'test.config_parser',
'src/config_parser.c',
include_directories: inc,
c_args: '-DTEST_PARSER',
dependencies: common_deps,
link_with: libi3,
)
anyevent_i3 = custom_target(
'anyevent-i3',
# Should be AnyEvent-I3/blib/lib/AnyEvent/I3.pm,
# but see https://github.com/mesonbuild/meson/issues/2320
output: 'AnyEvent-I3.stamp',
command: [
'sh',
'-c',
'cp -r @0@/AnyEvent-I3 . && cd AnyEvent-I3 && perl Makefile.PL && make && touch ../AnyEvent-I3.stamp'.format(meson.current_source_dir()),
],
)
if meson.version().version_compare('>=0.46.0')
test(
'complete-run',
perl,
args: [complete_run],
depends: [
# i3test.pm is generated at meson configure time,
# so no explicit dependency is required.
anyevent_i3,
],
)
else
# meson < 0.46.0 does not support the depends arg in test targets.
# Just hope for the best.
test(
'complete-run',
perl,
args: [complete_run],
)
message('meson < 0.46 detected, you might need to run ninja test twice')
endif

36
meson/meson-dist-script Executable file
View File

@ -0,0 +1,36 @@
#!/bin/sh
set -eu
cd "${MESON_DIST_ROOT}"
# Delete everything we do not want to have in the release tarballs:
rm -rf \
contrib/banner.svg \
contrib/show-download-count.sh \
contrib/sticker-7x5cm-stickma.tif.lzma \
contrib/sticker_stickma_black.svg \
debian/ \
docs/GPN-2009-06-27/ \
docs/NoName-2009-03-12/ \
docs/slides-2012-01-25/ \
docs/slides-2012-03-16/ \
testcases/.gitignore \
travis/ \
.clang-format \
.editorconfig \
i3bar/.gitignore \
.travis.yml \
logo.svg \
README.md \
RELEASE-NOTES-next \
release.sh
mkdir build
cd build
meson .. -Dprefix=/usr -Ddocs=true -Dmans=true
ninja
cp *.1 ../man/
cp *.html ../docs/
cd ..
rm -rf build

View File

@ -0,0 +1,2 @@
#!/bin/sh
ln -sf "i3" "${MESON_INSTALL_DESTDIR_PREFIX}/$1/i3-with-shmlog"

7
meson_options.txt Normal file
View File

@ -0,0 +1,7 @@
# -*- mode: meson -*-
option('docs', type: 'boolean', value: false,
description: 'Build documentation from source (release tarballs contain a generated copy)')
option('mans', type: 'boolean', value: false,
description: 'Build manpages from source (release tarballs contain a generated copy)')

View File

@ -55,25 +55,21 @@ git checkout -b release-${RELEASE_VERSION}
cp "${STARTDIR}/RELEASE-NOTES-${RELEASE_VERSION}" "RELEASE-NOTES-${RELEASE_VERSION}"
git add RELEASE-NOTES-${RELEASE_VERSION}
git rm RELEASE-NOTES-${PREVIOUS_VERSION}
sed -i "s,RELEASE-NOTES-${PREVIOUS_VERSION},RELEASE-NOTES-${RELEASE_VERSION},g" Makefile.am
sed -i "s/AC_INIT(\[i3\], \[${PREVIOUS_VERSION}\]/AC_INIT([i3], [${RELEASE_VERSION}]/" configure.ac
echo "${RELEASE_VERSION} ($(date +%F))" > I3_VERSION
git add I3_VERSION
sed -i "s/^\s*version: '${PREVIOUS_VERSION}'/ version: '${RELEASE_VERSION}'/" meson.build
git commit -a -m "release i3 ${RELEASE_VERSION}"
git tag "${RELEASE_VERSION}" -m "release i3 ${RELEASE_VERSION}" --sign --local-user=0x4AC8EE1D
autoreconf -fi
mkdir build
(cd build && ../configure && make dist-bzip2 -j8)
cp build/i3-${RELEASE_VERSION}.tar.bz2 .
(cd build && meson .. && ninja dist)
cp build/meson-build/i3-${RELEASE_VERSION}.tar.xz .
echo "Differences in the release tarball file lists:"
diff --color -u \
<(tar tf ../i3-${PREVIOUS_VERSION}.tar.bz2 | sed "s,i3-${PREVIOUS_VERSION}/,,g" | sort) \
<(tar tf i3-${RELEASE_VERSION}.tar.bz2 | sed "s,i3-${RELEASE_VERSION}/,,g" | sort)
<(tar tf ../i3-${PREVIOUS_VERSION}.tar.xz | sed "s,i3-${PREVIOUS_VERSION}/,,g" | sort) \
<(tar tf i3-${RELEASE_VERSION}.tar.xz | sed "s,i3-${RELEASE_VERSION}/,,g" | sort)
gpg --armor -b i3-${RELEASE_VERSION}.tar.bz2
gpg --armor -b i3-${RELEASE_VERSION}.tar.xz
echo "${RELEASE_VERSION}-non-git" > I3_VERSION
git add I3_VERSION
@ -113,9 +109,9 @@ cat > ${TMPDIR}/Dockerfile <<EOT
FROM debian:sid
RUN sed -i 's,^deb \(.*\),deb \1\ndeb-src \1,g' /etc/apt/sources.list
RUN apt-get update && apt-get install -y dpkg-dev devscripts
COPY i3/i3-${RELEASE_VERSION}.tar.bz2 /usr/src/i3-wm_${RELEASE_VERSION}.orig.tar.bz2
COPY i3/i3-${RELEASE_VERSION}.tar.xz /usr/src/i3-wm_${RELEASE_VERSION}.orig.tar.xz
WORKDIR /usr/src/
RUN tar xf i3-wm_${RELEASE_VERSION}.orig.tar.bz2
RUN tar xf i3-wm_${RELEASE_VERSION}.orig.tar.xz
WORKDIR /usr/src/i3-${RELEASE_VERSION}
COPY i3/debian /usr/src/i3-${RELEASE_VERSION}/debian/
RUN mkdir debian/source
@ -159,14 +155,14 @@ tar cf - '--exclude=[0-9]\.[0-9e]*' docs | tar xf - --strip-components=1 -C docs
git add docs/${PREVIOUS_VERSION}
git commit -a -m "save docs for ${PREVIOUS_VERSION}"
cp ${TMPDIR}/i3/i3-${RELEASE_VERSION}.tar.bz2* downloads/
git add downloads/i3-${RELEASE_VERSION}.tar.bz2*
cp ${TMPDIR}/i3/i3-${RELEASE_VERSION}.tar.xz* downloads/
git add downloads/i3-${RELEASE_VERSION}.tar.xz*
cp ${TMPDIR}/i3/RELEASE-NOTES-${RELEASE_VERSION} downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt
git add downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt
sed -i "s,<h2>Documentation for i3 v[^<]*</h2>,<h2>Documentation for i3 v${RELEASE_VERSION}</h2>,g" docs/index.html
sed -i "s,<span style=\"margin-left: 2em; color: #c0c0c0\">[^<]*</span>,<span style=\"margin-left: 2em; color: #c0c0c0\">${RELEASE_VERSION}</span>,g" index.html
sed -i "s,The current stable version is .*$,The current stable version is ${RELEASE_VERSION}.,g" downloads/index.html
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
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
git commit -a -m "add ${RELEASE_VERSION} release"

View File

@ -18,7 +18,7 @@ use Time::HiRes qw(time);
use IO::Handle;
# these are shipped with the testsuite
use lib qw(@abs_top_builddir@/testcases/lib @abs_top_srcdir@/testcases/lib @abs_top_builddir@/AnyEvent-I3/blib/lib);
use lib qw(@abs_top_builddir@ @abs_top_builddir@/testcases/lib @abs_top_srcdir@/testcases/lib @abs_top_builddir@/AnyEvent-I3/blib/lib);
use i3test::Util qw(slurp);
use StartXServer;
use StatusLine;

View File

@ -32,6 +32,5 @@ cmp_ok($version->{minor}, '>', 0, 'minor version > 0');
is(int($version->{minor}), $version->{minor}, 'minor version is an integer');
is(int($version->{patch}), $version->{patch}, 'patch version is an integer');
like($version->{human_readable}, qr/branch/, 'human readable version contains branch name');
done_testing;

View File

@ -5,10 +5,6 @@ set -e
BASENAME=$1
DOCKERFILE=$2
# .dockerignore is created on demand so that release.sh and other scripts are
# not influenced by our travis setup.
echo .git > .dockerignore
docker build --pull --no-cache --rm -t=${BASENAME} -f ${DOCKERFILE} .
# For pull requests, travis does not add secure environment variables to the
# environment (because pull requests could then steal their values), so skip

View File

@ -26,7 +26,7 @@ fi
# Try running the tests in parallel so that the common case (tests pass) is
# quick, but fall back to running them in sequence to make debugging easier.
if ! make check
if ! ninja test
then
./testcases/complete-run.pl --parallel=1 || (cat latest/complete-run.log; false)
./complete-run.pl --parallel=1 || (cat latest/complete-run.log; false)
fi