patch-src_Makefile 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. $OpenBSD: patch-src_Makefile,v 1.10 2013/03/27 15:33:32 ajacoutot Exp $
  2. --- src/Makefile.orig Mon Mar 18 01:51:31 2013
  3. +++ src/Makefile Wed Mar 27 16:10:39 2013
  4. @@ -1,8 +1,8 @@
  5. # remove -fno-exceptions if it causes problems with stdio library on some platforms (ARM)
  6. -DATADIR=/usr/share/espeak-data
  7. +DATADIR=$(PREFIX)/share/espeak-data
  8. -PREFIX=/usr
  9. +PREFIX ?=/usr
  10. BINDIR=$(PREFIX)/bin
  11. INCDIR=$(PREFIX)/include/espeak
  12. LIBDIR=$(PREFIX)/lib
  13. @@ -12,9 +12,11 @@ BIN_NAME = speak
  14. BIN2_NAME = espeak
  15. LIB_NAME = libespeak.so
  16. STATIC_LIB_NAME = libespeak.a
  17. -LIB_VERSION = 1
  18. -LIBTAG = $(LIB_VERSION).$(RELEASE)
  19. +LIB_VERSION = ${LIBespeak_VERSION}
  20. +LIBTAG = $(LIB_VERSION)
  21. +LPATH= -L${LOCALBASE}/lib -Wl,-R${LOCALBASE}/lib
  22. +
  23. # Use SONAME_OPT=-Wl,h, on Solaris
  24. SONAME_OPT=-Wl,-soname,
  25. @@ -45,7 +47,7 @@ USE_AUDIO=-DUSE_PULSEAUDIO
  26. else
  27. ifeq ($(AUDIO),portaudio)
  28. WAVE=wave.cpp
  29. -LIB_AUDIO=-lportaudio
  30. +LIB_AUDIO=-L$(LOCALBASE)/lib -lportaudio
  31. USE_AUDIO=-DUSE_PORTAUDIO
  32. else
  33. ifeq ($(AUDIO),portaudio0)
  34. @@ -91,9 +93,8 @@ LIBS2=-lstdc++ $(LIB_AUDIO) -lpthread
  35. SRCS3 = espeak.cpp
  36. OBJS3=$(patsubst %.cpp,%.o,$(SRCS3))
  37. -LIBS3=-lstdc++ -L . -lespeak
  38. +LIBS3=-lstdc++ -L . -lespeak -L${LOCALBASE}/lib
  39. -CXXFLAGS=-O2
  40. all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME)
  41. @@ -102,7 +103,7 @@ all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2
  42. $(CXX) $(CXXFLAGS) $(USE_AUDIO) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -pedantic -I. -c -fno-exceptions $<
  43. $(BIN_NAME): $(OBJS1)
  44. - $(CXX) $(LDFLAGS) -o $@ $(OBJS1) $(LIBS1)
  45. + $(CXX) $(LDFLAGS) -o $@ $(EXTRA_FLAGS) $(OBJS1) $(LIBS1)
  46. $(BIN2_NAME): $(OBJS3) $(LIB_NAME)
  47. $(CXX) $(LDFLAGS) -o $@ $(OBJS3) $(LIBS3)
  48. @@ -110,15 +111,13 @@ $(BIN2_NAME): $(OBJS3) $(LIB_NAME)
  49. x_%.o: %.cpp
  50. - $(CXX) $(CXXFLAGS) $(USE_AUDIO) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -fpic -fvisibility=hidden -pedantic \
  51. + $(CXX) $(CXXFLAGS) $(USE_AUDIO) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -fPIC -DPIC -pedantic \
  52. -I. -D LIBRARY -c -fno-exceptions $< -o x_$*.o
  53. $(LIB_NAME): $(OBJS2)
  54. - $(CXX) $(LDFLAGS) -shared $(SONAME_OPT)$(LIB_NAME).$(LIB_VERSION) -o $@ \
  55. - $(OBJS2) $(LIBS2)
  56. + $(CXX) $(LDFLAGS) -shared -fPIC -o $@ \
  57. + $(OBJS2) $(LIBS2) $(EXTRA_FLAGS)
  58. mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG)
  59. - $(LN_SF) $(LIB_NAME).$(LIBTAG) $(LIB_NAME).$(LIB_VERSION)
  60. - $(LN_SF) $(LIB_NAME).$(LIB_VERSION) $(LIB_NAME)
  61. $(STATIC_LIB_NAME): $(OBJS2)
  62. $(AR) cqs $(STATIC_LIB_NAME) $(OBJS2)
  63. @@ -144,10 +143,8 @@ install: all
  64. $(INSTALL) -m 755 $(LIB_NAME).$(LIBTAG) $(DESTDIR)$(LIBDIR)
  65. # Install static library
  66. $(INSTALL) -m 755 $(STATIC_LIB_NAME) $(DESTDIR)$(LIBDIR)
  67. - $(LN_SF) $(LIB_NAME).$(LIBTAG) $(DESTDIR)$(LIBDIR)/$(LIB_NAME).$(LIB_VERSION)
  68. - $(LN_SF) $(LIB_NAME).$(LIB_VERSION) $(DESTDIR)$(LIBDIR)/$(LIB_NAME)
  69. # Install development headers
  70. $(INSTALL) -pm 644 speak_lib.h $(DESTDIR)$(INCDIR)
  71. # Install data files
  72. - cp -prf ../espeak-data/* $(DESTDIR)$(DATADIR)
  73. + cp -pRf ../espeak-data/* $(DESTDIR)$(DATADIR)