[Debian-med-packaging] Bug#919490: praat FTCBFS: many reasons

Helmut Grohne helmut at subdivi.de
Wed Jan 16 16:27:15 GMT 2019


Source: praat
Version: 6.0.46-3
Tags: patch
User: helmutg at debian.org
Usertags: rebootstrap

praat fails to cross build from source for a fair number of reasons. The
most obvious is debian/rules hard coding the build architecture
pkg-config. It also uses make's default of CC which happens to be wrong
for cross compilation. dpkg's buildtools.mk fixes both. Then, the
upstream Makefiles stuff flags into CC and CXX. Since dh_auto_build
substitutes these variables, the relevant flags get lost.  We need to
move them to CFLAGS and CXXFLAGS respectively. The upstream Makefiles
also hard code the build architecture pkg-config. The attached patch
works through all these failures and ultimately makes praat cross
buildable. Please consider applying it.

Helmut
-------------- next part --------------
diff --minimal -Nru praat-6.0.46/debian/changelog praat-6.0.46/debian/changelog
--- praat-6.0.46/debian/changelog	2019-01-07 14:06:18.000000000 +0100
+++ praat-6.0.46/debian/changelog	2019-01-16 16:43:08.000000000 +0100
@@ -1,3 +1,14 @@
+praat (6.0.46-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + debian/rules: seed build tools from dpkg's buildtools.mk
+    + cross.patch: Allow substituting pkg-config.
+    + cross.patch: Don't stuff flags into $(CC) or $(CXX).
+    + cross.patch: Default LINK to $(CXX).
+
+ -- Helmut Grohne <helmut at subdivi.de>  Wed, 16 Jan 2019 16:43:08 +0100
+
 praat (6.0.46-3) unstable; urgency=medium
 
   * d/p/show-fc-discrimant-test.patch: Drop patch
diff --minimal -Nru praat-6.0.46/debian/mk-vars-hardening praat-6.0.46/debian/mk-vars-hardening
--- praat-6.0.46/debian/mk-vars-hardening	2017-11-30 06:08:10.000000000 +0100
+++ praat-6.0.46/debian/mk-vars-hardening	2019-01-16 16:43:08.000000000 +0100
@@ -1,2 +1,2 @@
 CFLAGS += $(shell dpkg-buildflags  --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
-CXXFLAGS = $(CFLAGS) -Wshadow $(shell dpkg-buildflags --get CXXFLAGS)
+CXXFLAGS += $(shell dpkg-buildflags --get CXXFLAGS)
diff --minimal -Nru praat-6.0.46/debian/patches/cross.patch praat-6.0.46/debian/patches/cross.patch
--- praat-6.0.46/debian/patches/cross.patch	1970-01-01 01:00:00.000000000 +0100
+++ praat-6.0.46/debian/patches/cross.patch	2019-01-16 16:43:08.000000000 +0100
@@ -0,0 +1,185 @@
+--- praat-6.0.46.orig/makefiles/makefile.defs.linux.alsa
++++ praat-6.0.46/makefiles/makefile.defs.linux.alsa
+@@ -3,19 +3,23 @@
+ # System: Linux
+ # Paul Boersma, 3 August 2018
+ 
+-CC = gcc -std=gnu99
++CC = gcc
+ 
+-CXX = g++ -std=c++17
++CXX = g++
+ 
+-CFLAGS = -DUNIX -Dlinux -DALSA -D_FILE_OFFSET_BITS=64 `pkg-config --cflags gtk+-2.0` -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O1 -g1 -pthread
++PKG_CONFIG ?= pkg-config
+ 
+-CXXFLAGS = $(CFLAGS) -Wshadow
++COMMON_CFLAGS = -DUNIX -Dlinux -DALSA -D_FILE_OFFSET_BITS=64 `$(PKG_CONFIG) --cflags gtk+-2.0` -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O1 -g1 -pthread
+ 
+-LINK = g++
++CFLAGS = -std=gnu99 $(COMMON_CFLAGS)
++
++CXXFLAGS = -std=c++17 $(COMMON_CFLAGS) -Wshadow
++
++LINK = $(CXX)
+ 
+ EXECUTABLE = praat
+ 
+-LIBS = `pkg-config --libs gtk+-2.0` -lm -lasound -lpthread
++LIBS = `$(PKG_CONFIG) --libs gtk+-2.0` -lm -lasound -lpthread
+ 
+ AR = ar
+ RANLIB = ls
+--- praat-6.0.46.orig/makefiles/makefile.defs.linux.jack
++++ praat-6.0.46/makefiles/makefile.defs.linux.jack
+@@ -3,19 +3,23 @@
+ # System: Linux
+ # Paul Boersma, 21 October 2018
+ 
+-CC = gcc -std=gnu99
++CC = gcc
+ 
+-CXX = g++ -std=c++17
++CXX = g++
+ 
+-CFLAGS = -DUNIX -Dlinux -DJACK -D_FILE_OFFSET_BITS=64 `pkg-config --cflags gtk+-2.0` -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O1 -g1 -pthread
++PKG_CONFIG ?= pkg-config
+ 
+-CXXFLAGS = $(CFLAGS) -Wshadow
++COMMON_CFLAGS = -DUNIX -Dlinux -DJACK -D_FILE_OFFSET_BITS=64 `$(PKG_CONFIG) --cflags gtk+-2.0` -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O1 -g1 -pthread
+ 
+-LINK = g++
++CFLAGS = -std=gnu99 $(COMMON_CFLAGS)
++
++CXXFLAGS = -std=c++17 $(COMMON_CFLAGS) -Wshadow
++
++LINK = $(CXX)
+ 
+ EXECUTABLE = praat
+ 
+-LIBS = `pkg-config --libs gtk+-2.0` -lm -ljack -lpthread
++LIBS = `$(PKG_CONFIG) --libs gtk+-2.0` -lm -ljack -lpthread
+ 
+ AR = ar
+ RANLIB = ls
+--- praat-6.0.46.orig/makefiles/makefile.defs.linux.nogui
++++ praat-6.0.46/makefiles/makefile.defs.linux.nogui
+@@ -3,19 +3,23 @@
+ # System: Linux without GUI, network, and sound
+ # Paul Boersma, 3 August 2018
+ 
+-CC = gcc -std=gnu99
++CC = gcc
+ 
+-CXX = g++ -std=c++17
++CXX = g++
+ 
+-CFLAGS = -DNO_GUI -DNO_NETWORK -D_FILE_OFFSET_BITS=64 `pkg-config --cflags pangocairo` -DUNIX -Dlinux -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O3 -g1 -pthread
++PKG_CONFIG ?= pkg-config
+ 
+-CXXFLAGS = $(CFLAGS) -Wshadow
++COMMON_CFLAGS = -DNO_GUI -DNO_NETWORK -D_FILE_OFFSET_BITS=64 `$(PKG_CONFIG) --cflags pangocairo` -DUNIX -Dlinux -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O3 -g1 -pthread
+ 
+-LINK = g++
++CFLAGS = -std=gnu99 $(COMMON_CFLAGS)
++
++CXXFLAGS = -std=c++17 $(COMMON_CFLAGS) -Wshadow
++
++LINK = $(CXX)
+ 
+ EXECUTABLE = praat_nogui
+ 
+-LIBS = `pkg-config --libs pangocairo` -lm -lpthread
++LIBS = `$(PKG_CONFIG) --libs pangocairo` -lm -lpthread
+ 
+ AR = ar
+ RANLIB = ls
+--- praat-6.0.46.orig/makefiles/makefile.defs.linux.pulse
++++ praat-6.0.46/makefiles/makefile.defs.linux.pulse
+@@ -3,19 +3,23 @@
+ # System: Linux
+ # David Weenink and Paul Boersma, 23 September 2018
+ 
+-CC = gcc -std=gnu99
++CC = gcc
+ 
+-CXX = g++ -std=c++17
++CXX = g++
+ 
+-CFLAGS = -DUNIX -Dlinux -DALSA -DHAVE_PULSEAUDIO -D_FILE_OFFSET_BITS=64 `pkg-config --cflags gtk+-2.0` -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O3 -g1 -pthread
++PKG_CONFIG ?= pkg-config
+ 
+-CXXFLAGS = $(CFLAGS) -Wshadow
++COMMON_CFLAGS = -DUNIX -Dlinux -DALSA -DHAVE_PULSEAUDIO -D_FILE_OFFSET_BITS=64 `$(PKG_CONFIG) --cflags gtk+-2.0` -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O3 -g1 -pthread
+ 
+-LINK = g++
++CFLAGS = -std=gnu99 $(COMMON_CFLAGS)
++
++CXXFLAGS = -std=c++17 $(COMMON_CFLAGS) -Wshadow
++
++LINK = $(CXX)
+ 
+ EXECUTABLE = praat
+ 
+-LIBS = `pkg-config --libs gtk+-2.0` -lm -lpulse -lasound -lpthread
++LIBS = `$(PKG_CONFIG) --libs gtk+-2.0` -lm -lpulse -lasound -lpthread
+ 
+ AR = ar
+ RANLIB = ls
+--- praat-6.0.46.orig/makefiles/makefile.defs.linux.silent
++++ praat-6.0.46/makefiles/makefile.defs.linux.silent
+@@ -3,19 +3,23 @@
+ # System: Linux without sound
+ # Paul Boersma, 3 August 2018
+ 
+-CC = gcc -std=gnu99
++CC = gcc
+ 
+-CXX = g++ -std=c++17
++CXX = g++
+ 
+-CFLAGS = -D_FILE_OFFSET_BITS=64 -DUNIX -Dlinux `pkg-config --cflags gtk+-2.0` -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O1 -g1 -pthread
++PKG_CONFIG ?= pkg-config
+ 
+-CXXFLAGS = $(CFLAGS) -Wshadow
++COMMON_CFLAGS = -D_FILE_OFFSET_BITS=64 -DUNIX -Dlinux `$(PKG_CONFIG) --cflags gtk+-2.0` -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O1 -g1 -pthread
+ 
+-LINK = g++
++CFLAGS = -std=gnu99 $(COMMON_CFLAGS)
++
++CXXFLAGS = -std=c++17 $(COMMON_CFLAGS) -Wshadow
++
++LINK = $(CXX)
+ 
+ EXECUTABLE = praat
+ 
+-LIBS = `pkg-config --libs gtk+-2.0` -lm -lpthread -static-libgcc -static-libstdc++
++LIBS = `$(PKG_CONFIG) --libs gtk+-2.0` -lm -lpthread -static-libgcc -static-libstdc++
+ 
+ AR = ar
+ RANLIB = ls
+--- praat-6.0.46.orig/makefiles/makefile.defs.linux.barren
++++ praat-6.0.46/makefiles/makefile.defs.linux.barren
+@@ -3,15 +3,17 @@
+ # System: Linux without GUI, network, graphics, and sound
+ # Paul Boersma, 3 August 2018
+ 
+-CC = gcc -std=gnu99
++CC = gcc
+ 
+-CXX = g++ -std=c++17
++CXX = g++
+ 
+-CFLAGS = -DNO_GRAPHICS -DNO_NETWORK -D_FILE_OFFSET_BITS=64 -DUNIX -Dlinux -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O3 -g1 -pthread
++COMMON_CFLAGS = -DNO_GRAPHICS -DNO_NETWORK -D_FILE_OFFSET_BITS=64 -DUNIX -Dlinux -Werror=missing-prototypes -Werror=implicit -Wreturn-type -Wunused -Wunused-parameter -Wuninitialized -O3 -g1 -pthread
+ 
+-CXXFLAGS = $(CFLAGS) -Wshadow
++CFLAGS = -std=gnu99 $(COMMON_CFLAGS)
+ 
+-LINK = g++
++CXXFLAGS = -std=c++17 $(COMMON_CFLAGS) -Wshadow
++
++LINK = $(CXX)
+ 
+ EXECUTABLE = praat_barren
+ 
diff --minimal -Nru praat-6.0.46/debian/patches/series praat-6.0.46/debian/patches/series
--- praat-6.0.46/debian/patches/series	2019-01-07 14:05:12.000000000 +0100
+++ praat-6.0.46/debian/patches/series	2019-01-16 16:43:08.000000000 +0100
@@ -1,3 +1,4 @@
 use-ldflags.patch
 remove-time-date-macros.patch
 fix-procrustes-unit-test.patch
+cross.patch
diff --minimal -Nru praat-6.0.46/debian/rules praat-6.0.46/debian/rules
--- praat-6.0.46/debian/rules	2018-09-12 08:28:50.000000000 +0200
+++ praat-6.0.46/debian/rules	2019-01-16 16:38:49.000000000 +0100
@@ -15,7 +15,9 @@
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
-DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+include /usr/share/dpkg/architecture.mk
+-include /usr/share/dpkg/buildtools.mk
+PKG_CONFIG ?= pkg-config
 
 ifneq (,$(filter $(DEB_HOST_ARCH), i386))
     export DEB_CXXFLAGS_MAINT_APPEND=-ffloat-store
@@ -64,7 +66,7 @@
 		$(shell dpkg-buildflags --get LDFLAGS)		\
 		-Wl,--as-needed -std=gnu99 -DSTAND_ALONE -DUNIX	\
 		-o sendpraat sys/sendpraat.c			\
-		$(shell pkg-config --cflags --libs gtk+-2.0)
+		$(shell $(PKG_CONFIG) --cflags --libs gtk+-2.0)
 
 override_dh_auto_build: sendpraat praat.1 praat_nogui.1 sendpraat.1 praat-open-files.1
 	dh_auto_build


More information about the Debian-med-packaging mailing list