swapped to meson
This commit is contained in:
parent
4edb64d311
commit
fd266a1904
8 changed files with 158 additions and 150 deletions
|
|
@ -18,3 +18,4 @@ tags
|
|||
*.swo
|
||||
*~
|
||||
include/lua5.4/*
|
||||
build/
|
||||
|
|
|
|||
99
Makefile
99
Makefile
|
|
@ -1,99 +0,0 @@
|
|||
.POSIX:
|
||||
.SUFFIXES:
|
||||
|
||||
include config.mk
|
||||
|
||||
DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(WLR_INCS) \
|
||||
-I. -Iinclude -Isrc -Iparser -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" \
|
||||
$(XWAYLAND) -g -Wall -Wextra -Wno-unused-parameter -O1 -std=c11 $(CFLAGS)
|
||||
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(WLR_LIBS) -lm $(LIBS)
|
||||
|
||||
SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
|
||||
PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
|
||||
|
||||
SMSG_CFLAGS = `$(PKG_CONFIG) --cflags wayland-client` -Wall -Wextra -Wno-unused-parameter
|
||||
SMSG_LDLIBS = `$(PKG_CONFIG) --libs wayland-client`
|
||||
|
||||
all: swindle smsg/smsg
|
||||
|
||||
swindle: src/dwl.o src/util.o parser/parser.o dwl-ipc-unstable-v2-protocol.o src/wlr_ext_workspace_v1.o ext-workspace-v1-protocol.o
|
||||
$(CC) $^ $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
|
||||
|
||||
src/dwl.o: src/swindle.c include/client.h config.h include/dwl-ipc.h dwl-ipc-unstable-v2-protocol.h \
|
||||
include/ext-workspace.h src/wlr_ext_workspace_v1.h ext-workspace-v1-protocol.h \
|
||||
cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h \
|
||||
wlr-layer-shell-unstable-v1-protocol.h \
|
||||
wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h \
|
||||
parser/parser.h
|
||||
$(CC) $(DWLCFLAGS) -o $@ -c $<
|
||||
|
||||
src/util.o: src/util.c src/util.h
|
||||
$(CC) $(DWLCFLAGS) -o $@ -c $<
|
||||
|
||||
src/wlr_ext_workspace_v1.o: src/wlr_ext_workspace_v1.c src/wlr_ext_workspace_v1.h ext-workspace-v1-protocol.h
|
||||
$(CC) $(DWLCFLAGS) -o $@ -c $<
|
||||
|
||||
parser/parser.o: parser/parser.c parser/parser.h
|
||||
$(CC) $(DWLCFLAGS) -o $@ -c $<
|
||||
|
||||
dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.c
|
||||
|
||||
ext-workspace-v1-protocol.o: ext-workspace-v1-protocol.c
|
||||
|
||||
# protocol headers and glue
|
||||
cursor-shape-v1-protocol.h:
|
||||
$(SCANNER) enum-header $(PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
|
||||
pointer-constraints-unstable-v1-protocol.h:
|
||||
$(SCANNER) enum-header $(PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
|
||||
wlr-layer-shell-unstable-v1-protocol.h:
|
||||
$(SCANNER) enum-header protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||
wlr-output-power-management-unstable-v1-protocol.h:
|
||||
$(SCANNER) server-header protocols/wlr-output-power-management-unstable-v1.xml $@
|
||||
xdg-shell-protocol.h:
|
||||
$(SCANNER) server-header $(PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
||||
dwl-ipc-unstable-v2-protocol.h:
|
||||
$(SCANNER) server-header protocols/dwl-ipc-unstable-v2.xml $@
|
||||
dwl-ipc-unstable-v2-protocol.c:
|
||||
$(SCANNER) private-code protocols/dwl-ipc-unstable-v2.xml $@
|
||||
|
||||
# smsg
|
||||
smsg/dwl-ipc-unstable-v2-protocol.h:
|
||||
$(SCANNER) client-header protocols/dwl-ipc-unstable-v2.xml $@
|
||||
|
||||
smsg/dwl-ipc-unstable-v2-protocol.c:
|
||||
$(SCANNER) private-code protocols/dwl-ipc-unstable-v2.xml $@
|
||||
|
||||
smsg/dwl-ipc-unstable-v2-protocol.o: smsg/dwl-ipc-unstable-v2-protocol.c
|
||||
$(CC) $(SMSG_CFLAGS) -o $@ -c $<
|
||||
|
||||
smsg/smsg.o: smsg/smsg.c smsg/dwl-ipc-unstable-v2-protocol.h
|
||||
$(CC) $(SMSG_CFLAGS) -o $@ -c $<
|
||||
|
||||
smsg/smsg: smsg/smsg.o smsg/dwl-ipc-unstable-v2-protocol.o
|
||||
$(CC) $^ $(SMSG_CFLAGS) $(SMSG_LDLIBS) -o $@
|
||||
|
||||
ext-workspace-v1-protocol.h:
|
||||
$(SCANNER) server-header protocols/ext-workspace-v1.xml $@
|
||||
ext-workspace-v1-protocol.c:
|
||||
$(SCANNER) private-code protocols/ext-workspace-v1.xml $@
|
||||
|
||||
clean:
|
||||
rm -f swindle smsg/smsg src/*.o parser/*.o smsg/*.o smsg/*-protocol.h smsg/*-protocol.c *.o *-protocol.h *-protocol.c
|
||||
|
||||
install: swindle smsg/smsg
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f swindle $(DESTDIR)$(PREFIX)/bin
|
||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/swindle
|
||||
cp -f smsg/smsg $(DESTDIR)$(PREFIX)/bin
|
||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/smsg
|
||||
mkdir -p $(DESTDIR)/etc/swindle
|
||||
cp -r example/* $(DESTDIR)/etc/swindle
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/swindle
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/smsg
|
||||
rm -rf $(DESTDIR)/etc/swindle
|
||||
|
||||
.SUFFIXES: .c .o
|
||||
.c.o:
|
||||
$(CC) $(DWLCFLAGS) -o $@ -c $<
|
||||
|
|
@ -22,6 +22,8 @@ Swindle is a fork of [dwl](https://codeberg.org/dwl/dwl) that was designed from
|
|||
* xkbcommon
|
||||
* wayland-protocols (compile-time only)
|
||||
* pkg-config (compile-time only)
|
||||
* meson (compile-time only)
|
||||
* ninja (compile-time only)
|
||||
|
||||
Install these (and their `-devel` versions if your distro has separate
|
||||
development packages) and run `make` followed by `doas/sudo make install`, if you wish to install it (installs to /usr/local/bin/ by default).
|
||||
|
|
|
|||
31
config.mk
31
config.mk
|
|
@ -1,31 +0,0 @@
|
|||
_VERSION = 0.1
|
||||
VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)`
|
||||
|
||||
PKG_CONFIG = pkg-config
|
||||
|
||||
# paths
|
||||
PREFIX = /usr/local
|
||||
MANDIR = $(PREFIX)/share/man
|
||||
DATDIR = $(PREFIX)/share
|
||||
|
||||
WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.20`
|
||||
WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.20`
|
||||
|
||||
# Allow using an alternative wlroots installation
|
||||
#WLR_INCS = -I/usr/include/pixman-1 -I/usr/include/elogind -I/usr/include/libdrm \
|
||||
# -I$(PWD)/wlroots/include
|
||||
#WLR_LIBS = -Wl,-rpath,$(PWD)/wlroots/build -L$(PWD)/wlroots/build -lwlroots-0.19
|
||||
|
||||
#XWAYLAND =
|
||||
#XLIBS =
|
||||
# Uncomment to build XWayland support
|
||||
XWAYLAND = -DXWAYLAND
|
||||
XLIBS = xcb xcb-icccm
|
||||
|
||||
# lua
|
||||
LUA_PKG = lua5.4
|
||||
|
||||
PKGS = wayland-server xkbcommon libinput $(LUA_PKG) $(XLIBS)
|
||||
|
||||
# Requires C11: _Alignas and anonymous unions in wlroots headers.
|
||||
CC = cc
|
||||
6
flake.lock
generated
6
flake.lock
generated
|
|
@ -20,11 +20,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1786106723,
|
||||
"narHash": "sha256-zDSUbpoeo/9ZmD2+wXnzxoo1+uhL8vxc0b8yuYMKYq0=",
|
||||
"lastModified": 1786599213,
|
||||
"narHash": "sha256-yNJd40f11EzXBjSByCB7IPpeFFAdeoSKKM67dGkfFoU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f13ff45afd1bb73e640eaa08a7066dbed07e3238",
|
||||
"rev": "0e251e24a4f24e036a084b6b4b2d2491af4167f4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
20
flake.nix
20
flake.nix
|
|
@ -1,11 +1,9 @@
|
|||
{
|
||||
description = "swindle: a dwl fork with Lua config, IPC, and ext-workspace support, plus its smsg client";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
|
|
@ -15,15 +13,14 @@
|
|||
packages.default = pkgs.stdenv.mkDerivation rec {
|
||||
pname = "swindle";
|
||||
version = "0.1";
|
||||
|
||||
src = self;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
wayland-scanner
|
||||
wayland-protocols
|
||||
meson
|
||||
ninja
|
||||
];
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
wayland
|
||||
wlroots_0_20
|
||||
|
|
@ -34,16 +31,8 @@
|
|||
libxcb
|
||||
libxcb-wm
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace '$(DESTDIR)/etc/swindle' '$(DESTDIR)$(PREFIX)/etc/swindle'
|
||||
'';
|
||||
|
||||
makeFlags = [ "PREFIX=${placeholder "out"}" ];
|
||||
|
||||
mesonFlags = [ "-Dxwayland=true" ];
|
||||
meta = with pkgs.lib; {
|
||||
description = "A dwl fork with Lua configuration, IPC support, and ext-workspace-v1";
|
||||
license = with licenses; [ gpl3Only mit isc ];
|
||||
|
|
@ -51,15 +40,12 @@
|
|||
mainProgram = "swindle";
|
||||
};
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
inputsFrom = [ self.packages.${system}.default ];
|
||||
packages = with pkgs; [ pkg-config gdb ];
|
||||
};
|
||||
|
||||
apps.default = flake-utils.lib.mkApp {
|
||||
drv = self.packages.${system}.default;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
143
meson.build
Normal file
143
meson.build
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
project(
|
||||
'swindle',
|
||||
'c',
|
||||
version: '0.1',
|
||||
default_options: [
|
||||
'c_std=c11',
|
||||
'buildtype=debugoptimized',
|
||||
],
|
||||
)
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
add_project_arguments(
|
||||
'-DWLR_USE_UNSTABLE',
|
||||
'-D_POSIX_C_SOURCE=200809L',
|
||||
'-DVERSION="0.1"',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Wno-unused-parameter',
|
||||
'-Wno-stringop-truncation',
|
||||
language: 'c',
|
||||
)
|
||||
|
||||
xwayland_opt = get_option('xwayland')
|
||||
|
||||
wayland_server = dependency('wayland-server')
|
||||
wayland_client = dependency('wayland-client')
|
||||
wayland_protocols = dependency('wayland-protocols')
|
||||
wayland_scanner_dep = dependency('wayland-scanner', native: true)
|
||||
wlroots = dependency('wlroots-0.20')
|
||||
xkbcommon = dependency('xkbcommon')
|
||||
libinput = dependency('libinput')
|
||||
lua = dependency('lua5.4')
|
||||
m_dep = cc.find_library('m', required: false)
|
||||
|
||||
swindle_deps = [
|
||||
wayland_server,
|
||||
wlroots,
|
||||
xkbcommon,
|
||||
libinput,
|
||||
lua,
|
||||
m_dep,
|
||||
]
|
||||
|
||||
if xwayland_opt
|
||||
swindle_deps += dependency('xcb')
|
||||
swindle_deps += dependency('xcb-icccm')
|
||||
add_project_arguments('-DXWAYLAND', language: 'c')
|
||||
endif
|
||||
|
||||
wayland_scanner = find_program(
|
||||
wayland_scanner_dep.get_variable('wayland_scanner'),
|
||||
native: true,
|
||||
)
|
||||
wl_protocol_dir = wayland_protocols.get_variable('pkgdatadir')
|
||||
|
||||
wayland_scanner_server = generator(
|
||||
wayland_scanner,
|
||||
output: '@BASENAME@-protocol.h',
|
||||
arguments: ['server-header', '@INPUT@', '@OUTPUT@'],
|
||||
)
|
||||
|
||||
wayland_scanner_private = generator(
|
||||
wayland_scanner,
|
||||
output: '@BASENAME@-protocol.c',
|
||||
arguments: ['private-code', '@INPUT@', '@OUTPUT@'],
|
||||
)
|
||||
|
||||
wayland_scanner_enum = generator(
|
||||
wayland_scanner,
|
||||
output: '@BASENAME@-protocol.h',
|
||||
arguments: ['enum-header', '@INPUT@', '@OUTPUT@'],
|
||||
)
|
||||
|
||||
cursor_shape_xml = wl_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml'
|
||||
pointer_constraints_xml = wl_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'
|
||||
xdg_shell_xml = wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml'
|
||||
|
||||
layer_shell_xml = 'protocols/wlr-layer-shell-unstable-v1.xml'
|
||||
output_power_xml = 'protocols/wlr-output-power-management-unstable-v1.xml'
|
||||
dwl_ipc_xml = 'protocols/dwl-ipc-unstable-v2.xml'
|
||||
ext_workspace_xml = 'protocols/ext-workspace-v1.xml'
|
||||
|
||||
cursor_shape_h = wayland_scanner_enum.process(cursor_shape_xml)
|
||||
pointer_constraints_h = wayland_scanner_enum.process(pointer_constraints_xml)
|
||||
layer_shell_h = wayland_scanner_enum.process(layer_shell_xml)
|
||||
output_power_h = wayland_scanner_server.process(output_power_xml)
|
||||
xdg_shell_h = wayland_scanner_server.process(xdg_shell_xml)
|
||||
|
||||
dwl_ipc_h = wayland_scanner_server.process(dwl_ipc_xml)
|
||||
dwl_ipc_c = wayland_scanner_private.process(dwl_ipc_xml)
|
||||
ext_workspace_h = wayland_scanner_server.process(ext_workspace_xml)
|
||||
ext_workspace_c = wayland_scanner_private.process(ext_workspace_xml)
|
||||
|
||||
protocol_headers = [
|
||||
cursor_shape_h,
|
||||
pointer_constraints_h,
|
||||
layer_shell_h,
|
||||
output_power_h,
|
||||
xdg_shell_h,
|
||||
]
|
||||
|
||||
swindle_sources = [
|
||||
'src/swindle.c',
|
||||
'src/util.c',
|
||||
'src/wlr_ext_workspace_v1.c',
|
||||
'parser/parser.c',
|
||||
dwl_ipc_c,
|
||||
dwl_ipc_h,
|
||||
ext_workspace_c,
|
||||
ext_workspace_h,
|
||||
]
|
||||
|
||||
executable(
|
||||
'swindle',
|
||||
swindle_sources + protocol_headers,
|
||||
include_directories: include_directories('.', 'include', 'src', 'parser'),
|
||||
dependencies: swindle_deps,
|
||||
install: true,
|
||||
)
|
||||
|
||||
smsg_dwl_ipc_h = custom_target(
|
||||
'smsg-dwl-ipc-unstable-v2-protocol-h',
|
||||
input: dwl_ipc_xml,
|
||||
output: 'dwl-ipc-unstable-v2-protocol.h',
|
||||
command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
|
||||
)
|
||||
|
||||
smsg_dwl_ipc_c = custom_target(
|
||||
'smsg-dwl-ipc-unstable-v2-protocol-c',
|
||||
input: dwl_ipc_xml,
|
||||
output: 'dwl-ipc-unstable-v2-protocol.c',
|
||||
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
|
||||
)
|
||||
|
||||
executable(
|
||||
'smsg',
|
||||
['smsg/smsg.c', smsg_dwl_ipc_c, smsg_dwl_ipc_h],
|
||||
dependencies: [wayland_client],
|
||||
install: true,
|
||||
)
|
||||
|
||||
install_subdir('example', install_dir: get_option('sysconfdir') / 'swindle', strip_directory: true)
|
||||
6
meson_options.txt
Normal file
6
meson_options.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
option(
|
||||
'xwayland',
|
||||
type: 'boolean',
|
||||
value: true,
|
||||
description: 'Enable XWayland support',
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue