Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Linux header to unbreak on FreeBSD #21

Merged
merged 3 commits into from
Feb 23, 2022
Merged

Drop Linux header to unbreak on FreeBSD #21

merged 3 commits into from
Feb 23, 2022

Conversation

jbeich
Copy link
Contributor

@jbeich jbeich commented Feb 21, 2022

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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Owner

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

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

`struct tm` is in `<time.h>` per POSIX, which is already included.

src/log.c:1:10: fatal error: 'bits/types/struct_tm.h' file not found
 #include <bits/types/struct_tm.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~
src/cfg.cpp:8:10: fatal error: 'yaml-cpp/yaml.h' file not found
 #include <yaml-cpp/yaml.h> // IWYU pragma: keep
          ^~~~~~~~~~~~~~~~~
ld: error: undefined symbol: signalfd
>>> referenced by fds.c
>>>               src/fds.o:(create_fd_signal)
>>> referenced by fds.c
>>>               src/fds.o:(init_fds)

ld: error: undefined symbol: inotify_init1
>>> referenced by fds.c
>>>               src/fds.o:(create_fd_cfg_dir)
>>> referenced by fds.c
>>>               src/fds.o:(init_fds)

ld: error: undefined symbol: inotify_add_watch
>>> referenced by fds.c
>>>               src/fds.o:(create_fd_cfg_dir)
>>> referenced by fds.c
>>>               src/fds.o:(init_fds)

ld: error: undefined symbol: epoll_shim_read
>>> referenced by fds.c
>>>               src/fds.o:(cfg_file_modified)
>>> referenced by fds.c
>>>               src/fds.o:(cfg_file_modified)
>>> referenced by server.c
>>>               src/server.o:(loop)

ld: error: undefined symbol: epoll_shim_poll
>>> referenced by server.c
>>>               src/server.o:(loop)
@jbeich
Copy link
Contributor Author

jbeich commented Feb 22, 2022

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 alex-courtis merged commit b50fc31 into alex-courtis:master Feb 23, 2022
@alex-courtis
Copy link
Owner

Much simpler, thank you so much.

It looks like the OFLAGS override is working as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants