openbsd-ports/editors/scintilla/patches/patch-gtk_makefile
aanriot da066535a6 - SHARED_LIBS.
ok espie@
2005-12-27 12:36:50 +00:00

105 lines
3.1 KiB
Plaintext

--- gtk/makefile.orig 2003-08-10 04:55:54.000000000 -0600
+++ gtk/makefile 2004-06-12 23:19:17.000000000 -0600
@@ -5,7 +5,7 @@
# GNU make does not like \r\n line endings so should be saved to CVS in binary form.
# To build for GTK+ 2, define GTK2 on the make command line.
-.SUFFIXES: .cxx .o .h .a
+.SUFFIXES: .cxx .o .h .a .so
CC = g++
AR = ar
RANLIB = touch
@@ -16,13 +16,16 @@ AR = ar
RANLIB = ranlib
endif
-COMPLIB=../bin/scintilla.a
+COMPLIB=../bin/libscintilla.a
+LEXERLIB=../bin/libscintilla_lexers.a
+SHAREDLIB=../bin/libscintilla.so.${LIBscintilla_VERSION}
+SHAREDLEXER=../bin/libscintilla_lexers.so.${LIBscintilla_lexers_VERSION}
vpath %.h ../src ../include
vpath %.cxx ../src
INCLUDEDIRS=-I ../include -I ../src
-CXXBASEFLAGS=-W -Wall -DGTK -DSCI_LEXER $(INCLUDEDIRS)
+CXXBASEFLAGS=-W -Wall -DGTK -DSCI_LEXER -Dunix $(INCLUDEDIRS)
ifdef NOTHREADS
THREADFLAGS=-DG_THREADS_IMPL_NONE
@@ -33,7 +36,7 @@ endif
ifdef DEBUG
CXXFLAGS=-DDEBUG -g $(CXXBASEFLAGS) $(THREADFLAGS)
else
-CXXFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS)
+CXXFLAGS+=-DNDEBUG $(CXXBASEFLAGS) $(THREADFLAGS)
endif
ifdef GTK2
@@ -43,7 +46,9 @@ CONFIGFLAGS=gtk-config --cflags
endif
.cxx.o:
- $(CC) `$(CONFIGFLAGS)` $(CXXFLAGS) -c $<
+ $(CXX) `$(CONFIGFLAGS)` $(CXXFLAGS) -c $<
+.cxx.so:
+ $(CXX) -fPIC `$(CONFIGFLAGS)` $(CXXFLAGS) -o $@ -c $<
#++Autogenerated -- run src/LexGen.py to regenerate
#**LEXOBJS=\\\n\(\*.o \)
@@ -57,20 +62,50 @@ LexSQL.o LexVB.o
# The LEXOBJS have to be treated specially as the functions in them are not called from external code
-all: $(COMPLIB) $(LEXOBJS)
+ifeq (${NO_SHARED_LIBS},"yes")
+all: static
+else
+all: static shared
+endif
+
+static: $(COMPLIB) $(LEXERLIB)
+shared: $(SHAREDLIB) $(SHAREDLEXER)
+
+install: install-shared
+ mkdir -p ${PREFIX}/include/scintilla
+ install -m 444 ../include/*.h ${PREFIX}/include/scintilla
+ install -m 444 ${COMPLIB} ${LEXERLIB} ${PREFIX}/lib
+
+ifeq (${NO_SHARED_LIBS},"yes")
+install-shared:
+else
+install-shared:
+ install -m 444 ${SHAREDLIB} ${SHAREDLEXER} ${PREFIX}/lib
+endif
clean:
rm -f *.o $(COMPLIB)
deps:
- $(CC) -MM `$(CONFIGFLAGS)` $(CXXFLAGS) *.cxx ../src/*.cxx >deps.mak
+ $(CXX) -MM `$(CONFIGFLAGS)` $(CXXFLAGS) *.cxx ../src/*.cxx >deps.mak
-$(COMPLIB): DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o Document.o CallTip.o \
+LIBOBJS = DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o Document.o CallTip.o \
ScintillaBase.o ContractionState.o Editor.o ExternalLexer.o PropSet.o PlatGTK.o \
KeyMap.o LineMarker.o ScintillaGTK.o CellBuffer.o ViewStyle.o \
RESearch.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o
+
+$(COMPLIB): $(LIBOBJS)
+ $(AR) rc $@ $^
+ $(RANLIB) $@
+
+$(LEXERLIB): $(LEXOBJS)
$(AR) rc $@ $^
$(RANLIB) $@
+$(SHAREDLIB): $(addsuffix .so,$(basename $(LIBOBJS)))
+ $(CC) -shared -fPIC -o $@ -Wl,-soname,$(notdir $(SHAREDLIB)) $^
+$(SHAREDLEXER): $(addsuffix .so,$(basename $(LEXOBJS)))
+ $(CC) -shared -fPIC -o $@ -Wl,-soname,$(notdir $(SHAREDLEXER)) $^
+
# Automatically generate header dependencies with "make deps"
include deps.mak