Tags: patch

Here's a patch, tested on i386 & AMD64 sid, importing the multi-arch
magic from libasound2.

The BIARCH_TEMPLIBDIR voodoo is there for two reasons:
1) pkg-config doesn't know the difference between archs, so configure
always detects the presence of jack, pulse, & dbus, but then the build
can't find a library of the appropriate bit-ness.

2) ia32-libs doesn't have dev symlinks, so the build fails to link
against the 32bit libpulse for example.

So we detect whether a version of lib{pulse, jack, dbus-1} exists.  If
so, we add a .so symlink to it in BIARCH_TEMPLIBDIR and copy the
pkgconfig file there as well.

Thus the package has the maximum possible functionality where the libs
exist (AMD64), and the build still works where they don't (everything
else, it seems).
Index: debian/control
===================================================================
--- debian/control	(revision 2035)
+++ debian/control	(working copy)
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Debian ALSA Maintainers <[EMAIL PROTECTED]>
 Uploaders: Jordi Mallach <[EMAIL PROTECTED]>, Elimar Riesebieter <[EMAIL PROTECTED]>
-Build-Depends: debhelper (>= 5.0.37), quilt (>= 0.40), autotools-dev, libasound2-dev (>= 1.0.12), libjack-dev, libpulse-dev, libsamplerate0-dev | libsamplerate-dev, libavcodec-dev
+Build-Depends: debhelper (>= 5.0.37), quilt (>= 0.40), autotools-dev, libasound2-dev (>= 1.0.12), lib32asound2-dev (>= 1.0.12) [amd64 ppc64], lib64asound2-dev (>= 1.0.12) [sparc s390 i386 powerpc], libpulse-dev, libsamplerate0-dev | libsamplerate-dev, libavcodec-dev, ia32-libs [amd64], ia64-libs [i386 powerpc sparc s390],libc6-dev-powerpc [ppc64], libc6-dev-i386 [amd64], libc6-dev-amd64 [i386], libc6-dev-ppc64 [powerpc], libc6-dev-s390x [s390], libc6-dev-sparc64 [sparc], lib32gcc1 [amd64 ppc64], lib64gcc1 [i386 powerpc sparc s390], gcc-multilib [amd64 i386 powerpc ppc64 s390 sparc], libjack-dev
 Standards-Version: 3.7.2
 Homepage: http://www.alsa-project.org/
 Vcs-Svn: svn://svn.debian.org/pkg-alsa/trunk/alsa-plugins
@@ -26,3 +26,39 @@
  .
  ALSA is the Advanced Linux Sound Architecture.
  JACK is the Jack Audio Connection Kit.
+
+Package: lib32asound2-plugins
+Architecture: amd64 ppc64
+Section: libs
+Depends: ${shlibs:Depends}, ${bilib:depends}
+Enhances: lib32asound2
+Description: ALSA library additional plugins (32 bit)
+ This package contains plugins for the ALSA library that are
+ not included in the main lib32asound2 package.
+ .
+ The ALSA library plugin "jack" allows the ALSA library to
+ play or capture via JACK. (This should not be confused with
+ the jackd output driver "alsa", included in the jackd
+ package, which allows the JACK daemon to play back via the
+ ALSA library.)
+ .
+ ALSA is the Advanced Linux Sound Architecture.
+ JACK is the Jack Audio Connection Kit.
+
+Package: lib64asound2-plugins
+Architecture: sparc s390 i386 powerpc
+Section: libs
+Depends: ${shlibs:Depends}, ${bilib:depends}
+Enhances: lib64asound2
+Description: ALSA library additional plugins (64 bit)
+ This package contains plugins for the ALSA library that are
+ not included in the main lib64asound2 package.
+ .
+ The ALSA library plugin "jack" allows the ALSA library to
+ play or capture via JACK. (This should not be confused with
+ the jackd output driver "alsa", included in the jackd
+ package, which allows the JACK daemon to play back via the
+ ALSA library.)
+ .
+ ALSA is the Advanced Linux Sound Architecture.
+ JACK is the Jack Audio Connection Kit.
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 2035)
+++ debian/changelog	(working copy)
@@ -1,9 +1,16 @@
 alsa-plugins (1.0.15-2) UNRELEASED; urgency=low
 
+  [ Jordi Mallach ]
   * Switch to now official Vcs-* control fields.
 
- -- Jordi Mallach <[EMAIL PROTECTED]>  Mon, 26 Nov 2007 11:24:30 +0100
+  [ Christopher James Halse Rogers ]
+  * debian/control
+  * debian/rules:
+    + Import the multi-arch magic from alsa-lib to build a lib32asound2-plugins
+      package wherever lib32asound2 is built, and similarly for lib64asound2.
 
+ -- Christopher James Halse Rogers <[EMAIL PROTECTED]>  Sun, 10 Feb 2008 18:59:30 +1100
+
 alsa-plugins (1.0.15-1) unstable; urgency=low
 
   * New upstream release.
Index: debian/rules
===================================================================
--- debian/rules	(revision 2035)
+++ debian/rules	(working copy)
@@ -7,6 +7,37 @@
 export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
+DEB_BUILD_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
+DEB_HOST_ARCH  ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+
+biarch_map := i386=amd64 powerpc=ppc64 sparc=sparc64 s390=s390x \
+		amd64=i386 ppc64=powerpc
+biarch_cpu := $(strip $(patsubst $(DEB_BUILD_ARCH_CPU)=%, %, \
+			   $(filter $(DEB_BUILD_ARCH_CPU)=%, $(biarch_map))))
+
+ifneq (,$(biarch_cpu))
+  ifneq (,$(findstring /$(DEB_HOST_ARCH)/, /i386/powerpc/sparc/s390/))
+    bi = 64
+    bilibdir = usr/lib64
+  endif
+  ifneq (,$(findstring /$(DEB_HOST_ARCH)/, /amd64/ppc64/))
+    bi = 32
+    bilibdir = usr/lib32
+  endif
+  ifneq (,$(bi))
+    configure_biarch_stamp = configure-biarch-stamp
+    build_biarch_stamp = build-biarch-stamp
+    BIARCH_CC = gcc -m$(bi)
+    dpkg_ctrl_args = -- '-Vbilib:depends=libc6-$(biarch_cpu)' \
+	'-Vbidev:depends=libc6-dev-$(biarch_cpu)'
+    BIARCH_TEMPLIBDIR = $(CURDIR)/debian/biarch-templibdir
+    BIARCH_PKGCONFIGDIR = $(BIARCH_TEMPLIBDIR)/pkgconfig
+    BIARCH_LIBPULSE = $(wildcard /$(bilibdir)/libpulse.so*)
+    BIARCH_LIBDBUS = $(wildcard /$(bilibdir)/libdbus-1.so*)
+    BIARCH_LIBJACK = $(wildcard /$(bilibdir)/libjack.so*)
+  endif
+endif
+
 CFLAGS = -g -Wall
 
 INSTALL_UAG := -o root -g audio
@@ -17,7 +48,7 @@
 	CFLAGS += -O2
 endif
 
-configure-stamp: debian/stamp-patched
+configure-stamp: debian/stamp-patched $(configure_biarch_stamp)
 	dh_testdir
 	-rm -f config.sub config.guess
 	ln -s /usr/share/misc/config.sub config.sub
@@ -30,6 +61,52 @@
 		    --enable-static
 	touch configure-stamp
 
+biarch-lib-dev-setup:
+	dh_testdir
+	mkdir $(BIARCH_TEMPLIBDIR)
+	mkdir $(BIARCH_PKGCONFIGDIR)
+	# We build-depend on lib$(BI)asound2-dev, so we are guaranteed
+	# to have linkable alsa libraries...
+	cp /usr/lib/pkgconfig/alsa.pc $(BIARCH_PKGCONFIGDIR)/
+
+	# We don't necessarily have pulse, dbus, or jack biarch libraries
+	# and even if we do, we don't have the .so symlink for them
+	# since ia32-libs-dev doesn't exist.
+	# SO: we need to detect these libs when they exist, provide .so
+	# symlinks, and copy the pkg-config files.
+ifneq ($(strip $(BIARCH_LIBPULSE)),)
+	cp /usr/lib/pkgconfig/libpulse.pc $(BIARCH_PKGCONFIGDIR)/
+	ln -s $(word 1, $(BIARCH_LIBPULSE)) $(BIARCH_TEMPLIBDIR)/libpulse.so
+endif
+ifneq ($(strip $(BIARCH_LIBDBUS)),)
+	cp /usr/lib/pkgconfig/dbus-1.pc $(BIARCH_PKGCONFIGDIR)/
+	ln -s $(word 1, $(BIARCH_LIBDBUS)) $(BIARCH_TEMPLIBDIR)/libdbus-1.so
+endif
+ifneq ($(strip $(BIARCH_LIBJACK)),)
+	cp /usr/lib/pkgconfig/jack.pc $(BIARCH_PKGCONFIGDIR)/
+	ln -s $(word 1, $(BIARCH_LIBJACK)) $(BIARCH_TEMPLIBDIR)/libjack.so
+endif
+	touch biarch-lib-dev-setup
+
+configure-biarch-stamp: debian/stamp-patched biarch-lib-dev-setup
+	dh_testdir
+	-rm -f config.sub config.guess
+	ln -s /usr/share/misc/config.sub config.sub
+	ln -s /usr/share/misc/config.guess config.guess
+	rm -rf bibuild
+	mkdir bibuild
+	cd bibuild && PKG_CONFIG_LIBDIR=$(BIARCH_PKGCONFIGDIR) \
+		CC="$(BIARCH_CC)" ../configure --prefix=/usr \
+		    --mandir=\$${prefix}/share/man \
+		    --infodir=\$${prefix}/share/info \
+		    --host=$(DEB_HOST_GNU_TYPE) \
+		    --enable-static 
+	sed -e '/^SUBDIRS/s/doc//' bibuild/Makefile > bibuild/Makefile.new
+	mv bibuild/Makefile bibuild/Makefile.old
+	mv bibuild/Makefile.new bibuild/Makefile
+	touch -r bibuild/Makefile.old bibuild/Makefile
+	touch configure-biarch-stamp
+
 configure: configure-stamp
 
 build-arch-stamp: configure-stamp
@@ -37,8 +114,13 @@
 	$(MAKE) CFLAGS="$(CFLAGS)"
 	touch build-arch-stamp
 
-build-arch: build-arch-stamp
+build-biarch-stamp: configure-biarch-stamp
+	dh_testdir
+	$(MAKE) -C bibuild CFLAGS="$(CFLAGS)" LDFLAGS="-L$(BIARCH_TEMPLIBDIR)"
+	touch build-biarch-stamp
 
+build-arch: $(build_biarch_stamp) build-arch-stamp
+
 build: build-arch
 
 install-arch: build-arch-stamp
@@ -46,7 +128,14 @@
 	dh_testroot
 	dh_clean -k
 	$(MAKE) install DESTDIR=$(CURDIR)/debian/libasound2-plugins
-	dh_installdirs usr/lib/alsa-lib
+ifneq (,$(build_biarch_stamp))
+	rm -rf debian/bitmp
+	$(MAKE) -C bibuild install DESTDIR=$(CURDIR)/debian/bitmp
+	mkdir -p debian/lib$(bi)asound2-plugins/$(bilibdir)/alsa-lib
+	cp -a debian/bitmp/usr/lib/alsa-lib/libasound_module* \
+	    debian/lib$(bi)asound2-plugins/$(bilibdir)/alsa-lib
+endif
+	dh_installdirs -plibasound2-plugins usr/lib/alsa-lib
 	dh_install
 	#install $(INSTALL_UAG) jack/.libs/libasound_module_pcm_jack.so \
 	#	debian/libasound2-plugins/usr/lib/alsa-lib/libasound_module_pcm_jack.so.2.0.0
@@ -60,12 +149,12 @@
 	dh_fixperms
 
 binary-arch: build-arch-stamp install-arch
-	dh_makeshlibs -n
-	dh_installdeb
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
+	dh_makeshlibs -n -s
+	dh_installdeb -s
+	dh_shlibdeps -s
+	dh_gencontrol -s
+	dh_md5sums -s
+	dh_builddeb -s
 
 binary: binary-arch
 
@@ -73,8 +162,12 @@
 	dh_testdir
 	dh_testroot
 	[ ! -f Makefile ] || $(MAKE) distclean
-	-rm -f configure-stamp build-arch-stamp build-indep-stamp
+	-rm -f configure-stamp build-arch-stamp build-indep-stamp biarch-lib-dev-setup
 	-rm -f config.sub config.guess config.status config.cache
+ifneq (,$(build_biarch_stamp))
+	-rm -rf $(CURDIR)/debian/bitmp
+	-rm -rf $(BIARCH_TEMPLIBDIR)
+endif
 	dh_clean
 
 .PHONY: configure build-arch build install-arch binary-arch binary clean

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to