summaryrefslogtreecommitdiff
blob: 52c64c76b29af2243dd3ad574277ff8be07cfd3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Upstream-PR: https://github.com/lecram/rover/pull/41
From 9e1f635a4c31d1621141dce51bb620365c784a0e Mon Sep 17 00:00:00 2001
From: orbea <orbea@riseup.net>
Date: Sat, 7 May 2022 08:41:22 -0700
Subject: [PATCH 1/2] build: Use pkgconfig to fix undefined references

On gentoo the build also requires -ltinfow which is exposed
by the ncursesw.pc pkgconfig file.
---
 Makefile | 8 ++++++--
 rover.c  | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 291a7b3..bbf376b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,18 @@
-LDLIBS := -lncursesw
 PREFIX ?= /usr/local
 BINDIR ?= $(PREFIX)/bin
 DATAROOTDIR ?= $(PREFIX)/share
 DATADIR ?= $(DATAROOTDIR)
 MANDIR ?= $(DATADIR)/man
 
+PKG_CONFIG ?= pkg-config
+
+CFLAGS_NCURSESW := `$(PKG_CONFIG) --cflags ncursesw`
+LIBS_NCURSESW := `$(PKG_CONFIG) --libs ncursesw`
+
 all: rover
 
 rover: rover.c config.h
-	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS)
+	$(CC) $(CFLAGS) $(CFLAGS_NCURSESW) -o $@ $< $(LDFLAGS) $(LIBS_NCURSESW)
 
 install: rover
 	rm -f $(DESTDIR)$(BINDIR)/rover
diff --git a/rover.c b/rover.c
index eca6aeb..342aa48 100644
--- a/rover.c
+++ b/rover.c
@@ -1,4 +1,6 @@
+#ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE       700
+#endif
 #define _XOPEN_SOURCE_EXTENDED
 #define _FILE_OFFSET_BITS   64
 

From 7b5983d9d90d8ec0ff6e846a7fc7126cddc1d808 Mon Sep 17 00:00:00 2001
From: orbea <orbea@riseup.net>
Date: Sat, 7 May 2022 08:49:07 -0700
Subject: [PATCH 2/2] build: Add CFLAGS default

---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index bbf376b..c2890fe 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,8 @@ DATAROOTDIR ?= $(PREFIX)/share
 DATADIR ?= $(DATAROOTDIR)
 MANDIR ?= $(DATADIR)/man
 
+CFLAGS ?= -O2
+
 PKG_CONFIG ?= pkg-config
 
 CFLAGS_NCURSESW := `$(PKG_CONFIG) --cflags ncursesw`