alex-courtis / way-displays

way-displays: Auto Manage Your Wayland Displays
MIT License
253 stars 13 forks source link

Drop Linux header to unbreak on FreeBSD #21

Closed jbeich closed 2 years ago

jbeich commented 2 years ago

Leaving out the following for simplicity (downstream can override/append):

diff --git a/config.mk b/config.mk
index 87e1ecd..c6aebe2 100644
--- a/config.mk
+++ b/config.mk
@@ -18,10 +18,9 @@ COMPFLAGS = $(WFLAGS) $(OFLAGS)
 CFLAGS += $(COMPFLAGS) -std=gnu17
 CXXFLAGS += $(COMPFLAGS) -std=gnu++17

-LDFLAGS +=
+# If we have pkg-config try harder to pass correct flags
+CFLAGS += `pkg-config --cflags wayland-client 2>/dev/null || echo -isystem$(PREFIX)/include`
+CXXFLAGS += `pkg-config --cflags yaml-cpp 2>/dev/null`
+LDFLAGS += `pkg-config --libs epoll-shim libinotify 2>/dev/null` # BSD, ignore on Linux

 LDLIBS += -lwayland-client -lyaml-cpp -linput -ludev
-
-CC = gcc
-CXX = g++
-
alex-courtis commented 2 years ago

Leaving out the following for simplicity (downstream can override/append)

I'm would appreciate your adding pkgconfig directives to the make. The packaging should not have to apply patches like that which could break in the future.

epoll-shim etc. in LDLIBS can be made conditional on BSD.

If doing that, we should use pkg-config for the libs as well. A construct like this simplifies the process: https://github.com/djpohly/dwl/blob/main/Makefile#L8

alex-courtis commented 2 years ago

Meson is more portable than custom Make files.

Strongly agreed.

This project was never intended to reach this size, hence the allure of the simplicity of make.

A migration to meson in the future would be useful.

alex-courtis commented 2 years ago

I have just now merged a branch (at tag 1.4.0) with many changes, which happened to change to .

include-what-you-use is a marvelous tool.

jbeich commented 2 years ago

I've rebased and made it build "as is". See also downstream change. For example, OFLAGS is still overriden per distro policy (mainly useful for debugging).

alex-courtis commented 2 years ago

Much simpler, thank you so much.

It looks like the OFLAGS override is working as intended.