tags 946861 +patch
thanks

Well I got buzztrax building, though i'm not sure of the correctness of my 
patch. I mostly based my fixes on cross-comparing the API documentation at 
http://www.fluidsynth.org/api-1.x/ and http://www.fluidsynth.org/api/

The first thing I did was add -Werror=incompatible-pointer-types because I saw 
some worrying warnings in addition to the errors and did not want to miss them 
later, I also added -Werror=implicit-function-declaration later for similar 
reasons.

Unfortunately that caused build failures in other parts of the code, in 
particular conversions to/from GOBject * I fixed these by adding casts ( 
0007-add-gobject-casts.patch)

Then it was on to the actual fixing of the fluidsynth stuff, with most of it, 
it was pretty obvious how to make the new code behave the same as the old code, 
but there were a couple of questionable cases.

The first is that FLUID_CHORUS_DEFAULT_TYPE had been removed, I replaced it 
with FLUID_CHORUS_MOD_SINE (which it had previously been #define'd to)

The second is that fluid_synth_set_midi_router has been removed, the documentation says 
"remove deprecated fluid_synth_set_midi_router(), instead supply the midi-router 
instance when creating a command handler with new_fluid_cmd_handler()", I replaced 
fluid_synth_set_midi_router with new_fluid_cmd_handler, but i'm not sure if that is 
sufficient or if more changes are required.

The fluidsynth changes are in 0008-fluidsynth2.0.patch , I have not made any 
attempt to put them behind conditional logic, if someone wants a codebase that 
builds with both 1.x and 2.x they will probablly need to do so.

I also had to add a "-f" to "rm -r /buzztrax-0.10.2/debian/buzztrax/usr/share/gtk-doc" to 
avoid a "No such file or directory"

With these changes the package builds, I have not tested if it actually works.

Debdiff attatched, no intent to NMU.

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-fluidsynth2.0.patch 
buzztrax-0.10.2/debian/patches/0008-fluidsynth2.0.patch
--- buzztrax-0.10.2/debian/patches/0008-fluidsynth2.0.patch     1970-01-01 
00:00:00.000000000 +0000
+++ buzztrax-0.10.2/debian/patches/0008-fluidsynth2.0.patch     2019-12-19 
00:33:43.000000000 +0000
@@ -0,0 +1,112 @@
+Description: Make code build with fluidsynth 2.0
+ This patch makes the package build with fluidsynth 2.0, it is based on
+ cross-referencing the API documentation for 1.x and 2.x from 
+ http://www.fluidsynth.org/api-1.x and http://www.fluidsynth.org/api/
+ no attempt is made to keep the code buildable with 1.x
+Author: Peter Michael Green <plugw...@debian.org>
+Bug-Debian: https://bugs.debian.org/946861
+
+--- buzztrax-0.10.2.orig/src/gst/fluidsynth/fluidsynth.c
++++ buzztrax-0.10.2/src/gst/fluidsynth/fluidsynth.c
+@@ -132,25 +132,25 @@ G_DEFINE_TYPE (GstBtFluidSynth, gstbt_fl
+ //-- fluid_synth log handler
+ 
+ static void
+-gstbt_fluid_synth_error_log_function (int level, char *message, void *data)
++gstbt_fluid_synth_error_log_function (int level, const char *message, void 
*data)
+ {
+   GST_ERROR ("%s", message);
+ }
+ 
+ static void
+-gstbt_fluid_synth_warning_log_function (int level, char *message, void *data)
++gstbt_fluid_synth_warning_log_function (int level, const char *message, void 
*data)
+ {
+   GST_WARNING ("%s", message);
+ }
+ 
+ static void
+-gstbt_fluid_synth_info_log_function (int level, char *message, void *data)
++gstbt_fluid_synth_info_log_function (int level, const char *message, void 
*data)
+ {
+   GST_INFO ("%s", message);
+ }
+ 
+ static void
+-gstbt_fluid_synth_debug_log_function (int level, char *message, void *data)
++gstbt_fluid_synth_debug_log_function (int level, const char *message, void 
*data)
+ {
+   GST_DEBUG ("%s", message);
+ }
+@@ -212,7 +212,7 @@ typedef struct
+ 
+ /* for counting the number of FluidSynth settings properties */
+ static void
+-settings_foreach_count (void *data, char *name, int type)
++settings_foreach_count (void *data, const char *name, int type)
+ {
+   int *count = (int *) data;
+   *count = *count + 1;
+@@ -220,7 +220,7 @@ settings_foreach_count (void *data, char
+ 
+ /* add each FluidSynth setting as a GObject property */
+ static void
+-settings_foreach_func (void *data, char *name, int type)
++settings_foreach_func (void *data, const char *name, int type)
+ {
+   ForeachBag *bag = (ForeachBag *) data;
+   GParamSpec *spec;
+@@ -231,18 +231,18 @@ settings_foreach_func (void *data, char
+   switch (type) {
+     case FLUID_NUM_TYPE:
+       fluid_settings_getnum_range (bag->settings, name, &dmin, &dmax);
+-      ddef = fluid_settings_getnum_default (bag->settings, name);
++      if (fluid_settings_getnum_default (bag->settings, name, &ddef) != 
FLUID_OK) ddef = 0;
+       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);
+-      idef = fluid_settings_getint_default (bag->settings, name);
++      if (fluid_settings_getint_default (bag->settings, name, &idef) != 
FLUID_OK) idef = 0;
+       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 (fluid_settings_getstr_default (bag->settings, name,&defstr) != 
FLUID_OK) defstr = 0;
+       spec = g_param_spec_string (name, name, name, defstr, 
G_PARAM_READWRITE);
+       break;
+     case FLUID_SET_TYPE:
+@@ -582,9 +582,10 @@ gstbt_fluid_synth_get_property (GObject
+           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);
++          fluid_free(s);
+         break;
+       default:
+         g_critical ("Unexpected FluidSynth dynamic property type");
+@@ -716,7 +717,9 @@ gstbt_fluid_synth_init (GstBtFluidSynth
+       new_fluid_midi_router (src->settings,
+       fluid_synth_handle_midi_event, (void *) src);
+   if (src->midi_router) {
+-    fluid_synth_set_midi_router (src->fluid, src->midi_router);
++    //not sure if this fix is correct, old call commented out below
++    new_fluid_cmd_handler(src->fluid, 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));
+@@ -874,7 +877,7 @@ gstbt_fluid_synth_class_init (GstBtFluid
+       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:33:04.000000000 
+0000
@@ -4,3 +4,5 @@
 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-fluidsynth2.0.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