$OpenBSD: patch-gtk_makefile,v 1.11 2018/02/24 10:55:25 bket Exp $

Index: gtk/makefile
--- gtk/makefile.orig
+++ gtk/makefile
@@ -7,16 +7,6 @@
 srcdir ?= .
 
 .SUFFIXES: .cxx .o .h .a .c
-ifdef CLANG
-# Can choose aspect to sanitize: address and undefined can simply change SANITIZE but for
-# thread also need to create Position Independent Executable -> search online documentation
-SANITIZE = address
-#SANITIZE = undefined
-CXX = clang++ -fsanitize=$(SANITIZE) -Wno-deprecated-register
-CC = clang -fsanitize=$(SANITIZE) -Wno-empty-body
-else
-MISLEADING=-Wno-misleading-indentation
-endif
 
 ifdef GTK3
 GTKVERSION=gtk+-3.0
@@ -28,20 +18,21 @@ endif
 CONFIGFLAGS:=$(shell pkg-config --cflags $(GTKVERSION))
 CONFIGLIB:=$(shell pkg-config --libs $(GTKVERSION) gthread-2.0 gmodule-no-export-2.0)
 CONFIGTHREADS:=
-gnomeprefix:=$(shell pkg-config --variable=prefix $(GTKVERSION) 2>/dev/null)
+#gnomeprefix:=$(shell pkg-config --variable=prefix $(GTKVERSION) 2>/dev/null)
 ifndef prefix
 ifdef gnomeprefix
   prefix=$(gnomeprefix)
 else
-  prefix=/usr
+  prefix=${PREFIX}
 endif
 endif
 datadir=$(prefix)/share
 pixmapdir=$(datadir)/pixmaps
 bindir=$(prefix)/bin
 SYSCONF_PATH=$(prefix)/share/scite
+DOC_PATH=$(prefix)/share/doc/scite
 
-INSTALL=install
+INSTALL=install -o root -g bin
 
 PROG	= $(srcdir)/../bin/SciTE
 
@@ -50,19 +41,21 @@ all: $(PROG)
 vpath %.h $(srcdir) $(srcdir)/../src $(srcdir)/../../scintilla/include
 vpath %.cxx $(srcdir) $(srcdir)/../src
 
-INCLUDEDIRS=-I $(srcdir)/../../scintilla/include -I $(srcdir)/../src
+INCLUDEDIRS=-I ${prefix}/include/scintilla  -I $(srcdir)/../../scintilla/include -I $(srcdir)/../src -I ${prefix}/include
 ifdef CHECK_DEPRECATED
 DEPRECATED=-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED
 endif
 CXXBASEFLAGS=-W -Wall -pedantic -DGTK -DSCI_LEXER -DPIXMAP_PATH=\"$(pixmapdir)\" -DSYSCONF_PATH=\"$(SYSCONF_PATH)\" $(INCLUDEDIRS) $(DEPRECATED)
 
 ifdef DEBUG
-CXXTFLAGS=-DDEBUG -g $(CXXBASEFLAGS)
+CXXTFLAGS+=-DDEBUG -g $(CXXBASEFLAGS)
 else
-CXXTFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS)
+CXXTFLAGS+=-DNDEBUG $(CXXBASEFLAGS)
 endif
 
-ifndef NO_LUA
+LIBS= -L $(prefix)/lib -lscintilla -lscintilla_lexers
+
+ifdef LUA
 LUA_CORE_OBJS = lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
 		lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o \
 		ltable.o ltm.o lundump.o lvm.o lzio.o
@@ -74,7 +67,7 @@ LUA_OBJS = LuaExtension.o $(LUA_CORE_OBJS) $(LUA_LIB_O
 
 vpath %.c $(srcdir)/../lua/src
 
-INCLUDEDIRS=-I $(srcdir)/../../scintilla/include -I $(srcdir)/../src -I$(srcdir)/../lua/src
+INCLUDEDIRS+=-I$(srcdir)/../lua/src
 
 .c.o:
 	$(CC) $(INCLUDEDIRS) $(MISLEADING) -DLUA_USE_POSIX $(CXXTFLAGS) $(CFLAGS) -c $< -o $@
@@ -111,9 +104,6 @@ deps: deps.mak
 deps.mak:
 	$(CXX) -MM $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) $(srcdir)/*.cxx $(srcdir)/../src/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >$@
 
-# make should be run in ../../scintilla/gtk to compile all the lexers.
-COMPLIB=$(srcdir)/../../scintilla/bin/scintilla.a
-
 # To almost make lua.vers (needs header and footer added) which is only needed after updating Lua:
 # nm -g ../bin/SciTE | grep lua | awk '{print "\t\t" $3 ";"}' >lua2.vers
 
@@ -123,7 +113,7 @@ ExportHTML.o ExportPDF.o ExportRTF.o ExportTEX.o Expor
 MatchMarker.o StringHelpers.o \
 PropSetFile.o MultiplexExtension.o DirectorExtension.o SciTEProps.o StyleDefinition.o StyleWriter.o Utf8_16.o \
 	JobQueue.o GTKMutex.o IFaceTable.o $(COMPLIB) $(LUA_OBJS)
-	$(CXX) `$(CONFIGTHREADS)` -rdynamic -Wl,--as-needed -Wl,--version-script $(srcdir)/lua.vers -DGTK $^ -o $@ $(CONFIGLIB) $(LIBDL) $(LDLIBS) -lm -lstdc++
+	$(CXX) `$(CONFIGTHREADS)` $(LIBS) -rdynamic -Wl,--as-needed -Wl,--version-script $(srcdir)/lua.vers -DGTK $^ -o $@ $(CONFIGLIB) $(LIBDL) $(LDLIBS) -lm -lstdc++
 
 # Automatically generate header dependencies with "make deps"
 include deps.mak
@@ -132,19 +122,17 @@ include deps.mak
 # This is OK - just means no SciTE in the Gnome Applications menu
 # Dead:	install -D SciTEGTK.properties $(SYSCONF_PATH)/SciTEGlobal.properties
 install:
-	$(INSTALL) -m 755 -d $(DESTDIR)$(bindir) $(DESTDIR)$(SYSCONF_PATH)
+	$(INSTALL) -m 755 -d $(bindir) $(SYSCONF_PATH)
 
-	$(INSTALL) -m 755 $(PROG) $(DESTDIR)$(bindir)
+	$(INSTALL) -m 755 $(PROG) $(bindir)
+	$(INSTALL) -m 755 -d $(SYSCONF_PATH) $(DOC_PATH)
+	$(INSTALL) -m 444 ../src/*.properties $(SYSCONF_PATH)
+	$(INSTALL) -m 444 ../doc/*.html ../doc/SciTEIco.png ../doc/PrintHi.png $(DOC_PATH)
 
-	for files in $(srcdir)/../src/*.properties $(srcdir)/../doc/*.html $(srcdir)/../doc/SciTEIco.png $(srcdir)/../doc/PrintHi.png; \
-	do \
-		$(INSTALL) -m 644 $$files $(DESTDIR)$(SYSCONF_PATH); \
-	done
-
 ifdef gnomeprefix
 	$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/applications $(DESTDIR)$(pixmapdir)
 	$(INSTALL) -m 644 $(srcdir)/SciTE.desktop $(DESTDIR)$(datadir)/applications/SciTE.desktop
-	$(INSTALL) -m 644 $(srcdir)/Sci48M.png $(DESTDIR)$(pixmapdir)/Sci48M.png
+	$(INSTALL) -m 444 $(srcdir)/Sci48M.png $(DESTDIR)$(pixmapdir)/Sci48M.png
 endif
 
 uninstall:
