Skip to content

Commit a2eef83

Browse files
committed
Add GNU/Hurd support
Signed-off-by: Samuel Thibault <[email protected]>
1 parent 43e1173 commit a2eef83

File tree

13 files changed

+207
-11
lines changed

13 files changed

+207
-11
lines changed

common/JackAudioAdapterFactory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3535
#define JackPlatformAdapter JackAlsaAdapter
3636
#endif
3737

38-
#if defined(__sun__) || defined(sun) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
38+
#if defined(__sun__) || defined(sun) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
3939
#include "JackOSSAdapter.h"
4040
#define JackPlatformAdapter JackOSSAdapter
4141
#endif

common/JackMetadata.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ JackMetadata::JackMetadata(bool isEngine)
5555
JackMetadata::~JackMetadata()
5656
{
5757
#if HAVE_DB
58-
char dbpath[PATH_MAX + 1];
58+
char dbpath[JACK_PATH_MAX + 1];
5959

6060
if (fDB) {
6161
fDB->close (fDB, 0);
@@ -93,16 +93,16 @@ int JackMetadata::PropertyInit()
9393
#if HAVE_DB
9494

9595
int ret;
96-
char dbpath[PATH_MAX + 1];
96+
char dbpath[JACK_PATH_MAX + 1];
9797

9898
#ifdef WIN32
99-
ret = GetTempPathA (PATH_MAX, fDBFilesDir);
100-
if ((ret > PATH_MAX) || (ret == 0)) {
99+
ret = GetTempPathA (JACK_PATH_MAX, fDBFilesDir);
100+
if ((ret > JACK_PATH_MAX) || (ret == 0)) {
101101
jack_error ("cannot get path for temp files");
102102
return -1;
103103
}
104104
#else
105-
strncpy (fDBFilesDir, jack_server_dir, PATH_MAX);
105+
strncpy (fDBFilesDir, jack_server_dir, JACK_PATH_MAX);
106106
#endif
107107

108108
/* idempotent */

common/JackMetadata.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
#include <jack/uuid.h>
4141

42+
#include "driver_interface.h"
43+
4244
#ifdef __cplusplus
4345
extern "C" {
4446
#endif
@@ -89,7 +91,7 @@ class JackMetadata
8991
DB* fDB;
9092
DB_ENV* fDBenv;
9193
const bool fIsEngine;
92-
char fDBFilesDir[PATH_MAX + 1];
94+
char fDBFilesDir[JACK_PATH_MAX + 1];
9395
#endif
9496

9597
int PropertyInit();

common/wscript

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ def create_jack_process_obj(bld, target, sources, uselib=None, framework=None):
3333
env_includes = ['../linux', '../posix', '../linux/alsa']
3434
if bld.env['IS_FREEBSD']:
3535
env_includes = ['../freebsd', '../posix', '../solaris/oss']
36+
if bld.env['IS_HURD']:
37+
env_includes = ['../gnu', '../posix', '../solaris/oss']
3638
if bld.env['IS_SUN']:
3739
env_includes = ['../solaris', '../posix', '../solaris/oss']
3840
if bld.env['IS_WINDOWS']:
@@ -41,7 +43,7 @@ def create_jack_process_obj(bld, target, sources, uselib=None, framework=None):
4143
process.name = target
4244
process.target = target
4345
process.source = sources
44-
if bld.env['IS_LINUX'] or bld.env['IS_MACOSX'] or bld.env['IS_FREEBSD']:
46+
if bld.env['IS_LINUX'] or bld.env['IS_MACOSX'] or bld.env['IS_FREEBSD'] or bld.env['IS_HURD']:
4547
process.env.append_value('CPPFLAGS', '-fvisibility=hidden')
4648
process.install_path = '${ADDON_DIR}/'
4749
process.use = [uselib.name]
@@ -112,6 +114,20 @@ def build(bld):
112114
]
113115
includes = ['../freebsd', '../posix'] + includes
114116

117+
if bld.env['IS_HURD']:
118+
common_libsources += [
119+
'JackDebugClient.cpp',
120+
'timestamps.c',
121+
'promiscuous.c',
122+
'../posix/JackPosixThread.cpp',
123+
'../posix/JackPosixProcessSync.cpp',
124+
'../posix/JackPosixMutex.cpp',
125+
'../posix/JackPosixSemaphore.cpp',
126+
'../posix/JackSocket.cpp',
127+
'../posix/JackPosixTime.c',
128+
]
129+
includes = ['../gnu', '../posix'] + includes
130+
115131
if bld.env['IS_SUN']:
116132
common_libsources += [
117133
'JackDebugClient.cpp',
@@ -202,6 +218,12 @@ def build(bld):
202218
'../posix/JackPosixServerLaunch.cpp',
203219
]
204220

221+
if bld.env['IS_HURD']:
222+
clientlib.source += [
223+
'../posix/JackSocketClientChannel.cpp',
224+
'../posix/JackPosixServerLaunch.cpp',
225+
]
226+
205227
if bld.env['IS_SUN']:
206228
clientlib.source += [
207229
'../posix/JackSocketClientChannel.cpp',
@@ -234,6 +256,9 @@ def build(bld):
234256
if bld.env['IS_FREEBSD']:
235257
clientlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
236258

259+
if bld.env['IS_HURD']:
260+
clientlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
261+
237262
if bld.env['IS_MACOSX']:
238263
clientlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
239264
clientlib.env.append_value('LINKFLAGS', '-single_module')
@@ -318,6 +343,14 @@ def build(bld):
318343
'../posix/JackNetUnixSocket.cpp',
319344
]
320345

346+
if bld.env['IS_HURD']:
347+
serverlib.source += [
348+
'../posix/JackSocketServerChannel.cpp',
349+
'../posix/JackSocketNotifyChannel.cpp',
350+
'../posix/JackSocketServerNotifyChannel.cpp',
351+
'../posix/JackNetUnixSocket.cpp',
352+
]
353+
321354
if bld.env['IS_SUN']:
322355
serverlib.source += [
323356
'../posix/JackSocketServerChannel.cpp',
@@ -411,6 +444,15 @@ def build(bld):
411444
]
412445
netlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
413446

447+
if bld.env['IS_HURD']:
448+
netlib.source += [
449+
'../posix/JackNetUnixSocket.cpp',
450+
'../posix/JackPosixThread.cpp',
451+
'../posix/JackPosixMutex.cpp',
452+
'../linux/JackLinuxTime.c',
453+
]
454+
netlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
455+
414456
if bld.env['IS_SUN']:
415457
netlib.source += [
416458
'../posix/JackNetUnixSocket.cpp',
@@ -489,7 +531,7 @@ def build(bld):
489531
process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
490532
process.use += ['ALSA', 'SAMPLERATE']
491533

492-
if bld.env['BUILD_ADAPTER'] and (bld.env['IS_SUN'] or bld.env['IS_FREEBSD']):
534+
if bld.env['BUILD_ADAPTER'] and (bld.env['IS_SUN'] or bld.env['IS_FREEBSD'] or bld.env['IS_HURD']):
493535
audio_adapter_sources += ['../solaris/oss/JackOSSAdapter.cpp', 'memops.c']
494536
process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
495537
process.use += 'SAMPLERATE'

dbus/wscript

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def build(bld):
5353
sysdeps_dbus_include = ['../linux', '../posix']
5454
if bld.env['IS_FREEBSD']:
5555
sysdeps_dbus_include = ['../freebsd', '../posix']
56+
if bld.env['IS_HURD']:
57+
sysdeps_dbus_include = ['../gnu', '../posix']
5658
if bld.env['IS_MACOSX']:
5759
sysdeps_dbus_include = ['../macosx', '../posix']
5860

@@ -85,6 +87,11 @@ def build(bld):
8587
'../linux/uptime.c',
8688
]
8789
obj.use += ['PTHREAD', 'EXECINFO', 'LIBSYSINFO', 'DBUS-1', 'EXPAT']
90+
if bld.env['IS_HURD']:
91+
obj.source += [
92+
'../linux/uptime.c',
93+
]
94+
obj.use += ['PTHREAD', 'DL', 'RT', 'DBUS-1', 'EXPAT', 'STDC++']
8895
if bld.env['IS_MACOSX']:
8996
obj.source += [
9097
'../macosx/uptime.c',

gnu/JackAtomic_os.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
Copyright (C) 2004-2008 Grame
3+
4+
This program is free software; you can redistribute it and/or modify
5+
it under the terms of the GNU Lesser General Public License as published by
6+
the Free Software Foundation; either version 2.1 of the License, or
7+
(at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public License
15+
along with this program; if not, write to the Free Software
16+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17+
18+
*/
19+
20+
#ifndef __JackAtomic_gnu__
21+
#define __JackAtomic_gnu__
22+
23+
#include "JackTypes.h"
24+
25+
static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* addr)
26+
{
27+
return __sync_bool_compare_and_swap ((UInt32*)addr, value, newvalue);
28+
}
29+
30+
#endif
31+

gnu/JackPlatformPlug_os.h

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
Copyright (C) 2004-2008 Grame
3+
Copyright (C) 2018 Greg V
4+
5+
This program is free software; you can redistribute it and/or modify
6+
it under the terms of the GNU Lesser General Public License as published by
7+
the Free Software Foundation; either version 2.1 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public License
16+
along with this program; if not, write to the Free Software
17+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18+
19+
*/
20+
21+
#ifndef __JackPlatformPlug_gnu__
22+
#define __JackPlatformPlug_gnu__
23+
24+
#define jack_server_dir "/tmp"
25+
#define jack_client_dir "/tmp"
26+
#define JACK_DEFAULT_DRIVER "oss"
27+
28+
namespace Jack
29+
{
30+
struct JackRequest;
31+
struct JackResult;
32+
33+
class JackPosixMutex;
34+
class JackPosixThread;
35+
class JackPosixSemaphore;
36+
37+
class JackSocketServerChannel;
38+
class JackSocketClientChannel;
39+
class JackSocketServerNotifyChannel;
40+
class JackSocketNotifyChannel;
41+
class JackClientSocket;
42+
class JackNetUnixSocket;
43+
}
44+
45+
/* __JackPlatformMutex__ */
46+
#include "JackPosixMutex.h"
47+
namespace Jack {typedef JackPosixMutex JackMutex; }
48+
49+
/* __JackPlatformThread__ */
50+
#include "JackPosixThread.h"
51+
namespace Jack { typedef JackPosixThread JackThread; }
52+
53+
/* __JackPlatformSynchro__ client activation */
54+
#include "JackPosixSemaphore.h"
55+
namespace Jack { typedef JackPosixSemaphore JackSynchro; }
56+
57+
/* __JackPlatformChannelTransaction__ */
58+
#include "JackSocket.h"
59+
namespace Jack { typedef JackClientSocket JackChannelTransaction; }
60+
61+
/* __JackPlatformProcessSync__ */
62+
#include "JackPosixProcessSync.h"
63+
namespace Jack { typedef JackPosixProcessSync JackProcessSync; }
64+
65+
/* __JackPlatformServerChannel__ */
66+
#include "JackSocketServerChannel.h"
67+
namespace Jack { typedef JackSocketServerChannel JackServerChannel; }
68+
69+
/* __JackPlatformClientChannel__ */
70+
#include "JackSocketClientChannel.h"
71+
namespace Jack { typedef JackSocketClientChannel JackClientChannel; }
72+
73+
/* __JackPlatformServerNotifyChannel__ */
74+
#include "JackSocketServerNotifyChannel.h"
75+
namespace Jack { typedef JackSocketServerNotifyChannel JackServerNotifyChannel; }
76+
77+
/* __JackPlatformNotifyChannel__ */
78+
#include "JackSocketNotifyChannel.h"
79+
namespace Jack { typedef JackSocketNotifyChannel JackNotifyChannel; }
80+
81+
/* __JackPlatformNetSocket__ */
82+
#include "JackNetUnixSocket.h"
83+
namespace Jack { typedef JackNetUnixSocket JackNetSocket; }
84+
85+
#endif

gnu/driver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "../linux/driver.h"

gnu/uptime.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "../linux/uptime.h"

solaris/oss/JackOSSAdapter.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ JackOSSAdapter::JackOSSAdapter(jack_nframes_t buffer_size, jack_nframes_t sample
197197
void JackOSSAdapter::DisplayDeviceInfo()
198198
{
199199
audio_buf_info info;
200+
#ifdef SNDCTL_AUDIOINFO
200201
oss_audioinfo ai_in, ai_out;
202+
#endif
201203
memset(&info, 0, sizeof(audio_buf_info));
202204
int cap = 0;
203205

@@ -208,6 +210,7 @@ void JackOSSAdapter::DisplayDeviceInfo()
208210

209211
if (fRWMode & kWrite) {
210212

213+
#ifdef OSS_SYSINFO
211214
oss_sysinfo si;
212215
if (ioctl(fOutFD, OSS_SYSINFO, &si) == -1) {
213216
jack_error("JackOSSAdapter::DisplayDeviceInfo OSS_SYSINFO failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
@@ -219,6 +222,7 @@ void JackOSSAdapter::DisplayDeviceInfo()
219222
jack_info("OSS numaudioengines %d", si.numaudioengines);
220223
jack_info("OSS numcards %d", si.numcards);
221224
}
225+
#endif
222226

223227
jack_info("Output capabilities - %d channels : ", fPlaybackChannels);
224228
jack_info("Output block size = %d", fOutputBufferSize);
@@ -246,6 +250,7 @@ void JackOSSAdapter::DisplayDeviceInfo()
246250

247251
if (fRWMode & kRead) {
248252

253+
#ifdef OSS_SYSINFO
249254
oss_sysinfo si;
250255
if (ioctl(fInFD, OSS_SYSINFO, &si) == -1) {
251256
jack_error("JackOSSAdapter::DisplayDeviceInfo OSS_SYSINFO failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
@@ -257,6 +262,7 @@ void JackOSSAdapter::DisplayDeviceInfo()
257262
jack_info("OSS numaudioengines %d", si.numaudioengines);
258263
jack_info("OSS numcards %d", si.numcards);
259264
}
265+
#endif
260266

261267
jack_info("Input capabilities - %d channels : ", fCaptureChannels);
262268
jack_info("Input block size = %d", fInputBufferSize);
@@ -282,6 +288,7 @@ void JackOSSAdapter::DisplayDeviceInfo()
282288
}
283289
}
284290

291+
#ifdef SNDCTL_AUDIOINFO
285292
if (ioctl(fInFD, SNDCTL_AUDIOINFO, &ai_in) != -1) {
286293
jack_info("Using audio engine %d = %s for input", ai_in.dev, ai_in.name);
287294
}
@@ -293,6 +300,7 @@ void JackOSSAdapter::DisplayDeviceInfo()
293300
if (ai_in.rate_source != ai_out.rate_source) {
294301
jack_info("Warning : input and output are not necessarily driven by the same clock!");
295302
}
303+
#endif
296304
}
297305

298306
int JackOSSAdapter::OpenInput()

0 commit comments

Comments
 (0)