summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2018-03-01 15:32:21 -0800
committerKeith Packard <keithp@keithp.com>2018-03-01 15:32:21 -0800
commitfae00e3d86afb3872e3c5e12e02d0b6ef939f5f5 (patch)
tree88b3a5db077f63bd17b5823040567e027c40ecab
parenta81c7027dcd3cd4225b267815fa7711128eda360 (diff)
Add meson build. Fix warnings.HEADmaster
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--meson.build64
-rw-r--r--xlease.c10
2 files changed, 71 insertions, 3 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..ca7e1b7
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,64 @@
+project('xlease', 'c',
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'c_std=gnu99',
+ ],
+ version: '0.99.901',
+ meson_version: '>= 0.42.0',
+)
+cc = meson.get_compiler('c')
+if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
+ test_wflags = [
+ '-Wall',
+ '-Wpointer-arith',
+ '-Wmissing-declarations',
+ '-Wformat=2',
+ '-Wstrict-prototypes',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Wbad-function-cast',
+ '-Wold-style-definition',
+ '-Wunused',
+ '-Wuninitialized',
+ '-Wshadow',
+ '-Wmissing-noreturn',
+ '-Wmissing-format-attribute',
+ '-Wredundant-decls',
+ '-Werror=implicit',
+ '-Werror=nonnull',
+ '-Werror=init-self',
+ '-Werror=main',
+ '-Werror=missing-braces',
+ '-Werror=sequence-point',
+ '-Werror=return-type',
+ '-Werror=trigraphs',
+ '-Werror=array-bounds',
+ '-Werror=write-strings',
+ '-Werror=address',
+ '-Werror=int-to-pointer-cast',
+ '-Werror=pointer-to-int-cast',
+ ]
+else
+ test_wflags = []
+endif
+
+common_wflags = []
+foreach wflag: test_wflags
+ if cc.has_argument(wflag)
+ common_wflags += [ wflag ]
+ endif
+endforeach
+
+add_global_arguments(common_wflags, language : 'c')
+
+xcb_xrandr_dep = [
+ dependency('xcb', version : '>= 1.12'),
+ dependency('xcb-randr', version : '>= 1.12')
+ ]
+
+e = executable(
+ 'xlease',
+ 'xlease.c',
+ dependencies: xcb_xrandr_dep,
+ install: true,
+)
diff --git a/xlease.c b/xlease.c
index ddaf349..eedc01e 100644
--- a/xlease.c
+++ b/xlease.c
@@ -32,7 +32,7 @@
#include <getopt.h>
#include <xcb/randr.h>
-char *default_x_server[] = {
+const char *default_x_server[] = {
"X",
"-seat",
"seat1",
@@ -191,6 +191,7 @@ make_lease(app_t *app, lease_t *lease, xcb_randr_output_t output)
return 1;
}
+#if 0
static void
free_randr_lease(app_t *app, lease_t *lease)
{
@@ -216,6 +217,7 @@ close_lease(app_t *app, lease_t *lease)
close_kernel_lease(app, lease);
free_randr_lease(app, lease);
}
+#endif
static void
describe_error(app_t *app, xcb_generic_error_t *error)
@@ -304,6 +306,7 @@ app_get_randr_resources(app_t *app)
return 1;
}
+#if 0
static void
app_fini(app_t *app)
{
@@ -313,6 +316,7 @@ app_fini(app_t *app)
xcb_disconnect(app->conn);
app->conn = NULL;
}
+#endif
static const struct option options[] = {
{ .name = "display", .has_arg = 1, .val = 'd' },
@@ -336,8 +340,8 @@ int main (int argc, char **argv)
init_app(&app);
- app.xserver = default_x_server;
- app.fd_arg = DEFAULT_FD_ARG;
+ app.xserver = (char **) default_x_server;
+ app.fd_arg = (char *) DEFAULT_FD_ARG;
while ((c = getopt_long(argc, argv, "?vo:d:f:", options, NULL)) != -1) {
switch (c) {