summaryrefslogtreecommitdiff
path: root/math/sc-im/patches/patch-src_Makefile
blob: baee84fe147906e024de1c8cda31cf6471b90a5b (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
73
74
75
76
77
78
79
$NetBSD: patch-src_Makefile,v 1.3 2021/07/26 01:38:05 sjmulder Exp $

- Make libdl and curses flags overridable
- Make color support opt in so we can control it
- Remove hardcoded paths for NetBSD

--- src/Makefile.orig	2021-05-13 17:38:26.000000000 +0000
+++ src/Makefile
@@ -37,7 +37,7 @@ CFLAGS += -DDFLT_PAGER=\"less\"
 # Sets default editor. Its use in case EDITOR env variable is not set
 CFLAGS += -DDFLT_EDITOR=\"vim\"
 # Comment out to disable color support
-CFLAGS += -DUSECOLORS
+#CFLAGS += -DUSECOLORS
 # Command history file, relative to HISTORY_DIR directory. Comment out to disable commandline history
 CFLAGS += -DHISTORY_FILE=\"$(HISTORY_FILE)\" -DHISTORY_DIR=\"$(HISTORY_DIR)\"
 # Configuration file, relative to CONFIG_DIR directory
@@ -94,25 +94,27 @@ endif
 
 # dynamic linking (not available in BSD)
 ifneq ($(shell uname -s | grep -o BSD),BSD)
-  LDLIBS += -ldl
+  LDLIBS_DL += -ldl
 endif
 
+LDLIBS += $(LDLIBS_DL)
+
 ifneq (, $(shell which pkg-config))
   # Any system with pkg-config
 
   # NOTE: ncursesw (required)
   ifeq ($(shell uname -s),Darwin)
     # macOS' ncurses is built with wide-char support
-    LDFLAGS += -lncurses
+    LDLIBS_CURSES ?= -lncurses
   else ifneq ($(shell pkg-config --exists ncursesw || echo 'no'),no)
-    CFLAGS += $(shell pkg-config --cflags ncursesw)
-    LDLIBS += $(shell pkg-config --libs ncursesw)
+    CFLAGS_CURSES ?= $(shell pkg-config --cflags ncursesw)
+    LDLIBS_CURSES ?= $(shell pkg-config --libs ncursesw)
   else ifneq ($(shell pkg-config --exists ncurses || echo 'no'),no)
     # hopefully this includes wide character support then
-    CFLAGS += $(shell pkg-config --cflags ncurses)
-    LDLIBS += $(shell pkg-config --libs ncurses)
+    CFLAGS_CURSES ?= $(shell pkg-config --cflags ncurses)
+    LDLIBS_CURSES ?= $(shell pkg-config --libs ncurses)
   else
-    LDLIBS += -lncursesw
+    LDLIBS_CURSES ?= -lncursesw
   endif
 
   # NOTE: libxlsreader (libxls) is required for xls file reading support
@@ -153,21 +155,14 @@ else ifeq ($(shell uname -s),Darwin)
   # macOS without pkg-config
 
   # macOS' ncurses is built with wide-char support
-  LDFLAGS += -lncurses
-else ifeq ($(shell uname -s),NetBSD)
-  # NetBSD without pkg-config
-
-  CFLAGS  += -I/usr/pkg/include
-  CFLAGS  += -I/usr/pkg/include/ncursesw
-
-  LDFLAGS += -L/usr/pkg/lib
-  LDFLAGS += -Wl,-R/usr/pkg/lib
-
-  LDLIBS += -lncursesw
+  LDLIBS_CURSES += -lncurses
 else
-  LDFLAGS += -lncursesw
+  LDLIBS_CURSES += -lncursesw
 endif
 
+CFLAGS += $(CFLAGS_CURSES)
+LDLIBS += $(LDLIBS_CURSES)
+
 OBJS = $(patsubst %.c, %.o, $(wildcard *.c) $(wildcard utils/*.c)) gram.o
 
 .PHONY : all clean install docs man_install man_uninstall