On 19/12/2019 00:52, peter green wrote:

tags 946861 +patch
thanks

Well I got buzztrax building, though i'm not sure of the correctness of my 
patch.

Update, I tried to submit my changes upstream and found that some of the issues 
had already been addressed there.

New debdiff attatched with two fluidsynth-related patches generated from 
upstream commits, plus a new one from me which I have submitted as a pull 
request upstream.

I don't have any immediate plans to NMU, but I may do so later, especially if 
upstream accepts my pull request.

diff -Nru buzztrax-0.10.2/debian/changelog buzztrax-0.10.2/debian/changelog
--- buzztrax-0.10.2/debian/changelog    2018-05-31 13:54:09.000000000 +0000
+++ buzztrax-0.10.2/debian/changelog    2019-12-19 00:34:06.000000000 +0000
@@ -1,3 +1,15 @@
+buzztrax (0.10.2-6.1) UNRELEASED; urgency=medium
+
+  * Patch for BTS, no intent to NMU
+  * Add -Werror=incompatible-pointer-types and 
-Werror=implicit-function-declaration
+    to help in checking the fluidsynth stuff.
+  * Add casts to/from GObject so the GObject related code would build with
+    -Werror=incompatible-pointer-types
+  * Port fluidsynth code to fluidsynth 2.x (Closes: 946861)
+  * Add -f to rm command to avoid "No such file or directory" error.
+
+ -- Peter Michael Green <plugw...@debian.org>  Thu, 19 Dec 2019 00:34:06 +0000
+
 buzztrax (0.10.2-6) unstable; urgency=medium
 
   * debian/control:
diff -Nru buzztrax-0.10.2/debian/patches/0007-add-gobject-casts.patch 
buzztrax-0.10.2/debian/patches/0007-add-gobject-casts.patch
--- buzztrax-0.10.2/debian/patches/0007-add-gobject-casts.patch 1970-01-01 
00:00:00.000000000 +0000
+++ buzztrax-0.10.2/debian/patches/0007-add-gobject-casts.patch 2019-12-19 
00:29:15.000000000 +0000
@@ -0,0 +1,97 @@
+Description: 
+ Add casts to/from GObject to allow code to be built with 
+ -Werror=incompatible-pointer-types
+ (which I wanted for work on the fluidsynth stuff)
+Author: Peter Michael Green <plugw...@debian.org>
+
+--- buzztrax-0.10.2.orig/src/lib/core/audio-session.c
++++ buzztrax-0.10.2/src/lib/core/audio-session.c
+@@ -226,7 +226,7 @@ bt_audio_session_constructor (GType type
+     singleton = BT_AUDIO_SESSION (object);
+     g_object_add_weak_pointer (object, (gpointer *) (gpointer) & singleton);
+   } else {
+-    object = g_object_ref (singleton);
++    object = (GObject *)(g_object_ref (singleton));
+   }
+   return object;
+ }
+--- buzztrax-0.10.2.orig/src/lib/core/machine.c
++++ buzztrax-0.10.2/src/lib/core/machine.c
+@@ -1982,7 +1982,7 @@ bt_machine_get_pattern_by_id (const BtMa
+     pattern = (GObject *) node->data;
+     if (!g_strcmp0 (g_object_get_data (pattern, "BtPattern::id"), id)) {
+       GST_INFO ("legacy pattern lookup for '%s' = %p", id, pattern);
+-      return g_object_ref (pattern);
++      return (BtCmdPattern *)(g_object_ref (pattern));
+     }
+   }
+   return NULL;
+--- buzztrax-0.10.2.orig/src/lib/ic/registry.c
++++ buzztrax-0.10.2/src/lib/ic/registry.c
+@@ -246,7 +246,7 @@ btic_registry_constructor (GType type, g
+     singleton->priv->gudev_discoverer = btic_gudev_discoverer_new ();
+ #endif
+   } else {
+-    object = g_object_ref (singleton);
++    object = (GObject *)(g_object_ref (singleton));
+   }
+   return object;
+ }
+--- buzztrax-0.10.2.orig/src/ui/edit/change-log.c
++++ buzztrax-0.10.2/src/ui/edit/change-log.c
+@@ -1153,7 +1153,7 @@ bt_change_log_constructor (GType type, g
+     singleton = BT_CHANGE_LOG (object);
+     g_object_add_weak_pointer (object, (gpointer *) (gpointer) & singleton);
+   } else {
+-    object = g_object_ref (singleton);
++    object = (GObject *)(g_object_ref (singleton));
+   }
+   return object;
+ }
+--- buzztrax-0.10.2.orig/src/ui/edit/edit-application.c
++++ buzztrax-0.10.2/src/ui/edit/edit-application.c
+@@ -930,7 +930,7 @@ bt_edit_application_constructor (GType t
+         G_OBJECT_LOG_REF_COUNT (singleton));
+     //GST_DEBUG(">>>");
+   } else {
+-    object = g_object_ref (singleton);
++    object = (GObject *)(g_object_ref (singleton));
+   }
+   return object;
+ }
+--- buzztrax-0.10.2.orig/src/ui/edit/main-page-sequence.c
++++ buzztrax-0.10.2/src/ui/edit/main-page-sequence.c
+@@ -653,9 +653,9 @@ pattern_list_model_get_pattern_by_key (G
+     gtk_tree_model_get (store, &iter, BT_PATTERN_LIST_MODEL_SHORTCUT, 
&this_key,
+         -1);
+     if (this_key[0] == that_key) {
+-      pattern =
++      pattern = (BtCmdPattern *)(
+           g_object_ref (bt_pattern_list_model_get_object ((BtPatternListModel 
*)
+-              store, &iter));
++              store, &iter)));
+       GST_INFO ("found pattern for key : %" G_OBJECT_REF_COUNT_FMT,
+           G_OBJECT_LOG_REF_COUNT (pattern));
+       g_free (this_key);
+--- buzztrax-0.10.2.orig/src/ui/edit/settings-page-interaction-controller.c
++++ buzztrax-0.10.2/src/ui/edit/settings-page-interaction-controller.c
+@@ -186,7 +186,7 @@ on_device_menu_changed (GtkComboBox * co
+     g_list_free (list);
+ 
+     // activate the new one
+-    self->priv->device = g_object_ref (device);
++    self->priv->device = (BtIcDevice *)(g_object_ref (device));
+     start_device (self);
+   }
+   GST_INFO ("control list refreshed");
+--- buzztrax-0.10.2.orig/src/ui/edit/ui-resources.c
++++ buzztrax-0.10.2/src/ui/edit/ui-resources.c
+@@ -429,7 +429,7 @@ bt_ui_resources_constructor (GType type,
+     g_object_unref (settings);
+     g_object_unref (app);
+   } else {
+-    object = g_object_ref (singleton);
++    object = (GObject *)(g_object_ref (singleton));
+   }
+   return object;
+ }
diff -Nru 
buzztrax-0.10.2/debian/patches/0008-replace-deprecated-fluid_settings_getstr.patch
 
buzztrax-0.10.2/debian/patches/0008-replace-deprecated-fluid_settings_getstr.patch
--- 
buzztrax-0.10.2/debian/patches/0008-replace-deprecated-fluid_settings_getstr.patch
  1970-01-01 00:00:00.000000000 +0000
+++ 
buzztrax-0.10.2/debian/patches/0008-replace-deprecated-fluid_settings_getstr.patch
  2019-12-19 00:34:06.000000000 +0000
@@ -0,0 +1,28 @@
+This patch is based on the git commit detailed below, but with the
+configure.ac changes removed.
+
+commit b39563b237f82408bc4929d38d52d6ebd4a513b7
+Author: David Beswick <dlbesw...@gmail.com>
+Date:   Wed Aug 7 08:03:39 2019 +0200
+
+    fluidsynth: replace deprecated fluid_settings_getstr()
+    
+    Simply depend on fluidsynth >=1.1.0 which introduced the new function to 
not
+    clutter the code with ifdefs.
+
+diff --git a/src/gst/fluidsynth/fluidsynth.c b/src/gst/fluidsynth/fluidsynth.c
+index c3263980..9e407590 100644
+--- a/src/gst/fluidsynth/fluidsynth.c
++++ b/src/gst/fluidsynth/fluidsynth.c
+@@ -587,9 +587,9 @@ gstbt_fluid_synth_get_property (GObject * object, guint 
prop_id,
+           g_value_set_double (value, d);
+         break;
+       case G_TYPE_STRING:
+-        retval = fluid_settings_getstr (src->settings, name, &s);
++        retval = fluid_settings_dupstr (src->settings, name, &s);
+         if (retval)
+-          g_value_set_string (value, s);
++          g_value_take_string (value, s);
+         break;
+       default:
+         g_critical ("Unexpected FluidSynth dynamic property type");
diff -Nru 
buzztrax-0.10.2/debian/patches/0009-replace-deprecated-fluid_synth_set_midi_router
 
buzztrax-0.10.2/debian/patches/0009-replace-deprecated-fluid_synth_set_midi_router
--- 
buzztrax-0.10.2/debian/patches/0009-replace-deprecated-fluid_synth_set_midi_router
  1970-01-01 00:00:00.000000000 +0000
+++ 
buzztrax-0.10.2/debian/patches/0009-replace-deprecated-fluid_synth_set_midi_router
  2019-12-19 00:34:06.000000000 +0000
@@ -0,0 +1,64 @@
+commit a3e7447885137a7569da948b5fb847829dfdb835
+Author: David Beswick <dlbesw...@gmail.com>
+Date:   Thu Aug 8 08:14:50 2019 +0200
+
+    fluidsynth: replace deprecated fluid_synth_set_midi_router
+    
+    Use a thread_safe command_handler instead.
+
+diff --git a/src/gst/fluidsynth/fluidsynth.c b/src/gst/fluidsynth/fluidsynth.c
+index 9e407590..0d954f8e 100644
+--- a/src/gst/fluidsynth/fluidsynth.c
++++ b/src/gst/fluidsynth/fluidsynth.c
+@@ -671,11 +671,14 @@ gstbt_fluid_synth_dispose (GObject * object)
+     delete_fluid_midi_driver (gstsynth->midi);
+   if (gstsynth->midi_router)
+     delete_fluid_midi_router (gstsynth->midi_router);
++  if (gstsynth->cmd_handler)
++    delete_fluid_cmd_handler (gstsynth->cmd_handler);
+   if (gstsynth->fluid)
+     delete_fluid_synth (gstsynth->fluid);
+ 
+   gstsynth->midi = NULL;
+   gstsynth->midi_router = NULL;
++  gstsynth->cmd_handler = NULL;
+   gstsynth->fluid = NULL;
+ 
+   g_free (gstsynth->instrument_patch_path);
+@@ -719,14 +722,17 @@ gstbt_fluid_synth_init (GstBtFluidSynth * src)
+   /* create MIDI router to send MIDI to FluidSynth */
+   src->midi_router =
+       new_fluid_midi_router (src->settings,
+-      fluid_synth_handle_midi_event, (void *) src);
++      fluid_synth_handle_midi_event, src->fluid);
+   if (src->midi_router) {
+-    fluid_synth_set_midi_router (src->fluid, src->midi_router);
+-    src->midi =
+-        new_fluid_midi_driver (src->settings,
+-        fluid_midi_router_handle_midi_event, (void *) (src->midi_router));
+-    if (!src->midi)
+-      g_warning ("Failed to create FluidSynth MIDI input driver");
++    src->cmd_handler = new_fluid_cmd_handler (src->fluid);
++    if (src->cmd_handler) {
++      src->midi = new_fluid_midi_driver (src->settings,
++          fluid_midi_router_handle_midi_event, (void *) (src->midi_router));
++      if (!src->midi)
++        g_warning ("Failed to create FluidSynth MIDI input driver");
++    } else {
++      g_warning ("Failed to create FluidSynth MIDI cmd handler");
++    }
+   } else
+     g_warning ("Failed to create MIDI input router");
+ 
+diff --git a/src/gst/fluidsynth/fluidsynth.h b/src/gst/fluidsynth/fluidsynth.h
+index 4676b716..c079b477 100644
+--- a/src/gst/fluidsynth/fluidsynth.h
++++ b/src/gst/fluidsynth/fluidsynth.h
+@@ -93,6 +93,7 @@ struct _GstBtFluidSynth {
+   fluid_settings_t *settings;       /* to free on close */
+   fluid_midi_driver_t *midi;              /* FluidSynth MIDI driver */
+   fluid_midi_router_t *midi_router; /* FluidSynth MIDI router */
++  fluid_cmd_handler_t *cmd_handler;
+ 
+   gchar *instrument_patch_path;
+   gint instrument_patch;
diff -Nru buzztrax-0.10.2/debian/patches/0010-fix-build-fluidsynth-2.patch 
buzztrax-0.10.2/debian/patches/0010-fix-build-fluidsynth-2.patch
--- buzztrax-0.10.2/debian/patches/0010-fix-build-fluidsynth-2.patch    
1970-01-01 00:00:00.000000000 +0000
+++ buzztrax-0.10.2/debian/patches/0010-fix-build-fluidsynth-2.patch    
2019-12-19 00:34:06.000000000 +0000
@@ -0,0 +1,129 @@
+commit 3ac7cbf1a712c3f4db7a34a6d3b46dc9a43172d3
+Author: Peter Michael Green <plugw...@debian.org>
+Date:   Thu Dec 19 01:38:18 2019 +0000
+
+    Fix build with fluidsynth 2.x
+
+diff --git a/src/gst/fluidsynth/fluidsynth.c b/src/gst/fluidsynth/fluidsynth.c
+index 0d954f8e..ec598dc4 100644
+--- a/src/gst/fluidsynth/fluidsynth.c
++++ b/src/gst/fluidsynth/fluidsynth.c
+@@ -132,25 +132,41 @@ G_DEFINE_TYPE (GstBtFluidSynth, gstbt_fluid_synth, 
GSTBT_TYPE_AUDIO_SYNTH);
+ //-- fluid_synth log handler
+ 
+ static void
++#if FLUIDSYNTH_VERSION_MAJOR < 2
+ gstbt_fluid_synth_error_log_function (int level, char *message, void *data)
++#else
++gstbt_fluid_synth_error_log_function (int level, const char *message, void 
*data)
++#endif
+ {
+   GST_ERROR ("%s", message);
+ }
+ 
+ static void
++#if FLUIDSYNTH_VERSION_MAJOR < 2
+ gstbt_fluid_synth_warning_log_function (int level, char *message, void *data)
++#else
++gstbt_fluid_synth_warning_log_function (int level, const char *message, void 
*data)
++#endif
+ {
+   GST_WARNING ("%s", message);
+ }
+ 
+ static void
++#if FLUIDSYNTH_VERSION_MAJOR < 2
+ gstbt_fluid_synth_info_log_function (int level, char *message, void *data)
++#else
++gstbt_fluid_synth_info_log_function (int level, const char *message, void 
*data)
++#endif
+ {
+   GST_INFO ("%s", message);
+ }
+ 
+ static void
++#if FLUIDSYNTH_VERSION_MAJOR < 2
+ gstbt_fluid_synth_debug_log_function (int level, char *message, void *data)
++#else
++gstbt_fluid_synth_debug_log_function (int level, const char *message, void 
*data)
++#endif
+ {
+   GST_DEBUG ("%s", message);
+ }
+@@ -212,7 +228,11 @@ typedef struct
+ 
+ /* for counting the number of FluidSynth settings properties */
+ static void
++#if FLUIDSYNTH_VERSION_MAJOR < 2
+ settings_foreach_count (void *data, char *name, int type)
++#else
++settings_foreach_count (void *data, const char *name, int type)
++#endif
+ {
+   int *count = (int *) data;
+   *count = *count + 1;
+@@ -220,7 +240,11 @@ settings_foreach_count (void *data, char *name, int type)
+ 
+ /* add each FluidSynth setting as a GObject property */
+ static void
++#if FLUIDSYNTH_VERSION_MAJOR < 2
+ settings_foreach_func (void *data, char *name, int type)
++#else
++settings_foreach_func (void *data, const char *name, int type)
++#endif
+ {
+   ForeachBag *bag = (ForeachBag *) data;
+   GParamSpec *spec;
+@@ -231,18 +255,30 @@ settings_foreach_func (void *data, char *name, int type)
+   switch (type) {
+     case FLUID_NUM_TYPE:
+       fluid_settings_getnum_range (bag->settings, name, &dmin, &dmax);
++#if FLUIDSYNTH_VERSION_MAJOR < 2
+       ddef = fluid_settings_getnum_default (bag->settings, name);
++#else
++      if (fluid_settings_getnum_default (bag->settings, name, &ddef) != 
FLUID_OK) ddef = 0;
++#endif
+       spec = g_param_spec_double (name, name, name, dmin, dmax, ddef,
+           G_PARAM_READWRITE);
+       break;
+     case FLUID_INT_TYPE:
+       fluid_settings_getint_range (bag->settings, name, &imin, &imax);
++#if FLUIDSYNTH_VERSION_MAJOR < 2
+       idef = fluid_settings_getint_default (bag->settings, name);
++#else
++      if (fluid_settings_getint_default (bag->settings, name, &idef) != 
FLUID_OK) idef = 0;
++#endif
+       spec = g_param_spec_int (name, name, name, imin, imax, idef,
+           G_PARAM_READWRITE);
+       break;
+     case FLUID_STR_TYPE:
+-      defstr = fluid_settings_getstr_default (bag->settings, name);
++#if FLUIDSYNTH_VERSION_MAJOR < 2
++      fluid_settings_getstr_default (bag->settings, name);
++#else
++      if (fluid_settings_getstr_default (bag->settings, name,&defstr) != 
FLUID_OK) defstr = 0;
++#endif
+       spec = g_param_spec_string (name, name, name, defstr, 
G_PARAM_READWRITE);
+       break;
+     case FLUID_SET_TYPE:
+@@ -724,7 +760,11 @@ gstbt_fluid_synth_init (GstBtFluidSynth * src)
+       new_fluid_midi_router (src->settings,
+       fluid_synth_handle_midi_event, src->fluid);
+   if (src->midi_router) {
++#if FLUIDSYNTH_VERSION_MAJOR < 2
+     src->cmd_handler = new_fluid_cmd_handler (src->fluid);
++#else
++    src->cmd_handler = new_fluid_cmd_handler (src->fluid,NULL);
++#endif
+     if (src->cmd_handler) {
+       src->midi = new_fluid_midi_driver (src->settings,
+           fluid_midi_router_handle_midi_event, (void *) (src->midi_router));
+@@ -886,7 +926,7 @@ gstbt_fluid_synth_class_init (GstBtFluidSynthClass * klass)
+       g_param_spec_enum ("chorus-waveform", "Chorus waveform",
+           "Chorus waveform type",
+           CHORUS_WAVEFORM_TYPE,
+-          FLUID_CHORUS_DEFAULT_TYPE,
++          FLUID_CHORUS_MOD_SINE,
+           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ 
+   gst_element_class_set_static_metadata (element_class,
diff -Nru buzztrax-0.10.2/debian/patches/series 
buzztrax-0.10.2/debian/patches/series
--- buzztrax-0.10.2/debian/patches/series       2018-05-31 13:54:09.000000000 
+0000
+++ buzztrax-0.10.2/debian/patches/series       2019-12-19 00:34:06.000000000 
+0000
@@ -4,3 +4,7 @@
 0004-configure-fix-the-header-name-mess.patch
 0005-bt-dec-rename-plugin.patch
 0006-gtk-update-icon-cache.patch
+0007-add-gobject-casts.patch
+0008-replace-deprecated-fluid_settings_getstr.patch
+0009-replace-deprecated-fluid_synth_set_midi_router
+0010-fix-build-fluidsynth-2.patch
diff -Nru buzztrax-0.10.2/debian/rules buzztrax-0.10.2/debian/rules
--- buzztrax-0.10.2/debian/rules        2016-09-27 08:14:52.000000000 +0000
+++ buzztrax-0.10.2/debian/rules        2019-12-19 00:34:06.000000000 +0000
@@ -4,6 +4,8 @@
 
 export AUTOPOINT=intltoolize --automake --copy
 
+export CFLAGS += -Werror=incompatible-pointer-types 
-Werror=implicit-function-declaration
+
 configure_flags += \
                --disable-silent-rules \
                --enable-man \
@@ -26,7 +28,7 @@
        rm $(CURDIR)/debian/buzztrax/usr/lib/*/*.a
        #rm -r $(CURDIR)/debian/buzztrax/usr/lib/pkgconfig
        rm -r $(CURDIR)/debian/buzztrax/usr/include
-       rm -r $(CURDIR)/debian/buzztrax/usr/share/gtk-doc
+       rm -rf $(CURDIR)/debian/buzztrax/usr/share/gtk-doc
 
 override_dh_auto_test:
 

Reply via email to