diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 0dde90e..0000000 --- a/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -dwl -*.o -*-protocol.c -*-protocol.h -.ccls-cache -config.h diff --git a/Makefile b/Makefile deleted file mode 100644 index ccca079..0000000 --- a/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -.POSIX: -.SUFFIXES: - -include config.mk - -# flags for compiling -DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XWAYLAND) -DWLDEVCFLAGS = -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wno-sign-compare -Wshadow -Wunused-macros\ - -Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types - -# CFLAGS / LDFLAGS -PKGS = wlroots wayland-server xkbcommon libinput $(XLIBS) -DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS) -LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS) - -all: dwl -dwl: dwl.o util.o - $(CC) dwl.o util.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@ -dwl.o: dwl.c config.mk config.h client.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h -util.o: util.c util.h - -# wayland-scanner is a tool which generates C headers and rigging for Wayland -# protocols, which are specified in XML. wlroots requires you to rig these up -# to your build system yourself and provide them in the include path. -WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner` -WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols` - -xdg-shell-protocol.h: - $(WAYLAND_SCANNER) server-header \ - $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@ -wlr-layer-shell-unstable-v1-protocol.h: - $(WAYLAND_SCANNER) server-header \ - protocols/wlr-layer-shell-unstable-v1.xml $@ - -config.h: - cp config.def.h $@ -clean: - rm -f dwl *.o *-protocol.h - -dist: clean - mkdir -p dwl-$(VERSION) - cp -R LICENSE* Makefile README.md client.h config.def.h\ - config.mk protocols dwl.1 dwl.c util.c util.h\ - dwl-$(VERSION) - tar -caf dwl-$(VERSION).tar.gz dwl-$(VERSION) - rm -rf dwl-$(VERSION) - -install: dwl - mkdir -p $(DESTDIR)$(PREFIX)/bin - cp -f dwl $(DESTDIR)$(PREFIX)/bin - chmod 755 $(DESTDIR)$(PREFIX)/bin/dwl - mkdir -p $(DESTDIR)$(MANDIR)/man1 - cp -f dwl.1 $(DESTDIR)$(MANDIR)/man1 - chmod 644 $(DESTDIR)$(MANDIR)/man1/dwl.1 -uninstall: - rm -f $(DESTDIR)$(PREFIX)/bin/dwl $(DESTDIR)$(MANDIR)/man1/dwl.1 - -.SUFFIXES: .c .o -.c.o: - $(CC) $(CPPFLAGS) $(DWLCFLAGS) -c $< diff --git a/README.md b/README.md index 05f149c..f433ed1 100644 --- a/README.md +++ b/README.md @@ -52,11 +52,15 @@ Feature *non-goals* for the main codebase include: dwl has only two dependencies: `wlroots` and `wayland-protocols`. Simply install these (and their `-devel` versions if your distro has separate -development packages) and run `make`. If you wish to build against a Git -version of wlroots, check out the [wlroots-next branch]. +development packages) and run +``` +cp config.def.h config.h +meson setup build +meson compile -C build +``` +If you wish to build against a Git version of wlroots, check out the [wlroots-next branch]. -To enable XWayland, you should also install xorg-xwayland and uncomment its flag -in `config.mk`. +To enable XWayland, you should also install xorg-xwayland and build with `meson setup build -Dxwayland=enabled`. ## Configuration diff --git a/config.mk b/config.mk deleted file mode 100644 index f50156f..0000000 --- a/config.mk +++ /dev/null @@ -1,14 +0,0 @@ -_VERSION = 0.4 -VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)` - -PKG_CONFIG = pkg-config - -# paths -PREFIX = /usr/local -MANDIR = $(PREFIX)/share/man - -XWAYLAND = -XLIBS = -# Uncomment to build XWayland support -#XWAYLAND = -DXWAYLAND -#XLIBS = xcb xcb-icccm diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..aa88079 --- /dev/null +++ b/meson.build @@ -0,0 +1,43 @@ +project('dwl', ['c', 'cpp'], + version : '0.4' +) + +subdir('protocols') + +cc = meson.get_compiler('c') +libm = cc.find_library('m') +xcb = dependency('xcb', required : get_option('xwayland')) +xlibs = dependency('xcb-icccm', required : get_option('xwayland')) +wayland_server_dep = dependency('wayland-server') +wlroots_dep = dependency('wlroots') +xkbcommon_dep = dependency('xkbcommon') +libinput_dep = dependency('libinput') + +c_args = [ + '-DWLR_USE_UNSTABLE', + '-D_POSIX_C_SOURCE=200809L', + '-DVERSION="@0@"'.format(meson.project_version()) +] + +if xcb.found() and xlibs.found() + c_args += '-DXWAYLAND' + endif + +executable('dwl', + 'dwl.c', + 'util.c', + wayland_sources, + dependencies : [ + libm, + xcb, + xlibs, + wayland_server_dep, + wlroots_dep, + xkbcommon_dep, + libinput_dep, + ], + install : true, + c_args : c_args +) + +install_man('dwl.1') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..693707f --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('xwayland', type : 'feature', value : 'disabled') diff --git a/protocols/meson.build b/protocols/meson.build new file mode 100644 index 0000000..9af06c2 --- /dev/null +++ b/protocols/meson.build @@ -0,0 +1,20 @@ +wayland_scanner = find_program('wayland-scanner') +wayland_protos_dep = dependency('wayland-protocols') +wl_protocol_dir = wayland_protos_dep.get_pkgconfig_variable('pkgdatadir') +wayland_scanner_code = generator( + wayland_scanner, + output: '@BASENAME@-protocol.c', + arguments: ['private-code', '@INPUT@', '@OUTPUT@']) +wayland_scanner_client = generator( + wayland_scanner, + output: '@BASENAME@-protocol.h', + arguments: ['server-header', '@INPUT@', '@OUTPUT@']) + +wayland_xmls = [ + wl_protocol_dir + '/stable/xdg-shell/xdg-shell.xml', + 'wlr-layer-shell-unstable-v1.xml' +] +wayland_sources = [ + wayland_scanner_code.process(wayland_xmls), + wayland_scanner_client.process(wayland_xmls), +]