Bug#951684: juce FTCBFS: multiple reasons
Source: juce
Version: 5.4.7~ds0-1
Tags: patch
User: debian-cross@lists.debian.org
Usertags: ftcbfs
juce fails to cross build from source, for multiple reasons.
1. debian/rules invokes the build architecture pkg-config. An easy
solution is letting dpkg's buildtools.mk supply pkg-config.
2. An upstream Makefile hard codes the build architecture pkg-config.
It should be substitutable such that dh_auto_build can replace it.
3. debian/rules has a bare make invocation that lacks cross tools. Using
dh_auto_build can fix this.
Please consider applying the attached patch to make juce cross
buildable.
Helmut
diff --minimal -Nru juce-5.4.7~ds0/debian/changelog juce-5.4.7~ds0/debian/changelog
--- juce-5.4.7~ds0/debian/changelog 2020-02-18 09:46:05.000000000 +0100
+++ juce-5.4.7~ds0/debian/changelog 2020-02-20 06:50:40.000000000 +0100
@@ -1,3 +1,13 @@
+juce (5.4.7~ds0-1.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Fix FTCBFS: (Closes: #-1)
+ + Let dpkg's buildtools.mk supply pkg-config for debian/rules.
+ + cross.patch: Make pkg-config substitutable.
+ + Let dh_auto_build pass cross tools to make.
+
+ -- Helmut Grohne <helmut@subdivi.de> Thu, 20 Feb 2020 06:50:40 +0100
+
juce (5.4.7~ds0-1) unstable; urgency=medium
* New upstream version 5.4.7~ds0
diff --minimal -Nru juce-5.4.7~ds0/debian/patches/cross.patch juce-5.4.7~ds0/debian/patches/cross.patch
--- juce-5.4.7~ds0/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 +0100
+++ juce-5.4.7~ds0/debian/patches/cross.patch 2020-02-20 06:50:38.000000000 +0100
@@ -0,0 +1,56 @@
+--- juce-5.4.7~ds0.orig/extras/Projucer/Builds/LinuxMakefile/Makefile
++++ juce-5.4.7~ds0/extras/Projucer/Builds/LinuxMakefile/Makefile
+@@ -19,6 +19,10 @@
+ AR=ar
+ endif
+
++ifndef PKG_CONFIG
++ PKG_CONFIG=pkg-config
++endif
++
+ ifndef CONFIG
+ CONFIG=Debug
+ endif
+@@ -35,13 +39,13 @@
+ TARGET_ARCH :=
+ endif
+
+- JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DDEBUG=1 -D_DEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=5.4.7 -DJUCE_APP_VERSION_HEX=0x50407 $(shell pkg-config --cflags x11 xinerama xext freetype2 webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
++ JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DDEBUG=1 -D_DEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=5.4.7 -DJUCE_APP_VERSION_HEX=0x50407 $(shell $(PKG_CONFIG) --cflags x11 xinerama xext freetype2 webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
+ JUCE_CPPFLAGS_APP := -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0
+ JUCE_TARGET_APP := Projucer
+
+ JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS)
+ JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++11 $(CXXFLAGS)
+- JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs x11 xinerama xext freetype2 webkit2gtk-4.0 gtk+-x11-3.0) -lrt -ldl -lpthread $(LDFLAGS)
++ JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs x11 xinerama xext freetype2 webkit2gtk-4.0 gtk+-x11-3.0) -lrt -ldl -lpthread $(LDFLAGS)
+
+ CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
+ endif
+@@ -56,13 +60,13 @@
+ TARGET_ARCH :=
+ endif
+
+- JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DNDEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=5.4.7 -DJUCE_APP_VERSION_HEX=0x50407 $(shell pkg-config --cflags x11 xinerama xext freetype2 webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
++ JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DNDEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=5.4.7 -DJUCE_APP_VERSION_HEX=0x50407 $(shell $(PKG_CONFIG) --cflags x11 xinerama xext freetype2 webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
+ JUCE_CPPFLAGS_APP := -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0
+ JUCE_TARGET_APP := Projucer
+
+ JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -O3 $(CFLAGS)
+ JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++11 $(CXXFLAGS)
+- JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs x11 xinerama xext freetype2 webkit2gtk-4.0 gtk+-x11-3.0) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS)
++ JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell $(PKG_CONFIG) --libs x11 xinerama xext freetype2 webkit2gtk-4.0 gtk+-x11-3.0) -fvisibility=hidden -lrt -ldl -lpthread $(LDFLAGS)
+
+ CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
+ endif
+@@ -136,8 +140,8 @@
+ all : $(JUCE_OUTDIR)/$(JUCE_TARGET_APP)
+
+ $(JUCE_OUTDIR)/$(JUCE_TARGET_APP) : $(OBJECTS_APP) $(RESOURCES)
+- @command -v pkg-config >/dev/null 2>&1 || { echo >&2 "pkg-config not installed. Please, install it."; exit 1; }
+- @pkg-config --print-errors x11 xinerama xext freetype2 webkit2gtk-4.0 gtk+-x11-3.0
++ @command -v $(PKG_CONFIG) >/dev/null 2>&1 || { echo >&2 "pkg-config not installed. Please, install it."; exit 1; }
++ @$(PKG_CONFIG) --print-errors x11 xinerama xext freetype2 webkit2gtk-4.0 gtk+-x11-3.0
+ @echo Linking "Projucer - App"
+ -$(V_AT)mkdir -p $(JUCE_BINDIR)
+ -$(V_AT)mkdir -p $(JUCE_LIBDIR)
diff --minimal -Nru juce-5.4.7~ds0/debian/patches/series juce-5.4.7~ds0/debian/patches/series
--- juce-5.4.7~ds0/debian/patches/series 2020-02-18 09:46:05.000000000 +0100
+++ juce-5.4.7~ds0/debian/patches/series 2020-02-20 06:49:32.000000000 +0100
@@ -8,3 +8,4 @@
debian_unittests_globalpaths.patch
debian_vst.patch
debian_link_systemlibs.patch
+cross.patch
diff --minimal -Nru juce-5.4.7~ds0/debian/rules juce-5.4.7~ds0/debian/rules
--- juce-5.4.7~ds0/debian/rules 2020-02-18 09:46:05.000000000 +0100
+++ juce-5.4.7~ds0/debian/rules 2020-02-20 06:50:40.000000000 +0100
@@ -3,6 +3,8 @@
# Copyright © 2015 IOhannes m zmölnig <umlaeute@debian.org>
# Description: Main Debian packaging script for JUCE
+include /usr/share/dpkg/buildtools.mk
+
## export dummy TARGET_ARCH that doesn't do much,
## but disables "-march=native" optimization
export TARGET_ARCH=-Wl,--as-needed
@@ -17,7 +19,7 @@
#DEB_COPYRIGHT_CHECK_IGNORE_REGEX = \
#^((.*\.jpg)|(.*\.JPG)|(.*\.gif)|(.*\.png)|(.*\.ico)|(.*\.icns)|(gradle-wrapper\.jar)|(.*\.mp3)|(.*\.caf)|(.*\.nib)|examples/InAppPurchase/Signing/InAppPurchase\.keystore|examples/(InAppPurchase/BinaryData/(Robot|Ed|Jules|JB|Fabian|Lukasz)[012]\.ogg|AUv3Synth|PlugInSamples/MultiOutSynth)/Source/BinaryData/singing\.ogg|examples/Demo/Resources/cello\.wav|examples/Demo/Resources/icons\.zip|modules/juce_audio_plugin_client/RTAS/juce_RTAS_WinResources\.rsr|examples/ComponentTutorialExample/Introduction to Components - Part 1\.pdf|debian/(changelog|copyright(|_hints|_newhints)))$
-LDFLAGS += $(shell pkg-config --libs libjpeg libpng zlib)
+LDFLAGS += $(shell $(PKG_CONFIG) --libs libjpeg libpng zlib)
# JUCE uses some c++11 features requiring atomic_store_8 and
# atomic_load_8, so we need to link with libatomic on
@@ -44,7 +46,7 @@
LDFLAGS="$(LDFLAGS)" \
CPPFLAGS="$(CPPFLAGS)" \
$(empty)
- make -C debian/extra/lv2-ttl-generator/
+ dh_auto_build --sourcedirectory=debian/extra/lv2-ttl-generator/
help2man -N \
--version-string="Projucer $(DEB_UPSTREAM_VERSION)" \
-n "the JUCE project-management tool" \
Reply to: