• R/O
  • HTTP
  • SSH
  • HTTPS

cinnamon: Commit

Cinnamon audio library


Commit MetaInfo

Révision46f663529320ad7c23ba0c7e0238596ab296624e (tree)
l'heure2020-05-03 05:54:58
AuteurAlaskanEmily <emily@alas...>
CommiterAlaskanEmily

Message de Log

Fix compiling on OpenBSD for OSS rather than OpenAL

Change Summary

Modification

--- a/src/GNUmakefile
+++ b/src/GNUmakefile
@@ -7,10 +7,15 @@ include gcc.mk
77
88 BACKEND?=openal
99
10+CURDIR=$(shell pwd)
1011 ifeq "$(BACKEND)" "dsound"
1112 LINK?=$(CXX)
1213 else ifeq "$(BACKEND)" "oss"
14+
1315 EXTRALIBS=-lpthread
16+# Get OSS emulation on BSD's
17+EXTRALIBS+=$(if $(findstring $(shell uname),"BSD"),-lossaudio,)
18+
1419 LINK?="$(CC)"
1520 else ifeq "$(BACKEND)" "openal"
1621 EXTRALIBS=-lopenal
--- a/src/gcc.mk
+++ b/src/gcc.mk
@@ -8,8 +8,8 @@ CIN_DEBUGFLAGS?= -g
88 CC?=gcc
99 CXX?=g++
1010 CCFLAGS?=-Wall -Wextra -pedantic -Wshadow -Wenum-compare -Wno-switch $(CIN_DEBUGFLAGS) $(CIN_FPICFLAGS)
11-CFLAGS?=$(CCFLAGS) -ansi
12-CXXFLAGS?=$(CCFLAGS) -std=c++98 -fno-rtti -fno-exceptions
11+CFLAGS=$(CCFLAGS) -ansi
12+CXXFLAGS=$(CCFLAGS) -std=c++98 -fno-rtti -fno-exceptions
1313 AR?=ar
1414 RANLIB?=ranlib
1515 LINKFLAGS?=$(CIN_DEBUGFLAGS) $(CIN_FPICFLAGS)
--- a/src/makefile
+++ b/src/makefile
@@ -7,10 +7,15 @@
77
88 BACKEND?=oss
99
10+CURDIR=${PWD}
1011 .if "${BACKEND}" == "dsound"
1112 LINK?=$(CXX)
1213 .else
1314 LINK=$(CC)
1415 .endif
1516
17+.if ${BACKEND} == oss
18+EXTRALIBS=-lossaudio -lpthread
19+.endif
20+
1621 .include "unix.mk"
--- a/src/oss/cin_oss.c
+++ b/src/oss/cin_oss.c
@@ -14,10 +14,6 @@
1414 #define _DEFAULT_SOURCE
1515 #define _BSD_SOURCE
1616
17-#if defined __GNUC__
18-#include <alloca.h>
19-#endif
20-
2117 #include <assert.h>
2218 #include <stdlib.h>
2319 #include <stdio.h>
--- a/src/oss/cin_oss_driver.c
+++ b/src/oss/cin_oss_driver.c
@@ -323,7 +323,8 @@ enum Cin_DriverError Cin_CreateDriver(struct Cin_Driver *drv){
323323 drv->id_counter = 0;
324324
325325 {
326- int dev = -1, val = 0;
326+ int dev = -1, val;
327+ char buffer[] = "/dev/audio\0";
327328 const char *const devname = getenv("AUDIODEV");
328329 if(devname != NULL)
329330 dev = open(devname, O_WRONLY);
@@ -331,6 +332,12 @@ enum Cin_DriverError Cin_CreateDriver(struct Cin_Driver *drv){
331332 if(dev == -1 && devname == NULL)
332333 dev = open("/dev/dsp", O_WRONLY);
333334
335+ /* Some BSD systems have /dev/audio* instead. */
336+ for(val = 0; dev == -1 && val <= 10; val++){
337+ dev = open(buffer, O_WRONLY);
338+ buffer[sizeof(buffer)-2] = '0' + val;
339+ }
340+
334341 if(dev == -1){
335342 ret = Cin_eDriverNoDevice;
336343 goto fail_mutex;
--- a/src/oss/makefile
+++ b/src/oss/makefile
@@ -16,7 +16,7 @@ libcin_oss_x.a: $(OBJECTS)
1616
1717 libcin_oss.a: $(CIN_COMMONLIB) $(CIN_MIXERLIB) libcin_oss_x.a
1818 if [ -f libcin_oss2.a ] ; then rm libcin_oss2.a ; fi
19- echo 'create libcin_oss2.a\naddlib libcin_oss_x.a\naddlib $(CIN_COMMONLIB)\naddlib $(CIN_MIXERLIB)\nsave\nend\n' | $(AR) M
19+ echo 'create libcin_oss2.a\naddlib libcin_oss_x.a\naddlib $(CIN_COMMONLIB)\naddlib $(CIN_MIXERLIB)\nsave\nend\n' | $(AR) -M
2020 $(RANLIB) libcin_oss2.a
2121 mv libcin_oss2.a libcin_oss.a
2222
Afficher sur ancien navigateur de dépôt.