Compare commits
5 commits
ab4cb6e283
...
51e5de1c8b
| Author | SHA1 | Date | |
|---|---|---|---|
| 51e5de1c8b | |||
| 92167bff9e | |||
| 9b2fec0df1 | |||
| af68b5e63c | |||
| 5c056777d6 |
13 changed files with 135 additions and 21 deletions
60
Makefile
60
Makefile
|
|
@ -1,10 +1,11 @@
|
||||||
.POSIX:
|
.POSIX:
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
.DEFAULT_GOAL := all
|
||||||
|
|
||||||
include config.mk
|
include config.mk
|
||||||
|
|
||||||
# flags for compiling
|
# flags for compiling
|
||||||
DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L \
|
DWLCPPFLAGS = -I$(INCLUDE) -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L \
|
||||||
-DVERSION=\"$(VERSION)\" $(XWAYLAND)
|
-DVERSION=\"$(VERSION)\" $(XWAYLAND)
|
||||||
DWLDEVCFLAGS = -g -Wpedantic -Wall -Wextra -Wdeclaration-after-statement \
|
DWLDEVCFLAGS = -g -Wpedantic -Wall -Wextra -Wdeclaration-after-statement \
|
||||||
-Wno-unused-parameter -Wshadow -Wunused-macros -Werror=strict-prototypes \
|
-Wno-unused-parameter -Wshadow -Wunused-macros -Werror=strict-prototypes \
|
||||||
|
|
@ -16,13 +17,31 @@ PKGS = wayland-server xkbcommon libinput $(XLIBS)
|
||||||
DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(WLR_INCS) $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS)
|
DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(WLR_INCS) $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS)
|
||||||
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(WLR_LIBS) -lm $(LIBS)
|
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(WLR_LIBS) -lm $(LIBS)
|
||||||
|
|
||||||
all: dwl
|
# macros to relevant path definitions
|
||||||
dwl: dwl.o util.o
|
define mkbin
|
||||||
$(CC) dwl.o util.o $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
|
$(addprefix $(BIN)/,$1)
|
||||||
dwl.o: dwl.c client.h config.h config.mk cursor-shape-v1-protocol.h \
|
endef
|
||||||
|
define mkobj
|
||||||
|
$(addprefix $(OBJ)/,$1)
|
||||||
|
endef
|
||||||
|
define mkinclude
|
||||||
|
$(addprefix $(INCLUDE)/,$1)
|
||||||
|
endef
|
||||||
|
define mksrc
|
||||||
|
$(addprefix $(SRC)/,$1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
.PHONY: setup
|
||||||
|
setup:
|
||||||
|
mkdir -p $(BIN) $(BUILD) $(INCLUDE) $(OBJ)
|
||||||
|
|
||||||
|
all: setup $(call mkbin,dwl)
|
||||||
|
$(BIN)/dwl: $(call mkobj,dwl.o util.o)
|
||||||
|
$(CC) $^ $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
|
||||||
|
$(OBJ)/dwl.o: $(call mksrc,dwl.c client.h) config.mk $(call mkinclude,config.h cursor-shape-v1-protocol.h \
|
||||||
pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-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
|
wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h)
|
||||||
util.o: util.c util.h
|
$(OBJ)/util.o: $(call mksrc,util.c util.h)
|
||||||
|
|
||||||
# wayland-scanner is a tool which generates C headers and rigging for Wayland
|
# 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
|
# protocols, which are specified in XML. wlroots requires you to rig these up
|
||||||
|
|
@ -30,39 +49,39 @@ util.o: util.c util.h
|
||||||
WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
|
WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
|
||||||
WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
|
WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
|
||||||
|
|
||||||
cursor-shape-v1-protocol.h:
|
$(INCLUDE)/cursor-shape-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) enum-header \
|
$(WAYLAND_SCANNER) enum-header \
|
||||||
$(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
|
$(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
|
||||||
pointer-constraints-unstable-v1-protocol.h:
|
$(INCLUDE)/pointer-constraints-unstable-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) enum-header \
|
$(WAYLAND_SCANNER) enum-header \
|
||||||
$(WAYLAND_PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
|
$(WAYLAND_PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
|
||||||
wlr-layer-shell-unstable-v1-protocol.h:
|
$(INCLUDE)/wlr-layer-shell-unstable-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) enum-header \
|
$(WAYLAND_SCANNER) enum-header \
|
||||||
protocols/wlr-layer-shell-unstable-v1.xml $@
|
protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||||
wlr-output-power-management-unstable-v1-protocol.h:
|
$(INCLUDE)/wlr-output-power-management-unstable-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) server-header \
|
$(WAYLAND_SCANNER) server-header \
|
||||||
protocols/wlr-output-power-management-unstable-v1.xml $@
|
protocols/wlr-output-power-management-unstable-v1.xml $@
|
||||||
xdg-shell-protocol.h:
|
$(INCLUDE)/xdg-shell-protocol.h:
|
||||||
$(WAYLAND_SCANNER) server-header \
|
$(WAYLAND_SCANNER) server-header \
|
||||||
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
||||||
|
|
||||||
config.h:
|
$(INCLUDE)/config.h:
|
||||||
cp config.def.h $@
|
cp $(SRC)/config.def.h $@
|
||||||
clean:
|
clean:
|
||||||
rm -f dwl *.o *-protocol.h
|
rm -rf $(INCLUDE) $(OBJ) $(BUILD) $(BIN)
|
||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
mkdir -p dwl-$(VERSION)
|
mkdir -p dwl-$(VERSION)
|
||||||
cp -R LICENSE* Makefile CHANGELOG.md README.md client.h config.def.h \
|
cp -R LICENSE Makefile CHANGELOG.md README.md src \
|
||||||
config.mk protocols dwl.1 dwl.c util.c util.h dwl.desktop \
|
config.mk protocols dwl.1 dwl.desktop \
|
||||||
dwl-$(VERSION)
|
dwl-$(VERSION)
|
||||||
tar -caf dwl-$(VERSION).tar.gz dwl-$(VERSION)
|
tar -caf dwl-$(VERSION).tar.gz dwl-$(VERSION)
|
||||||
rm -rf dwl-$(VERSION)
|
rm -rf dwl-$(VERSION)
|
||||||
|
|
||||||
install: dwl
|
install: $(BIN)/dwl
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/dwl
|
rm -f $(DESTDIR)$(PREFIX)/bin/dwl
|
||||||
cp -f dwl $(DESTDIR)$(PREFIX)/bin
|
cp -f $(BIN)/dwl $(DESTDIR)$(PREFIX)/bin
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dwl
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/dwl
|
||||||
mkdir -p $(DESTDIR)$(MANDIR)/man1
|
mkdir -p $(DESTDIR)$(MANDIR)/man1
|
||||||
cp -f dwl.1 $(DESTDIR)$(MANDIR)/man1
|
cp -f dwl.1 $(DESTDIR)$(MANDIR)/man1
|
||||||
|
|
@ -74,6 +93,5 @@ uninstall:
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/dwl $(DESTDIR)$(MANDIR)/man1/dwl.1 \
|
rm -f $(DESTDIR)$(PREFIX)/bin/dwl $(DESTDIR)$(MANDIR)/man1/dwl.1 \
|
||||||
$(DESTDIR)$(DATADIR)/wayland-sessions/dwl.desktop
|
$(DESTDIR)$(DATADIR)/wayland-sessions/dwl.desktop
|
||||||
|
|
||||||
.SUFFIXES: .c .o
|
%.c %.o:
|
||||||
.c.o:
|
|
||||||
$(CC) $(CPPFLAGS) $(DWLCFLAGS) -o $@ -c $<
|
$(CC) $(CPPFLAGS) $(DWLCFLAGS) -o $@ -c $<
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,12 @@ PREFIX = /usr/local
|
||||||
MANDIR = $(PREFIX)/share/man
|
MANDIR = $(PREFIX)/share/man
|
||||||
DATADIR = $(PREFIX)/share
|
DATADIR = $(PREFIX)/share
|
||||||
|
|
||||||
|
SRC = src
|
||||||
|
BUILD = build
|
||||||
|
OBJ = $(BUILD)/obj
|
||||||
|
INCLUDE = $(BUILD)/include
|
||||||
|
BIN = bin
|
||||||
|
|
||||||
WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19`
|
WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19`
|
||||||
WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.19`
|
WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.19`
|
||||||
|
|
||||||
|
|
|
||||||
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1755922037,
|
||||||
|
"narHash": "sha256-wY1+2JPH0ZZC4BQefoZw/k+3+DowFyfOxv17CN/idKs=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "b1b3291469652d5a2edb0becc4ef0246fff97a7c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-25.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
63
flake.nix
Normal file
63
flake.nix
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
{
|
||||||
|
description = "DWL Development Shell";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {nixpkgs, ...}: let
|
||||||
|
system = "x86_64-linux";
|
||||||
|
enableXWayland = false;
|
||||||
|
in {
|
||||||
|
devShells."${system}".default = let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
};
|
||||||
|
lib = nixpkgs.lib;
|
||||||
|
stdenv = pkgs.stdenv;
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = with pkgs;
|
||||||
|
[
|
||||||
|
# NativeBuildInputs
|
||||||
|
installShellFiles
|
||||||
|
pkg-config
|
||||||
|
wayland-scanner
|
||||||
|
|
||||||
|
# BuildInputs
|
||||||
|
libinput
|
||||||
|
xorg.libxcb
|
||||||
|
libxkbcommon
|
||||||
|
pixman
|
||||||
|
wayland
|
||||||
|
wayland-protocols
|
||||||
|
wlroots_0_19
|
||||||
|
]
|
||||||
|
++ lib.optionals enableXWayland
|
||||||
|
[
|
||||||
|
# XWayland
|
||||||
|
xorg.libX11
|
||||||
|
xorg.xcbutilwm
|
||||||
|
xwayland
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = let
|
||||||
|
makeFlags =
|
||||||
|
lib.strings.concatStringsSep " "
|
||||||
|
([
|
||||||
|
"PKG_CONFIG=${stdenv.cc.targetPrefix}pkg-config"
|
||||||
|
"WAYLAND_SCANNER=wayland-scanner"
|
||||||
|
# "PREFIX=$(out)"
|
||||||
|
# "MANDIR=$(man)/share/man"
|
||||||
|
]
|
||||||
|
++ lib.optionals enableXWayland [
|
||||||
|
''XWAYLAND="-DXWAYLAND"''
|
||||||
|
''XLIBS="xcb xcb-icccm"''
|
||||||
|
]);
|
||||||
|
in ''
|
||||||
|
TERM=xterm-256color
|
||||||
|
alias mk='${makeFlags} make'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue