summaryrefslogtreecommitdiff
blob: 0c029c9f0966df16aad01bef5e2e86e6d3df81ad (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
From 88579f929f0fc777762de1ad0895264ad077e0ee Mon Sep 17 00:00:00 2001
From: hasufell <hasufell@gentoo.org>
Date: Mon, 27 Oct 2014 20:48:03 +0100
Subject: [PATCH 2/2] Use pkg-config for linking to ncurses

Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=527034
---
 source/Makefile | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index df51e70..2db2781 100644
--- a/Makefile
+++ b/Makefile
@@ -956,17 +956,15 @@ endif
 # Your ncurses library may include Unicode support, and you may not have a
 # separate libncursesw; this is the case on Mac OS/Darwin.
 ifdef LIBNCURSES_IS_UNICODE
-NC_LIB = ncurses
-NC_INCLUDE = $(NC_PREFIX)/include/ncurses
+NC_LIBS = $(shell $(PKGCONFIG) --lib ncurses 2>/dev/null || echo "-L$(NC_PREFIX)/lib -lncurses")
+NC_CFLAGS = $(shell $(PKGCONFIG) --cflags ncurses 2>/dev/null || echo "-isystem $(NC_PREFIX)/include/ncurses")
 else
-NC_LIB = ncursesw
-NC_INCLUDE = $(NC_PREFIX)/include/ncursesw
+NC_LIBS = $(shell $(PKGCONFIG) --lib ncursesw || echo "-L$(NC_PREFIX)/lib -lncursesw")
+NC_CFLAGS = $(shell $(PKGCONFIG) --cflags ncursesw 2>/dev/null || echo "-isystem $(NC_PREFIX)/include/ncursesw")
 endif
 
-INCLUDES_L += -isystem $(NC_INCLUDE)
-
 ifndef TILES
-LIBS += -L$(NC_PREFIX)/lib -l$(NC_LIB)
+LIBS += $(NC_LIBS)
 endif
 
 endif
@@ -1111,7 +1109,7 @@ CFLAGS   := $(CFOPTIMIZE) $(CFOTHERS) $(CFWARN) $(CFLAGS)
 else
 CFLAGS   := $(CFOPTIMIZE) $(CFOTHERS) $(CFWARN)
 endif
-CFLAGS_L := $(CFOPTIMIZE_L) $(DEFINES_L) $(CFWARN_L) $(INCLUDES_L) $(CFOTHERS_L)
+CFLAGS_L := $(CFOPTIMIZE_L) $(DEFINES_L) $(CFWARN_L) $(INCLUDES_L) $(CFOTHERS_L) $(NC_CFLAGS)
 ALL_CFLAGS := $(CFLAGS) $(CFLAGS_L)
 YACC_CFLAGS  := $(ALL_CFLAGS) -Wno-unused-function -Wno-sign-compare -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0
 
-- 
2.1.2