[proaudio] libffado SConstruct patch (python 2->3)

[ Thread Index | Date Index | More lists.tuxfamily.org/proaudio Archives ]


Hi,

Libffado was failing on my system with python 3. So I did this revised ebuild applying a patch to upgrade the SConstructs.

Best regards,
Natanael.
commit 941930dc892ac93b540a46149bf815d226ec5375
Author: layman <layman@localhost>
Date:   Sat Nov 4 20:10:07 2017 +0100

     added patch for SConstruct to be compatible with python 3

diff --git a/media-libs/libffado/files/python2to3.patch b/media-libs/libffado/files/python2to3.patch
new file mode 100644
index 0000000..cfe4bc6
--- /dev/null
+++ b/media-libs/libffado/files/python2to3.patch
@@ -0,0 +1,301 @@
+diff -urN a/SConstruct b/SConstruct
+--- a/SConstruct	2016-08-08 12:31:03.000000000 +0200
++++ b/SConstruct	2017-11-04 19:59:41.768836586 +0100
+@@ -93,7 +93,7 @@
+ custom_flags = False
+ 
+ if env.has_key('COMPILE_FLAGS') and len(env['COMPILE_FLAGS']) > 0:
+-    print "The COMPILE_FLAGS option is deprecated. Use CFLAGS and CXXFLAGS with CUSTOM_ENV=True instead"
++    print ("The COMPILE_FLAGS option is deprecated. Use CFLAGS and CXXFLAGS with CUSTOM_ENV=True instead")
+     custom_flags = True
+     env.MergeFlags(env['COMPILE_FLAGS'])
+ 
+@@ -115,7 +115,7 @@
+         env.Append(LINKFLAGS = str(os.environ['LDFLAGS'].replace('\"', '')))
+ 
+ if custom_flags:
+-    print '''
++    print ('''
+  * Usage of additional flags is not supported by the ffado-devs.
+  * Use at own risk!
+  *
+@@ -125,7 +125,7 @@
+  *   CFLAGS = %s
+  *   CXXFLAGS = %s
+  *   LDFLAGS = %s
+-''' % (env['CC'], env['CXX'], env['CFLAGS'], env['CXXFLAGS'], env['LINKFLAGS'])
++''' % (env['CC'], env['CXX'], env['CFLAGS'], env['CXXFLAGS'], env['LINKFLAGS']))
+ 
+ Help( """
+ For building ffado you can set different options as listed below. You have to
+@@ -225,13 +225,13 @@
+     return (int(maj) << 24) | (int(min) << 8) | int(patch)
+ 
+ def CheckJackdVer():
+-    print 'Checking jackd version...',
++    print ('Checking jackd version...',)
+     ret = Popen("which jackd >/dev/null 2>&1 && jackd --version | tail -n 1 | cut -d ' ' -f 3", shell=True, stdout=PIPE).stdout.read()[:-1]
+     if (ret == ""):
+-        print "not installed"
++        print("not installed")
+         return -1
+     else:
+-        print ret
++        print(ret)
+     return VersionInt(ret)
+ 
+ if env['SERIALIZE_USE_EXPAT']:
+@@ -249,12 +249,12 @@
+     # Check for working gcc and g++ compilers and their environment.
+     #
+     if not conf.CompilerCheck():
+-        print "\nIt seems as if your system isn't even able to compile any C-/C++-programs. Probably you don't have gcc and g++ installed. Compiling a package from source without a working compiler is very hard to do, please install the needed packages.\nHint: on *ubuntu you need both gcc- and g++-packages installed, easiest solution is to install build-essential which depends on gcc and g++."
++        print ("\nIt seems as if your system isn't even able to compile any C-/C++-programs. Probably you don't have gcc and g++ installed. Compiling a package from source without a working compiler is very hard to do, please install the needed packages.\nHint: on *ubuntu you need both gcc- and g++-packages installed, easiest solution is to install build-essential which depends on gcc and g++.")
+         Exit( 1 )
+ 
+     # Check for pkg-config before using pkg-config to check for other dependencies.
+     if not conf.CheckForPKGConfig():
+-        print "\nThe program 'pkg-config' could not be found.\nEither you have to install the corresponding package first or make sure that PATH points to the right directions."
++        print ("\nThe program 'pkg-config' could not be found.\nEither you have to install the corresponding package first or make sure that PATH points to the right directions.")
+         Exit( 1 )
+ 
+     #
+@@ -298,41 +298,41 @@
+ 
+     if env['ENABLE_SETBUFFERSIZE_API_VER'] == 'auto':
+         if not(have_jack):
+-            print """
++            print ("""
+ No Jack Audio Connection Kit (JACK) installed: assuming a FFADO 
+ setbuffersize-compatible version will be used.
+-"""
++""")
+         elif not(good_jack1 or good_jack2):
+             FFADO_API_VERSION="8"
+-            print """
++            print ("""
+ Installed Jack Audio Connection Kit (JACK) jack does not support FFADO 
+ setbuffersize API: will report earlier API version at runtime.  Consider 
+ upgrading to jack1 >=0.122.0 or jack2 >=1.9.9 at some point, and then 
+ recompile ffado to gain access to this added feature.
+-"""
++""")
+         else:
+-            print "Installed Jack Audio Connection Kit (JACK) supports FFADO setbuffersize API"
++            print ("Installed Jack Audio Connection Kit (JACK) supports FFADO setbuffersize API")
+     elif env['ENABLE_SETBUFFERSIZE_API_VER'] == 'true':
+         if (have_jack and not(good_jack1) and not(good_jack2)):
+-            print """
++            print ("""
+ SetBufferSize API version is enabled but no suitable version of Jack Audio 
+ Connection Kit (JACK) has been found.  The resulting FFADO would cause your 
+ jackd to abort with "incompatible FFADO version".  Please upgrade to 
+ jack1 >=0.122.0 or jack2 >=1.9.9, or set ENABLE_SETBUFFERSIZE_API_VER to "auto"
+ or "false".
+-"""
++""")
+             # Although it's not strictly an error, in almost every case that 
+             # this occurs the user will want to know about it and fix the
+             # problem, so we exit so they're guaranteed of seeing the above
+             # message.
+             Exit( 1 )
+         else:
+-            print "Will report SetBufferSize API version at runtime"
++            print ("Will report SetBufferSize API version at runtime")
+     elif env['ENABLE_SETBUFFERSIZE_API_VER'] == 'force':
+-        print "Will report SetBufferSize API version at runtime"
++        print ("Will report SetBufferSize API version at runtime")
+     else:
+         FFADO_API_VERSION="8"
+-        print "Will not report SetBufferSize API version at runtime"
++        print ("Will not report SetBufferSize API version at runtime")
+ 
+     for pkg in pkgs:
+         name2 = pkg.replace("+","").replace(".","").replace("-","").upper()
+@@ -342,14 +342,14 @@
+             allpresent &= 0
+ 
+     if not allpresent:
+-        print """
++        print ("""
+ (At least) One of the dependencies is missing. I can't go on without it, please
+ install the needed packages for each of the lines saying "no".
+ (Remember to also install the *-devel packages!)
+ 
+ And remember to remove the cache with "rm -Rf .sconsign.dblite cache" so the
+ results above get rechecked.
+-"""
++""")
+         Exit( 1 )
+ 
+     # libxml++-2.6 requires a c++11 compiler as of version 2.39.1.  The 
+@@ -393,15 +393,15 @@
+     elif not env.GetOption('clean'):
+         if env['BUILD_MIXER'] == 'auto':
+             env['BUILD_MIXER'] = 'false'
+-            print """
++            print ("""
+ The prerequisites ('pyuic4' and the python-modules 'dbus' and 'PyQt4', the
+ packages could be named like dbus-python and PyQt) to build the mixer were not
+-found. Therefore the qt4 mixer will not be installed."""
++found. Therefore the qt4 mixer will not be installed.""")
+         else: # env['BUILD_MIXER'] == 'true'
+-            print """
++            print ("""
+ The prerequisites ('pyuic4' and the python-modules 'dbus' and 'PyQt4', the
+ packages could be named like dbus-python and PyQt) to build the mixer were not
+-found, but BUILD_MIXER was requested."""
++found, but BUILD_MIXER was requested.""")
+             Exit( 1 )
+ 
+ env['XDG_TOOLS'] = False
+@@ -409,10 +409,10 @@
+     if conf.CheckForApp( 'xdg-desktop-menu --help' ) and conf.CheckForApp( 'xdg-icon-resource --help' ):
+         env['XDG_TOOLS'] = True
+     else:
+-        print """
++        print ("""
+ I couldn't find the 'xdg-desktop-menu' and 'xdg-icon-resource' programs. These
+ are needed to add the fancy entry for the mixer to your menu, but you can still
+-start it by executing "ffado-mixer"."""
++start it by executing "ffado-mixer".""")
+ 
+ #
+ # Optional pkg-config
+@@ -429,11 +429,11 @@
+ if not env['DBUS1_FLAGS'] or not env['DBUSC1_FLAGS'] or not conf.CheckForApp('which dbusxx-xml2cpp'):
+     env['DBUS1_FLAGS'] = ""
+     env['DBUSC1_FLAGS'] = ""
+-    print """
++    print ("""
+ One of the dbus-headers, the dbus-c++-headers and/or the application
+ 'dbusxx-xml2cpp' where not found. The dbus-server for ffado will therefore not
+ be built.
+-"""
++""")
+ else:
+     # Get the directory where dbus stores the service-files
+     env['dbus_service_dir'] = conf.GetPKGVariable( 'dbus-1', 'session_bus_services_dir' ).strip()
+@@ -455,7 +455,7 @@
+ env = conf.Finish()
+ 
+ if env['DEBUG']:
+-    print "Doing a debug build"
++    print ("Doing a debug build")
+     env.MergeFlags( "-Wall -g -DDEBUG" )
+     env['DEBUG_MESSAGES'] = True
+ elif not custom_flags:
+@@ -466,7 +466,7 @@
+     env.MergeFlags( "-DDEBUG_MESSAGES" )
+ 
+ if env['PROFILE']:
+-    print "Doing a PROFILE build"
++    print ("Doing a PROFILE build")
+     env.MergeFlags( "-Wall -g" )
+ 
+ if env['PEDANTIC']:
+@@ -487,7 +487,7 @@
+ 
+ env['BUILD_STATIC_LIB'] = False
+ if env['BUILD_STATIC_TOOLS']:
+-    print "Building static versions of the tools..."
++    print ("Building static versions of the tools...")
+     env['BUILD_STATIC_LIB'] = True
+ 
+ env['build_base']="#/"
+@@ -705,7 +705,7 @@
+                 answer = 'elf32' in fmt
+                 break
+     else:
+-        print '!!! Not found %s' % exe
++        print ('!!! Not found %s' % exe)
+     return answer
+ 
+ 
+@@ -780,7 +780,7 @@
+         env['DIST_TARGET'] = 'powerpc'
+     else:
+         env['DIST_TARGET'] = config[config_cpu]
+-    print "Detected DIST_TARGET = " + env['DIST_TARGET']
++    print ("Detected DIST_TARGET = " + env['DIST_TARGET'])
+ 
+ #=== Begin Revised CXXFLAGS =========================================
+ # comment on DIST_TARGET up top implies it can be used for cross-compiling
+@@ -799,21 +799,21 @@
+ 
+ if env['DETECT_USERSPACE_ENV']:
+     m32 = is_userspace_32bit(cpuinfo)
+-    print 'User space is %s' % (m32 and '32-bit' or '64-bit')
++    print ('User space is %s' % (m32 and '32-bit' or '64-bit'))
+     if cpuinfo.is_powerpc:
+         if m32:
+-            print "Doing a 32-bit PowerPC build for %s CPU" % cpuinfo.ppc_type
++            print ("Doing a 32-bit PowerPC build for %s CPU" % cpuinfo.ppc_type)
+             machineflags = { 'CXXFLAGS' : ['-m32'] }
+         else:
+-            print "Doing a 64-bit PowerPC build for %s CPU" % cpuinfo.ppc_type
++            print ("Doing a 64-bit PowerPC build for %s CPU" % cpuinfo.ppc_type)
+             machineflags = { 'CXXFLAGS' : ['-m64'] }
+         env.MergeFlags( machineflags )
+     elif cpuinfo.is_x86:
+         if m32:
+-            print "Doing a 32-bit %s build for %s" % (cpuinfo.machine, cpuinfo.model_name)
++            print ("Doing a 32-bit %s build for %s" % (cpuinfo.machine, cpuinfo.model_name))
+             machineflags = { 'CXXFLAGS' : ['-m32'] }
+         else:
+-            print "Doing a 64-bit %s build for %s" % (cpuinfo.machine, cpuinfo.model_name)
++            print ("Doing a 64-bit %s build for %s" % (cpuinfo.machine, cpuinfo.model_name))
+             machineflags = { 'CXXFLAGS' : ['-m64'] }
+             needs_fPIC = True
+         env.MergeFlags( machineflags )
+@@ -827,7 +827,7 @@
+ if env['ENABLE_OPTIMIZATIONS']:
+     opt_flags.extend (["-fomit-frame-pointer","-ffast-math","-funroll-loops"])
+     env.MergeFlags( opt_flags )
+-    print "Doing an optimized build..."
++    print ("Doing an optimized build...")
+ 
+ env['REVISION'] = os.popen('svnversion .').read()[:-1]
+ # This may be as simple as '89' or as complex as '4123:4184M'.
+@@ -907,7 +907,7 @@
+ #
+ if len(env.destdir) > 0:
+     if not len( ARGUMENTS.get( "WILL_DEAL_WITH_XDG_MYSELF", "" ) ) > 0:
+-        print """
++        print ("""
+ WARNING!
+ You are using the (packagers) option DESTDIR to install this package to a
+ different place than the real prefix. As the xdg-tools can't cope with
+@@ -915,7 +915,7 @@
+ deal with them your own.
+ (And you have to look into the SConstruct to learn how to disable this
+ message.)
+-"""
++""")
+ else:
+ 
+     def CleanAction( action ):
+diff -urN a/support/dbus/SConscript b/support/dbus/SConscript
+--- a/support/dbus/SConscript	2012-06-13 03:39:07.000000000 +0200
++++ b/support/dbus/SConscript	2017-11-04 20:00:15.509837202 +0100
+@@ -79,16 +79,16 @@
+ 
+ servicefile = env.ScanReplace('org.ffado.Control.service.in')
+ if env['dbus_service_dir'] and ( env.destdir or os.access( env['dbus_service_dir'], os.W_OK ) ):
+-    print "Will install the service-file"
++    print ("Will install the service-file")
+     targetdir = env.destdir + env['dbus_service_dir']
+     env.Alias( "install", env.Install( env.destdir + env['dbus_service_dir'], servicefile ) )
+ else:
+     if not env['dbus_service_dir']:
+-        print 'Can\'t install the system-wide dbus service file as the concerned variable is not defined.'
++        print ('Can\'t install the system-wide dbus service file as the concerned variable is not defined.')
+     else:
+         if not os.access( env['dbus_service_dir'], os.W_OK ):
+-            print 'Insufficient rights to install the system-wide dbus service file.'
+-            print 'Please run the "scons install" command with higher authority.'
++            print ('Insufficient rights to install the system-wide dbus service file.')
++            print ('Please run the "scons install" command with higher authority.')
+ 
+ # static versions
+ if static_env['BUILD_STATIC_TOOLS']:
diff --git a/media-libs/libffado/libffado-2.3.0-r1.ebuild b/media-libs/libffado/libffado-2.3.0-r1.ebuild
new file mode 100644
index 0000000..9741927
--- /dev/null
+++ b/media-libs/libffado/libffado-2.3.0-r1.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit eutils python-single-r1 scons-utils toolchain-funcs udev multilib-minimal
+
+DESCRIPTION="Driver for IEEE1394 (Firewire) audio interfaces"
+HOMEPAGE="http://www.ffado.org";
+
+if [ "${PV}" = "9999" ]; then
+	inherit subversion
+	ESVN_REPO_URI="http://subversion.ffado.org/ffado/trunk/${PN}";
+	KEYWORDS=""
+else
+	SRC_URI="http://www.ffado.org/files/${P}.tgz";
+	KEYWORDS="~amd64"
+fi
+
+LICENSE="GPL-2 GPL-3"
+SLOT="0"
+IUSE="debug qt4 test-programs"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="dev-cpp/libxmlpp:2.6[${MULTILIB_USEDEP}]
+	dev-libs/dbus-c++
+	dev-libs/libconfig[cxx,${MULTILIB_USEDEP}]
+	media-libs/alsa-lib
+	media-libs/libiec61883[${MULTILIB_USEDEP}]
+	!<media-sound/jack-audio-connection-kit-0.122.0:0
+	!<media-sound/jack-audio-connection-kit-1.9.9:2
+	sys-apps/dbus
+	sys-libs/libraw1394[${MULTILIB_USEDEP}]
+	sys-libs/libavc1394[${MULTILIB_USEDEP}]
+	${PYTHON_DEPS}
+	qt4? (
+		dev-python/PyQt4[dbus,${PYTHON_USEDEP}]
+		dev-python/dbus-python[${PYTHON_USEDEP}]
+		x11-misc/xdg-utils
+	)"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig"
+
+PATCHES=(
+	"${FILESDIR}/libffado-2.3.0-modelname-strip.patch"
+	"${FILESDIR}/libffado-2.3.0-gcc6.patch"
+	"${FILESDIR}/python2to3.patch"
+)
+
+myescons() {
+	local myesconsargs=(
+		PREFIX="${EPREFIX}/usr"
+		LIBDIR="${EPREFIX}/usr/$(get_libdir)"
+		MANDIR="${EPREFIX}/usr/share/man"
+		UDEVDIR="$(get_udevdir)/rules.d"
+		CUSTOM_ENV=true
+		DETECT_USERSPACE_ENV=false
+		DEBUG=$(usex debug)
+		# ENABLE_OPTIMIZATIONS detects cpu type and sets flags accordingly
+		# -fomit-frame-pointer is added also which can cripple debugging.
+		# we set flags from portage instead
+		ENABLE_OPTIMIZATIONS=false
+		# This only works for JACK1>=0.122.0 or JACK2>=1.9.9, so we block
+		# lower versions.
+		ENABLE_SETBUFFERSIZE_API_VER=force
+	)
+	if multilib_is_native_abi; then
+		myesconsargs+=(
+			BUILD_MIXER=$(usex qt4 true false)
+			BUILD_TESTS=$(usex test-programs)
+		)
+	else
+		myesconsargs+=(
+			BUILD_MIXER=false
+			BUILD_TESTS=false
+		)
+	fi
+	escons "${myesconsargs[@]}" "${@}"
+}
+
+src_prepare() {
+	default
+	multilib_copy_sources
+}
+
+multilib_src_compile() {
+	tc-export CC CXX
+	myescons
+}
+
+multilib_src_install() {
+	myescons DESTDIR="${D}" WILL_DEAL_WITH_XDG_MYSELF="True" install
+}
+
+multilib_src_install_all() {
+	einstalldocs
+
+	python_fix_shebang "${D}"
+	python_optimize "${D}"
+
+	if use qt4; then
+		newicon "support/xdg/hi64-apps-ffado.png" "ffado.png"
+		newmenu "support/xdg/ffado.org-ffadomixer.desktop" "ffado-mixer.desktop"
+	fi
+}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/