Loading on win32 systems tested
[trivial-gtk.git] / trivial-gtk.lisp
blob9986ad633ac5af90e60ee4f79d612f8178928d11
2 (defpackage :trivial-gtk
3 (:use :cl :cffi))
5 (in-package :trivial-gtk)
7 ;;;
8 ;;; System
9 ;;;
11 ;; shamelessly stolen from CLOCC
12 (defun getenv (var)
13 "Return the value of the environment variable."
14 #+allegro (sys::getenv (string var))
15 #+clisp (ext:getenv (string var))
16 #+(or cmu scl)
17 (cdr (assoc (string var) ext:*environment-list* :test #'equalp
18 :key #'string))
19 #+gcl (si:getenv (string var))
20 #+lispworks (lw:environment-variable (string var))
21 #+lucid (lcl:environment-variable (string var))
22 #+mcl (ccl::getenv var)
23 #+sbcl (sb-ext:posix-getenv var)
24 #-(or allegro clisp cmu gcl lispworks lucid mcl sbcl scl)
25 (error 'not-implemented :proc (list 'getenv var)))
27 (defun (setf getenv) (val var)
28 "Set an environment variable."
29 #+allegro (setf (sys::getenv (string var)) (string val))
30 #+clisp (setf (ext:getenv (string var)) (string val))
31 #+(or cmu scl)
32 (let ((cell (assoc (string var) ext:*environment-list* :test #'equalp
33 :key #'string)))
34 (if cell
35 (setf (cdr cell) (string val))
36 (push (cons (intern (string var) "KEYWORD") (string val))
37 ext:*environment-list*)))
38 #+gcl (si:setenv (string var) (string val))
39 #+lispworks (setf (lw:environment-variable (string var)) (string val))
40 #+lucid (setf (lcl:environment-variable (string var)) (string val))
41 #-(or allegro clisp cmu gcl lispworks lucid scl)
42 (error 'not-implemented :proc (list '(setf getenv) var)))
44 (defparameter *gtk-location* #P"C:\\Program Files (x86)\\GIMP-2.0\\bin\\"))
47 #-(or win32 mswindows windows darwin)
48 (eval-when (:compile-toplevel :load-toplevel :execute)
49 (cffi:load-foreign-library "libglib-2.0.so")
50 (cffi:load-foreign-library "libgmodule-2.0.so")
51 (cffi:load-foreign-library "libgobject-2.0.so")
52 (cffi:load-foreign-library "libcario.so")
53 (cffi:load-foreign-library "libpango-1.0.so")
54 (cffi:load-foreign-library "libpangocairo-1.0.so")
55 (cffi:load-foreign-library "libgdk_pixbuf-2.0.so")
56 (cffi:load-foreign-library "libgthread-2.0.so")
57 (cffi:load-foreign-library "libatk-1.0.so")
58 (cffi:load-foreign-library "libgdk-x11-2.0.so"))
60 #+(or win32 windows)
61 (push *gtk-location* cffi:*foreign-library-directories*)
63 #+(or win32 windows)
64 (eval-when (:compile-toplevel :load-toplevel :execute)
65 (cffi:load-foreign-library "intl.dll")
66 (cffi:load-foreign-library "zlib1.dll")
67 (cffi:load-foreign-library "libpng13.dll")
68 (cffi:load-foreign-library "libglib-2.0-0.dll")
69 (cffi:load-foreign-library "libgmodule-2.0-0.dll")
70 (cffi:load-foreign-library "libgobject-2.0-0.dll")
71 (cffi:load-foreign-library "libcairo-2.dll")
72 (cffi:load-foreign-library "libpango-1.0-0.dll")
73 (cffi:load-foreign-library "libpangowin32-1.0-0.dll")
74 (cffi:load-foreign-library "libpangocairo-1.0-0.dll")
75 (cffi:load-foreign-library "libgdk_pixbuf-2.0-0.dll")
76 (cffi:load-foreign-library "libgthread-2.0-0.dll")
77 (cffi:load-foreign-library "libatk-1.0-0.dll")
78 (cffi:load-foreign-library "libgdk-win32-2.0-0.dll"))