File praat-use_system_libs.patch of Package praat

From: Luigi Baldoni <aloisio@gmx.com>
Date: 2017-07-29 13:47:50 +0200
Subject: Use system libraries when possible

Praat includes a number of external libraries that then builds
internally.
Some (gsl, glpk and portaudio) can be replaced by system ones,
other like espeak and FLAC are too heavily patched for the program
to be compatible with upstream ones.

Index: praat-6.0.36/fon/SoundRecorder.h
===================================================================
--- praat-6.0.36.orig/fon/SoundRecorder.h
+++ praat-6.0.36/fon/SoundRecorder.h
@@ -25,7 +25,7 @@
 
 #include "SoundRecorder_enums.h"
 
-#include "../external/portaudio/portaudio.h"
+#include <portaudio.h>
 #if defined (_WIN32)
 #elif defined (macintosh)
 #elif defined (linux)
Index: praat-6.0.36/fon/Sound_audio.cpp
===================================================================
--- praat-6.0.36.orig/fon/Sound_audio.cpp
+++ praat-6.0.36/fon/Sound_audio.cpp
@@ -28,7 +28,7 @@
 #include "Preferences.h"
 
 
-#include "../external/portaudio/portaudio.h"
+#include <portaudio.h>
 
 #if defined (macintosh)
 	#include "macport_on.h"
Index: praat-6.0.36/num/NUMlinprog.cpp
===================================================================
--- praat-6.0.36.orig/num/NUMlinprog.cpp
+++ praat-6.0.36/num/NUMlinprog.cpp
@@ -17,7 +17,7 @@
  */
 
 #include "melder.h"
-#include "../external/glpk/glpk.h"
+#include <glpk.h>
 
 struct structNUMlinprog {
 	glp_prob *linearProgram;
Index: praat-6.0.36/sys/melder_audio.cpp
===================================================================
--- praat-6.0.36.orig/sys/melder_audio.cpp
+++ praat-6.0.36/sys/melder_audio.cpp
@@ -46,7 +46,7 @@
 #include "melder.h"
 #include <time.h>
 
-#include "../external/portaudio/portaudio.h"
+#include <portaudio.h>
 
 #ifdef HAVE_PULSEAUDIO
 	void pulseAudio_initialize ();
Index: praat-6.0.36/dwsys/Makefile
===================================================================
--- praat-6.0.36.orig/dwsys/Makefile
+++ praat-6.0.36/dwsys/Makefile
@@ -4,7 +4,7 @@
 
 include ../makefile.defs
 
-CPPFLAGS =  -I ../stat -I ../sys -I ../external/gsl -I ../kar
+CPPFLAGS =  -I ../stat -I ../sys -I /usr/include/gsl -I ../kar
 
 all: libdwsys.a
 
@@ -33,5 +33,5 @@ libdwsys.a: $(OBJECTS) NUMmachar.o
 	$(AR) cq libdwsys.a $(OBJECTS)
 	$(RANLIB) libdwsys.a
 
-$(OBJECTS): *.h ../stat/*.h ../sys/*.h ../external/gsl/*.h ../dwsys/*.h ../kar/*.h
+$(OBJECTS): *.h ../stat/*.h ../sys/*.h /usr/include/gsl/*.h ../dwsys/*.h ../kar/*.h
 
Index: praat-6.0.36/contrib/ola/Makefile
===================================================================
--- praat-6.0.36.orig/contrib/ola/Makefile
+++ praat-6.0.36/contrib/ola/Makefile
@@ -4,7 +4,7 @@
 
 include ../../makefile.defs
 
-CPPFLAGS = -I ../../kar -I ../../sys -I ../../FFNet -I ../../dwtools -I ../../fon -I ../../dwsys -I ../../stat -I ../../external/gsl -D_DEBUG -D_REENTRANT
+CPPFLAGS = -I ../../kar -I ../../sys -I ../../FFNet -I ../../dwtools -I ../../fon -I ../../dwsys -I ../../stat -I /usr/include/gsl -D_DEBUG -D_REENTRANT
 
 OBJECTS = KNN.o \
    KNN_threads.o Pattern_to_Categories_cluster.o KNN_prune.o FeatureWeights.o praat_contrib_Ola_KNN.o manual_KNN.o
@@ -23,4 +23,4 @@ libOla.a: $(OBJECTS)
 	$(AR) cq libOla.a $(OBJECTS)
 	$(RANLIB) libOla.a
 
-$(OBJECTS): *.h ../../kar/*.h ../../sys/*.h ../../FFNet/*.h ../../dwtools/*.h ../../fon/*.h ../../dwsys/*.h ../../stat/*.h ../../external/gsl/*.h
+$(OBJECTS): *.h ../../kar/*.h ../../sys/*.h ../../FFNet/*.h ../../dwtools/*.h ../../fon/*.h ../../dwsys/*.h ../../stat/*.h /usr/include/gsl/*.h
Index: praat-6.0.36/dwtools/VowelEditor.cpp
===================================================================
--- praat-6.0.36.orig/dwtools/VowelEditor.cpp
+++ praat-6.0.36/dwtools/VowelEditor.cpp
@@ -55,7 +55,7 @@ trajectory --> path ????
 
 #include "FormantGrid.h"
 #include "KlattGrid.h"
-#include "../external/portaudio/portaudio.h"
+#include <portaudio.h>
 #include "PitchTier_to_PointProcess.h"
 #include "PitchTier_to_Sound.h"
 #include "PointProcess_and_Sound.h"
Index: praat-6.0.36/Makefile
===================================================================
--- praat-6.0.36.orig/Makefile
+++ praat-6.0.36/Makefile
@@ -13,11 +13,8 @@ include makefile.defs
 
 # Makes the Praat executable in the source directory.
 all:
-	$(MAKE) -C external/gsl
-	$(MAKE) -C external/glpk
 	$(MAKE) -C external/mp3
 	$(MAKE) -C external/flac
-	$(MAKE) -C external/portaudio
 	$(MAKE) -C external/espeak
 	$(MAKE) -C kar
 	$(MAKE) -C num
@@ -40,9 +37,9 @@ all:
 		fon/libfon.a stat/libstat.a dwsys/libdwsys.a \
 		sys/libsys.a num/libnum.a kar/libkar.a \
 		external/espeak/libespeak.a \
-		external/portaudio/libportaudio.a \
+		`pkg-config --libs portaudio-2.0` `pkg-config --libs gtk+-2.0` \
 		external/flac/libflac.a external/mp3/libmp3.a \
-		external/glpk/libglpk.a external/gsl/libgsl.a \
+		`pkg-config --libs libpulse` -lglpk `pkg-config --libs gsl` \
 		$(LIBS)
 
 clean:
openSUSE Build Service is sponsored by