View Issue Details

IDProjectCategoryView StatusLast Update
0009886ardourbugspublic2025-02-01 11:36
Reporterwiz Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Platformx86_64OSNetBSDOS Version10.99.12
Product Version8.10 
Summary0009886: Build fixes for NetBSD from pkgsrc
DescriptionWe have a package for ardour in pkgsrc, and it has accumulated quite a number of patches, mostly for making it compile on NetBSD.
I'd like to get these integrated.

This also includes a build fix for when not using VST3 support.

(We are also using Arch Linux's patches for preferring the included qm-dsp, but I'll leave these out.)

Most of these are unproblematic to apply, the exception is perhaps the ifdef for when HAVE_GNU_FTW is defined (in libs/tk/ytk and libs/tk/ydk) - there I've changed the logic from NOT-Apple to ONLY-Linux, since I think that's probably right, but I can change that to NOT-Apply-AND-NOT-NetBSD if you prefer.
Steps To ReproduceBuild ardour on NetBSD.
TagsNo tags attached.

Activities

wiz

2025-01-31 22:00

reporter  

patch-libs_aaf_aaf_LibCFB.h (328 bytes)   
$NetBSD: patch-libs_aaf_aaf_LibCFB.h,v 1.2 2025/01/31 17:15:11 wiz Exp $

Fix build on NetBSD.

--- libs/aaf/aaf/LibCFB.h.orig	2024-02-04 02:25:00.306525205 +0000
+++ libs/aaf/aaf/LibCFB.h
@@ -37,6 +37,8 @@
 #elif defined(_WIN32)
 #include <windows.h> // MAX_PATH
 #include <limits.h>
+#else
+#include <limits.h>
 #endif
 
 /**
patch-libs_aaf_aaf_LibCFB.h (328 bytes)   
patch-libs_aaf_utils.c (494 bytes)   
$NetBSD: patch-libs_aaf_utils.c,v 1.1 2025/01/31 17:15:11 wiz Exp $

Fix build on NetBSD.

--- libs/aaf/utils.c.orig	2025-01-31 16:58:13.463705776 +0000
+++ libs/aaf/utils.c
@@ -32,7 +32,7 @@
 #include <arpa/inet.h>
 #include <mntent.h>
 #include <unistd.h> /* access() */
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__NetBSD__)
 #include <sys/syslimits.h>
 #include <unistd.h> /* access() */
 #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
patch-libs_aaf_utils.c (494 bytes)   
patch-libs_ardour_plugin__manager.cc (460 bytes)   
$NetBSD: patch-libs_ardour_plugin__manager.cc,v 1.1 2021/09/11 16:33:11 nia Exp $

Fix building without VST3 support.

--- libs/ardour/plugin_manager.cc.orig	2021-08-13 16:20:07.000000000 +0000
+++ libs/ardour/plugin_manager.cc
@@ -116,8 +116,9 @@
 #include <Carbon/Carbon.h>
 #endif
 
-#ifdef VST3_SUPPORT
 #include "ardour/system_exec.h"
+
+#ifdef VST3_SUPPORT
 #include "ardour/vst3_module.h"
 #include "ardour/vst3_plugin.h"
 #include "ardour/vst3_scan.h"
patch-libs_backends_jack_jack__utils.cc (1,747 bytes)   
$NetBSD: patch-libs_backends_jack_jack__utils.cc,v 1.3 2021/09/11 16:33:11 nia Exp $

NetBSD needs the -Sr -d sun arguments to jackd.

--- libs/backends/jack/jack_utils.cc.orig	2021-08-13 16:20:07.000000000 +0000
+++ libs/backends/jack/jack_utils.cc
@@ -121,9 +121,10 @@ ARDOUR::get_jack_audio_driver_names (vec
 #ifdef HAVE_ALSA
 	audio_driver_names.push_back (alsa_driver_name);
 #endif
-	audio_driver_names.push_back (oss_driver_name);
-#if defined(__NetBSD__) || defined(__sun)
+#if defined(__NetBSD__)
 	audio_driver_names.push_back (sun_driver_name);
+#else
+	audio_driver_names.push_back (oss_driver_name);
 #endif
 	audio_driver_names.push_back (freebob_driver_name);
 	audio_driver_names.push_back (ffado_driver_name);
@@ -508,7 +509,7 @@ bool
 ARDOUR::get_jack_audio_driver_supports_setting_period_count (const string& driver)
 {
 	return !(driver == dummy_driver_name || driver == coreaudio_driver_name ||
-			driver == portaudio_driver_name);
+			driver == portaudio_driver_name || driver == sun_driver_name);
 }
 
 bool
@@ -689,7 +690,7 @@ ARDOUR::get_jack_command_line_string (Ja
 
 	args.push_back (options.server_path);
 
-#ifdef PLATFORM_WINDOWS
+#if defined(PLATFORM_WINDOWS) || defined(__NetBSD__) || defined(__sun)
 	// must use sync mode on windows
 	args.push_back ("-S");
 #endif
@@ -719,6 +720,7 @@ ARDOUR::get_jack_command_line_string (Ja
 	args.push_back ("-p");
 	args.push_back (to_string(options.ports_max));
 
+#ifndef __NetBSD__
 	if (options.realtime) {
 		args.push_back ("-R");
 		if (options.priority != 0) {
@@ -728,6 +730,9 @@ ARDOUR::get_jack_command_line_string (Ja
 	} else {
 		args.push_back ("-r");
 	}
+#else
+	args.push_back ("-r");
+#endif
 
 	if (options.unlock_gui_libs) {
 		args.push_back ("-u");
patch-libs_pbd_cpus.cc (462 bytes)   
$NetBSD: patch-libs_pbd_cpus.cc,v 1.2 2025/01/31 17:15:11 wiz Exp $

Fix build on NetBSD and OpenBSD.

--- libs/pbd/cpus.cc.orig	2024-02-04 02:25:51.019870123 +0000
+++ libs/pbd/cpus.cc
@@ -25,7 +25,7 @@
 
 #ifdef __linux__
 #include <unistd.h>
-#elif defined(__APPLE__) || defined(__FreeBSD__)
+#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
 #include <stddef.h>
 #include <sys/types.h>
 #include <sys/sysctl.h>
patch-libs_pbd_cpus.cc (462 bytes)   
patch-libs_tk_ydk_config.h (338 bytes)   
$NetBSD: patch-libs_tk_ydk_config.h,v 1.1 2025/01/31 17:15:11 wiz Exp $

Only assume GNU ftw on Linux.

--- libs/tk/ydk/config.h.orig	2024-10-17 04:04:34.000000000 +0000
+++ libs/tk/ydk/config.h
@@ -25,7 +25,7 @@
 #define HAVE_GETRESUID 1
 #endif
 
-#ifndef __APPLE__
+#ifdef __Linux__
 /* Have GNU ftw */
 #define HAVE_GNU_FTW 1
 #endif
patch-libs_tk_ydk_config.h (338 bytes)   
patch-libs_tk_ytk_config.h (578 bytes)   
$NetBSD: patch-libs_tk_ytk_config.h,v 1.1 2025/01/31 17:15:11 wiz Exp $

No getresuid() on NetBSD.
Only assume GNU ftw on Linux.

--- libs/tk/ytk/config.h.orig	2024-10-17 04:04:34.000000000 +0000
+++ libs/tk/ytk/config.h
@@ -18,11 +18,11 @@
 #define HAVE_FTW_H 1
 
 /* Define to 1 if you have the `getresuid' function. */
-#if !(defined PLATFORM_WINDOWS || defined __APPLE__)
+#if !(defined PLATFORM_WINDOWS || defined __APPLE__ || defined(__NetBSD__))
 #define HAVE_GETRESUID 1
 #endif
 
-#ifndef __APPLE__
+#ifdef __Linux__
 /* Have GNU ftw */
 #define HAVE_GNU_FTW 1
 #endif
patch-libs_tk_ytk_config.h (578 bytes)   
patch-libs_vst3_pluginterfaces_base_fplatform.h (629 bytes)   
$NetBSD: patch-libs_vst3_pluginterfaces_base_fplatform.h,v 1.2 2025/01/31 17:15:11 wiz Exp $

Fix build on *BSD.

--- libs/vst3/pluginterfaces/base/fplatform.h.orig	2024-02-04 02:22:43.806501710 +0000
+++ libs/vst3/pluginterfaces/base/fplatform.h
@@ -86,7 +86,7 @@
 //-----------------------------------------------------------------------------
 // LINUX
 //-----------------------------------------------------------------------------
-#elif __gnu_linux__ || __linux__
+#elif __gnu_linux__ || __linux__ || __FreeBSD__ || __NetBSD__ || __OpenBSD__
 	#define SMTG_OS_LINUX	1
 	#define SMTG_OS_MACOS	0
 	#define SMTG_OS_WINDOWS	0

x42

2025-01-31 23:07

administrator   ~0029205

Thanks!
Looks good, except for the "HAVE_GNU_FTW" patch. w64-mingw32 also offers that feature (and for some reason MSVC can also compile this as-is).
So changing <code>#ifndef __APPLE__</code> to <code>#ifdef __Linux__</code> is not correct.
 
Then again it looks like we don't even use the gtksearchengine, so perhaps we can just remove this altogether.

the libAAF changes will have to go upstream to https://github.com/agfline/LibAAF otherwise they will be lost next time we pull from there.

wiz

2025-02-01 09:59

reporter   ~0029206

The code in libAAF is slightly different (mostly whitespace), and I've filed a ticket to get this to compile on NetBSD: https://github.com/agfline/LibAAF/pull/30

wiz

2025-02-01 10:00

reporter   ~0029207

Here are the updated patches for ytk & ydk.
Thanks for the feedback!
patch-libs_tk_ydk_config-2.h (413 bytes)   
$NetBSD: patch-libs_tk_ydk_config.h,v 1.2 2025/01/31 22:01:23 wiz Exp $

Only assume GNU ftw on Linux.
https://tracker.ardour.org/view.php?id=9886

--- libs/tk/ydk/config.h.orig	2024-10-17 04:04:34.000000000 +0000
+++ libs/tk/ydk/config.h
@@ -25,7 +25,7 @@
 #define HAVE_GETRESUID 1
 #endif
 
-#ifndef __APPLE__
+#if !defined(__APPLE__) && !defined(__NetBSD__)
 /* Have GNU ftw */
 #define HAVE_GNU_FTW 1
 #endif
patch-libs_tk_ytk_config-2.h (653 bytes)   
$NetBSD: patch-libs_tk_ytk_config.h,v 1.2 2025/01/31 22:01:23 wiz Exp $

No getresuid() on NetBSD.
Only assume GNU ftw on Linux.
https://tracker.ardour.org/view.php?id=9886

--- libs/tk/ytk/config.h.orig	2024-10-17 04:04:34.000000000 +0000
+++ libs/tk/ytk/config.h
@@ -18,11 +18,11 @@
 #define HAVE_FTW_H 1
 
 /* Define to 1 if you have the `getresuid' function. */
-#if !(defined PLATFORM_WINDOWS || defined __APPLE__)
+#if !(defined PLATFORM_WINDOWS || defined __APPLE__ || defined(__NetBSD__))
 #define HAVE_GETRESUID 1
 #endif
 
-#ifndef __APPLE__
+#if !defined(__APPLE__) && !defined(__NetBSD__)
 /* Have GNU ftw */
 #define HAVE_GNU_FTW 1
 #endif

x42

2025-02-01 10:33

administrator   ~0029208

OK,, I've applied all the patches. Then noticed the following

-	audio_driver_names.push_back (oss_driver_name);
-#if defined(__NetBSD__) || defined(__sun)
+#if defined(__NetBSD__)
     audio_driver_names.push_back (sun_driver_name);
+#else
+	audio_driver_names.push_back (oss_driver_name);
 #endif


Isn't that reverse? and one would use <code>sun_driver_name</code> on Solaris, and OSS on *BSD?

wiz

2025-02-01 11:33

reporter   ~0029209

The NetBSD audio system is quite similar to the Sun one.
NetBSD also provides an OSS compatibility library, so that also works, but of course the native one is preferred.

wiz

2025-02-01 11:36

reporter   ~0029210

But you're right that the defined(__sun__) should perhaps be restored.

Issue History

Date Modified Username Field Change
2025-01-31 22:00 wiz New Issue
2025-01-31 22:00 wiz File Added: patch-libs_aaf_aaf_LibCFB.h
2025-01-31 22:00 wiz File Added: patch-libs_aaf_utils.c
2025-01-31 22:00 wiz File Added: patch-libs_ardour_plugin__manager.cc
2025-01-31 22:00 wiz File Added: patch-libs_backends_jack_jack__utils.cc
2025-01-31 22:00 wiz File Added: patch-libs_pbd_cpus.cc
2025-01-31 22:00 wiz File Added: patch-libs_tk_ydk_config.h
2025-01-31 22:00 wiz File Added: patch-libs_tk_ytk_config.h
2025-01-31 22:00 wiz File Added: patch-libs_vst3_pluginterfaces_base_fplatform.h
2025-01-31 23:07 x42 Note Added: 0029205
2025-02-01 09:59 wiz Note Added: 0029206
2025-02-01 10:00 wiz Note Added: 0029207
2025-02-01 10:00 wiz File Added: patch-libs_tk_ydk_config-2.h
2025-02-01 10:00 wiz File Added: patch-libs_tk_ytk_config-2.h
2025-02-01 10:33 x42 Note Added: 0029208
2025-02-01 11:33 wiz Note Added: 0029209
2025-02-01 11:36 wiz Note Added: 0029210