summaryrefslogtreecommitdiff
path: root/textproc/libhighlight/patches/patch-src_makefile
blob: 176443df6fa28df87f9667590fd3a44eb725cc12 (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
80
81
82
83
84
85
86
$NetBSD: patch-src_makefile,v 1.12 2022/10/03 18:09:12 schmonz Exp $

Use pkgsrc-specified compiler and flags.

--- src/makefile.orig	2022-09-28 17:52:30.000000000 +0000
+++ src/makefile
@@ -13,11 +13,11 @@
 # See src/gui-qt/highlight.pro for the Qt GUI compilation options
 
 #CXX ?= clang++
-CXX ?= g++
+#CXX ?= g++
 
 QMAKE ?= qmake
 
-CFLAGS:=-Wall -O2 ${CFLAGS} -DNDEBUG -std=c++11 -D_FILE_OFFSET_BITS=64
+#CFLAGS:=-Wall -O2 ${CFLAGS} -DNDEBUG -std=c++11 -D_FILE_OFFSET_BITS=64
 
 #CFLAGS:= -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection
 
@@ -68,16 +68,20 @@ ifdef PIC
 	CFLAGS+=-fPIC
 endif
 
-ifneq ($(OS), Windows_NT)
-LDFLAGS = -ldl
-endif
+#ifneq ($(OS), Windows_NT)
+#LDFLAGS = -ldl
+#endif
 # Do not strip by default (Mac OS X lazy pointer issues)
 # Add -static to avoid linking with shared libs (can cause trouble when highlight
 # is run as service)
 #LDFLAGS = ${LDFLAGS} -s
 #LDFLAGS= -Wl,--as-needed
 
-CXX_COMPILE=${CXX} ${CFLAGS} -c -I ${INCLUDE_DIR} ${LUA_CFLAGS}
+
+LSO_VERSION=$(shell echo ${SO_VERSION} | awk -F. '{ printf "%d:%d:0\n", $$1 - 1, $$2 }')
+LIBTOOL=libtool --tag=CXX
+
+CXX_COMPILE=${LIBTOOL} --mode=compile ${CXX} ${CFLAGS} ${CXX_DIR} -I ${INCLUDE_DIR} ${LUA_CFLAGS} -c
 
 # Data directories (data dir, configuration file dir)
 CXX_DIR=-DHL_DATA_DIR=\"${HL_DATA_DIR}\" -DHL_CONFIG_DIR=\"${HL_CONFIG_DIR}\"
@@ -105,18 +109,18 @@ GUI_OBJECTS:=${GUI_QT_DIR}main.cpp ${GUI
 	${GUI_QT_DIR}showtextfile.cpp
 
 
-cli: libhighlight.a ${CLI_OBJECTS}
-	${CXX} ${LDFLAGS} -o highlight ${CLI_OBJECTS} -L. -lhighlight ${LUA_LIBS}
+cli: ${CLI_OBJECTS}
+	${CXX} ${LDFLAGS} -o highlight ${CLI_OBJECTS} -lhighlight ${LUA_LIBS}
 
 lib-static libhighlight.a: ${CORE_OBJECTS}
 	${AR} ${ARFLAGS} libhighlight.a ${CORE_OBJECTS} ${DILU_OBJECTS}
 
 lib-shared libhighlight.so.1.0: ${CORE_OBJECTS}
-	${CXX} -shared -Wl,-soname,libhighlight.so.${SO_VERSION} -o libhighlight.so.${SO_VERSION} -lc ${CORE_OBJECTS}
+	${LIBTOOL} --mode=link ${CXX} ${LDFLAGS} -o libhighlight.la ${CORE_OBJECTS:%.o=%.lo} ${DILU_OBJECTS:%.o=%.lo} -version-info ${LSO_VERSION} -rpath ${PREFIX}/lib
 
 gui-qt: highlight-gui
 
-highlight-gui: libhighlight.a ${GUI_OBJECTS}
+highlight-gui: ${GUI_OBJECTS}
 	cd gui-qt && \
 	${QMAKE} 'DEFINES+=DATA_DIR=\\\"${HL_DATA_DIR}\\\" CONFIG_DIR=\\\"${HL_CONFIG_DIR}\\\" DOC_DIR=\\\"${HL_DOC_DIR}\\\" ' && \
 	$(MAKE)
@@ -125,7 +129,7 @@ $(OBJECTFILES) : makefile
 
 
 datadir.o: ${CORE_DIR}datadir.cpp ${INCLUDE_DIR}datadir.h ${INCLUDE_DIR}platform_fs.h
-	${CXX_COMPILE} ${CORE_DIR}datadir.cpp ${CXX_DIR}
+	${CXX_COMPILE} ${CORE_DIR}datadir.cpp
 
 platform_fs.o: ${CORE_DIR}platform_fs.cpp ${INCLUDE_DIR}platform_fs.h
 	${CXX_COMPILE} ${CORE_DIR}platform_fs.cpp
@@ -212,7 +216,7 @@ main.o: ${CLI_DIR}main.cpp ${CLI_DIR}mai
 	${INCLUDE_DIR}syntaxreader.h ${INCLUDE_DIR}themereader.h ${INCLUDE_DIR}elementstyle.h \
 	${INCLUDE_DIR}stylecolour.h  ${INCLUDE_DIR}preformatter.h \
 	${CLI_DIR}help.h ${INCLUDE_DIR}version.h
-	${CXX_COMPILE} ${CLI_DIR}main.cpp ${CXX_DIR}
+	${CXX_COMPILE} ${CLI_DIR}main.cpp
 
 
 #3rd party libs