summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/CFLAGS.patch26
-rw-r--r--debian/patches/arch_without_mregparm.patch24
-rw-r--r--debian/patches/cmd.patch124
-rw-r--r--debian/patches/dont_build_kernel_module.patch11
-rw-r--r--debian/patches/fix_invalid_printf.patch17
-rw-r--r--debian/patches/gcc-4.6.patch61
-rw-r--r--debian/patches/generic_srccconf.patch75
-rw-r--r--debian/patches/hurd_iot.patch21
-rw-r--r--debian/patches/kfreebsd-gnu.patch116
-rw-r--r--debian/patches/liboss4-salsa.patch19
-rw-r--r--debian/patches/libsalsa_fixes.patch51
-rw-r--r--debian/patches/modules-i386.patch10
-rw-r--r--debian/patches/no_EBADE.patch35
-rw-r--r--debian/patches/os_cmd.patch139
-rw-r--r--debian/patches/series17
-rw-r--r--debian/patches/snd_asoundlib_version.patch18
-rw-r--r--debian/patches/txt2man.patch12
17 files changed, 776 insertions, 0 deletions
diff --git a/debian/patches/CFLAGS.patch b/debian/patches/CFLAGS.patch
new file mode 100644
index 0000000..0b0e102
--- /dev/null
+++ b/debian/patches/CFLAGS.patch
@@ -0,0 +1,26 @@
+Index: oss4-4.2-build2004/lib/libsalsa/Makefile
+===================================================================
+--- oss4-4.2-build2004.orig/lib/libsalsa/Makefile 2011-06-14 11:33:22.000000000 -0500
++++ oss4-4.2-build2004/lib/libsalsa/Makefile 2011-06-14 11:35:03.000000000 -0500
+@@ -2,7 +2,7 @@
+
+ OSSLIBDIR=/usr/lib/oss
+
+-CFLAGS=-O -I../../include -I../libOSSlib
++CFLAGS+=-I../../include -I../libOSSlib
+ LIBTOOL=libtool --tag=CC
+
+ all: libsalsa.la
+Index: oss4-4.2-build2004/lib/libOSSlib/Makefile
+===================================================================
+--- oss4-4.2-build2004.orig/lib/libOSSlib/Makefile 2011-06-14 11:33:22.000000000 -0500
++++ oss4-4.2-build2004/lib/libOSSlib/Makefile 2011-06-14 11:33:24.000000000 -0500
+@@ -1,7 +1,7 @@
+ OBJS=libmain.o midiparser.o play_event.o
+ INSTALLLIB=/lib
+ LDFLAGS=-shared -fPIC
+-CFLAGS=-O -fPIC
++CFLAGS+=-fPIC
+ #LDFLAGS=-Bdynamic
+ AROPTS=rc
+ AR=ar
diff --git a/debian/patches/arch_without_mregparm.patch b/debian/patches/arch_without_mregparm.patch
new file mode 100644
index 0000000..2efe8e0
--- /dev/null
+++ b/debian/patches/arch_without_mregparm.patch
@@ -0,0 +1,24 @@
+Index: oss4-4.2-build2004/setup/srcconf_linux.inc
+===================================================================
+--- oss4-4.2-build2004.orig/setup/srcconf_linux.inc 2011-06-14 11:33:23.000000000 -0500
++++ oss4-4.2-build2004/setup/srcconf_linux.inc 2011-06-14 11:33:24.000000000 -0500
+@@ -53,7 +53,9 @@
+ fprintf (f,
+ "CFLAGS += -O3 -fno-common -mcmodel=kernel -mno-red-zone -fno-asynchronous-unwind-tables -ffreestanding%s\n", fnsp);
+ # else
+-# ifndef __arm__
++# if defined(__arm__) || defined(__sh__) || defined(__mips__) || defined(__sparc__) || defined(__ia64__) || defined(__alpha__) || defined(__s390__) || defined(__powerpc__) || defined(__hppa__)
++ fprintf (f, "CFLAGS += -O3 -fno-common -ffreestanding%s\n", fnsp);
++# else
+ if (getenv ("NO_REGPARM") == NULL)
+ {
+ fprintf (f,
+@@ -63,8 +65,6 @@
+ {
+ fprintf (f, "CFLAGS += -O3 -fno-common -ffreestanding -DNO_REGPARM%s\n", fnsp);
+ }
+-# else
+- fprintf (f, "CFLAGS += -O3 -fno-common -ffreestanding%s\n", fnsp);
+ # endif
+ # endif
+ }
diff --git a/debian/patches/cmd.patch b/debian/patches/cmd.patch
new file mode 100644
index 0000000..9f685de
--- /dev/null
+++ b/debian/patches/cmd.patch
@@ -0,0 +1,124 @@
+Index: oss4-4.2-build2004/cmd/ossdevlinks/ossdevlinks.c
+===================================================================
+--- oss4-4.2-build2004.orig/cmd/ossdevlinks/ossdevlinks.c 2011-06-14 11:33:24.000000000 -0500
++++ oss4-4.2-build2004/cmd/ossdevlinks/ossdevlinks.c 2011-06-14 11:33:24.000000000 -0500
+@@ -75,7 +75,7 @@
+ #if defined(sun)
+ #define DEFAULT_OSSLIBDIR "/etc/oss"
+ #else
+-#define DEFAULT_OSSLIBDIR "/usr/lib/oss"
++#define DEFAULT_OSSLIBDIR "/var/lib/oss4"
+ #endif
+
+ static char *
+@@ -99,7 +99,7 @@
+ if (l > 0 && tmp[l - 1] == '\n')
+ tmp[l - 1] = '\0';
+
+- if (strncmp (tmp, "OSSLIBDIR=", 10) == 0)
++ if (strncmp (tmp, "OSSVARDIR=", 10) == 0)
+ {
+ l = snprintf (name, sizeof (name), "%s", &tmp[10]);
+ if ((l >= OSSLIBDIRLEN) || (l < 0))
+@@ -991,7 +991,7 @@
+ char lfile[PATH_MAX+20], * osslibdir;
+
+ osslibdir = get_mapname ();
+- snprintf (lfile, sizeof (lfile), "%s/%s", osslibdir, "etc/legacy_devices");
++ snprintf (lfile, sizeof (lfile), "%s/%s", osslibdir, "legacy_devices");
+ if ((f = fopen (lfile, "w")) == NULL)
+ {
+ perror (lfile);
+Index: oss4-4.2-build2004/cmd/ossdevlinks/ossdevlinks.man
+===================================================================
+--- oss4-4.2-build2004.orig/cmd/ossdevlinks/ossdevlinks.man 2011-06-14 11:33:24.000000000 -0500
++++ oss4-4.2-build2004/cmd/ossdevlinks/ossdevlinks.man 2011-06-14 11:33:24.000000000 -0500
+@@ -34,7 +34,7 @@
+
+ FILES
+ /usr/sbin/ossdevlinks
+-/usr/lib/oss/etc/legacy_devices
++/var/lib/oss4/legacy_devices
+ /dev/dspN
+ /dev/midiNN
+ /dev/mixerN
+Index: oss4-4.2-build2004/cmd/savemixer/savemixer.c
+===================================================================
+--- oss4-4.2-build2004.orig/cmd/savemixer/savemixer.c 2011-06-14 11:33:24.000000000 -0500
++++ oss4-4.2-build2004/cmd/savemixer/savemixer.c 2011-06-14 11:33:24.000000000 -0500
+@@ -268,14 +268,14 @@
+ get_mapname (void)
+ {
+ FILE *f;
+- char tmp[ETCDIRLEN+11]; /* Adding 'OSSLIBDIR=' */
+- static char name[ETCDIRLEN+15]; /* Adding '/etc/mixer.save' */
++ char tmp[ETCDIRLEN+11]; /* Adding 'OSSVARDIR=' */
++ static char name[ETCDIRLEN+10]; /* Adding 'mixer.save' */
+ struct stat st;
+
+- if (stat ("/etc/oss", &st) != -1) /* Use /etc/oss/mixer.save */
++ if (stat ("/var/lib/oss4", &st) != -1) /* Use /var/lib/oss4/mixer.save */
+ {
+- strcpy (name, "/etc/oss/mixer.save");
+- strcpy (ossetcdir, "/etc/oss");
++ strcpy (name, "/var/lib/oss4/mixer.save");
++ strcpy (ossetcdir, "/var/lib/oss4");
+ return name;
+ }
+
+@@ -291,15 +291,15 @@
+ if (l > 0 && tmp[l - 1] == '\n')
+ tmp[l - 1] = '\0';
+
+- if (strncmp (tmp, "OSSLIBDIR=", 10) == 0)
++ if (strncmp (tmp, "OSSVARDIR=", 10) == 0)
+ {
+- l = snprintf (name, sizeof (name), "%s/etc/mixer.save", &tmp[10]);
++ l = snprintf (name, sizeof (name), "%s/mixer.save", &tmp[10]);
+ if ((l >= sizeof (name)) || (l < 0))
+ {
+ fprintf (stderr, "String in /etc/oss.conf is too long!\n");
+ goto oexit;
+ }
+- snprintf (ossetcdir, sizeof (ossetcdir), "%s/etc", &tmp[10]);
++ snprintf (ossetcdir, sizeof (ossetcdir), "%s", &tmp[10]);
+ if ((l >= sizeof (ossetcdir)) || (l < 0))
+ {
+ fprintf (stderr, "String in /etc/oss.conf is too long!\n");
+@@ -311,7 +311,7 @@
+ }
+
+ fclose (f);
+- fprintf (stderr, "Error: OSSLIBDIR not set in /etc/oss.conf\n");
++ fprintf (stderr, "Error: OSSVARDIR not set in /etc/oss.conf\n");
+
+ dexit:
+ snprintf (name, sizeof (name), "%s/mixer.save", ossetcdir);
+Index: oss4-4.2-build2004/cmd/savemixer/savemixer.man
+===================================================================
+--- oss4-4.2-build2004.orig/cmd/savemixer/savemixer.man 2011-06-14 11:33:23.000000000 -0500
++++ oss4-4.2-build2004/cmd/savemixer/savemixer.man 2011-06-14 11:33:24.000000000 -0500
+@@ -9,8 +9,8 @@
+ settings back into the mixer.
+
+ Running this program without any parameters will save the current mixer
+-settings into /etc/oss/mixer.save or $OSSLIBDIR/etc/mixer.save file.
+-OSSLIBDIR is decided by reading /etc/oss.conf, and defaults to /usr/lib/oss.
++settings into /var/lib/oss4/mixer.save or $OSSVARDIR/mixer.save file.
++OSSVARDIR is decided by reading /etc/oss.conf, and defaults to /var/lib/oss4.
+
+ AUTOMATIC SAVE
+ By default the soundoff command will automatically run savemixer to save
+@@ -29,9 +29,9 @@
+ FILES
+ /etc/oss.conf
+ /usr/sbin/savemixer
+-/usr/lib/oss/etc/mixer.save
+-/usr/lib/oss/etc/dspdevs.map
+-/usr/lib/oss/etc/applist.conf
++/var/lib/oss4/mixer.save
++/var/lib/oss4/dspdevs.map
++/var/lib/oss4/applist.conf
+
+ AUTHOR
+ 4Front Technologies
diff --git a/debian/patches/dont_build_kernel_module.patch b/debian/patches/dont_build_kernel_module.patch
new file mode 100644
index 0000000..d417af1
--- /dev/null
+++ b/debian/patches/dont_build_kernel_module.patch
@@ -0,0 +1,11 @@
+--- oss-v4.2-build2006-src-gpl/setup/Linux/build.sh.orig 2012-02-18 18:56:31.543278967 +0100
++++ oss-v4.2-build2006-src-gpl/setup/Linux/build.sh 2012-02-18 18:56:47.167278816 +0100
+@@ -110,7 +110,6 @@
+ if ! $LD -r -o prototype/$OSSLIBDIR/$OBJECTS/osscore.o target/objects/*.o
+ then
+ echo Linking osscore failed!
+- exit 1
+ fi
+
+ rm -f devlist.txt devices.list
+
diff --git a/debian/patches/fix_invalid_printf.patch b/debian/patches/fix_invalid_printf.patch
new file mode 100644
index 0000000..1f6bb96
--- /dev/null
+++ b/debian/patches/fix_invalid_printf.patch
@@ -0,0 +1,17 @@
+Index: oss4-4.2-build2004/setup/elflib.inc
+===================================================================
+--- oss4-4.2-build2004.orig/setup/elflib.inc 2011-06-14 11:33:23.000000000 -0500
++++ oss4-4.2-build2004/setup/elflib.inc 2011-06-14 11:33:24.000000000 -0500
+@@ -81,7 +81,11 @@
+ }
+ if (hdr->e_ehsize != sizeof (*hdr))
+ {
+- fprintf (stderr, "e_ehsize=%x (%x)\n", hdr->e_ehsize, sizeof (*hdr));
++ #if defined(__alpha__) || defined(__s390__) || defined(__ia64__)
++ fprintf (stderr, "e_ehsize=%x (%lx)\n", hdr->e_ehsize, sizeof (*hdr));
++ #else
++ fprintf (stderr, "e_ehsize=%x (%x)\n", hdr->e_ehsize, sizeof (*hdr));
++ #endif
+ return 0;
+ }
+
diff --git a/debian/patches/gcc-4.6.patch b/debian/patches/gcc-4.6.patch
new file mode 100644
index 0000000..c07a737
--- /dev/null
+++ b/debian/patches/gcc-4.6.patch
@@ -0,0 +1,61 @@
+--- oss4-4.2-build2004/cmd/ossmixd/ossmixd.c
++++ oss4-4.2-build2004/cmd/ossmixd/ossmixd.c
+@@ -161,7 +161,7 @@
+ oss_mixext *ext;
+ int i;
+ int nrext;
+- int value, prev_value;
++ int value, prev_value __attribute__((unused));
+
+ nrext = ossmix_get_nrext (mixernum);
+
+--- oss4-4.2-build2004/cmd/ossphone/ossphone.c
++++ oss4-4.2-build2004/cmd/ossphone/ossphone.c
+@@ -151,7 +151,7 @@
+ printf("Waiting for dial tone...\n");
+ while (dc_level < min_dc_level)
+ {
+- int dummy;
++ int dummy __attribute__((unused));
+ modem_read(modem_in_fd, buf, sizeof(buf));
+ dummy=write(dev_dsp_fd, buf, sizeof(buf));
+
+@@ -187,7 +187,7 @@
+ {
+ if (dtmf_fill_digit (digit, digit_len, *phone_number) >= 0)
+ {
+- int dummy;
++ int dummy __attribute__((unused));
+
+ printf("%c", *phone_number);
+ fflush(stdout);
+@@ -381,7 +381,7 @@
+
+ while (1)
+ {
+- int dummy;
++ int dummy __attribute__((unused));
+ FD_ZERO(&rfds);
+ FD_SET(modem_in_fd, &rfds);
+ FD_SET(dev_dsp_fd, &rfds);
+--- oss4-4.2-build2004/cmd/ossplay/ossplay_parser.c
++++ oss4-4.2-build2004/cmd/ossplay/ossplay_parser.c
+@@ -764,7 +764,7 @@
+ pos = l + 7, tmp, vers;
+ unsigned char buf[256], block_type;
+ flag plock = 0;
+- int speed = 11025, channels = 1, bits = 8, format = AFMT_U8;
++ int speed = 11025, channels = 1, bits __attribute__((unused)) = 8, format = AFMT_U8;
+ errors_t ret;
+
+ if (read (fd, hdr + 19, 7) < 7)
+@@ -1685,7 +1685,7 @@
+ caf_desc_parse (uint32 id, unsigned char * buf, big_t len, file_t * f)
+ {
+ int format;
+- uint32 bits, bytes_per_packet, flags, frames_per_packet;
++ uint32 bits, bytes_per_packet, flags, frames_per_packet __attribute__((unused));
+
+ {
+ /*
+
diff --git a/debian/patches/generic_srccconf.patch b/debian/patches/generic_srccconf.patch
new file mode 100644
index 0000000..26d815a
--- /dev/null
+++ b/debian/patches/generic_srccconf.patch
@@ -0,0 +1,75 @@
+--- oss-v4.2-build2003-src-gpl/setup/srcconf.c.orig 2010-08-23 03:17:48.000000000 +0200
++++ oss-v4.2-build2003-src-gpl/setup/srcconf.c 2010-08-23 03:31:07.000000000 +0200
+@@ -107,32 +107,38 @@
+
+ static char arch[32] = "";
+
+-static void
+-generate_driver (char *name, conf_t * conf, char *cfg_name, char *cfg_header,
+- char *dirname, char *topdir);
+-
+-typedef void
+-(*generate_driver_t) (char *name, conf_t * conf, char *cfg_name, char *cfg_header,
+- char *dirname, char *topdir);
+-
+-generate_driver_t driver_gen = generate_driver;
+-
+ #ifdef linux
+ #include "srcconf_vxworks.inc"
+ #include "srcconf_linux.inc"
++#define HAVE_SRCCONF
+ #endif
+
+ #ifdef __FreeBSD__
+ #include "srcconf_freebsd.inc"
++#define HAVE_SRCCONF
+ #endif
+
+ #ifdef sun
+ #include "srcconf_vxworks.inc"
+ #include "srcconf_solaris.inc"
++#define HAVE_SRCCONF
+ #endif
+
+ #if defined(__BEOS__) || defined(__HAIKU__)
+ #include "srcconf_beos.inc"
++#define HAVE_SRCCONF
++#endif
++
++#ifdef HAVE_SRCCONF
++static void
++generate_driver (char *name, conf_t * conf, char *cfg_name, char *cfg_header,
++ char *dirname, char *topdir);
++
++typedef void
++(*generate_driver_t) (char *name, conf_t * conf, char *cfg_name, char *cfg_header,
++ char *dirname, char *topdir);
++
++generate_driver_t driver_gen = generate_driver;
+ #endif
+
+ static int
+@@ -643,8 +649,10 @@
+ conf.mode == MD_KERNEL_ || conf.mode == MD_MODULE_)
+ return 0;
+
++#ifdef HAVE_SRCCONF
+ if (conf.mode == MD_MODULE)
+ driver_gen (name, &conf, cfg_name, cfg_header, path, topdir);
++#endif
+
+ if ((dir = opendir (path)) == NULL)
+ {
+@@ -1471,9 +1479,9 @@
+ shlib_ldflags = "-G -lsocket -lnsl";
+ # endif
+
+- if (strcmp (un.machine, "i386") == 0 ||
+- strcmp (un.machine, "i486") == 0 ||
+- strcmp (un.machine, "i586") == 0 || strcmp (un.machine, "i686") == 0)
++ if (strncmp (un.machine, "i386", 4) == 0 ||
++ strncmp (un.machine, "i486", 4) == 0 ||
++ strncmp (un.machine, "i586", 4) == 0 || strncmp (un.machine, "i686", 4) == 0)
+ {
+ strcpy (conf->platform, "i86pc");
+ }
diff --git a/debian/patches/hurd_iot.patch b/debian/patches/hurd_iot.patch
new file mode 100644
index 0000000..791d9d3
--- /dev/null
+++ b/debian/patches/hurd_iot.patch
@@ -0,0 +1,21 @@
+This is needed for GNU/Hurd build. These _IOT__IOTBASE_* definitions will not
+work of course, that's ok since we do not support sound yet anyway, and we do
+not export this to other packages.
+
+Index: oss4-4.2-build2004/lib/libsalsa/local.h
+===================================================================
+--- oss4-4.2-build2004.orig/lib/libsalsa/local.h 2011-06-14 11:33:22.000000000 -0500
++++ oss4-4.2-build2004/lib/libsalsa/local.h 2011-06-14 11:35:15.000000000 -0500
+@@ -96,3 +96,12 @@
+ extern void midiparser_callback (void *context, int category,
+ unsigned char msg, unsigned char ch,
+ unsigned char *parms, int len);
++
++#define _IOT__IOTBASE_oss_longname_t _IOT (0, 0, 0, 0, 0, 0)
++#define _IOT__IOTBASE_audio_buf_info _IOT (0, 0, 0, 0, 0, 0)
++#define _IOT__IOTBASE_oss_sysinfo _IOT (0, 0, 0, 0, 0, 0)
++#define _IOT__IOTBASE_oss_mixext _IOT (0, 0, 0, 0, 0, 0)
++#define _IOT__IOTBASE_oss_mixer_value _IOT (0, 0, 0, 0, 0, 0)
++#define _IOT__IOTBASE_oss_audioinfo _IOT (0, 0, 0, 0, 0, 0)
++#define _IOT__IOTBASE_oss_mixerinfo _IOT (0, 0, 0, 0, 0, 0)
++#define _IOT__IOTBASE_oss_card_info _IOT (0, 0, 0, 0, 0, 0)
diff --git a/debian/patches/kfreebsd-gnu.patch b/debian/patches/kfreebsd-gnu.patch
new file mode 100644
index 0000000..010c603
--- /dev/null
+++ b/debian/patches/kfreebsd-gnu.patch
@@ -0,0 +1,116 @@
+--- a/include/soundcard.h
++++ b/include/soundcard.h
+@@ -50,7 +50,7 @@
+ /* In Linux we need to be prepared for cross compiling */
+ #include <linux/ioctl.h>
+ #else
+-# ifdef __FreeBSD__
++# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ # include <sys/ioccom.h>
+ # else
+ # include <sys/ioctl.h>
+--- a/kernel/framework/audio/oss_audio_core.c
++++ b/kernel/framework/audio/oss_audio_core.c
+@@ -3646,7 +3646,7 @@
+ }
+ return 0;
+
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ case FREEBSD_GETBLKSIZE:
+ #endif
+ case SNDCTL_DSP_GETBLKSIZE:
+--- a/kernel/framework/sndstat/oss_sndstat.c
++++ b/kernel/framework/sndstat/oss_sndstat.c
+@@ -109,9 +109,9 @@
+ put_status ("\n");
+ }
+
+-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__NetBSD__)
+ {
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ extern char version[];
+ #endif
+
+--- a/lib/libOSSlib/compile.sh
++++ b/lib/libOSSlib/compile.sh
+@@ -7,7 +7,7 @@
+ $MAKE libOSSlib.so
+ ;;
+
+-"FreeBSD")
++"FreeBSD" | "GNU/kFreeBSD")
+ $MAKE libOSSlib.so
+ ;;
+
+--- a/setup/srcconf.c
++++ b/setup/srcconf.c
+@@ -122,7 +122,7 @@
+ #include "srcconf_linux.inc"
+ #endif
+
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ #include "srcconf_freebsd.inc"
+ #endif
+
+@@ -480,7 +480,7 @@
+ #include "gen_driver_linux.inc"
+ #endif
+
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ #include "gen_driver_freebsd.inc"
+ #endif
+
+@@ -1456,6 +1456,8 @@
+ strcpy (un.sysname, "SCO_SV");
+ if (strcmp (un.sysname, "Haiku") == 0)
+ strcpy (un.sysname, "BeOS");
++ if (strcmp (un.sysname, "GNU/kFreeBSD") == 0)
++ strcpy (un.sysname, "FreeBSD");
+ printf ("System: %s\n", un.sysname);
+ strcpy (conf->system, un.sysname);
+ sprintf (this_os, "kernel/OS/%s", un.sysname);
+@@ -1549,7 +1551,7 @@
+ if (hostcc == NULL) hostcc = DEFAULT_CC;
+ if (targetcc == NULL) targetcc = DEFAULT_CC;
+
+-#if defined(linux) || defined(__FreeBSD__) || defined(__SCO_VERSION__)
++#if defined(linux) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__SCO_VERSION__)
+ mkdir ("target", 0755);
+ mkdir ("target/build", 0755);
+ system ("touch target/build/.nomake");
+--- a/setup/setupdir.sh
++++ b/setup/setupdir.sh
+@@ -33,6 +33,12 @@
+ OS=BeOS
+ fi
+
++# Use the same source directories for FreeBSD and GNU/kFreeBSD
++if test "$OS " = "GNU/kFreeBSD "
++then
++ OS=FreeBSD
++fi
++
+ # Use Linux24 as the OS name for Linux 2.4.x
+ if test "$OS " = "Linux "
+ then
+--- a/setup/FreeBSD/build.sh
++++ b/setup/FreeBSD/build.sh
+@@ -150,10 +150,10 @@
+ strip prototype/usr/sbin/osslic
+
+ BITS=3 # Default to 32 bit ELF format
+- if test "`uname -m` " = "amd64 "
+- then
++ case "`uname -m`" in amd64|x86_64)
+ BITS=6 # Use 64 bit ELF format
+- fi
++ ;;
++ esac
+
+ prototype/usr/sbin/osslic -q -u -$BITS./prototype/$OSSLIBDIR/build/osscore.lib
+
diff --git a/debian/patches/liboss4-salsa.patch b/debian/patches/liboss4-salsa.patch
new file mode 100644
index 0000000..5eeb628
--- /dev/null
+++ b/debian/patches/liboss4-salsa.patch
@@ -0,0 +1,19 @@
+Rename libsalsa into liboss4-salsa (the former would conflict for no good reason
+with another package in Debian).
+
+Add rpath to /usr/lib/oss4-libsalsa, where the internal lib libOSSlib resides
+(as agreed on with ftp-master).
+
+Index: oss4-4.2-build2004/lib/libsalsa/Makefile
+===================================================================
+--- oss4-4.2-build2004.orig/lib/libsalsa/Makefile 2011-06-14 11:33:24.000000000 -0500
++++ oss4-4.2-build2004/lib/libsalsa/Makefile 2011-06-14 11:33:24.000000000 -0500
+@@ -46,7 +46,7 @@
+ $(LIBTOOL) --mode=compile ${CC} $(CFLAGS) -c rawmidi.c
+
+ libsalsa.la: $(LOBJECTS)
+- $(LIBTOOL) --mode=link ${CC} -rpath /usr/lib -Wl,--version-script=Versions -version-info 2:0:0 -o libsalsa.la $(LOBJECTS) -L../libOSSlib -lOSSlib
++ $(LIBTOOL) --mode=link ${CC} -rpath /usr/lib -R /usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)/oss4-libsalsa -Wl,--version-script=Versions -version-info 2:0:0 -o liboss4-salsa.la $(LOBJECTS) -L../libOSSlib -lOSSlib
+
+ install: libsalsa.la
+ $(LIBTOOL) cp libsalsa.la /usr/lib
diff --git a/debian/patches/libsalsa_fixes.patch b/debian/patches/libsalsa_fixes.patch
new file mode 100644
index 0000000..8bb2f88
--- /dev/null
+++ b/debian/patches/libsalsa_fixes.patch
@@ -0,0 +1,51 @@
+Index: oss4-4.2-build2004/lib/libsalsa/seq.c
+===================================================================
+--- oss4-4.2-build2004.orig/lib/libsalsa/seq.c 2011-06-14 11:33:22.000000000 -0500
++++ oss4-4.2-build2004/lib/libsalsa/seq.c 2011-06-14 11:33:24.000000000 -0500
+@@ -111,7 +111,7 @@
+ if ((seq = malloc (sizeof (*seq))) == NULL)
+ return -ENOMEM;
+
+- dbg_printf ("Created sequencer seq=%x\n", seq);
++ dbg_printf ("Created sequencer seq=%p\n", seq);
+
+ memset (seq, 0, sizeof (*seq));
+
+Index: oss4-4.2-build2004/lib/libsalsa/seq_output.c
+===================================================================
+--- oss4-4.2-build2004.orig/lib/libsalsa/seq_output.c 2011-06-14 11:33:22.000000000 -0500
++++ oss4-4.2-build2004/lib/libsalsa/seq_output.c 2011-06-14 11:35:11.000000000 -0500
+@@ -78,7 +78,7 @@
+
+ dbg_printf3
+ ("Event %2d: flags=%08x tag=%08x, q=%2d, time=%d, src=%x, dst=%x\n",
+- ev->type, ev->flags, ev->tag, ev->queue, ev->time, ev->source, ev->dest);
++ ev->type, ev->flags, ev->tag, ev->queue, ev->time.tick, ev->source, ev->dest);
+
+ switch (ev->type)
+ {
+Index: oss4-4.2-build2004/lib/libsalsa/timer.c
+===================================================================
+--- oss4-4.2-build2004.orig/lib/libsalsa/timer.c 2011-06-14 11:33:22.000000000 -0500
++++ oss4-4.2-build2004/lib/libsalsa/timer.c 2011-06-14 11:33:24.000000000 -0500
+@@ -57,7 +57,7 @@
+
+ timer = malloc (sizeof (*timer));
+
+- dbg_printf ("snd_timer_open(name='%s', mode=%x)=%x\n", name, mode, timer);
++ dbg_printf ("snd_timer_open(name='%s', mode=%x)=%p\n", name, mode, timer);
+
+ if (timer == NULL)
+ return -ENOMEM;
+Index: oss4-4.2-build2004/lib/libsalsa/local.h
+===================================================================
+--- oss4-4.2-build2004.orig/lib/libsalsa/local.h 2011-06-14 11:33:24.000000000 -0500
++++ oss4-4.2-build2004/lib/libsalsa/local.h 2011-06-14 11:33:24.000000000 -0500
+@@ -9,6 +9,7 @@
+ #include "../../include/soundcard.h"
+ #include "alsakernel.h"
+ #include <sys/poll.h>
++#include <sys/ioctl.h>
+ #include "../../kernel/framework/include/midiparser.h"
+
+ extern int alib_verbose;
diff --git a/debian/patches/modules-i386.patch b/debian/patches/modules-i386.patch
new file mode 100644
index 0000000..4e7e279
--- /dev/null
+++ b/debian/patches/modules-i386.patch
@@ -0,0 +1,10 @@
+--- oss4-4.2-build2005/kernel/OS/Linux/os_linux.h.orig
++++ oss4-4.2-build2005/kernel/OS/Linux/os_linux.h
+@@ -53,7 +53,6 @@
+
+ #include <sys/types.h>
+ #include <sys/param.h>
+-#include <sys/signal.h>
+ #include <oss_errno.h>
+ #include <sys/file.h>
+ #include "oss_ddi.h"
diff --git a/debian/patches/no_EBADE.patch b/debian/patches/no_EBADE.patch
new file mode 100644
index 0000000..99d85c8
--- /dev/null
+++ b/debian/patches/no_EBADE.patch
@@ -0,0 +1,35 @@
+GNU/Hurd doesn't have EBADE. Report EGRATUITOUS there for now (or EIO on any
+other system which doesn't have EBADE either).
+
+Index: oss4-4.2-build2004/lib/libsalsa/seq_output.c
+===================================================================
+--- oss4-4.2-build2004.orig/lib/libsalsa/seq_output.c 2011-06-14 11:33:24.000000000 -0500
++++ oss4-4.2-build2004/lib/libsalsa/seq_output.c 2011-06-14 11:33:24.000000000 -0500
+@@ -40,7 +40,13 @@
+ if (l == -1)
+ return -errno;
+
++#ifdef EBADE
+ return -EBADE; /* Randomly selected error */
++#elif defined(EGRATUITOUS)
++ return -EGRATUITOUS; /* Randomly selected error */
++#else
++ return -EIO; /* Randomly selected error */
++#endif
+ }
+
+ return 0;
+@@ -65,7 +71,13 @@
+ if (l == -1)
+ return -errno;
+
++#ifdef EBADE
+ return -EBADE; /* Randomly selected error */
++#elif defined(EGRATUITOUS)
++ return -EGRATUITOUS; /* Randomly selected error */
++#else
++ return -EIO; /* Randomly selected error */
++#endif
+ }
+
+ return 0;
diff --git a/debian/patches/os_cmd.patch b/debian/patches/os_cmd.patch
new file mode 100644
index 0000000..ea06852
--- /dev/null
+++ b/debian/patches/os_cmd.patch
@@ -0,0 +1,139 @@
+Index: oss4-4.2-build2004/os_cmd/Linux/ossdetect/ossdetect.c
+===================================================================
+--- oss4-4.2-build2004.orig/os_cmd/Linux/ossdetect/ossdetect.c
++++ oss4-4.2-build2004/os_cmd/Linux/ossdetect/ossdetect.c
+@@ -23,6 +23,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/dir.h>
++#include <grp.h>
+
+ #define PCI_PASS 0
+ #define USB_PASS 1
+@@ -31,6 +32,7 @@
+
+ #define OSSLIBDIRLEN 512
+ static char *osslibdir = NULL;
++static char *groupname = "root";
+
+ static int usb_ok = 0;
+
+@@ -90,7 +92,7 @@
+ if (l > 0 && tmp[l - 1] == '\n')
+ tmp[l - 1] = '\0';
+
+- if (strncmp (tmp, "OSSLIBDIR=", 10) == 0)
++ if (strncmp (tmp, "OSSETCDIR=", 10) == 0)
+ {
+ l = snprintf (name, sizeof (name), "%s", &tmp[10]);
+ if ((l >= OSSLIBDIRLEN) || (l < 0))
+@@ -109,12 +111,12 @@
+ }
+ }
+
+- fprintf (stderr, "OSSLIBDIR not set in /etc/oss.conf, using default "
+- "/usr/lib/oss\n");
++ fprintf (stderr, "OSSETCDIR not set in /etc/oss.conf, using default "
++ "/etc/oss4\n");
+ oexit:
+ fclose (f);
+ oexit2:
+- snprintf (name, sizeof (name), "/usr/lib/oss");
++ snprintf (name, sizeof (name), "/etc/oss4");
+ return name;
+ }
+
+@@ -503,6 +505,13 @@
+ mode_t perm;
+ int minor, major;
+
++ struct group *grpstruct;
++ if((grpstruct = getgrnam(groupname)) == NULL)
++ {
++ fprintf (stderr, "getgrnam() error\n");
++ exit (-1);
++ }
++
+ if ((f = fopen ("/proc/opensound/devfiles", "r")) == NULL)
+ {
+ perror ("/proc/opensound/devfiles");
+@@ -554,6 +563,8 @@
+ printf ("mknod %s c %d %d -m %o\n", dev, major, minor, node_m);
+ if (mknod (dev, node_m, makedev (major, minor)) == -1)
+ perror (dev);
++
++ chown(dev, 0, grpstruct->gr_gid);
+ }
+
+ umask (perm);
+@@ -586,7 +597,7 @@
+ struct stat st;
+ FILE *f;
+
+- while ((i = getopt(argc, argv, "L:a:dilm:uv")) != EOF)
++ while ((i = getopt(argc, argv, "L:a:dg:ilm:uv")) != EOF)
+ switch (i)
+ {
+ case 'v':
+@@ -613,6 +624,10 @@
+ do_license = 1;
+ break;
+
++ case 'g':
++ groupname = optarg;
++ break;
++
+ case 'L':
+ osslibdir = optarg;
+ break;
+@@ -648,7 +663,7 @@
+ exit (0);
+ }
+
+- load_devlist ("etc/devices.list", 0);
++ load_devlist ("devices.list", 0);
+
+ if (stat ("/etc/oss_3rdparty", &st) != -1)
+ load_devlist ("/etc/oss_3rdparty", 1);
+@@ -674,7 +689,7 @@
+ }
+
+ snprintf (instfname, sizeof (instfname), "%s/%s", osslibdir,
+- "etc/installed_drivers");
++ "installed_drivers");
+
+ if ((f = fopen (instfname, "w")) == NULL)
+ {
+Index: oss4-4.2-build2004/os_cmd/Linux/ossdetect/ossdetect.man
+===================================================================
+--- oss4-4.2-build2004.orig/os_cmd/Linux/ossdetect/ossdetect.man
++++ oss4-4.2-build2004/os_cmd/Linux/ossdetect/ossdetect.man
+@@ -6,9 +6,10 @@
+
+ DESCRIPTION
+ The ossdetect application performs automatic detection of soundcards.
+-The application looks at the /usr/lib/oss/etc/device.list and performs
++The application looks at the $OSSETCDIR/device.list and performs
+ automatic detection. It will create a file with the list of the configured
+-drivers in /usr/lib/oss/etc/installed_drivers.
++drivers in $OSSETCDIR/installed_drivers.
++OSSETCDIR is decided by reading /etc/oss.conf, and defaults to /etc/oss4.
+
+ The Input Multiplexer driver (IMUX) is not configured by default and
+ can be added to the OSS configuration using the -i option.
+@@ -17,6 +18,7 @@
+ -d Create device file links.
+ -i Adds the oss_imux driver.
+ -m<mode> Create nodes with permissions set to octal <mode>.
++-g<group> Create nodes with group ownership set to <group>.
+ -u Adds the oss_userdev driver.
+ -v Verbose output.
+ -L<path> Use <path> as root directory for OSS files.
+@@ -26,6 +28,7 @@
+ ossdevlinks(1), ossinfo(1)
+
+ FILES
++/etc/oss.conf
+ /usr/sbin/ossdetect
+
+ AUTHOR
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..b101a66
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,17 @@
+cmd.patch
+os_cmd.patch
+txt2man.patch
+arch_without_mregparm.patch
+dont_build_kernel_module.patch
+fix_invalid_printf.patch
+hurd_iot.patch
+libsalsa_fixes.patch
+no_EBADE.patch
+CFLAGS.patch
+liboss4-salsa.patch
+snd_asoundlib_version.patch
+gcc-4.6.patch
+#generic_srccconf.patch
+kfreebsd-gnu.patch
+modules-i386.patch
+
diff --git a/debian/patches/snd_asoundlib_version.patch b/debian/patches/snd_asoundlib_version.patch
new file mode 100644
index 0000000..fc1d47f
--- /dev/null
+++ b/debian/patches/snd_asoundlib_version.patch
@@ -0,0 +1,18 @@
+Index: oss4-4.2-build2004/lib/libsalsa/misc.c
+===================================================================
+--- oss4-4.2-build2004.orig/lib/libsalsa/misc.c 2011-06-14 11:33:21.000000000 -0500
++++ oss4-4.2-build2004/lib/libsalsa/misc.c 2011-06-14 11:33:24.000000000 -0500
+@@ -105,3 +105,13 @@
+ dbg_printf ("snd_lib_error_set_handler()\n");
+ return 0;
+ }
++
++
++/**
++ * \brief Returns the ALSA sound library version in ASCII format
++ * \return The ASCII description of the used ALSA sound library.
++ */
++const char *snd_asoundlib_version(void)
++{
++ return SND_LIB_VERSION_STR;
++}
diff --git a/debian/patches/txt2man.patch b/debian/patches/txt2man.patch
new file mode 100644
index 0000000..e790a34
--- /dev/null
+++ b/debian/patches/txt2man.patch
@@ -0,0 +1,12 @@
+--- oss-v4.2-build2006-src-gpl/setup/Linux/build.sh.orig 2012-02-18 18:53:51.707280520 +0100
++++ oss-v4.2-build2006-src-gpl/setup/Linux/build.sh 2012-02-18 18:54:01.955280417 +0100
+@@ -8,7 +8,7 @@
+ else
+ echo "No gawk found. Using lesser replacement" >&2
+ cc -o txt2man origdir/setup/txt2man.c
+- TXT2MAN=./txt2man
++ TXT2MAN=/usr/bin/txt2man
+ fi
+
+ [ -z "$LD" ] && LD=ld
+