From 29f629f5ad8b5a3ed5f77cbbfadafbcfb308825eb98cf5a12647859702334e7d Mon Sep 17 00:00:00 2001
From: Dave Plater <davejplater@gmail.com>
Date: Thu, 7 Jan 2016 17:19:25 +0000
Subject: [PATCH] Accepting request 352473 from home:plater

Update to 0.10.2 and fix various issues in collaboration with upstream

OBS-URL: https://build.opensuse.org/request/show/352473
OBS-URL: https://build.opensuse.org/package/show/multimedia:apps/buzztrax?expand=0&rev=11
---
 autogen.sh                      | 390 ++++++++++++++++++++++++++++++++
 buzztrax-0.10.2.tar.gz          |   3 +
 buzztrax-0.9.0.tar.gz           |   3 -
 buzztrax-build.patch            | 171 ++++++++++++++
 buzztrax-fixx86build.patch      |  13 --
 buzztrax-nolibbml_la-bmlw.patch |  36 ---
 buzztrax-songio-dir.patch       |  13 --
 buzztrax.changes                |  10 +
 buzztrax.spec                   |  85 +++----
 9 files changed, 617 insertions(+), 107 deletions(-)
 create mode 100644 autogen.sh
 create mode 100644 buzztrax-0.10.2.tar.gz
 delete mode 100644 buzztrax-0.9.0.tar.gz
 create mode 100644 buzztrax-build.patch
 delete mode 100644 buzztrax-fixx86build.patch
 delete mode 100644 buzztrax-nolibbml_la-bmlw.patch
 delete mode 100644 buzztrax-songio-dir.patch

diff --git a/autogen.sh b/autogen.sh
new file mode 100644
index 0000000..b8991e7
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,390 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+DIE=0
+package=buzztrax
+
+# a silly hack that generates autoregen.sh but it's handy
+if [ -f "autoregen.sh" ]; then
+  rm autoregen.sh
+fi
+echo "#!/bin/sh" > autoregen.sh
+echo "./autogen.sh $@ \$@" >> autoregen.sh
+chmod +x autoregen.sh
+
+# helper functions for autogen.sh
+
+debug ()
+# print out a debug message if DEBUG is a defined variable
+{
+  if test ! -z "$DEBUG"
+  then
+    echo "DEBUG: $1"
+  fi
+}
+
+version_check ()
+# check the version of a package
+# first argument : package name (executable)
+# second argument : optional path where to look for it instead
+# third argument : source download url
+# rest of arguments : major, minor, micro version
+# all consecutive ones : suggestions for binaries to use
+# (if not specified in second argument)
+{
+  PACKAGE=$1
+  PKG_PATH=$2
+  URL=$3
+  MAJOR=$4
+  MINOR=$5
+  MICRO=$6
+
+  # for backwards compatibility, we let PKG_PATH=PACKAGE when PKG_PATH null
+  if test -z "$PKG_PATH"; then PKG_PATH=$PACKAGE; fi
+  debug "major $MAJOR minor $MINOR micro $MICRO"
+  VERSION=$MAJOR
+  if test ! -z "$MINOR"; then VERSION=$VERSION.$MINOR; else MINOR=0; fi
+  if test ! -z "$MICRO"; then VERSION=$VERSION.$MICRO; else MICRO=0; fi
+
+  debug "major $MAJOR minor $MINOR micro $MICRO"
+
+  for SUGGESTION in $PKG_PATH; do
+    COMMAND="$SUGGESTION"
+
+    # don't check if asked not to
+    test -z "$NOCHECK" && {
+      echo -n "  checking for $COMMAND >= $VERSION ... "
+    } || {
+      # we set a var with the same name as the package, but stripped of
+      # unwanted chars
+      VAR=`echo $PACKAGE | sed 's/-//g'`
+      debug "setting $VAR"
+      eval $VAR="$COMMAND"
+      return 0
+    }
+
+    debug "checking version with $COMMAND"
+    ($COMMAND --version) < /dev/null > /dev/null 2>&1 ||
+    {
+      echo "not found."
+      continue
+    }
+    # strip everything that's not a digit, then use cut to get the first field
+    pkg_version=`$COMMAND --version|head -n 1|sed 's/^[^0-9]*//'|cut -d' ' -f1`
+    debug "pkg_version $pkg_version"
+    # remove any non-digit characters from the version numbers to permit numeric
+    # comparison
+    pkg_major=`echo $pkg_version | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
+    pkg_minor=`echo $pkg_version | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
+    pkg_micro=`echo $pkg_version | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
+    test -z "$pkg_major" && pkg_major=0
+    test -z "$pkg_minor" && pkg_minor=0
+    test -z "$pkg_micro" && pkg_micro=0
+    debug "found major $pkg_major minor $pkg_minor micro $pkg_micro"
+
+    #start checking the version
+    debug "version check"
+
+    # reset check
+    WRONG=
+
+    if [ ! "$pkg_major" -gt "$MAJOR" ]; then
+      debug "major: $pkg_major <= $MAJOR"
+      if [ "$pkg_major" -lt "$MAJOR" ]; then
+        debug "major: $pkg_major < $MAJOR"
+        WRONG=1
+      elif [ ! "$pkg_minor" -gt "$MINOR" ]; then
+        debug "minor: $pkg_minor <= $MINOR"
+        if [ "$pkg_minor" -lt "$MINOR" ]; then
+          debug "minor: $pkg_minor < $MINOR"
+          WRONG=1
+        elif [ "$pkg_micro" -lt "$MICRO" ]; then
+          debug "micro: $pkg_micro < $MICRO"
+          WRONG=1
+        fi
+      fi
+    fi
+
+    if test ! -z "$WRONG"; then
+      echo "found $pkg_version, not ok !"
+      continue
+    else
+      echo "found $pkg_version, ok."
+      # we set a var with the same name as the package, but stripped of
+      # unwanted chars
+      VAR=`echo $PACKAGE | sed 's/-//g'`
+      debug "setting $VAR"
+      eval $VAR="$COMMAND"
+      return 0
+    fi
+  done
+
+  if test ! -z "$URL"; then
+    echo "not found !"
+    echo "You must have $PACKAGE installed to compile $package."
+    echo "Download the appropriate package for your distribution,"
+    echo "or get the source tarball at $URL"
+  fi
+  return 1;
+}
+
+aclocal_check ()
+{
+  # normally aclocal is part of automake
+  # so we expect it to be in the same place as automake
+  # so if a different automake is supplied, we need to adapt as well
+  # so how's about replacing automake with aclocal in the set var,
+  # and saving that in $aclocal ?
+  # note, this will fail if the actual automake isn't called automake*
+  # or if part of the path before it contains it
+  if [ -z "$automake" ]; then
+    echo "Error: no automake variable set !"
+    return 1
+  else
+    aclocal=`echo $automake | sed s/automake/aclocal/`
+    debug "aclocal: $aclocal"
+    if [ "$aclocal" != "aclocal" ];
+    then
+      CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-aclocal=$aclocal"
+    fi
+    if [ ! -x `which $aclocal` ]; then
+      echo "Error: cannot execute $aclocal !"
+      return 1
+    fi
+  fi
+}
+
+autoheader_check ()
+{
+  # same here - autoheader is part of autoconf
+  # use the same voodoo
+  if [ -z "$autoconf" ]; then
+    echo "Error: no autoconf variable set !"
+    return 1
+  else
+    autoheader=`echo $autoconf | sed s/autoconf/autoheader/`
+    debug "autoheader: $autoheader"
+    if [ "$autoheader" != "autoheader" ];
+    then
+      CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoheader=$autoheader"
+    fi
+    if [ ! -x `which $autoheader` ]; then
+      echo "Error: cannot execute $autoheader !"
+      return 1
+    fi
+  fi
+
+}
+
+die_check ()
+{
+  # call with $DIE
+  # if set to 1, we need to print something helpful then die
+  DIE=$1
+  if test "x$DIE" = "x1";
+  then
+    echo
+    echo "- Please get the right tools before proceeding."
+    echo "- Alternatively, if you're sure we're wrong, run with --nocheck."
+    exit 1
+  fi
+}
+
+autogen_options ()
+{
+  if test "x$1" = "x"; then
+    return 0
+  fi
+
+  while test "x$1" != "x" ; do
+    optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    case "$1" in
+      --noconfigure)
+          NOCONFIGURE=defined
+	  AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure"
+          echo "+ configure run disabled"
+          shift
+          ;;
+      --nocheck)
+	  AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck"
+          NOCHECK=defined
+          echo "+ autotools version check disabled"
+          shift
+          ;;
+      --debug)
+          DEBUG=defined
+	  AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug"
+          echo "+ debug output enabled"
+          shift
+          ;;
+      --prefix=*)
+	  CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$optarg"
+	  echo "+ passing --prefix=$optarg to configure"
+          shift
+          ;;
+      --prefix)
+	  shift
+	  echo "DEBUG: $1"
+	  CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$1"
+	  echo "+ passing --prefix=$1 to configure"
+          shift
+          ;;
+
+      -h|--help)
+          echo "autogen.sh (autogen options) -- (configure options)"
+          echo "autogen.sh help options: "
+          echo " --noconfigure            don't run the configure script"
+          echo " --nocheck                don't do version checks"
+          echo " --debug                  debug the autogen process"
+	  echo " --prefix		  will be passed on to configure"
+          echo
+          echo " --with-autoconf PATH     use autoconf in PATH"
+          echo " --with-automake PATH     use automake in PATH"
+          echo
+          echo "to pass options to configure, put them as arguments after -- "
+	  exit 1
+          ;;
+      --with-automake=*)
+          AUTOMAKE=$optarg
+          echo "+ using alternate automake in $optarg"
+	  CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-automake=$AUTOMAKE"
+          shift
+          ;;
+      --with-autoconf=*)
+          AUTOCONF=$optarg
+          echo "+ using alternate autoconf in $optarg"
+	  CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoconf=$AUTOCONF"
+          shift
+          ;;
+      --disable*|--enable*|--with*)
+          echo "+ passing option $1 to configure"
+	  CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $1"
+          shift
+          ;;
+       --) shift ; break ;;
+      *) echo "- ignoring unknown autogen.sh argument $1"; shift ;;
+    esac
+  done
+
+  for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done
+  if test ! -z "$CONFIGURE_EXT_OPT"
+  then
+    echo "+ options passed to configure: $CONFIGURE_EXT_OPT"
+  fi
+}
+
+toplevel_check ()
+{
+  srcfile=$1
+  test -f $srcfile || {
+        echo "You must run this script in the top-level $package directory"
+        exit 1
+  }
+}
+
+
+tool_run ()
+{
+  tool=$1
+  options=$2
+  echo "+ running $tool $options..."
+  $tool $options || {
+    echo
+    echo $tool failed
+    exit 1
+  }
+}
+
+CONFIGURE_DEF_OPT='--enable-debug=yes'
+
+autogen_options $@
+
+have_gtkdoc_1_9=0
+
+echo -n "+ check for build tools"
+if test ! -z "$NOCHECK"; then echo ": skipped version checks"; else  echo; fi
+version_check "autoconf" "$AUTOCONF autoconf" \
+              "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 61 || DIE=1
+version_check "automake" "$AUTOMAKE automake automake-1.7 automake17 automake-1.6" \
+              "ftp://ftp.gnu.org/pub/gnu/automake/" 1 6 || DIE=1
+version_check "autopoint" "autopoint" \
+              "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 12 1 || DIE=1
+version_check "gtkdocize" "" "" 1 9 && have_gtkdoc_1_9=1
+if test "x$have_gtkdoc_1_9" = "x0"; then
+version_check "gtkdocize" "" \
+              "ftp://ftp.gnome.org/pub/gnome/sources/gtk-doc/" 1 4
+fi
+version_check "intltoolize" "" \
+              "ftp://ftp.gnome.org/pub/gnome/sources/intltool/" 0 1 5 || DIE=1
+version_check "libtoolize" "libtoolize glibtoolize" \
+              "ftp://ftp.gnu.org/pub/gnu/libtool/" 2 2 0 || DIE=1
+version_check "pkg-config" "" \
+              "ftp://ftp.gnome.org/pub/gnome/sources/pkgconfig/" 0 8 0 || DIE=1
+
+die_check $DIE
+
+aclocal_check || DIE=1
+autoheader_check || DIE=1
+
+die_check $DIE
+
+# if no arguments specified then this will be printed
+if test -z "$*"; then
+  echo "+ checking for autogen.sh options"
+  echo "  This autogen script will automatically run ./configure as:"
+  echo "  ./configure $CONFIGURE_DEF_OPT"
+  echo "  To pass any additional options, please specify them on the $0"
+  echo "  command line."
+fi
+
+toplevel_check $srcfile
+
+# autopoint
+#    older autopoint (< 0.12) has a tendency to complain about mkinstalldirs
+if test -x mkinstalldirs; then rm mkinstalldirs; fi
+tool_run "$autopoint --force"
+
+# must be run before aclocal, as this installs some m4 files
+tool_run "$libtoolize" "--copy --force"
+
+# aclocal
+if test -f acinclude.m4; then rm acinclude.m4; fi
+tool_run "$aclocal" "-I m4 $ACLOCAL_FLAGS"
+
+tool_run "$intltoolize" "--copy --force --automake"
+if test -n "$gtkdocize"; then
+  if test "x$have_gtkdoc_1_9" = "x0"; then
+    tool_run "$gtkdocize" "--copy"
+  else
+    tool_run "$gtkdocize" "--copy --flavour no-tmpl"
+  fi
+else
+  echo "EXTRA_DIST = " > gtk-doc.make
+fi
+tool_run "$autoheader"
+
+# touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo
+echo timestamp > stamp-h.in 2> /dev/null
+
+tool_run "$autoconf"
+debug "automake: $automake"
+tool_run "$automake" "--add-missing --copy --gnu -Wno-portability"
+
+test -n "$NOCONFIGURE" && {
+  echo "skipping configure stage for package $package, as requested."
+  echo "autogen.sh done."
+  exit 0
+}
+
+echo "+ running configure ... "
+test ! -z "$CONFIGURE_DEF_OPT" && echo "  ./configure default flags: $CONFIGURE_DEF_OPT"
+test ! -z "$CONFIGURE_EXT_OPT" && echo "  ./configure external flags: $CONFIGURE_EXT_OPT"
+echo
+
+echo ./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT
+./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT || {
+        echo "  configure failed"
+        exit 1
+}
+
+echo "Now type 'make' to compile $package."
diff --git a/buzztrax-0.10.2.tar.gz b/buzztrax-0.10.2.tar.gz
new file mode 100644
index 0000000..9c99070
--- /dev/null
+++ b/buzztrax-0.10.2.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:675ed744cd5209dda11e1d2fcd621d6ca23bf2eac89230bbd39242fe5f4000ed
+size 4121943
diff --git a/buzztrax-0.9.0.tar.gz b/buzztrax-0.9.0.tar.gz
deleted file mode 100644
index 323b343..0000000
--- a/buzztrax-0.9.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7ac492232e71ed009085e2b998ffdcae9c63b64458fa7a5c4c48199a0cad46fa
-size 3260963
diff --git a/buzztrax-build.patch b/buzztrax-build.patch
new file mode 100644
index 0000000..730774a
--- /dev/null
+++ b/buzztrax-build.patch
@@ -0,0 +1,171 @@
+diff --git a/Makefile.src.am b/Makefile.src.am
+index aee876c..fe4bb62 100644
+--- a/Makefile.src.am
++++ b/Makefile.src.am
+@@ -112,6 +112,7 @@ libbml_HEADERS = src/lib/bml/bml.h src/lib/bml/BuzzMachineLoader/BuzzMachineLoad
+ libbml_la_SOURCES = src/lib/bml/bml.c src/lib/bml/bmllog.c $(DLLWRAPPER_SRC)
+ libbml_la_CFLAGS = \
+   -I$(srcdir) -I$(top_srcdir)/src/lib \
++  -I$(top_srcdir)/src/lib/dllwrapper \
+   $(PTHREAD_CFLAGS) $(BML_CFLAGS)
+ libbml_la_CPPFLAGS = -DNATIVE_BML_DIR="\"$(pkglibdir)\""
+ libbml_la_LIBADD = $(LIBM) $(PTHREAD_LIBS) $(BML_LIBS) $(DLLWRAPPER_LIB)
+@@ -356,7 +357,7 @@ libbuzztrax_core_HEADERS = \
+   src/lib/core/wire.h
+ 
+ # -- songio plugins
+-songiodir = ${exec_prefix}/lib/buzztrax-songio
++songiodir = ${libdir}/buzztrax-songio
+ songio_LTLIBRARIES = libbtbsl.la
+ libbtbsl_la_LIBADD = \
+   libbuzztrax-core.la \
+@@ -760,7 +761,9 @@ BuzztraxIc-@BT_MAJORMINOR@.gir: $(G_IR_SCANNER) libbuzztrax-ic.la
+ 
+ BUILT_GIRSOURCES = BuzztraxCore-@BT_MAJORMINOR@.gir BuzztraxIc-@BT_MAJORMINOR@.gir
+ 
+-girdir = $(datadir)/gir
++# We can't use $(GIRDIR) and $(TYPELIBDIR), since that might using a different
++# prefix
++girdir = $(datadir)/gir-1.0
+ gir_DATA = $(BUILT_GIRSOURCES)
+ 
+ typelibsdir = $(libdir)/girepository-1.0
+diff --git a/configure.ac b/configure.ac
+index cd08e3f..c2181ca 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -49,8 +49,15 @@ AC_DEFINE_UNQUOTED(GST_MAJORMINOR, "$GST_MAJORMINOR", [gstreamer series])
+ AC_SUBST(GST_MAJORMINOR)
+ 
+ dnl release year and date
+-BT_RELEASE_YEAR=`date +%Y`
+-BT_RELEASE_DATE=`date +%Y-%m-%d`
++DATE_STAMP=`head -n1 NEWS | sed 's/^[[^(]]*(\(.*\)).*$/\1/'`
++if test "$DATE_STAMP" == "XX.XXX.XXXX"; then
++  BT_RELEASE_YEAR=`date +%Y`
++  BT_RELEASE_DATE=`date +%Y-%m-%d`
++else
++  IFS="." read -r d m y <<< "$DATE_STAMP"
++  BT_RELEASE_YEAR="$y"
++  BT_RELEASE_DATE=`date -d "%d %m %y" +%Y-%m-%d`
++fi
+ 
+ AC_SUBST(BT_MAJOR_VERSION)
+ AC_SUBST(BT_MINOR_VERSION)
+@@ -62,6 +69,7 @@ AC_SUBST(BT_RELEASE_DATE)
+ 
+ AC_DEFINE_UNQUOTED(BT_VERSION, "$BT_VERSION", [library version as string])
+ AC_DEFINE_UNQUOTED(PACKAGE_VERSION_NUMBER, 900, [version as a number])
++AC_DEFINE_UNQUOTED(BT_RELEASE_YEAR, $BT_RELEASE_YEAR, [release year])
+ 
+ dnl Checks for programs.
+ AC_PROG_CC
+@@ -271,6 +279,9 @@ if test "$enable_dllwrapper" != "no"; then
+     enable_dllwrapper="yes"
+   fi
+ fi
++if test "$enable_dllwrapper" == "no"; then
++  CALLING_MODE=void
++fi
+ AC_MSG_RESULT($enable_dllwrapper)
+ if test "$enable_dllwrapper" = "yes"; then
+   AC_DEFINE(USE_DLLWRAPPER, 1, [Defined if emulation for buzzmachine dlls is enabled])
+@@ -530,17 +541,32 @@ AC_CHECK_DECL(sysi86,[
+ ])
+ 
+ dnl check for SSE intrisics
++have_sse_intrinsics=no
+ ARCH_CFLAGS=""
+-ARCH_CPPFLAGS=""
+ case "x${target_cpu}" in
+   xi?86|k?|xx86_64|xamd64)
+-    # seems to cause "CPU you selected does not support x86-64 instruction set" on some targets
+-    #ARCH_CFLAGS="-march=native"
+-    ARCH_CPPFLAGS="-D__SSE__ -D__MMX__"
+-    AC_CHECK_HEADERS([xmmintrin.h])
++    AC_CHECK_HEADERS([xmmintrin.h],
++      [
++        SAVED_CFLAGS="${CFLAGS}"
++        AC_MSG_CHECKING([for working sse intrinsics])
++        CFLAGS="-mmmx -msse"
++        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
++                          #include <xmmintrin.h>
++                          int main () {
++                              _mm_getcsr ();
++                          }]])], [
++                          AC_MSG_RESULT(yes)
++                          have_sse_intrinsics=yes],[
++                          AC_MSG_RESULT(no)])
++        CFLAGS="${SAVED_CFLAGS}"
++        ARCH_CFLAGS="-mmmx -msse"
++      ],[])
+     ;;
+ esac
+-
++if test $have_sse_intrinsics = yes ; then
++   AC_DEFINE(USE_X86_SSE, 1, [use x86 SSE compiler intrinsics])
++   ARCH_CFLAGS="-mmmx -msse"
++fi
+ 
+ dnl check for libraries
+ LT_LIB_M
+@@ -585,7 +611,7 @@ AC_ARG_ENABLE(Bsymbolic,
+ dnl Extra vars
+ BT_INCLUDEDIR='-I${includedir}'
+ dnl -Wl,--as-needed # can be put into CFLAGS to drop all unused libs
+-BT_CFLAGS="$ARCH_CFLAGS $ARCH_CPPFLAGS $DEBUG_CFLAGS $COVERAGE_CFLAGS $BT_DISABLE_DEPRECATED"
++BT_CFLAGS="$ARCH_CFLAGS $DEBUG_CFLAGS $COVERAGE_CFLAGS $BT_DISABLE_DEPRECATED"
+ BT_LIBDIR='-L${libdir}'
+ BT_LIBS="$COVERAGE_LIBS"
+ BT_LDFLAGS="$DEBUG_LDFLAGS"
+diff --git a/src/lib/core/core.c b/src/lib/core/core.c
+index 6a03d5e..3742cb5 100644
+--- a/src/lib/core/core.c
++++ b/src/lib/core/core.c
+@@ -32,14 +32,16 @@
+ 
+ #ifdef HAVE_SCHED_SETSCHEDULER
+ #include <sched.h>
+-#if HAVE_MLOCKALL
++#ifdef HAVE_MLOCKALL
+ #include <sys/mman.h>
+ #endif
+ #endif
+ 
+-#if HAVE_XMMINTRIN_H
++#ifdef USE_X86_SSE
++#ifdef HAVE_XMMINTRIN_H
+ #include <xmmintrin.h>
+ #endif
++#endif
+ 
+ /**
+  * bt_major_version:
+@@ -145,11 +147,13 @@ bt_init_post (void)
+ #endif
+ #endif
+ 
+-#if HAVE_XMMINTRIN_H
++#if USE_X86_SSE
+   // TODO(ensonic): we need to probe the CPU capabilities
+   // see http://www.mail-archive.com/linux-audio-dev@music.columbia.edu/msg19520.html
+   //   [linux-audio-dev] Channels and best practice
+   // _MM_FLUSH_ZERO_ON = FZ
++  // TODO(ensonic): wikipedia says we must do this for each thread:
++  // https://en.wikipedia.org/wiki/Denormal_number#Disabling_denormal_floats_at_the_code_level
+   _mm_setcsr (_mm_getcsr () | 0x8040);  // set DAZ and FZ bits
+ #endif
+ 
+diff --git a/src/ui/edit/about-dialog.c b/src/ui/edit/about-dialog.c
+index d2ff4bc..a85bf31 100644
+--- a/src/ui/edit/about-dialog.c
++++ b/src/ui/edit/about-dialog.c
+@@ -68,7 +68,7 @@ bt_about_dialog_init_ui (const BtAboutDialog * self)
+       g_alloca (strlen (_("Copyright \xc2\xa9 2003-%d Buzztrax developer team"))
+       + 3);
+   sprintf (copyright, _("Copyright \xc2\xa9 2003-%d Buzztrax developer team"),
+-      2014);
++      BT_RELEASE_YEAR);
+ 
+   /* we can get logo via icon name, so this here is just for educational purpose
+      GdkPixbuf *logo;
diff --git a/buzztrax-fixx86build.patch b/buzztrax-fixx86build.patch
deleted file mode 100644
index aaeb999..0000000
--- a/buzztrax-fixx86build.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Index: configure
-===================================================================
---- configure.orig
-+++ configure
-@@ -21763,7 +21763,7 @@ fi
- ARCH_CFLAGS=""
- ARCH_CPPFLAGS=""
- case "x${target_cpu}" in
--  xi?86|k?|xx86_64|xamd64)
-+  k?|xx86_64|xamd64)
-     # seems to cause "CPU you selected does not support x86-64 instruction set" on some targets
-     #ARCH_CFLAGS="-march=native"
-     ARCH_CPPFLAGS="-D__SSE__ -D__MMX__"
diff --git a/buzztrax-nolibbml_la-bmlw.patch b/buzztrax-nolibbml_la-bmlw.patch
deleted file mode 100644
index 1e2ebf0..0000000
--- a/buzztrax-nolibbml_la-bmlw.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Index: configure
-===================================================================
---- configure.orig
-+++ configure
-@@ -19702,7 +19702,7 @@ BMLHOST_CCASFLAGS=""
- case "x${target_cpu}" in
-   xi?86 | k?)
-     HAVE_X86=yes
--    CALLING_MODE=direct
-+    CALLING_MODE=void
-     ;;
-   xx86_64|xamd64)
-         if test "$have_x32_h" = "xno"; then
-@@ -19761,7 +19761,8 @@ else
-   USE_DLLWRAPPER_TRUE='#'
-   USE_DLLWRAPPER_FALSE=
- fi
--
-+echo "dlltrue=$USE_DLLWRAPPER_FALSE"
-+echo "dlltrue=$USE_DLLWRAPPER_TRUE"
-  if test x$CALLING_MODE = xdirect; then
-   USE_DLLWRAPPER_DIRECT_TRUE=
-   USE_DLLWRAPPER_DIRECT_FALSE='#'
-@@ -19778,6 +19779,12 @@ else
-   USE_DLLWRAPPER_IPC_FALSE=
- fi
- 
-+echo "dllfalse=$USE_DLLWRAPPER_FALSE"
-+echo "dlltrue=$USE_DLLWRAPPER_TRUE"
-+echo "dllfalseipc=$USE_DLLWRAPPER_IPC_FALSE"
-+echo "dlltrueipc=$USE_DLLWRAPPER_IPC_TRUE"
-+echo "dllfalse=$USE_DLLWRAPPER_DIRECT_FALSE"
-+echo "dlltrue=$USE_DLLWRAPPER_DIRECT_TRUE"
- 
- 
- 
diff --git a/buzztrax-songio-dir.patch b/buzztrax-songio-dir.patch
deleted file mode 100644
index 061b015..0000000
--- a/buzztrax-songio-dir.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Index: Makefile.in
-===================================================================
---- Makefile.in.orig
-+++ Makefile.in
-@@ -2066,7 +2066,7 @@ libbuzztrax_core_HEADERS = \
- 
- 
- # -- songio plugins
--songiodir = ${exec_prefix}/lib/buzztrax-songio
-+songiodir = ${libdir}/buzztrax-songio
- songio_LTLIBRARIES = libbtbsl.la
- libbtbsl_la_LIBADD = \
-   libbuzztrax-core.la \
diff --git a/buzztrax.changes b/buzztrax.changes
index eba5f1c..1c4a1b1 100644
--- a/buzztrax.changes
+++ b/buzztrax.changes
@@ -1,3 +1,13 @@
+-------------------------------------------------------------------
+Wed Jan  6 10:30:55 UTC 2016 - davejplater@gmail.com
+
+- Update to 0.10.2 and replace buzztrax-songio-dir.patch,
+  buzztrax-fixx86build.patch and buzztrax-nolibbml_la-bmlw.patch
+  with buzztrax-build.patch from upstream, to be included in 0.10.3
+  Upstream changes:
+- Bumped to upstream buffix release 0.10.2
+- Adjusted dependencies (dropped obsolete ones)
+
 -------------------------------------------------------------------
 Thu Dec 17 07:36:32 UTC 2015 - davejplater@gmail.com
 
diff --git a/buzztrax.spec b/buzztrax.spec
index 082ca24..31dd588 100644
--- a/buzztrax.spec
+++ b/buzztrax.spec
@@ -18,7 +18,7 @@
 
 %define gir gobject-introspection-1.0
 %define gstreamer_pluginsdir %(pkg-config --variable=pluginsdir gstreamer-1.0)
-%define girdir %{_datadir}/gir
+%define girdir %{_datadir}/gir-1.0
 %define typelibdir %(pkg-config --variable=typelibdir %{gir})
 %define core_soname 1
 %define ic_soname 1
@@ -26,32 +26,28 @@
 %define gst_soname 1
 %define bml_soname 1
 
+%define glib_version 2.32.0
+%define gst_version 1.2.0
+
 Name:           buzztrax
-Version:        0.9.0
+Version:        0.10.2
 Release:        0
 Summary:        A music studio inspired by Buzz
 License:        LGPL-2.0
 Group:          Productivity/Multimedia/Sound/Utilities
-Url:            http://sourceforge.net/projects/buzztard/
+Url:            http://buzztrax.org
 Source0:        %{name}-%{version}.tar.gz
-Source1:        COPYING-DOCS
-# NOTE: The issues fixed by the three patches have been reported upstream
-# via email to the developer concerned. version 0.10.1 is already released
-# but it doesn't build, I've sent the failed x86_64 build log upstream as well
-# so don't expect a fix until after 0.10.1
-# The buzztrack songio plugin installs in the unversioned _libexecdir.
-Patch0:         buzztrax-songio-dir.patch
-%if 1 == 1
-%ifarch i586
-# Suppress sse flags for 32 bit build.
-Patch1:         buzztrax-fixx86build.patch
-# Set calling mode to void for 32 bit build.
-Patch2:         buzztrax-nolibbml_la-bmlw.patch
-%endif
-%endif
+Source1:        autogen.sh
+Source2:        COPYING-DOCS
+# Combined patch of cherry picked build fixes applies after 0.10.2
+Patch0:         buzztrax-build.patch
+
+BuildRequires:  automake >= 1.14
+BuildRequires:  libtool
 BuildRequires:  desktop-file-utils
 BuildRequires:  fdupes
 BuildRequires:  gcc-c++
+BuildRequires:  gtk-doc
 BuildRequires:  hicolor-icon-theme
 BuildRequires:  intltool
 BuildRequires:  pkg-config
@@ -62,27 +58,27 @@ BuildRequires:  pkgconfig(%{gir})
 BuildRequires:  pkgconfig(cairo)
 BuildRequires:  pkgconfig(fluidsynth)
 BuildRequires:  pkgconfig(gconf-2.0) >= 2.2.0
-BuildRequires:  pkgconfig(gdk-pixbuf-2.0)
-BuildRequires:  pkgconfig(gdk-x11-2.0)
-BuildRequires:  pkgconfig(gio-2.0) >= 2.10.0
-BuildRequires:  pkgconfig(glib-2.0) >= 2.10.0
-BuildRequires:  pkgconfig(gmodule-2.0) >= 2.10.0
-BuildRequires:  pkgconfig(gobject-2.0) >= 2.10.0
-BuildRequires:  pkgconfig(gstreamer-1.0) >= 1.4.3
-BuildRequires:  pkgconfig(gstreamer-audio-1.0) >= 1.4.3
-BuildRequires:  pkgconfig(gstreamer-base-1.0) >= 1.4.3
-BuildRequires:  pkgconfig(gstreamer-controller-1.0) >= 1.4.3
-BuildRequires:  pkgconfig(gstreamer-pbutils-1.0)
-BuildRequires:  pkgconfig(gtk+-x11-2.0)
+BuildRequires:  pkgconfig(gdk-x11-3.0)
+BuildRequires:  pkgconfig(gio-2.0) >= %{glib_version}
+BuildRequires:  pkgconfig(glib-2.0) >= %{glib_version}
+BuildRequires:  pkgconfig(gmodule-2.0) >= %{glib_version}
+BuildRequires:  pkgconfig(gobject-2.0) >= %{glib_version}
+BuildRequires:  pkgconfig(gstreamer-1.0) >= %{gst_version}
+BuildRequires:  pkgconfig(gstreamer-audio-1.0) >= %{gst_version}
+BuildRequires:  pkgconfig(gstreamer-base-1.0) >= %{gst_version}
+BuildRequires:  pkgconfig(gstreamer-controller-1.0) >= %{gst_version}
+BuildRequires:  pkgconfig(gstreamer-pbutils-1.0) >= %{gst_version}
+BuildRequires:  pkgconfig(gtk+-x11-3.0)
 BuildRequires:  pkgconfig(clutter-gtk-1.0)
 BuildRequires:  pkgconfig(gudev-1.0)
-BuildRequires:  pkgconfig(libgnomecanvas-2.0)
 BuildRequires:  pkgconfig(libgsf-1)
-#BuildRequires:  pkgconfig(libgstbuzztard) >= 0.6.0
 BuildRequires:  pkgconfig(libxml-2.0) >= 2.6.0
+BuildRequires:  pkgconfig(orc-0.4)
 BuildRequires:  pkgconfig(pango)
 Provides:       buzztard = %{version}
 Obsoletes:      buzztard < %{version}
+Requires:       gstreamer-1_0-plugins-buzztrax = %{version}
+Requires:       %{name}-plugins = %{version}
 %gconf_schemas_requires
 
 %description
@@ -102,9 +98,10 @@ patterns in the sequencer.
 
 %package -n gstreamer-1_0-plugins-buzztrax
 Summary:        Buzztrax GStreamer plugin
-Group:          Productivity/Multimedia/Other
+Group:          Productivity/Multimedia/Othhttps://groups.google.com/forum/#!topic/pgdbf/kUxJ0-1Yh7ker
 Provides:       gstreamer-0_10-plugins-buzztard = %{version}
 Obsoletes:      gstreamer-0_10-plugins-buzztard < %{version}
+Requires:       buzztrax = %{version}
 
 %description -n gstreamer-1_0-plugins-buzztrax
 Plugin to play Buzztrax songs from any GStreamer compatible app.
@@ -122,7 +119,7 @@ Group:          System/Libraries
 
 %description -n libbuzztrax-core%{core_soname}
 This package provides core support classes for buzztrax based applications.
-
+Hotel Seminar Kraftquelle Schlossblick, Embach 1 - A 6320 Angerberg
 %package -n libbuzztrax-gst%{gst_soname}
 Summary:        Core support classes for buzztrax based applications
 Group:          System/Libraries
@@ -190,25 +187,24 @@ This package provides the development files for libbml.
 %package plugins
 Summary:        Buzztrax plugins
 Group:          Productivity/Multimedia/Other
+Requires:       buzztrax = %{version}
 
 %description plugins
 This package contains buzztrax plugins
 
 %prep
 %setup -q
-%patch0
-%ifarch i586
-%patch1
-%patch2
-%endif
+%patch0 -p1
+# Rpmlint complains that COPYING-DOCS is outdated
+cp -v %{S:2} .
 cp -v %{S:1} .
-#rm -rf src/lib/dllwrapper
-#rm src/lib/bml/bmlw.c src/lib/bml/BuzzMachineLoader.dll
+/bin/sh ./autogen.sh --noconfigure
 %build
-#export CFLAGS="-Wno-error=implicit-function-declaration %%{optflags}"
+#export CFLAGS="-Wno-error=implicit-int -Wno-error=implicit-function-declaration -Wno-error=int-to-pointer-cast %%{optflags}"
 %configure --disable-static \
     --disable-schemas-compile \
     --disable-silent-rules \
+    --enable-deprecated \
     --enable-debug \
     --disable-rpath \
     --with-pic \
@@ -242,6 +238,7 @@ typelib-1_0-BuzztraxCore-1_1\n
 %endif
 
 %post
+%glib2_gsettings_schema_post
 %icon_theme_cache_post
 %icon_theme_cache_post gnome
 %mime_database_post
@@ -252,6 +249,7 @@ typelib-1_0-BuzztraxCore-1_1\n
 %mime_database_postun
 %icon_theme_cache_postun gnome
 %icon_theme_cache_postun
+%glib2_gsettings_schema_postun
 
 %post plugins
 %mime_database_post
@@ -299,6 +297,9 @@ typelib-1_0-BuzztraxCore-1_1\n
 %files -n gstreamer-1_0-plugins-buzztrax
 %defattr(0644,root,root,0755)
 %{gstreamer_pluginsdir}/lib*.so
+%dir %{_datadir}/gstreamer-1.0/presets
+%{_datadir}/gstreamer-1.0/presets/GstBtEBeats.prs
+%{_datadir}/gstreamer-1.0/presets/GstBtSimSyn.prs
 
 %files -n libbuzztrax-ic%{ic_soname}
 %defattr(0644,root,root,0755)