Skip to content

Commit

Permalink
gui-wm/hikari: new wayland window manager
Browse files Browse the repository at this point in the history
Closes: https://bugs.gentoo.org/719672

hikari is a minimalistic wayland window manager
based on wlroots trying inspired by the simplicity
of CWM in the X days. It aims stay out of your way
and focus more on the task than the windows.

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Aisha Tammy <[email protected]>
Closes: gentoo#15531
Signed-off-by: Aaron Bauman <[email protected]>
  • Loading branch information
epsilon-0 authored and FuzzyGophers committed Jun 6, 2020
1 parent effe59a commit 10ac27b
Show file tree
Hide file tree
Showing 4 changed files with 394 additions and 0 deletions.
1 change: 1 addition & 0 deletions gui-wm/hikari/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST hikari-1.2.0.tar.gz 98941 BLAKE2B 0b882d483143e307d4b173560f335e85b4c5613b75c51c6b70b68df9b4f70f9a009d95cb8eda1c211f4968b5c8600e7113bca5e014cecfb1917db2acae7e6f3d SHA512 2bd0b6032541ca63a2bd12aee9155e9b0d08e4c541ec2f837073f1498ecb39df969f8821fcbd066e44c5ddaf658e4875bea25f344226b7ea97fe008a0db4d328
315 changes: 315 additions & 0 deletions gui-wm/hikari/files/hikari-1.2.0-gnu-make.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,315 @@
explain steps to guide future me and other patchers
(1) define common variables on top
(2) remove conditions for doc and others to define VERSION
(3) replace all ${*} by $(*)
(4) replace pkg-config by $(PKG_CONFIG)
(6) remove .PATH: src
(5) remove main.c from OBJS because it is in different directory
- we will define a separate target for it
(6) add $(OBJS) target + main.o target and add then to the end
of dependencies for hikari
(7) add main.o to be cleaned-up
(8) reorder the library orders in the $(CC) steps because gcc
diff --git a/Makefile b/Makefile
index 11fc449..d73c4e0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,24 +1,22 @@
-.ifmake doc || dist
-.ifndef VERSION
-.error please specify VERSION
-.endif
-.endif
-
-VERSION ?= "darcs"
-
-.ifmake install || uninstall
-.ifndef PREFIX
-.error please specify PREFIX
-.endif
+TARGET = hikari
+
+DESTDIR ?=
+
+prefix ?= /usr/local
+exec_prefix ?= $(prefix)
+bindir ?= $(exec_prefix)/bin
+sysconfdir ?= $(prefix)/etc
+
+PKG_CONFIG ?= pkg-config
+
+VERSION ?= "darcs"
+
+### Upstream variables
+PREFIX ?= $(prefix)
+ETC_PREFIX ?= $(sysconfdir)
+
OS != uname
INSTALL_GROUP != id -gn
-.endif
-
-.ifmake install || uninstall
-.ifndef ETC_PREFIX
-.error please specify ETC_PREFIX
-.endif
-.endif

OBJS = \
action.o \
@@ -45,7 +43,6 @@ OBJS = \
layout.o \
layout_config.o \
layout_select_mode.o \
- main.o \
mark.o \
mark_assign_mode.o \
mark_select_mode.o \
@@ -72,106 +69,117 @@ OBJS = \
xwayland_unmanaged_view.o \
xwayland_view.o

-WAYLAND_PROTOCOLS != pkg-config --variable pkgdatadir wayland-protocols
-
-.PHONY: distclean clean clean-doc doc dist install uninstall
-.PATH: src
+WAYLAND_PROTOCOLS != $(PKG_CONFIG) --variable pkgdatadir wayland-protocols

-.ifdef DEBUG
-CFLAGS += -g -O0 -fsanitize=address
-.else
-CFLAGS += -DNDEBUG
-.endif
+ifeq ($(DEBUG),1)
+ CFLAGS += -g -O0 -fsanitize=address
+else
+ CFLAGS += -DNDEBUG
+endif

-.ifdef WITH_POSIX_C_SOURCE
-CFLAGS += -D_POSIX_C_SOURCE=200809L
-.endif
+ifeq ($(WITH_POSIX_C_SOURCE),1)
+ CFLAGS += -D_POSIX_C_SOURCE=200809L
+endif

-.ifdef WITH_XWAYLAND
-CFLAGS += -DHAVE_XWAYLAND=1
-.endif
+ifeq ($(WITH_XWAYLAND),1)
+ CFLAGS += -DHAVE_XWAYLAND=1
+endif

-.ifdef WITH_GAMMACONTROL
-CFLAGS += -DHAVE_GAMMACONTROL=1
-.endif
+ifeq ($(WITH_GAMMACONTROL),1)
+ CFLAGS += -DHAVE_GAMMACONTROL=1
+endif

-.ifdef WITH_SCREENCOPY
-CFLAGS += -DHAVE_SCREENCOPY=1
-.endif
+ifeq ($(WITH_SCREENCOPY),1)
+ CFLAGS += -DHAVE_SCREENCOPY=1
+endif

-.ifdef WITH_LAYERSHELL
-CFLAGS += -DHAVE_LAYERSHELL=1
-.endif
+ifeq ($(WITH_LAYERSHELL),1)
+ CFLAGS += -DHAVE_LAYERSHELL=1
+endif

CFLAGS += -Wall -I. -Iinclude

-WLROOTS_CFLAGS != pkg-config --cflags wlroots
-WLROOTS_LIBS != pkg-config --libs wlroots
+WLROOTS_CFLAGS != $(PKG_CONFIG) --cflags wlroots
+WLROOTS_LIBS != $(PKG_CONFIG) --libs wlroots

WLROOTS_CFLAGS += -DWLR_USE_UNSTABLE=1

-PANGO_CFLAGS != pkg-config --cflags pangocairo
-PANGO_LIBS != pkg-config --libs pangocairo
+PANGO_CFLAGS != $(PKG_CONFIG) --cflags pangocairo
+PANGO_LIBS != $(PKG_CONFIG) --libs pangocairo

-CAIRO_CFLAGS != pkg-config --cflags cairo
-CAIRO_LIBS != pkg-config --libs cairo
+CAIRO_CFLAGS != $(PKG_CONFIG) --cflags cairo
+CAIRO_LIBS != $(PKG_CONFIG) --libs cairo

-GLIB_CFLAGS != pkg-config --cflags glib-2.0
-GLIB_LIBS != pkg-config --libs glib-2.0
+GLIB_CFLAGS != $(PKG_CONFIG) --cflags glib-2.0
+GLIB_LIBS != $(PKG_CONFIG) --libs glib-2.0

-PIXMAN_CFLAGS != pkg-config --cflags pixman-1
-PIXMAN_LIBS != pkg-config --libs pixman-1
+PIXMAN_CFLAGS != $(PKG_CONFIG) --cflags pixman-1
+PIXMAN_LIBS != $(PKG_CONFIG) --libs pixman-1

-XKBCOMMON_CFLAGS != pkg-config --cflags xkbcommon
-XKBCOMMON_LIBS != pkg-config --libs xkbcommon
+XKBCOMMON_CFLAGS != $(PKG_CONFIG) --cflags xkbcommon
+XKBCOMMON_LIBS != $(PKG_CONFIG) --libs xkbcommon

-WAYLAND_CFLAGS != pkg-config --cflags wayland-server
-WAYLAND_LIBS != pkg-config --libs wayland-server
+WAYLAND_CFLAGS != $(PKG_CONFIG) --cflags wayland-server
+WAYLAND_LIBS != $(PKG_CONFIG) --libs wayland-server

-LIBINPUT_CFLAGS != pkg-config --cflags libinput
-LIBINPUT_LIBS != pkg-config --libs libinput
+LIBINPUT_CFLAGS != $(PKG_CONFIG) --cflags libinput
+LIBINPUT_LIBS != $(PKG_CONFIG) --libs libinput

-UCL_CFLAGS != pkg-config --cflags libucl
-UCL_LIBS != pkg-config --libs libucl
+UCL_CFLAGS != $(PKG_CONFIG) --cflags libucl
+UCL_LIBS != $(PKG_CONFIG) --libs libucl

CFLAGS += \
- ${WLROOTS_CFLAGS} \
- ${PANGO_CFLAGS} \
- ${CAIRO_CFLAGS} \
- ${GLIB_CFLAGS} \
- ${PIXMAN_CFLAGS} \
- ${XKBCOMMON_CFLAGS} \
- ${WAYLAND_CFLAGS} \
- ${LIBINPUT_CFLAGS} \
- ${UCL_CFLAGS}
+ $(WLROOTS_CFLAGS) \
+ $(PANGO_CFLAGS) \
+ $(CAIRO_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(PIXMAN_CFLAGS) \
+ $(XKBCOMMON_CFLAGS) \
+ $(WAYLAND_CFLAGS) \
+ $(LIBINPUT_CFLAGS) \
+ $(UCL_CFLAGS)

LIBS = \
- ${WLROOTS_LIBS} \
- ${PANGO_LIBS} \
- ${CAIRO_LIBS} \
- ${GLIB_LIBS} \
- ${PIXMAN_LIBS} \
- ${XKBCOMMON_LIBS} \
- ${WAYLAND_LIBS} \
- ${LIBINPUT_LIBS} \
- ${UCL_LIBS}
-
-all: hikari hikari-unlocker
+ $(WLROOTS_LIBS) \
+ $(PANGO_LIBS) \
+ $(CAIRO_LIBS) \
+ $(GLIB_LIBS) \
+ $(PIXMAN_LIBS) \
+ $(XKBCOMMON_LIBS) \
+ $(WAYLAND_LIBS) \
+ $(LIBINPUT_LIBS) \
+ $(UCL_LIBS)
+
+.PHONY: distclean clean clean-doc doc dist install uninstall
+
+all: hikari hikari-unlocker doc

version.h:
- echo "#define HIKARI_VERSION \"${VERSION}\"" >> version.h
+ echo "#define HIKARI_VERSION \"$(VERSION)\"" >> version.h

-hikari: version.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h ${OBJS}
- ${CC} ${LDFLAGS} ${CFLAGS} ${INCLUDES} ${LIBS} ${OBJS} -o ${.TARGET}
+$(OBJS): %.o: src/%.c
+ $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
+
+main.o:
+ $(CC) $(CFLAGS) $(INCLUDES) -c main.c -o main.o

xdg-shell-protocol.h:
- wayland-scanner server-header ${WAYLAND_PROTOCOLS}/stable/xdg-shell/xdg-shell.xml ${.TARGET}
+ wayland-scanner server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.h

wlr-layer-shell-unstable-v1-protocol.h:
- wayland-scanner server-header protocol/wlr-layer-shell-unstable-v1.xml ${.TARGET}
+ wayland-scanner server-header protocol/wlr-layer-shell-unstable-v1.xml wlr-layer-shell-unstable-v1-protocol.h
+
+hikari: version.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h $(OBJS) main.o
+ $(CC) $(LDFLAGS) $(CFLAGS) $(INCLUDES) $(OBJS) main.o $(LIBS) -o $(TARGET)

hikari-unlocker: hikari_unlocker.c
- ${CC} -lpam hikari_unlocker.c -o hikari-unlocker
+ $(CC) $(LDFLAGS) $(CFLAGS) $(INCLUDES) hikari_unlocker.c -lpam $(LIBS) -o hikari-unlocker
+
+share/man/man1/hikari.1:
+ pandoc -M title:"HIKARI(1) $(VERSION) | hikari - Wayland Compositor" -s \
+ --to man -o share/man/man1/hikari.1 share/man/man1/hikari.md
+
+doc: share/man/man1/hikari.1

clean-doc:
@test -e _darcs && echo "cleaning manpage" ||:
@@ -183,20 +191,15 @@ clean: clean-doc
@rm xdg-shell-protocol.h 2> /dev/null ||:
@rm wlr-layer-shell-unstable-v1-protocol.h 2> /dev/null ||:
@echo "cleaning object files"
- @rm ${OBJS} 2> /dev/null ||:
+ @rm $(OBJS) 2> /dev/null ||:
+ @rm main.o 2> /dev/null ||:
@echo "cleaning executables"
@rm hikari 2> /dev/null ||:
@rm hikari-unlocker 2> /dev/null ||:

-share/man/man1/hikari.1:
- pandoc -M title:"HIKARI(1) ${VERSION} | hikari - Wayland Compositor" -s \
- --to man -o share/man/man1/hikari.1 share/man/man1/hikari.md
-
-doc: share/man/man1/hikari.1
-
-hikari-${VERSION}.tar.gz: version.h share/man/man1/hikari.1
+hikari-$(VERSION).tar.gz: version.h share/man/man1/hikari.1
@darcs revert
- @tar -s "#^#hikari-${VERSION}/#" -czf hikari-${VERSION}.tar.gz \
+ @tar -s "#^#hikari-$(VERSION)/#" -czf hikari-$(VERSION).tar.gz \
version.h \
main.c \
hikari_unlocker.c \
@@ -215,22 +218,22 @@ distclean: clean-doc
@test -e _darcs && echo "cleaning version.h" ||:
@test -e _darcs && rm version.h ||:

-dist: distclean hikari-${VERSION}.tar.gz
+dist: distclean hikari-$(VERSION).tar.gz

install: hikari hikari-unlocker share/man/man1/hikari.1
- mkdir -p ${PREFIX}/bin
- mkdir -p ${PREFIX}/share/man/man1
- mkdir -p ${PREFIX}/share/examples/hikari
- mkdir -p ${ETC_PREFIX}/pam.d
- install -m 4555 -g ${INSTALL_GROUP} hikari hikari-unlocker ${PREFIX}/bin
- install -m 644 -g ${INSTALL_GROUP} share/man/man1/hikari.1 ${PREFIX}/share/man/man1
- install -m 644 -g ${INSTALL_GROUP} share/examples/hikari/hikari.conf ${PREFIX}/share/examples/hikari
- install -m 644 -g ${INSTALL_GROUP} pam.d/hikari-unlocker.${OS} ${ETC_PREFIX}/pam.d/hikari-unlocker
+ mkdir -p $(PREFIX)/bin
+ mkdir -p $(PREFIX)/share/man/man1
+ mkdir -p $(PREFIX)/share/examples/hikari
+ mkdir -p $(ETC_PREFIX)/pam.d
+ install -m 4555 -g $(INSTALL_GROUP) hikari hikari-unlocker $(PREFIX)/bin
+ install -m 644 -g $(INSTALL_GROUP) share/man/man1/hikari.1 $(PREFIX)/share/man/man1
+ install -m 644 -g $(INSTALL_GROUP) share/examples/hikari/hikari.conf $(PREFIX)/share/examples/hikari
+ install -m 644 -g $(INSTALL_GROUP) pam.d/hikari-unlocker.$(OS) $(ETC_PREFIX)/pam.d/hikari-unlocker

uninstall:
- -rm ${PREFIX}/bin/hikari
- -rm ${PREFIX}/bin/hikari-unlocker
- -rm ${PREFIX}/share/examples/hikari/hikari.conf
- -rmdir ${PREFIX}/share/examples/hikari
- -rm ${PREFIX}/share/man/man1/hikari.1
- -rm ${ETC_PREFIX}/pam.d/hikari-unlocker
+ -rm $(PREFIX)/bin/hikari
+ -rm $(PREFIX)/bin/hikari-unlocker
+ -rm $(PREFIX)/share/examples/hikari/hikari.conf
+ -rmdir $(PREFIX)/share/examples/hikari
+ -rm $(PREFIX)/share/man/man1/hikari.1
+ -rm $(ETC_PREFIX)/pam.d/hikari-unlocker
55 changes: 55 additions & 0 deletions gui-wm/hikari/hikari-1.2.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2019-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

DESCRIPTION="wayland compositor inspired by CWM"
HOMEPAGE="https://hikari.acmelabs.space/"
SRC_URI="https://hikari.acmelabs.space/releases/${P}.tar.gz"
KEYWORDS="~amd64 ~x86"

LICENSE="MIT"
SLOT="0"
IUSE="gamma layershell screencopy +X"

DEPEND="
dev-libs/glib
dev-libs/libinput:=
dev-libs/libucl
gui-libs/wlroots
x11-libs/cairo:=[X,svg]
x11-libs/pango:=[X]
x11-libs/pixman
x11-libs/libxkbcommon:=[X]
"

RDEPEND="
${DEPEND}
x11-misc/xkeyboard-config
"

BDEPEND="
${DEPEND}
app-text/pandoc
virtual/pkgconfig
dev-libs/wayland-protocols
"

# keep this as others OS's are using this as reference
PATCHES=(
"${FILESDIR}/${P}-gnu-make.patch"
)

src_compile() {
emake VERSION="{PV}" \
WITH_POSIX_C_SOURCE=1 \
WITH_GAMMACONTROL=$(usex gamma 1 0) \
WITH_LAYERSHELL=$(usex layershell 1 0) \
WITH_SCREENCOPY=$(usex screencopy 1 0) \
WITH_XWAYLAND=$(usex X 1 0) \
all
}

src_install() {
emake PREFIX=${D}/usr ETC_PREFIX=${D}/etc install
}
23 changes: 23 additions & 0 deletions gui-wm/hikari/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<longdescription>
hikari is a minimalistic wayland window manager
based on wlroots trying inspired by the simplicity
of CWM in the X days. It aims stay out of your way
and focus more on the task than the windows.
</longdescription>
<maintainer type="person">
<email>[email protected]</email>
<name>Aisha Tammy</name>
</maintainer>
<maintainer type="project">
<email>[email protected]</email>
<name>Proxy Maintainers</name>
</maintainer>
<use>
<flag name="gamma">add gamma control for redshift</flag>
<flag name="layershell">add support for wayland apps using layer shell</flag>
<flag name="screencopy">add support for screen grabbing</flag>
</use>
</pkgmetadata>

0 comments on commit 10ac27b

Please sign in to comment.