# TODO: make the two shlibs installable in parallel, by leaving the regular one
# where it is now, and moving the -nox one to another place

# TODO: In the non-nox version, make sure to add the X11 headers as appropriate

# TODO: 

Info4: <<
Package: sdl%type_pkg[-nox]
Type: -nox (boolean)
Version: 1.2.15
Revision: 3
BuildDependsOnly: True
Depends: %N-shlibs (= %v-%r)
BuildDepends: <<
    (%type_raw[-nox] != -nox) x11-dev,
    fink (>= 0.27.2),
<<
Conflicts: sdl, sdl-nox
Replaces: sdl, sdl-nox

Source: http://www.libsdl.org/release/SDL-%v.tar.gz
Source-Checksum: SHA256(d6d316a793e5e348155f0dd93b979798933fb98aa1edebcc108829d6474aad00)
PatchFile: sdl.patch
PatchFile-MD5: 7e736602b44b4240e7a52d93ea19f3fb

ConfigureParams: <<
    (%type_raw[-nox] != -nox) --enable-video-x11 \
    (%type_raw[-nox] != -nox) --x-includes=$X11DIR/include \
    (%type_raw[-nox] != -nox) --x-libraries=$X11DIR/lib \
    (%type_raw[-nox] = -nox) --disable-video-x11 \
    (%type_raw[-nox] = -nox) --libdir='${prefix}/lib/sdl-nox' \
    --mandir='${prefix}/share/man'
<<

CompileScript: <<
    #!/bin/sh -ev
    # we explicitly specify the X11 location, to avoid convenience symlinks
    darwin_vers=`uname -r | cut -d. -f1`
    if [ "$darwin_vers" -ge 12 ]; then
        X11DIR=/opt/X11
    else
        X11DIR=/usr/X11
    fi
    ./configure %c
    DISTCC_HOSTS='' MAKEFLAGS='-j1' make
<<

InstallScript: <<
    #!/bin/sh -ev
    make install DESTDIR=%d

    darwin_vers=`uname -r | cut -d. -f1`
    if [ "$darwin_vers" -ge 12 ]; then
        X11DIR=/opt/X11
    else
        X11DIR=/usr/X11
    fi

    if [ "%type_raw[-nox]" == "." ]; then
        # modify "sdl-config --cflags" to explicitly add X11DIR to include path
        perl -pi -e "s,/include/SDL ,/include/SDL -I$X11DIR/include ," %i/bin/sdl-config
    fi
<<
DocFiles: BUGS COPYING CREDITS README README-SDL.txt README.MacOSX TODO

SplitOff: <<
  Package: %N-shlibs
  Replaces: %N (<= 1.2.4-1)
  Files: <<
    (%type_raw[-nox] != -nox) lib/libSDL-*.dylib
    (%type_raw[-nox] = -nox) lib/sdl-nox/libSDL-*.dylib
  <<
  Shlibs: <<
    (%type_raw[-nox] != -nox) %p/lib/libSDL-1.2.0.dylib 12.0.0 %n (>= 1.2.13-1)
    (%type_raw[-nox] = -nox) %p/lib/sdl-nox/libSDL-1.2.0.dylib 12.0.0 %n (>= 1.2.13-3)
  <<
  DocFiles: BUGS COPYING CREDITS README README-SDL.txt README.MacOSX TODO
<<

Description: Cross-platform multimedia library
DescPackaging: <<
  Added DISTCC_HOSTS='' MAKEFLAGS='-j1' to avoid the -fconstant-cfstrings warning
  when building with distcc (-- rangerrick@fink.sourceforge.net).
<<

Homepage: http://www.libsdl.org
License: LGPL
Maintainer: None <fink-devel@lists.sourceforge.net>

<<