summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--man/meson.build24
-rw-r--r--meson.build46
-rw-r--r--src/meson.build78
4 files changed, 153 insertions, 0 deletions
diff --git a/README.md b/README.md
index 06b6607..e926c46 100644
--- a/README.md
+++ b/README.md
@@ -21,3 +21,8 @@ For patch submission instructions, see:
https://www.x.org/wiki/Development/Documentation/SubmittingPatches
+To build, run:
+ ./autogen.sh
+ make
+
+The meson based build system is experimental.
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..40287d5
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,24 @@
+custom_target(
+ 'twm.1',
+ build_by_default: true,
+ capture: true,
+ input: files('twm.man'),
+ output: 'twm.1',
+ install: true,
+ install_dir: get_option('mandir'),
+ command: [
+ find_program('sed'),
+ '@INPUT@',
+ '-e', 's#__appmansuffix__#1#g',
+ '-e', 's#__miscmansuffix__#7#g',
+ '-e', 's#__datadir__#@0@#g'.format(
+ get_option('prefix') / get_option('datadir')
+ ),
+ '-e', 's#__projectroot__#@0@#g'.format(
+ meson.project_source_root()
+ ),
+ '-e', 's#__xorgversion__#"twm @0@" "X Version 11"#g'.format(
+ meson.project_version()
+ ),
+ ],
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..b560add
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,46 @@
+project(
+ 'twm',
+ 'c',
+ default_options: [
+ 'warning_level=3',
+ 'werror=true',
+ ],
+ version: '1.0.12',
+)
+
+add_project_arguments(
+ '-DAPP_VERSION="@0@"'.format(meson.project_version()),
+ language: 'c',
+)
+
+add_project_arguments(
+ '-DDATA_DIR="@0@"'.format(get_option('datadir')),
+ language: 'c',
+)
+
+if meson.get_compiler('c').has_function('mkstemp')
+ add_project_arguments(
+ '-DHAVE_MKSTEMP=1',
+ language: 'c',
+ )
+endif
+
+twm_dependencies = [
+ dependency('x11'),
+ dependency('xext'),
+ dependency('xt'),
+ dependency('xmu'),
+ dependency('ice'),
+ dependency('sm'),
+ dependency('xproto', version:'>=7.0.17'),
+]
+
+xrandr = dependency('xrandr', required: false)
+if xrandr.found()
+ twm_dependencies += xrandr
+
+ add_project_arguments('-DHAVE_XRANDR', language: 'c')
+endif
+
+subdir('src')
+subdir('man')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..9c801df
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,78 @@
+deftwmrc = custom_target(
+ 'deftwmrc.c',
+ input: 'system.twmrc',
+ output: 'deftwmrc.c',
+ command: [
+ find_program('gen_deftwmrc.sh'),
+ '@OUTPUT@',
+ '@INPUT@',
+ ],
+)
+
+parser = custom_target(
+ 'gram.[ch]',
+ input: [
+ 'gram.y',
+ ],
+ output: [
+ 'gram.c',
+ 'gram.h'
+ ],
+ command: [
+ find_program('bison'),
+ '-y',
+ '-d',
+ '-o',
+ '@OUTPUT0@',
+ '@INPUT@',
+ ],
+)
+
+lexer = custom_target(
+ 'lex.c',
+ input: [
+ 'lex.l',
+ parser[1],
+ ],
+ output: [
+ 'lex.c',
+ ],
+ command: [
+ find_program('flex'),
+ '-o',
+ '@OUTPUT@',
+ '@INPUT0@',
+ ],
+)
+
+twm = executable(
+ 'twm',
+ [
+ 'add_window.c',
+ 'cursor.c',
+ 'events.c',
+ 'gc.c',
+ 'iconmgr.c',
+ 'icons.c',
+ 'list.c',
+ 'menus.c',
+ 'parse.c',
+ 'resize.c',
+ 'session.c',
+ 'twm.c',
+ 'util.c',
+ deftwmrc,
+ parser,
+ lexer,
+ ],
+ dependencies: twm_dependencies,
+ install: true,
+)
+
+configure_file(
+ input: 'system.twmrc',
+ output: 'system.twmrc',
+ copy: true,
+ install: true,
+ install_dir: get_option('datadir') / 'X11/twm/',
+)