Skip to content

Commit

Permalink
audio/sdl2_sound: add port: Abstract SDL soundfile decoder
Browse files Browse the repository at this point in the history
- Add the latest version of sdl_sound with support for
  USE_SDL=sound2.
- Note that this is sdl2-only library, so audio/sdl_sound,
  which is sdl1-only library, remains in the tree and is
  not affected. I've had to rename playsound binary this
  port also installs to avoid the conflict.
- The library now contains all the decoder code, so no external
  depends and options are needed any longer. I've added MIDI
  option though, since upstream has it disabled by default due
  to different license.
  • Loading branch information
AMDmi3 committed Mar 31, 2022
1 parent 332714f commit 7059a13
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Mk/Uses/sdl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Feature: sdl
# Usage: USES=sdl
# USE_SDL=sdl console gfx image mixer mm net pango sound ttf
# sdl2 gfx2 image2 mixer2 net2 ttf2
# sdl2 gfx2 image2 mixer2 net2 sound2 ttf2
#
# USE_SDL specifies which SDL components to add as dependencies.
# Not specifying USE_SDL with USES=sdl is an error.
Expand Down Expand Up @@ -47,7 +47,7 @@ _SDL_ttf_LIB_DEPENDS= libSDL_ttf.so:graphics/sdl_ttf
_SDL_ttf_REQUIRES= sdl

# These are the current supported SDL2 modules
_SDL_USE_ALL+= sdl2 gfx2 image2 mixer2 net2 ttf2
_SDL_USE_ALL+= sdl2 gfx2 image2 mixer2 net2 sound2 ttf2

_SDL_sdl2_LIB_DEPENDS= libSDL2.so:devel/sdl20

Expand All @@ -63,6 +63,9 @@ _SDL_mixer2_REQUIRES= sdl2
_SDL_net2_LIB_DEPENDS= libSDL2_net.so:net/sdl2_net
_SDL_net2_REQUIRES= sdl2

_SDL_sound2_LIB_DEPENDS= libSDL2_sound.so:audio/sdl2_sound
_SDL_sound2_REQUIRES= sdl2

_SDL_ttf2_LIB_DEPENDS= libSDL2_ttf.so:graphics/sdl2_ttf
_SDL_ttf2_REQUIRES= sdl2

Expand Down
1 change: 1 addition & 0 deletions audio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@
SUBDIR += schismtracker
SUBDIR += screcord-lv2
SUBDIR += sdl2_mixer
SUBDIR += sdl2_sound
SUBDIR += sdl_mixer
SUBDIR += sdl_sound
SUBDIR += sfizz
Expand Down
43 changes: 43 additions & 0 deletions audio/sdl2_sound/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
PORTNAME= sdl2_sound
DISTVERSIONPREFIX= v
DISTVERSION= 2.0.1
CATEGORIES= audio

MAINTAINER= amdmi3@FreeBSD.org
COMMENT= Abstract SDL soundfile decoder

LICENSE= ZLIB
LICENSE_FILE_ZLIB=${WRKSRC}/LICENSE.txt

USES= cmake sdl
USE_SDL= sdl2
USE_GITHUB= yes
GH_ACCOUNT= icculus
GH_PROJECT= SDL_sound
USE_LDCONFIG= yes

PORTDOCS= *
PORTEXAMPLES= *

OPTIONS_DEFINE= MIDI DOCS EXAMPLES
OPTIONS_DEFAULT=MIDI

MIDI_DESC= MIDI support
MIDI_CMAKE_BOOL=SDLSOUND_DECODER_MIDI
MIDI_VARS= LICENSE+=ART10 \
LICENSE_COMB=multi \
LICENSE_FILE_ART10=${WRKSRC}/src/timidity/COPYING

post-install:
@cd ${STAGEDIR}${PREFIX}/bin && ${MV} playsound playsound2

post-install-DOCS-on:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
cd ${WRKSRC}/docs && ${INSTALL_DATA} CHANGELOG.txt \
CREDITS.txt README.txt ${STAGEDIR}${DOCSDIR}

post-install-EXAMPLES-on:
@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
${INSTALL_DATA} ${WRKSRC}/examples/*.c ${STAGEDIR}${EXAMPLESDIR}

.include <bsd.port.mk>
3 changes: 3 additions & 0 deletions audio/sdl2_sound/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TIMESTAMP = 1648728983
SHA256 (icculus-SDL_sound-v2.0.1_GH0.tar.gz) = 3527f05b7a3f00d8523cf25671598c85568b4e8b615ce7570113b44cbb7d555c
SIZE (icculus-SDL_sound-v2.0.1_GH0.tar.gz) = 443682
14 changes: 14 additions & 0 deletions audio/sdl2_sound/pkg-descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SDL_sound is a library that handles the decoding of several popular
sound file formats, such as .WAV and .MP3. It is meant to make the
programmer's sound playback tasks simpler. The programmer gives
SDL_sound a filename, or feeds it data directly from one of many
sources, and then reads the decoded waveform data back at her
leisure. If resource constraints are a concern, SDL_sound can process
sound data in programmer-specified blocks. Alternately, SDL_sound
can decode a whole sound file and hand back a single pointer to the
whole waveform. SDL_sound can also handle sample rate, audio format,
and channel conversion on-the-fly and behind-the-scenes, if the
programmer desires.

WWW: https://icculus.org/SDL_sound/
WWW: https://github.com/icculus/SDL_sound
6 changes: 6 additions & 0 deletions audio/sdl2_sound/pkg-plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bin/playsound2
include/SDL2/SDL_sound.h
lib/libSDL2_sound.a
lib/libSDL2_sound.so
lib/libSDL2_sound.so.2
lib/libSDL2_sound.so.2.0.1

0 comments on commit 7059a13

Please sign in to comment.