Source: baresip
Version: 0.6.1-1
Tags: patch upstream
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

baresip fails to cross build from source, because the upstream build
system hard codes the build architecture pkg-config. Fixing that
requires touching a fair number of locations. Even then it fails,
because make install needs access to know cross tools, but
dh_auto_install doesn't pass them there. I'm coming to the conclusion
that dh_auto_install should do that and will file a bug there. Here, I'm
only attaching the patch that makes pkg-config substitutable. Please
consider applying it.

Helmut
--- baresip-0.6.1.orig/Makefile
+++ baresip-0.6.1/Makefile
@@ -39,12 +39,13 @@
 endif
 
 include $(LIBRE_MK)
+PKG_CONFIG ?= pkg-config
 include mk/modules.mk
 
 ifndef LIBREM_PATH
 LIBREM_PATH	:= $(shell [ -d ../rem ] && echo "../rem")
 endif
-LIBREM_CFLAGS := $(or $(shell pkg-config --cflags librem),\
+LIBREM_CFLAGS := $(or $(shell $(PKG_CONFIG) --cflags librem),\
  -I$(SYSROOT)/local/include/rem -I$(SYSROOT)/include/rem)
 
 
--- baresip-0.6.1.orig/mk/modules.mk
+++ baresip-0.6.1/mk/modules.mk
@@ -69,7 +69,7 @@
 
 USE_ALSA  := $(shell echo '\#include <alsa/asoundlib.h>' | \
 	$(CC) -E - >/dev/null 2>&1 && echo yes)
-USE_AMR   := $(shell pkg-config --exists opencore-amrnb && echo "yes")
+USE_AMR   := $(shell $(PKG_CONFIG) --exists opencore-amrnb && echo "yes")
 ifeq ($(USE_AMR),)
 USE_AMR   := $(shell [ -d $(SYSROOT)/include/opencore-amrnb ] || \
 	[ -d $(SYSROOT_ALT)/include/opencore-amrnb ] || \
@@ -80,7 +80,7 @@
 	$(CC) -E - >/dev/null 2>&1 && echo yes)
 USE_AVFORMAT := $(shell echo '\#include <libavformat/avformat.h>' | \
 	$(CC) -E - >/dev/null 2>&1 && echo yes)
-USE_AVAHI := $(shell pkg-config --exists avahi-client && echo "yes")
+USE_AVAHI := $(shell $(PKG_CONFIG) --exists avahi-client && echo "yes")
 USE_BV32  := $(shell echo '\#include <bv32/bv32.h' | \
 	$(CC) -E - >/dev/null 2>&1 && echo yes)
 USE_CAIRO  := $(shell echo '\#include <cairo/cairo.h>' |\
@@ -97,15 +97,15 @@
 	$(CC) -E - >/dev/null 2>&1 && echo yes)
 USE_GSM := $(shell echo '\#include <gsm.h>' | \
 	$(CC) -E - >/dev/null 2>&1 && echo yes)
-USE_GST := $(shell pkg-config --exists gstreamer-0.10 && echo "yes")
-USE_GST1 := $(shell pkg-config --exists gstreamer-1.0 && echo "yes")
+USE_GST := $(shell $(PKG_CONFIG) --exists gstreamer-0.10 && echo "yes")
+USE_GST1 := $(shell $(PKG_CONFIG) --exists gstreamer-1.0 && echo "yes")
 USE_GST_VIDEO := \
-	$(shell pkg-config --exists gstreamer-0.10 gstreamer-app-0.10 \
+	$(shell $(PKG_CONFIG) --exists gstreamer-0.10 gstreamer-app-0.10 \
 		&& echo "yes")
-USE_GST_VIDEO1 := $(shell pkg-config --exists gstreamer-1.0 gstreamer-app-1.0 \
+USE_GST_VIDEO1 := $(shell $(PKG_CONFIG) --exists gstreamer-1.0 gstreamer-app-1.0 \
 		&& echo "yes")
-USE_GTK := $(shell pkg-config 'gtk+-2.0 >= 2.22' && \
-		   pkg-config 'glib-2.0 >= 2.32' && echo "yes")
+USE_GTK := $(shell $(PKG_CONFIG) 'gtk+-2.0 >= 2.22' && \
+		   $(PKG_CONFIG) 'glib-2.0 >= 2.32' && echo "yes")
 ifneq ($(USE_AVCODEC),)
 USE_H265  := $(shell echo '\#include <x265.h>' | \
 	$(CC) -E - >/dev/null 2>&1 && echo yes)
@@ -129,7 +129,7 @@
 	$(CC) -E - >/dev/null 2>&1 && echo yes)
 USE_PORTAUDIO := $(shell echo '\#include <portaudio.h>' | \
 	$(CC) -E - >/dev/null 2>&1 && echo yes)
-USE_PULSE := $(shell pkg-config --exists libpulse && echo "yes")
+USE_PULSE := $(shell $(PKG_CONFIG) --exists libpulse && echo "yes")
 USE_SDL  := $(shell echo '\#include <SDL/SDL.h>' | \
 	$(CC) -E - >/dev/null 2>&1 && echo yes)
 USE_SDL2  := $(shell echo '\#include <SDL2/SDL.h>' | \
@@ -138,7 +138,7 @@
 	$(CC) -E - >/dev/null 2>&1 && echo yes)
 USE_STDIO := $(shell echo '\#include <termios.h>' | \
 	$(CC) -E - >/dev/null 2>&1 && echo yes)
-HAVE_SPEEXDSP := $(shell pkg-config --exists speexdsp && echo "yes")
+HAVE_SPEEXDSP := $(shell $(PKG_CONFIG) --exists speexdsp && echo "yes")
 ifeq ($(HAVE_SPEEXDSP),)
 HAVE_SPEEXDSP := $(shell \
 	[ -f $(SYSROOT)/local/lib/libspeexdsp$(LIB_SUFFIX) ] || \
@@ -229,7 +229,7 @@
 endif
 
 ifneq ($(USE_GTK),)
-USE_LIBNOTIFY := $(shell pkg-config 'libnotify glib-2.0 < 2.40' && echo "yes")
+USE_LIBNOTIFY := $(shell $(PKG_CONFIG) 'libnotify glib-2.0 < 2.40' && echo "yes")
 endif
 
 endif
@@ -413,7 +413,7 @@
 endif
 ifneq ($(USE_VPX),)
 MODULES   += vp8
-MODULES   += $(shell pkg-config 'vpx >= 1.3.0' && echo "vp9")
+MODULES   += $(shell $(PKG_CONFIG) 'vpx >= 1.3.0' && echo "vp9")
 endif
 ifneq ($(USE_WINWAVE),)
 MODULES   += winwave
--- baresip-0.6.1.orig/modules/amr/module.mk
+++ baresip-0.6.1/modules/amr/module.mk
@@ -8,9 +8,9 @@
 $(MOD)_SRCS	+= amr.c sdp.c
 
 
-ifneq ($(shell pkg-config --exists opencore-amrnb && echo "yes"),)
-$(MOD)_CFLAGS	+= -DAMR_NB=1 $(shell pkg-config --cflags opencore-amrnb)
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs opencore-amrnb)
+ifneq ($(shell $(PKG_CONFIG) --exists opencore-amrnb && echo "yes"),)
+$(MOD)_CFLAGS	+= -DAMR_NB=1 $(shell $(PKG_CONFIG) --cflags opencore-amrnb)
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs opencore-amrnb)
 else
 ifneq ($(shell [ -d $(SYSROOT)/include/opencore-amrnb ] && echo 1 ),)
 $(MOD)_CFLAGS	+= -DAMR_NB=1 -I$(SYSROOT)/include/opencore-amrnb
@@ -34,9 +34,9 @@
 endif
 
 
-ifneq ($(shell pkg-config --exists vo-amrwbenc && echo "yes"),)
-$(MOD)_CFLAGS	+= -DAMR_WB=1 $(shell pkg-config --cflags vo-amrwbenc)
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs vo-amrwbenc)
+ifneq ($(shell $(PKG_CONFIG) --exists vo-amrwbenc && echo "yes"),)
+$(MOD)_CFLAGS	+= -DAMR_WB=1 $(shell $(PKG_CONFIG) --cflags vo-amrwbenc)
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs vo-amrwbenc)
 else
 ifneq ($(shell [ -f $(SYSROOT_ALT)/include/opencore-amrwb/enc_if.h ] && \
 	echo 1 ),)
@@ -62,9 +62,9 @@
 
 
 # extra for decoder
-ifneq ($(shell pkg-config --exists opencore-amrwb && echo "yes"),)
-$(MOD)_CFLAGS	+= $(shell pkg-config --cflags opencore-amrwb)
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs opencore-amrwb)
+ifneq ($(shell $(PKG_CONFIG) --exists opencore-amrwb && echo "yes"),)
+$(MOD)_CFLAGS	+= $(shell $(PKG_CONFIG) --cflags opencore-amrwb)
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs opencore-amrwb)
 else
 ifneq ($(shell [ -f $(SYSROOT)/include/opencore-amrwb/dec_if.h ] && echo 1 ),)
 $(MOD)_CFLAGS	+= -I$(SYSROOT)/include/opencore-amrwb
--- baresip-0.6.1.orig/modules/avahi/module.mk
+++ baresip-0.6.1/modules/avahi/module.mk
@@ -6,7 +6,7 @@
 
 MOD		:= avahi
 $(MOD)_SRCS	+= avahi.c
-$(MOD)_LFLAGS   += $(shell pkg-config --libs avahi-client)
-$(MOD)_CFLAGS   += $(shell pkg-config --cflags avahi-client)
+$(MOD)_LFLAGS   += $(shell $(PKG_CONFIG) --libs avahi-client)
+$(MOD)_CFLAGS   += $(shell $(PKG_CONFIG) --cflags avahi-client)
 
 include mk/mod.mk
--- baresip-0.6.1.orig/modules/cairo/module.mk
+++ baresip-0.6.1/modules/cairo/module.mk
@@ -6,7 +6,7 @@
 
 MOD		:= cairo
 $(MOD)_SRCS	+= cairo.c
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs cairo)
-$(MOD)_CFLAGS	+= $(shell pkg-config --cflags cairo)
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs cairo)
+$(MOD)_CFLAGS	+= $(shell $(PKG_CONFIG) --cflags cairo)
 
 include mk/mod.mk
--- baresip-0.6.1.orig/modules/directfb/module.mk
+++ baresip-0.6.1/modules/directfb/module.mk
@@ -7,8 +7,8 @@
 
 MOD                := directfb
 $(MOD)_SRCS        += directfb.c
-$(MOD)_LFLAGS      += $(shell pkg-config --libs directfb)
-$(MOD)_CFLAGS      += $(shell pkg-config --cflags directfb \
+$(MOD)_LFLAGS      += $(shell $(PKG_CONFIG) --libs directfb)
+$(MOD)_CFLAGS      += $(shell $(PKG_CONFIG) --cflags directfb \
 			| sed -e 's/-I/-isystem/g')
 
 include mk/mod.mk
--- baresip-0.6.1.orig/modules/gst/module.mk
+++ baresip-0.6.1/modules/gst/module.mk
@@ -6,8 +6,8 @@
 
 MOD		:= gst
 $(MOD)_SRCS	+= gst.c dump.c
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs gstreamer-0.10)
-$(MOD)_CFLAGS	+= $(shell pkg-config --cflags gstreamer-0.10 | \
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs gstreamer-0.10)
+$(MOD)_CFLAGS	+= $(shell $(PKG_CONFIG) --cflags gstreamer-0.10 | \
 	sed -e 's/-I/-isystem/g')
 
 include mk/mod.mk
--- baresip-0.6.1.orig/modules/gst1/module.mk
+++ baresip-0.6.1/modules/gst1/module.mk
@@ -6,8 +6,8 @@
 
 MOD		:= gst1
 $(MOD)_SRCS	+= gst.c
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs gstreamer-1.0)
-$(MOD)_CFLAGS	+= $(shell pkg-config --cflags gstreamer-1.0)
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs gstreamer-1.0)
+$(MOD)_CFLAGS	+= $(shell $(PKG_CONFIG) --cflags gstreamer-1.0)
 $(MOD)_CFLAGS	+= -Wno-cast-align
 
 include mk/mod.mk
--- baresip-0.6.1.orig/modules/gst_video/module.mk
+++ baresip-0.6.1/modules/gst_video/module.mk
@@ -6,9 +6,9 @@
 
 MOD		:= gst_video
 $(MOD)_SRCS	+= gst_video.c encode.c sdp.c
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs gstreamer-0.10 gstreamer-app-0.10)
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs gstreamer-0.10 gstreamer-app-0.10)
 $(MOD)_CFLAGS   += \
-	$(shell pkg-config --cflags gstreamer-0.10 gstreamer-app-0.10 | \
+	$(shell $(PKG_CONFIG) --cflags gstreamer-0.10 gstreamer-app-0.10 | \
 	sed -e 's/-I/-isystem/g')
 
 include mk/mod.mk
--- baresip-0.6.1.orig/modules/gst_video1/module.mk
+++ baresip-0.6.1/modules/gst_video1/module.mk
@@ -6,8 +6,8 @@
 
 MOD		:= gst_video1
 $(MOD)_SRCS	+= gst_video.c encode.c sdp.c
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs gstreamer-1.0 gstreamer-app-1.0)
-$(MOD)_CFLAGS   += $(shell pkg-config --cflags gstreamer-1.0 gstreamer-app-1.0)
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs gstreamer-1.0 gstreamer-app-1.0)
+$(MOD)_CFLAGS   += $(shell $(PKG_CONFIG) --cflags gstreamer-1.0 gstreamer-app-1.0)
 $(MOD)_CFLAGS	+= -Wno-cast-align
 
 include mk/mod.mk
--- baresip-0.6.1.orig/modules/gtk/module.mk
+++ baresip-0.6.1/modules/gtk/module.mk
@@ -8,9 +8,9 @@
 MOD		:= gtk
 $(MOD)_SRCS	+= gtk_mod.c call_window.c dial_dialog.c transfer_dialog.c \
 	uri_entry.c
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs gtk+-2.0 $($(MOD)_EXTRA))
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs gtk+-2.0 $($(MOD)_EXTRA))
 $(MOD)_CFLAGS	+= \
-	$(shell pkg-config --cflags gtk+-2.0 $($(MOD)_EXTRA) | \
+	$(shell $(PKG_CONFIG) --cflags gtk+-2.0 $($(MOD)_EXTRA) | \
 		sed -e 's/-I/-isystem/g' )
 $(MOD)_CFLAGS	+= -Wno-strict-prototypes
 
--- baresip-0.6.1.orig/modules/jack/module.mk
+++ baresip-0.6.1/modules/jack/module.mk
@@ -6,7 +6,7 @@
 
 MOD		:= jack
 $(MOD)_SRCS	+= jack.c jack_play.c jack_src.c
-$(MOD)_CFLAGS	+= $(shell pkg-config --cflags jack)
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs jack)
+$(MOD)_CFLAGS	+= $(shell $(PKG_CONFIG) --cflags jack)
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs jack)
 
 include mk/mod.mk
--- baresip-0.6.1.orig/modules/pulse/module.mk
+++ baresip-0.6.1/modules/pulse/module.mk
@@ -8,7 +8,7 @@
 $(MOD)_SRCS	+= pulse.c
 $(MOD)_SRCS	+= player.c
 $(MOD)_SRCS	+= recorder.c
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs libpulse-simple)
-$(MOD)_CFLAGS	+= $(shell pkg-config --cflags libpulse-simple)
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs libpulse-simple)
+$(MOD)_CFLAGS	+= $(shell $(PKG_CONFIG) --cflags libpulse-simple)
 
 include mk/mod.mk
--- baresip-0.6.1.orig/modules/rst/module.mk
+++ baresip-0.6.1/modules/rst/module.mk
@@ -8,7 +8,7 @@
 $(MOD)_SRCS	+= audio.c
 $(MOD)_SRCS	+= rst.c
 $(MOD)_SRCS	+= video.c
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs cairo libmpg123)
-$(MOD)_CFLAGS	+= $(shell pkg-config --cflags cairo libmpg123)
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs cairo libmpg123)
+$(MOD)_CFLAGS	+= $(shell $(PKG_CONFIG) --cflags cairo libmpg123)
 
 include mk/mod.mk
--- baresip-0.6.1.orig/modules/vidinfo/module.mk
+++ baresip-0.6.1/modules/vidinfo/module.mk
@@ -6,7 +6,7 @@
 
 MOD		:= vidinfo
 $(MOD)_SRCS	+= vidinfo.c panel.c
-$(MOD)_LFLAGS	+= $(shell pkg-config --libs cairo)
-$(MOD)_CFLAGS	+= $(shell pkg-config --cflags cairo)
+$(MOD)_LFLAGS	+= $(shell $(PKG_CONFIG) --libs cairo)
+$(MOD)_CFLAGS	+= $(shell $(PKG_CONFIG) --cflags cairo)
 
 include mk/mod.mk

Reply via email to