@@ -1,156 +0,0 @@
{ lib
, alsa-lib
, audiofile
, config
, darwin
, fetchpatch
, fetchurl
, libGL
, libGLU
, libICE
, libXext
, libXrandr
, libcap
, libiconv
, libpulseaudio
, pkg-config
, stdenv
# Boolean flags
, alsaSupport ? stdenv . hostPlatform . isLinux && ! stdenv . hostPlatform . isAndroid
, libGLSupported ? lib . meta . availableOn stdenv . hostPlatform libGL
, openglSupport ? libGLSupported
, pulseaudioSupport ? config . pulseaudio or stdenv . hostPlatform . isLinux && ! stdenv . hostPlatform . isAndroid && lib . meta . availableOn stdenv . hostPlatform libpulseaudio
, x11Support ? ! stdenv . hostPlatform . isCygwin && ! stdenv . hostPlatform . isAndroid
}:
# NOTE: When editing this expression see if the same change applies to
# SDL2 expression too
let
inherit ( darwin . apple_sdk . frameworks ) OpenGL CoreAudio CoreServices AudioUnit Kernel Cocoa GLUT ;
extraPropagatedBuildInputs = [ ]
++ lib . optionals x11Support [ libXext libICE libXrandr ]
++ lib . optionals ( openglSupport && stdenv . hostPlatform . isLinux ) [ libGL ]
# libGLU doesn’ t work with Android's SDL
++ lib . optionals ( openglSupport && stdenv . hostPlatform . isLinux && ( ! stdenv . hostPlatform . isAndroid ) ) [ libGLU ]
++ lib . optionals ( openglSupport && stdenv . hostPlatform . isDarwin ) [ OpenGL GLUT ]
++ lib . optional alsaSupport alsa-lib
++ lib . optional pulseaudioSupport libpulseaudio
++ lib . optional stdenv . hostPlatform . isDarwin Cocoa ;
in
stdenv . mkDerivation ( finalAttrs : {
pname = " S D L " ;
version = " 1 . 2 . 1 5 " ;
src = fetchurl {
url = " h t t p s : / / w w w . l i b s d l . o r g / r e l e a s e / S D L - ${ finalAttrs . version } . t a r . g z " ;
hash = " s h a 2 5 6 - 1 t M W p 5 P l 4 0 g V X w 3 Z O 5 e X m J M / u Y q h 7 e v M E I g p 1 k d K r Q A = " ;
} ;
outputs = [ " o u t " " d e v " ] ;
outputBin = " d e v " ; # sdl-config
nativeBuildInputs = [ pkg-config ]
++ lib . optional stdenv . hostPlatform . isLinux libcap ;
propagatedBuildInputs = [ libiconv ] ++ extraPropagatedBuildInputs ;
buildInputs =
[ ]
++ lib . optionals ( ! stdenv . hostPlatform . isMinGW && alsaSupport ) [ audiofile ]
++ lib . optionals stdenv . hostPlatform . isDarwin [ AudioUnit CoreAudio CoreServices Kernel OpenGL ] ;
configureFlags = [
" - - d i s a b l e - o s s "
" - - d i s a b l e - v i d e o - x 1 1 - x m e "
" - - e n a b l e - r p a t h "
# Building without this fails on Darwin with
#
# ./src/video/x11/SDL_x11sym.h:168:17: error: conflicting types for '_XData32'
# SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
#
# Please try revert the change that introduced this comment when updating SDL.
] ++ lib . optional stdenv . hostPlatform . isDarwin " - - d i s a b l e - x 1 1 - s h a r e d "
++ lib . optional ( ! x11Support ) " - - w i t h o u t - x "
++ lib . optional alsaSupport " - - w i t h - a l s a - p r e f i x = ${ alsa-lib . out } / l i b "
++ lib . optional stdenv . hostPlatform . isMusl " C F L A G S = - D I C O N V _ I N B U F _ N O N C O N S T " ;
patches = [
./find-headers.patch
# Fix window resizing issues, e.g. for xmonad
# Ticket: http://bugzilla.libsdl.org/show_bug.cgi?id=1430
( fetchpatch {
name = " f i x _ w i n d o w _ r e s i z i n g . d i f f " ;
url = " h t t p s : / / b u g s . d e b i a n . o r g / c g i - b i n / b u g r e p o r t . c g i ? m s g = 1 0 ; f i l e n a m e = f i x _ w i n d o w _ r e s i z i n g . d i f f ; a t t = 2 ; b u g = 6 6 5 7 7 9 " ;
hash = " s h a 2 5 6 - h j 3 y k y O K e D h 6 u P D l v w N H S o w Q x m R + m f h v C n H v c d h X Z f w = " ;
} )
# Fix drops of keyboard events for SDL_EnableUNICODE
( fetchpatch {
url = " h t t p s : / / g i t h u b . c o m / l i b s d l - o r g / S D L - 1 . 2 / c o m m i t / 0 3 3 2 e 2 b b 1 8 d c 6 8 d 6 8 9 2 c 3 b 6 5 3 b 2 5 4 7 a f e 3 2 3 8 5 4 b . p a t c h " ;
hash = " s h a 2 5 6 - 5 V 6 K 0 o T N 5 6 R R i 4 8 X L P Q s j g L z t 0 a 6 G s j a j D r d a 3 Z E h T w = " ;
} )
# Ignore insane joystick axis events
( fetchpatch {
url = " h t t p s : / / g i t h u b . c o m / l i b s d l - o r g / S D L - 1 . 2 / c o m m i t / a b 9 9 c c 8 2 b 0 a 8 9 8 a d 5 2 8 d 4 6 f a 1 2 8 b 6 4 9 a 2 2 0 a 9 4 f 4 . p a t c h " ;
hash = " s h a 2 5 6 - 8 C v K H v k m i d m 4 t F C W Y h x E 0 5 9 h N 3 g w O K z 6 n K s 5 r v Q 4 Z K w = " ;
} )
# https://bugzilla.libsdl.org/show_bug.cgi?id=1769
( fetchpatch {
url = " h t t p s : / / g i t h u b . c o m / l i b s d l - o r g / S D L - 1 . 2 / c o m m i t / 5 d 7 9 9 7 7 e c 7 a 6 b 5 8 a f a 6 e 4 8 1 7 0 3 5 a a a b a 1 8 6 f 7 e 9 f . p a t c h " ;
hash = " s h a 2 5 6 - t + 6 0 b C 4 g L F b s l X m 1 n 9 n i m i F r h o 2 D n x d W d K r 4 H 9 Y p / s w = " ;
} )
# Workaround X11 bug to allow changing gamma
# Ticket: https://bugs.freedesktop.org/show_bug.cgi?id=27222
( fetchpatch {
name = " S D L _ S e t G a m m a . p a t c h " ;
url = " h t t p s : / / s r c . f e d o r a p r o j e c t . o r g / r p m s / S D L / r a w / 7 a 0 7 3 2 3 e 5 c e c 0 8 b e a 6 f 3 9 0 5 2 6 f 8 6 a 1 c e 5 3 4 1 5 9 6 d / f / S D L - 1 . 2 . 1 5 - x 1 1 - B y p a s s - S e t G a m m a R a m p - w h e n - c h a n g i n g - g a m m a . p a t c h " ;
hash = " s h a 2 5 6 - m 7 Z Q 5 G n f G l M k K J k r B S B 3 G r L z 8 M T 6 n j g I 9 j R O J A b R o n Q = " ;
} )
# Fix a build failure on OS X Mavericks
# Ticket: https://bugzilla.libsdl.org/show_bug.cgi?id=2085
( fetchpatch {
url = " h t t p s : / / g i t h u b . c o m / l i b s d l - o r g / S D L - 1 . 2 / c o m m i t / 1 9 0 3 9 3 2 4 b e 7 1 7 3 8 d 8 9 9 0 e 9 1 b 9 b a 3 4 1 b 2 e a 0 6 8 4 4 5 . p a t c h " ;
hash = " s h a 2 5 6 - D C W Z o 0 L z H J o W U r / 5 v L 5 p K I E m m z 3 p v r 4 T O 6 I p 8 W y k f D I = " ;
} )
( fetchpatch {
url = " h t t p s : / / g i t h u b . c o m / l i b s d l - o r g / S D L - 1 . 2 / c o m m i t / 7 9 3 3 0 3 2 a d 4 d 5 7 c 2 4 f 2 2 3 0 d b 2 9 f 6 7 e b 7 d 2 1 b b 5 6 5 4 . p a t c h " ;
hash = " s h a 2 5 6 - K n q + c e L 6 y / z K c f J a y C 2 g y + D K n o a 8 D L s l B N l 3 l a M z w a 8 = " ;
} )
( fetchpatch {
name = " C V E - 2 0 2 2 - 3 4 5 6 8 . p a t c h " ;
url = " h t t p s : / / g i t h u b . c o m / l i b s d l - o r g / S D L - 1 . 2 / c o m m i t / d 7 e 0 0 2 0 8 7 3 8 a 0 b c 6 a f 3 0 2 7 2 3 f e 6 4 9 0 8 a c 3 5 b 7 7 7 b . p a t c h " ;
hash = " s h a 2 5 6 - f u x X s q Z W 9 4 / C 8 C K u 9 L a k p p C U 4 z H u p j 6 6 O 2 M n g Q 4 B O 9 o = " ;
} )
] ;
enableParallelBuilding = true ;
postInstall = ''
m o v e T o O u t p u t s h a r e / a c l o c a l " $d e v "
'' ;
# See the same place in the expression for SDL2
postFixup = let
rpath = lib . makeLibraryPath extraPropagatedBuildInputs ;
in ''
f o r l i b i n $o u t / l i b / * . s o * ; d o
i f [ [ - L " $l i b " ] ] ; t h e n
p a t c h e l f - - s e t - r p a t h " $( p a t c h e l f - - p r i n t - r p a t h $l i b ) : ${ rpath } " " $l i b "
f i
d o n e
'' ;
setupHook = ./setup-hook.sh ;
passthru = { inherit openglSupport ; } ;
meta = {
homepage = " h t t p : / / w w w . l i b s d l . o r g / " ;
description = " C r o s s - p l a t f o r m m u l t i m e d i a l i b r a r y " ;
license = lib . licenses . lgpl21 ;
mainProgram = " s d l - c o n f i g " ;
maintainers = lib . teams . sdl . members ++ ( with lib . maintainers ; [ lovek323 ] ) ;
platforms = lib . platforms . unix ;
} ;
} )