diff -Nru pwlib-1.10.10/debian/changelog pwlib-1.10.10/debian/changelog
--- pwlib-1.10.10/debian/changelog	2012-04-08 21:00:26.000000000 +0200
+++ pwlib-1.10.10/debian/changelog	2012-04-08 19:04:06.000000000 +0200
@@ -1,3 +1,12 @@
+pwlib (1.10.10-3.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Switch to dpkg source format 3.0 (quilt).
+  * kfreebsd-ftbfs.diff: Fix FTBFS on GNU/kFreeBSD, based on patch from
+    Tuco Xyz with some adjustments.  (Closes: #587588)
+
+ -- Robert Millan <rmh@debian.org>  Sun, 08 Apr 2012 19:00:21 +0200
+
 pwlib (1.10.10-3.1) unstable; urgency=low
 
   * Non-maintainer upload.
diff -Nru pwlib-1.10.10/debian/control pwlib-1.10.10/debian/control
--- pwlib-1.10.10/debian/control	2012-04-08 21:00:26.000000000 +0200
+++ pwlib-1.10.10/debian/control	2012-04-08 19:35:58.000000000 +0200
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Debian VoIP Team <pkg-voip-maintainers@lists.alioth.debian.org>
 Uploaders: Kilian Krause <kilian@debian.org>, Mark Purcell <msp@debian.org>, Faidon Liambotis <paravoid@debian.org>
-Build-Depends: debhelper (>= 5), bison, flex, libssl-dev, libldap2-dev, libsdl1.2-dev, libexpat1-dev, g++ (>=2.95), autotools-dev, dpatch (>=1.11), libasound2-dev, libdv-dev, libsasl2-dev, libkrb5-dev, doxygen, linux-kernel-headers|linux-libc-dev, binutils (>= 2.14.90.0.7), dpkg-dev (>= 1.13.19)
+Build-Depends: debhelper (>= 5), bison, flex, libssl-dev, libldap2-dev, libsdl1.2-dev, libexpat1-dev, autotools-dev, libasound2-dev [linux-any], libdv-dev, libsasl2-dev, libkrb5-dev, doxygen
 Build-Conflicts: libpt-1.11.2, libpt-1.11.2-ptrace, libpt-1.11.2-develop,
   libpt-1.10.10, libpt-1.10.10-ptrace, libpt-1.10.10-develop, 
   libpt-1.10.0, libpt-1.10.0-ptrace, libpt-1.10.0-develop, 
@@ -17,7 +17,7 @@
 Package: libpt-1.10.10
 Section: libs
 Architecture: any
-Depends: ${shlibs:Depends}, libpt-1.10.10-plugins-alsa|libpt-1.10.10-plugins-oss, libpt-1.10.10-plugins-v4l2
+Depends: ${shlibs:Depends}, libpt-1.10.10-plugins-alsa [linux-any] | libpt-1.10.10-plugins-oss, libpt-1.10.10-plugins-v4l2 [linux-any kfreebsd-any]
 Conflicts: libpt-1.10.10-ptrace, libpt-1.10.10-develop
 Description: Portable Windows Library
  This package contains the shared version of the library PWLib, which is
@@ -62,7 +62,7 @@
 
 Package: libpt-1.10.10-plugins-v4l2
 Section: libs
-Architecture: any
+Architecture: linux-any kfreebsd-any
 Depends: ${shlibs:Depends}
 Conflicts: libpt-plugins-v4l2
 Replaces: libpt-plugins-v4l2
@@ -84,7 +84,7 @@
  interface..
 
 Package: libpt-1.10.10-plugins-alsa
-Architecture: any
+Architecture: linux-any
 Depends: ${shlibs:Depends}
 Recommends: alsa-base
 Conflicts: libpt-plugins-alsa
diff -Nru pwlib-1.10.10/debian/patches/00list pwlib-1.10.10/debian/patches/00list
--- pwlib-1.10.10/debian/patches/00list	2012-04-08 21:00:26.000000000 +0200
+++ pwlib-1.10.10/debian/patches/00list	1970-01-01 01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-01_unix.mak_Os
-04_names
-05_hppa
-06_plugins_shared
-CVE-2007-4897
diff -Nru pwlib-1.10.10/debian/patches/01_unix.mak_Os.dpatch pwlib-1.10.10/debian/patches/01_unix.mak_Os.dpatch
--- pwlib-1.10.10/debian/patches/01_unix.mak_Os.dpatch	2012-04-08 21:00:26.000000000 +0200
+++ pwlib-1.10.10/debian/patches/01_unix.mak_Os.dpatch	2012-04-08 18:59:39.000000000 +0200
@@ -4,9 +4,8 @@
 ## DP: Pass -O2 instead of -Os to gcc.
 
 @DPATCH@
-diff -urNad pwlib-1.9.3/make/unix.mak /tmp/dpep.1VnKtr/pwlib-1.9.3/make/unix.mak
---- pwlib-1.9.3/make/unix.mak	2006-01-17 19:57:17.000000000 +0100
-+++ /tmp/dpep.1VnKtr/pwlib-1.9.3/make/unix.mak	2006-02-19 22:09:55.562848765 +0100
+--- a/make/unix.mak
++++ b/make/unix.mak
 @@ -970,7 +970,7 @@
    ifeq ($(OSTYPE),solaris)
      OPTCCFLAGS	+= -xO3 
diff -Nru pwlib-1.10.10/debian/patches/04_names.dpatch pwlib-1.10.10/debian/patches/04_names.dpatch
--- pwlib-1.10.10/debian/patches/04_names.dpatch	2012-04-08 21:00:26.000000000 +0200
+++ pwlib-1.10.10/debian/patches/04_names.dpatch	2012-04-08 18:59:39.000000000 +0200
@@ -24,9 +24,8 @@
 exit 0
 
 @DPATCH@
-diff -urNad pwlib-1.10.3~dfsg~/make/common.mak pwlib-1.10.3~dfsg/make/common.mak
---- pwlib-1.10.3~dfsg~/make/common.mak	2007-05-20 10:48:29.000000000 +0000
-+++ pwlib-1.10.3~dfsg/make/common.mak	2007-05-20 10:52:38.000000000 +0000
+--- a/make/common.mak
++++ b/make/common.mak
 @@ -368,7 +368,7 @@
  OBJS += $(OBJDIR)/buildnum.o
  endif
@@ -36,9 +35,8 @@
  
  # distinguish betweek building and using pwlib
  ifeq (,$(wildcard $(PWLIBDIR)/src))
-diff -urNad pwlib-1.10.3~dfsg~/make/unix.mak pwlib-1.10.3~dfsg/make/unix.mak
---- pwlib-1.10.3~dfsg~/make/unix.mak	2007-05-20 10:52:38.000000000 +0000
-+++ pwlib-1.10.3~dfsg/make/unix.mak	2007-05-20 10:52:38.000000000 +0000
+--- a/make/unix.mak
++++ b/make/unix.mak
 @@ -936,10 +936,12 @@
  UNIX_SRC_DIR	= $(PWLIBDIR)/src/ptlib/unix
  endif
diff -Nru pwlib-1.10.10/debian/patches/05_hppa.dpatch pwlib-1.10.10/debian/patches/05_hppa.dpatch
--- pwlib-1.10.10/debian/patches/05_hppa.dpatch	2012-04-08 21:00:26.000000000 +0200
+++ pwlib-1.10.10/debian/patches/05_hppa.dpatch	2012-04-08 18:59:39.000000000 +0200
@@ -23,11 +23,10 @@
 exit 0
 
 @DPATCH@
-diff -urNad /home/jose/devel/temp/pwlib-1.7.5/make/unix.mak pwlib-1.7.5/make/unix.mak
---- /home/jose/devel/temp/pwlib-1.7.5/make/unix.mak	2004-07-18 16:29:42.000000000 +0200
-+++ pwlib-1.7.5/make/unix.mak	2004-07-18 16:29:52.000000000 +0200
-@@ -270,6 +270,10 @@
- MACHTYPE := ia64
+--- a/make/unix.mak
++++ b/make/unix.mak
+@@ -309,6 +309,10 @@
+ MACHTYPE := hppa64
  endif
  
 +ifneq (,$(findsting hppa64, $(MACHTYPE)))
@@ -37,7 +36,7 @@
  ifneq (,$(findstring s390, $(MACHTYPE)))
  ifneq (,$(findstring s390x, $(MACHTYPE)))
  MACHTYPE := s390x
-@@ -377,6 +381,10 @@
+@@ -418,6 +422,10 @@
  STDCCFLAGS     += -DP_64BIT
  endif
  
@@ -45,6 +44,6 @@
 +STDCCFLAGS     += -DP_64BIT
 +endif
 +
- ifeq ($(MACHTYPE),s390x)
+ ifeq ($(MACHTYPE),hppa64)
  STDCCFLAGS     += -DP_64BIT
  endif
diff -Nru pwlib-1.10.10/debian/patches/06_plugins_shared.dpatch pwlib-1.10.10/debian/patches/06_plugins_shared.dpatch
--- pwlib-1.10.10/debian/patches/06_plugins_shared.dpatch	2012-04-08 21:00:26.000000000 +0200
+++ pwlib-1.10.10/debian/patches/06_plugins_shared.dpatch	2012-04-08 18:59:40.000000000 +0200
@@ -23,9 +23,8 @@
 exit 0
 
 @DPATCH@
-diff -urNad /home/jose/devel/temp/pwlib-1.7.5/plugins/Makefile.in pwlib-1.7.5/plugins/Makefile.in
---- /home/jose/devel/temp/pwlib-1.7.5/plugins/Makefile.in	2003-12-17 16:40:56.000000000 +0100
-+++ pwlib-1.7.5/plugins/Makefile.in	2004-07-18 16:04:07.000000000 +0200
+--- a/plugins/Makefile.in
++++ b/plugins/Makefile.in
 @@ -4,6 +4,8 @@
  
  include ../make/ptlib.mak
@@ -35,7 +34,7 @@
  HAS_ALSA	= @HAS_ALSA@
  
  ifeq (1,$(HAS_ALSA))
-@@ -67,5 +69,5 @@
+@@ -91,5 +93,5 @@
  	@echo $(DEFAULT_SOUND)
  
  
diff -Nru pwlib-1.10.10/debian/patches/CVE-2007-4897.dpatch pwlib-1.10.10/debian/patches/CVE-2007-4897.dpatch
--- pwlib-1.10.10/debian/patches/CVE-2007-4897.dpatch	2012-04-08 21:00:26.000000000 +0200
+++ pwlib-1.10.10/debian/patches/CVE-2007-4897.dpatch	2012-04-08 18:59:40.000000000 +0200
@@ -6,9 +6,8 @@
 ## DP: contained more than 1000 characters
 
 @DPATCH@
-diff -urNad pwlib-1.10.10~/src/ptlib/common/contain.cxx pwlib-1.10.10/src/ptlib/common/contain.cxx
---- pwlib-1.10.10~/src/ptlib/common/contain.cxx	2005-11-30 13:47:41.000000000 +0100
-+++ pwlib-1.10.10/src/ptlib/common/contain.cxx	2007-12-03 13:45:00.000000000 +0100
+--- a/src/ptlib/common/contain.cxx
++++ b/src/ptlib/common/contain.cxx
 @@ -2465,7 +2465,7 @@
    PAssert(SetSize(2000), POutOfMemory);
    ::vsprintf(theArray+len, fmt, arg);
diff -Nru pwlib-1.10.10/debian/patches/kfreebsd-ftbfs.diff pwlib-1.10.10/debian/patches/kfreebsd-ftbfs.diff
--- pwlib-1.10.10/debian/patches/kfreebsd-ftbfs.diff	1970-01-01 01:00:00.000000000 +0100
+++ pwlib-1.10.10/debian/patches/kfreebsd-ftbfs.diff	2012-04-08 19:03:45.000000000 +0200
@@ -0,0 +1,46 @@
+--- a/configure
++++ b/configure
+@@ -2639,7 +2639,7 @@
+ NEEDS_PTHREADS=yes
+ 
+ case "$target_os" in
+-  linux*)          OSTYPE=linux ;
++  linux* | *-gnu | gnu*)          OSTYPE=linux ;
+                    OSRELEASE="\"`uname -r`\"";
+ 		   OS_TAG="P_LINUX" ;
+                    need_pragma=yes ;
+--- a/configure.ac
++++ b/configure.ac
+@@ -62,7 +62,7 @@
+ NEEDS_PTHREADS=yes
+ 
+ case "$target_os" in
+-  linux*)          OSTYPE=linux ;  
++  linux* | *-gnu | gnu*)          OSTYPE=linux ;  
+                    OSRELEASE="\"`uname -r`\"";
+ 		   OS_TAG="P_LINUX" ;
+                    need_pragma=yes ;
+--- a/src/ptlib/unix/pipechan.cxx
++++ b/src/ptlib/unix/pipechan.cxx
+@@ -148,8 +148,8 @@
+ #include <fcntl.h>
+ #include <signal.h>
+ 
+-#if defined(P_LINUX) || defined(P_SOLARIS)
+-#include <termio.h>
++#if defined(__GLIBC__) || defined(P_SOLARIS)
++#include <termios.h>
+ #endif
+ 
+ #if defined(P_MACOSX)
+--- a/src/ptlib/unix/serchan.cxx
++++ b/src/ptlib/unix/serchan.cxx
+@@ -435,7 +435,7 @@
+   // save new baud rate
+   baudRate = newBaudRate;
+ 
+-#if defined(P_FREEBSD) || defined(P_OPENBSD) || defined (P_NETBSD) || defined(P_MACOSX) || defined(P_MACOS)
++#if defined(P_FREEBSD) || defined(P_OPENBSD) || defined (P_NETBSD) || defined(P_MACOSX) || defined(P_MACOS) || defined(__FreeBSD_kernel__)
+   // The BSD way
+   Termio.c_ispeed = baud; 
+   Termio.c_ospeed = baud;
diff -Nru pwlib-1.10.10/debian/patches/misc.diff pwlib-1.10.10/debian/patches/misc.diff
--- pwlib-1.10.10/debian/patches/misc.diff	1970-01-01 01:00:00.000000000 +0100
+++ pwlib-1.10.10/debian/patches/misc.diff	2012-04-08 19:19:32.000000000 +0200
@@ -0,0 +1,40 @@
+Description: Misc (undocumented) changes found in this package prior to
+ switch to source format 3.0.
+
+--- a/src/ptclib/pssl.cxx
++++ b/src/ptclib/pssl.cxx
+@@ -888,7 +888,7 @@
+   InitialisationMutex.Signal();
+ 
+   // create the new SSL context
+-  SSL_METHOD * meth = SSLv23_method();
++  const SSL_METHOD * meth = SSLv23_method();
+   context  = SSL_CTX_new(meth);
+   if (context == NULL)
+     PSSLAssert("Error creating context: ");
+--- /dev/null
++++ b/plugins/vidinput_dc/Makefile
+@@ -0,0 +1,12 @@
++ifndef PWLIBDIR
++PWLIBDIR = $(HOME)/pwlib
++endif
++
++PLUGIN_NAME	= dc
++PLUGIN_FAMILY	= device/videoinput
++PLUGIN_LIBS	= -lraw1394 -ldv -ldc1394_control
++PLUGIN_SOURCES	= video4dc1394.cxx
++
++CFLAGS		= 
++
++include ../../make/plugins.mak
+--- a/plugins/vidinput_v4l2/vidinput_v4l2.h
++++ b/plugins/vidinput_v4l2/vidinput_v4l2.h
+@@ -80,7 +80,7 @@
+ #ifdef SOLARIS
+ #include <sys/videodev2.h>
+ #else
+-#include <linux/videodev.h>
++#include <linux/videodev2.h>
+ #endif
+ 
+ #ifndef V4L2_PIX_FMT_SBGGR8
diff -Nru pwlib-1.10.10/debian/patches/series pwlib-1.10.10/debian/patches/series
--- pwlib-1.10.10/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ pwlib-1.10.10/debian/patches/series	2012-04-08 19:19:29.000000000 +0200
@@ -0,0 +1,7 @@
+misc.diff
+01_unix.mak_Os.dpatch
+04_names.dpatch
+05_hppa.dpatch
+06_plugins_shared.dpatch
+CVE-2007-4897.dpatch
+kfreebsd-ftbfs.diff
diff -Nru pwlib-1.10.10/debian/rules pwlib-1.10.10/debian/rules
--- pwlib-1.10.10/debian/rules	2012-04-08 21:00:26.000000000 +0200
+++ pwlib-1.10.10/debian/rules	2012-04-08 19:28:53.000000000 +0200
@@ -22,6 +22,7 @@
 
 export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+export DEB_HOST_ARCH_OS   ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
 
 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
   confflags += --build $(DEB_HOST_GNU_TYPE)
@@ -216,10 +217,12 @@
 	cp plugins/pwlib/device/sound/oss_pwplugin.so \
 		debian/$(PACKAGE)-plugins-oss/usr/lib/pwlib/$(SHLIBSVER)/device/sound/
 
+ifeq ($(DEB_HOST_ARCH_OS), linux)
 	#$(PACKAGE)-plugins-alsa
 	install -d -m 755 debian/$(PACKAGE)-plugins-alsa/usr/lib/pwlib/$(SHLIBSVER)/device/sound/
 	cp plugins/pwlib/device/sound/alsa_pwplugin.so \
 		debian/$(PACKAGE)-plugins-alsa/usr/lib/pwlib/$(SHLIBSVER)/device/sound/
+endif
 
 # Must not depend on anything. This is to be called by
 # binary-arch/binary-multi
diff -Nru pwlib-1.10.10/debian/source/format pwlib-1.10.10/debian/source/format
--- pwlib-1.10.10/debian/source/format	1970-01-01 01:00:00.000000000 +0100
+++ pwlib-1.10.10/debian/source/format	2010-07-04 14:06:25.000000000 +0200
@@ -0,0 +1 @@
+3.0 (quilt)
diff -Nru pwlib-1.10.10/plugins/vidinput_dc/Makefile pwlib-1.10.10/plugins/vidinput_dc/Makefile
--- pwlib-1.10.10/plugins/vidinput_dc/Makefile	2012-04-08 21:00:26.000000000 +0200
+++ pwlib-1.10.10/plugins/vidinput_dc/Makefile	1970-01-01 01:00:00.000000000 +0100
@@ -1,12 +0,0 @@
-ifndef PWLIBDIR
-PWLIBDIR = $(HOME)/pwlib
-endif
-
-PLUGIN_NAME	= dc
-PLUGIN_FAMILY	= device/videoinput
-PLUGIN_LIBS	= -lraw1394 -ldv -ldc1394_control
-PLUGIN_SOURCES	= video4dc1394.cxx
-
-CFLAGS		= 
-
-include ../../make/plugins.mak
diff -Nru pwlib-1.10.10/plugins/vidinput_v4l2/vidinput_v4l2.h pwlib-1.10.10/plugins/vidinput_v4l2/vidinput_v4l2.h
--- pwlib-1.10.10/plugins/vidinput_v4l2/vidinput_v4l2.h	2012-04-08 21:00:26.000000000 +0200
+++ pwlib-1.10.10/plugins/vidinput_v4l2/vidinput_v4l2.h	2007-02-19 23:28:42.000000000 +0100
@@ -80,7 +80,7 @@
 #ifdef SOLARIS
 #include <sys/videodev2.h>
 #else
-#include <linux/videodev2.h>
+#include <linux/videodev.h>
 #endif
 
 #ifndef V4L2_PIX_FMT_SBGGR8
diff -Nru pwlib-1.10.10/src/ptclib/pssl.cxx pwlib-1.10.10/src/ptclib/pssl.cxx
--- pwlib-1.10.10/src/ptclib/pssl.cxx	2012-04-08 21:00:26.000000000 +0200
+++ pwlib-1.10.10/src/ptclib/pssl.cxx	2005-11-30 13:47:41.000000000 +0100
@@ -888,7 +888,7 @@
   InitialisationMutex.Signal();
 
   // create the new SSL context
-  const SSL_METHOD * meth = SSLv23_method();
+  SSL_METHOD * meth = SSLv23_method();
   context  = SSL_CTX_new(meth);
   if (context == NULL)
     PSSLAssert("Error creating context: ");
