Skip to content

Commit 2e7e3c4

Browse files
authored
bpo-46053: Fix OSS audio support on NetBSD (GH-30065)
1 parent 804ea2d commit 2e7e3c4

File tree

5 files changed

+97
-2
lines changed

5 files changed

+97
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Do not use POSIX semaphores on NetBSD
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix OSS audio support on NetBSD.

Modules/ossaudiodev.c

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,16 +1226,36 @@ PyInit_ossaudiodev(void)
12261226

12271227
/* Expose all the ioctl numbers for masochists who like to do this
12281228
stuff directly. */
1229+
#ifdef SNDCTL_COPR_HALT
12291230
_EXPORT_INT(m, SNDCTL_COPR_HALT);
1231+
#endif
1232+
#ifdef SNDCTL_COPR_LOAD
12301233
_EXPORT_INT(m, SNDCTL_COPR_LOAD);
1234+
#endif
1235+
#ifdef SNDCTL_COPR_RCODE
12311236
_EXPORT_INT(m, SNDCTL_COPR_RCODE);
1237+
#endif
1238+
#ifdef SNDCTL_COPR_RCVMSG
12321239
_EXPORT_INT(m, SNDCTL_COPR_RCVMSG);
1240+
#endif
1241+
#ifdef SNDCTL_COPR_RDATA
12331242
_EXPORT_INT(m, SNDCTL_COPR_RDATA);
1243+
#endif
1244+
#ifdef SNDCTL_COPR_RESET
12341245
_EXPORT_INT(m, SNDCTL_COPR_RESET);
1246+
#endif
1247+
#ifdef SNDCTL_COPR_RUN
12351248
_EXPORT_INT(m, SNDCTL_COPR_RUN);
1249+
#endif
1250+
#ifdef SNDCTL_COPR_SENDMSG
12361251
_EXPORT_INT(m, SNDCTL_COPR_SENDMSG);
1252+
#endif
1253+
#ifdef SNDCTL_COPR_WCODE
12371254
_EXPORT_INT(m, SNDCTL_COPR_WCODE);
1255+
#endif
1256+
#ifdef SNDCTL_COPR_WDATA
12381257
_EXPORT_INT(m, SNDCTL_COPR_WDATA);
1258+
#endif
12391259
#ifdef SNDCTL_DSP_BIND_CHANNEL
12401260
_EXPORT_INT(m, SNDCTL_DSP_BIND_CHANNEL);
12411261
#endif
@@ -1278,46 +1298,104 @@ PyInit_ossaudiodev(void)
12781298
_EXPORT_INT(m, SNDCTL_DSP_STEREO);
12791299
_EXPORT_INT(m, SNDCTL_DSP_SUBDIVIDE);
12801300
_EXPORT_INT(m, SNDCTL_DSP_SYNC);
1301+
#ifdef SNDCTL_FM_4OP_ENABLE
12811302
_EXPORT_INT(m, SNDCTL_FM_4OP_ENABLE);
1303+
#endif
1304+
#ifdef SNDCTL_FM_LOAD_INSTR
12821305
_EXPORT_INT(m, SNDCTL_FM_LOAD_INSTR);
1306+
#endif
1307+
#ifdef SNDCTL_MIDI_INFO
12831308
_EXPORT_INT(m, SNDCTL_MIDI_INFO);
1309+
#endif
1310+
#ifdef SNDCTL_MIDI_MPUCMD
12841311
_EXPORT_INT(m, SNDCTL_MIDI_MPUCMD);
1312+
#endif
1313+
#ifdef SNDCTL_MIDI_MPUMODE
12851314
_EXPORT_INT(m, SNDCTL_MIDI_MPUMODE);
1315+
#endif
1316+
#ifdef SNDCTL_MIDI_PRETIME
12861317
_EXPORT_INT(m, SNDCTL_MIDI_PRETIME);
1318+
#endif
1319+
#ifdef SNDCTL_SEQ_CTRLRATE
12871320
_EXPORT_INT(m, SNDCTL_SEQ_CTRLRATE);
1321+
#endif
1322+
#ifdef SNDCTL_SEQ_GETINCOUNT
12881323
_EXPORT_INT(m, SNDCTL_SEQ_GETINCOUNT);
1324+
#endif
1325+
#ifdef SNDCTL_SEQ_GETOUTCOUNT
12891326
_EXPORT_INT(m, SNDCTL_SEQ_GETOUTCOUNT);
1327+
#endif
12901328
#ifdef SNDCTL_SEQ_GETTIME
12911329
_EXPORT_INT(m, SNDCTL_SEQ_GETTIME);
12921330
#endif
1331+
#ifdef SNDCTL_SEQ_NRMIDIS
12931332
_EXPORT_INT(m, SNDCTL_SEQ_NRMIDIS);
1333+
#endif
1334+
#ifdef SNDCTL_SEQ_NRSYNTHS
12941335
_EXPORT_INT(m, SNDCTL_SEQ_NRSYNTHS);
1336+
#endif
1337+
#ifdef SNDCTL_SEQ_OUTOFBAND
12951338
_EXPORT_INT(m, SNDCTL_SEQ_OUTOFBAND);
1339+
#endif
1340+
#ifdef SNDCTL_SEQ_PANIC
12961341
_EXPORT_INT(m, SNDCTL_SEQ_PANIC);
1342+
#endif
1343+
#ifdef SNDCTL_SEQ_PERCMODE
12971344
_EXPORT_INT(m, SNDCTL_SEQ_PERCMODE);
1345+
#endif
1346+
#ifdef SNDCTL_SEQ_RESET
12981347
_EXPORT_INT(m, SNDCTL_SEQ_RESET);
1348+
#endif
1349+
#ifdef SNDCTL_SEQ_RESETSAMPLES
12991350
_EXPORT_INT(m, SNDCTL_SEQ_RESETSAMPLES);
1351+
#endif
1352+
#ifdef SNDCTL_SEQ_SYNC
13001353
_EXPORT_INT(m, SNDCTL_SEQ_SYNC);
1354+
#endif
1355+
#ifdef SNDCTL_SEQ_TESTMIDI
13011356
_EXPORT_INT(m, SNDCTL_SEQ_TESTMIDI);
1357+
#endif
1358+
#ifdef SNDCTL_SEQ_THRESHOLD
13021359
_EXPORT_INT(m, SNDCTL_SEQ_THRESHOLD);
1360+
#endif
13031361
#ifdef SNDCTL_SYNTH_CONTROL
13041362
_EXPORT_INT(m, SNDCTL_SYNTH_CONTROL);
13051363
#endif
13061364
#ifdef SNDCTL_SYNTH_ID
13071365
_EXPORT_INT(m, SNDCTL_SYNTH_ID);
13081366
#endif
1367+
#ifdef SNDCTL_SYNTH_INFO
13091368
_EXPORT_INT(m, SNDCTL_SYNTH_INFO);
1369+
#endif
1370+
#ifdef SNDCTL_SYNTH_MEMAVL
13101371
_EXPORT_INT(m, SNDCTL_SYNTH_MEMAVL);
1372+
#endif
13111373
#ifdef SNDCTL_SYNTH_REMOVESAMPLE
13121374
_EXPORT_INT(m, SNDCTL_SYNTH_REMOVESAMPLE);
13131375
#endif
1376+
#ifdef SNDCTL_TMR_CONTINUE
13141377
_EXPORT_INT(m, SNDCTL_TMR_CONTINUE);
1378+
#endif
1379+
#ifdef SNDCTL_TMR_METRONOME
13151380
_EXPORT_INT(m, SNDCTL_TMR_METRONOME);
1381+
#endif
1382+
#ifdef SNDCTL_TMR_SELECT
13161383
_EXPORT_INT(m, SNDCTL_TMR_SELECT);
1384+
#endif
1385+
#ifdef SNDCTL_TMR_SOURCE
13171386
_EXPORT_INT(m, SNDCTL_TMR_SOURCE);
1387+
#endif
1388+
#ifdef SNDCTL_TMR_START
13181389
_EXPORT_INT(m, SNDCTL_TMR_START);
1390+
#endif
1391+
#ifdef SNDCTL_TMR_STOP
13191392
_EXPORT_INT(m, SNDCTL_TMR_STOP);
1393+
#endif
1394+
#ifdef SNDCTL_TMR_TEMPO
13201395
_EXPORT_INT(m, SNDCTL_TMR_TEMPO);
1396+
#endif
1397+
#ifdef SNDCTL_TMR_TIMEBASE
13211398
_EXPORT_INT(m, SNDCTL_TMR_TIMEBASE);
1399+
#endif
13221400
return m;
13231401
}

configure

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3553,6 +3553,12 @@ AS_VAR_IF([have_nis], [yes], [
35533553
])
35543554
])
35553555

3556+
dnl On NetBSD, when using OSS audio, you need to link against libossaudio
3557+
AS_CASE([$ac_sys_system],
3558+
[NetBSD*], [OSSAUDIODEV_LIBS="-lossaudio"],
3559+
[OSSAUDIODEV_LIBS=""]
3560+
)
3561+
35563562
dnl Check for SQLite library. Use pkg-config if available.
35573563
PKG_CHECK_MODULES(
35583564
[LIBSQLITE3], [sqlite3 >= 3.7.15], [], [
@@ -6786,7 +6792,8 @@ PY_STDLIB_MOD([_socket],
67866792
dnl platform specific extensions
67876793
PY_STDLIB_MOD([grp], [], [test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes])
67886794
PY_STDLIB_MOD([ossaudiodev],
6789-
[], [test "$ac_cv_header_linux_soundcard_h" = yes -o "$ac_cv_header_sys_soundcard_h" = yes])
6795+
[], [test "$ac_cv_header_linux_soundcard_h" = yes -o "$ac_cv_header_sys_soundcard_h" = yes],
6796+
[], [$OSSAUDIODEV_LIBS])
67906797
PY_STDLIB_MOD([pwd], [], [test "$ac_cv_func_getpwuid" = yes -o "$ac_cv_func_getpwuid_r" = yes])
67916798
PY_STDLIB_MOD([resource], [], [test "$ac_cv_header_sys_resource_h" = yes])
67926799
PY_STDLIB_MOD([_scproxy],

0 commit comments

Comments
 (0)