;;;; allegro.setup -*- Scheme -*- (use posix srfi-13) (define compile-options "-O3 -C -O3") (define link-options "") (define extra-defines (if (version>=? (chicken-version) "4.7.0") '(-Dimproved-64-bit-support) '())) (define (pkg-config lib-name) (let ((output (call-with-input-pipe (string-append "pkg-config --libs " lib-name) read-all))) (if (string-null? output) #f (string-delete (lambda (c) (char=? #\newline c)) output)))) (let ((allegro (pkg-config "allegro-5.0"))) (when allegro (set! link-options (string-append link-options " " allegro)))) (let ((primitives (pkg-config "allegro_primitives-5.0"))) (when primitives (set! link-options (string-append link-options " " primitives)) (set! extra-defines (append extra-defines '(-Dhas-allegro-primitives))))) (let ((color (pkg-config "allegro_color-5.0"))) (when color (set! link-options (string-append link-options " " color)) (set! extra-defines (append extra-defines '(-Dhas-allegro-color))))) (let ((dialog (pkg-config "allegro_dialog-5.0"))) (when dialog (set! link-options (string-append link-options " " dialog)) (set! extra-defines (append extra-defines '(-Dhas-allegro-dialog))))) (let ((main (pkg-config "allegro_main-5.0"))) (when main (set! link-options (string-append link-options " " main)) (set! extra-defines (append extra-defines '(-Dhas-allegro-main))))) (let ((physfs (pkg-config "allegro_physfs-5.0"))) (when physfs (set! link-options (string-append link-options " " physfs)) (set! extra-defines (append extra-defines '(-Dhas-allegro-physfs))))) (let ((font (pkg-config "allegro_font-5.0"))) (when font (set! link-options (string-append link-options " " font)) (set! extra-defines (append extra-defines '(-Dhas-allegro-font))))) (let ((ttf (pkg-config "allegro_ttf-5.0"))) (when ttf (set! link-options (string-append link-options " " ttf)) (set! extra-defines (append extra-defines '(-Dhas-allegro-ttf))))) (let ((audio (pkg-config "allegro_audio-5.0"))) (when audio (set! link-options (string-append link-options " " audio)) (set! extra-defines (append extra-defines '(-Dhas-allegro-audio))))) (let ((memfile (pkg-config "allegro_memfile-5.0"))) (when memfile (set! link-options (string-append link-options " " memfile)) (set! extra-defines (append extra-defines '(-Dhas-allegro-memfile))))) (let ((acodec (pkg-config "allegro_acodec-5.0"))) (when acodec (set! link-options (string-append link-options " " acodec)) (set! extra-defines (append extra-defines '(-Dhas-allegro-acodec))))) (let ((image (pkg-config "allegro_image-5.0"))) (when image (set! link-options (string-append link-options " " image)) (set! extra-defines (append extra-defines '(-Dhas-allegro-image))))) (compile -s -d1 allegro.scm -j allegro ,link-options ,compile-options ,@extra-defines) (compile -s allegro.import.scm -d0 ,link-options ,compile-options ,@extra-defines) (compile -s -d1 allegro-glext.scm -j allegro-glext ,link-options ,compile-options ,@extra-defines) (compile -s allegro-glext.import.scm -d0 ,link-options ,compile-options ,@extra-defines) (compile -s -d1 allegro-c-util.scm -j allegro-c-util ,link-options ,compile-options ,@extra-defines) (compile -s allegro-c-util.import.scm -d0 ,link-options ,compile-options ,@extra-defines) (install-extension 'allegro '("allegro.so" "allegro.import.so" "allegro-glext.so" "allegro-glext.import.so" "allegro-c-util.so" "allegro-c-util.import.so") '((version 2.4.3)))