Source: libffado
Version: 2.4.9-3
Tags: patch upstream
User: [email protected]
Usertags: ftcbfs
libffado cannot be cross built from source for a pile of reasons. It is
not clear what to do about the scons dependency. Should it be annotated
:native or marked M-A:foreign?
What is clear though is that the build should leverage the host's
pkg-config and that it cannot check the compiler by running created
executables. Both aspects presently undermine any attempt at cross
compilation. I'm attaching a patch fixing these. Would you mind
including it in the package and/or forwarding it upstream? I hope that
it is written in a way that upstream likes.
Helmut
--- libffado-2.4.9.orig/SConstruct
+++ libffado-2.4.9/SConstruct
@@ -83,7 +83,7 @@
BoolVariable( "ENABLE_OPTIMIZATIONS", "Enable optimizations and the use of processor specific extentions (MMX/SSE/...).", False ),
BoolVariable( "DETECT_USERSPACE_ENV", "Try to detect the user space environment and add necessary 32/64 bit machine flags.", True ),
BoolVariable( "PEDANTIC", "Enable -Werror and more pedantic options during compile.", False ),
- BoolVariable( "CUSTOM_ENV", "Respect CC, CXX, CFLAGS, CXXFLAGS and LDFLAGS.\nOnly meant for distributors and gentoo-users who want to over-optimize their build.\n Using this is not supported by the ffado-devs!", False ),
+ BoolVariable( "CUSTOM_ENV", "Respect CC, CXX, PKG_CONFIG, CFLAGS, CXXFLAGS and LDFLAGS.\nOnly meant for distributors and gentoo-users who want to over-optimize their build.\n Using this is not supported by the ffado-devs!", False ),
( "COMPILE_FLAGS", "Deprecated (use CFLAGS and CXXFLAGS with CUSTOM_ENV=True instead). Add additional flags to the environment.\nOnly meant for distributors and gentoo-users who want to over-optimize their build.\n Using this is not supported by the ffado-devs!" ),
EnumVariable( "ENABLE_SETBUFFERSIZE_API_VER", "Report API version at runtime which includes support for dynamic buffer resizing (requires recent jack).", 'auto', allowed_values=('auto', 'true', 'false', 'force'), ignorecase=2),
("PYTHON_INTERPRETER", "Python interpreter to be used by FFADO installation.", "/usr/bin/python"),
@@ -110,6 +110,8 @@
env['CC'] = os.environ['CC']
if 'CXX' in os.environ and len(os.environ['CXX']) > 0:
env['CXX'] = os.environ['CXX']
+ if 'PKG_CONFIG' in os.environ and len(os.environ['PKG_CONFIG']) > 0:
+ env['PKG_CONFIG'] = os.environ['PKG_CONFIG']
# Honour the user supplied flags (if any), but notify the user that this is not supported.
if 'CFLAGS' in os.environ and len(os.environ['CFLAGS']) > 0:
@@ -127,10 +129,11 @@
* Flags in use:
* CC = %s
* CXX = %s
+ * PKG_CONFIG = %s
* CFLAGS = %s
* CXXFLAGS = %s
* LDFLAGS = %s
-''' % (env['CC'], env['CXX'], env['CFLAGS'], env['CXXFLAGS'], env['LINKFLAGS']))
+''' % (env['CC'], env['CXX'], env['PKG_CONFIG'], env['CFLAGS'], env['CXXFLAGS'], env['LINKFLAGS']))
Help( """
For building ffado you can set different options as listed below. You have to
@@ -169,30 +172,30 @@
def CompilerCheck( context ):
context.Message( "Checking for a working C-compiler " )
- ret = context.TryRun( """
+ ret = context.TryLink( """
#include <stdio.h>
int main() {
printf( "Hello World!" );
return 0;
-}""", '.c' )[0]
+}""", '.c' )
context.Result( ret )
if ret == 0:
return False;
context.Message( "Checking for a working C++-compiler " )
- ret = context.TryRun( """
+ ret = context.TryLink( """
#include <iostream>
int main() {
std::cout << "Hello World!" << std::endl;
return 0;
-}""", ".cpp" )[0]
+}""", ".cpp" )
context.Result( ret )
return ret
def CheckPKG(context, name):
context.Message( 'Checking for %s... ' % name )
- ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
+ ret = context.TryAction('%s --exists \'%s\'' % (env.get('PKG_CONFIG', 'pkg-config'), name))[0]
context.Result( ret )
return ret
--- libffado-2.4.9.orig/admin/pkgconfig.py
+++ libffado-2.4.9/admin/pkgconfig.py
@@ -28,12 +28,19 @@
import subprocess
+
+#
+# Return the name of the pkg-config executable
+#
+def PKGConfigExe(context):
+ return context.env.get( "PKG_CONFIG", "pkg-config" )
+
#
# Checks for pkg-config
#
def CheckForPKGConfig( context, version='0.0.0' ):
context.Message( "Checking for pkg-config (at least version %s)... " % version )
- ret = context.TryAction( "pkg-config --atleast-pkgconfig-version=%s" %version )[0]
+ ret = context.TryAction( "%s --atleast-pkgconfig-version=%s" % (PKGConfigExe(context), version) )[0]
context.Result( ret )
return ret
@@ -49,13 +56,13 @@
if version == "":
context.Message( "Checking for %s... \t" % name )
- ret = context.TryAction( "pkg-config --exists '%s'" % name )[0]
+ ret = context.TryAction( "%s --exists '%s'" % (PKGConfigExe(context),name) )[0]
else:
context.Message( "Checking for %s (%s or higher)... \t" % (name,version) )
- ret = context.TryAction( "pkg-config --atleast-version=%s '%s'" % (version,name) )[0]
+ ret = context.TryAction( "%s --atleast-version=%s '%s'" % (PKGConfigExe(context),version,name) )[0]
if ret:
- context.env['%s_FLAGS' % name2.upper()] = context.env.ParseFlags("!pkg-config --cflags --libs %s" % name)
+ context.env['%s_FLAGS' % name2.upper()] = context.env.ParseFlags("!%s --cflags --libs %s" % (PKGConfigExe(context),name))
context.Result( ret )
return ret
@@ -70,16 +77,16 @@
if version == "":
context.Message( "Checking for %s... \t" % name )
- ret = context.TryAction( "pkg-config --exists '%s'" % name )[0]
+ ret = context.TryAction( "%s --exists '%s'" % (PKGConfigExe(context),name) )[0]
else:
context.Message( "Checking for %s (%s or higher)... \t" % (name,version) )
- ret = context.TryAction( "pkg-config --atleast-version=%s '%s'" % (version,name) )[0]
+ ret = context.TryAction( "%s --atleast-version=%s '%s'" % (PKGConfigExe(context),version,name) )[0]
if not ret:
context.Result( ret )
return ret
- out = subprocess.Popen(['pkg-config', '--cflags', '--libs', name], stdout=subprocess.PIPE)
+ out = subprocess.Popen([PKGConfigExe(context), '--cflags', '--libs', name], stdout=subprocess.PIPE)
ret = out.stdout.read()
context.Result( True )
@@ -93,12 +100,12 @@
context.Message( "Checking for variable %s in package %s... \t" % (variable,name) )
- ret = context.TryAction( "pkg-config --exists '%s'" % name )[0]
+ ret = context.TryAction( "%s --exists '%s'" % (PKGConfigExe(context),name) )[0]
if not ret:
context.Result( ret )
return ret
- out = subprocess.Popen(['pkg-config', '--variable=%s' % variable, name], stdout=subprocess.PIPE)
+ out = subprocess.Popen([PKGConfigExe(context), '--variable=%s' % variable, name], stdout=subprocess.PIPE)
ret = out.stdout.read()
context.Result( True )