;;;; sdl-mixer.setup -*- Scheme -*- (define sources '("sdl-mixer-lolevel" "sdl-mixer")) (let* ((escape-flags (lambda (fs) (map (lambda (s) (if (not (or (string-prefix-ci? "-l" s) (string-prefix-ci? "-i" s) (string-prefix-ci? "-d" s))) (sprintf " -C ~a " s) (sprintf " ~a " s))) (string-split fs)))) (sdl-cflags (apply string-append (escape-flags (with-input-from-pipe "sdl-config --cflags" read-line)))) (sdl-lflags (apply string-append (escape-flags (with-input-from-pipe "sdl-config --libs" read-line))))) (print "Building with sdl-flags: " sdl-cflags) (print "Building with linker flags: " sdl-lflags) (for-each (lambda (s) (let ((source (string-append s ".scm")) (import (string-append s ".import.scm"))) (compile -s -O3 -d1 ,source -J -lSDL -lSDL_mixer ,sdl-cflags ,sdl-lflags) (compile -s -O3 -d0 ,import ,sdl-cflags ,sdl-lflags))) sources)) (install-extension 'sdl-mixer (fold (lambda (x s) (cons (string-append x ".so") (cons (string-append x ".import.so") s))) '() sources) '((version "0.5")))