-
Notifications
You must be signed in to change notification settings - Fork 9
/
build-win32.lisp
69 lines (54 loc) · 2.87 KB
/
build-win32.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
(in-package :cl-user)
(require 'sb-posix)
(push (merge-pathnames "lib/" (values *default-pathname-defaults*))
asdf:*central-registry*)
(push #p"~/2x0ng/" asdf:*central-registry*)
(defvar *dll-pathname* #p"z:/home/dto/blocky/win32/")
(defvar *game* "2x0ng")
(defvar *executable* #p"z:/home/dto/blocky/2x0ng.exe")
(defvar *base-pathname* (make-pathname :name nil :type nil :defaults *load-pathname*))
(pushnew (translate-pathname *base-pathname* "**/" "**/site/cffi_0.10.3/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/babel_0.3.0/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/alexandria/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/trivial-features_0.4/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/rt-20040621/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/lispbuilder/lispbuilder-sdl/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/lispbuilder/lispbuilder-sdl-image/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/lispbuilder/lispbuilder-sdl-mixer/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/lispbuilder/lispbuilder-sdl-ttf/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/blocky/") asdf:*central-registry*)
;(pushnew (translate-pathname *base-pathname* "**/" "**/xe2/") asdf:*central-registry*)
(asdf:oos 'asdf:load-op :cffi)
(require 'sb-posix)
(sb-posix:chdir *dll-pathname*)
;;(setf *default-pathname-defaults* (make-pathname :directory '(:relative)))
(map nil
#'ql:quickload (list "lispbuilder-sdl-mixer" "lispbuilder-sdl-ttf" "lispbuilder-sdl-image" "cl-opengl" "cl-fad" "uuid")) (require :blocky)
(asdf:oos 'asdf:load-op :blocky)
(pop cffi:*foreign-library-directories*)
(defun main ()
(setf blocky:*project-directories* (list (make-pathname :directory '(:relative))))
(blocky:play *game*)
0)
(sb-ext:save-lisp-and-die *executable* :toplevel #'main :executable t)
;; #+sbcl
;; (progn
;; (if (member :sb-core-compression *features*)
;; (sb-ext:save-lisp-and-die
;; "name.exe"
;; :executable t :toplevel (function main-prog)
;; :compression t)
;; (sb-ext:save-lisp-and-die
;; "name.exe" :executable t :toplevel (function main-prog))))
;; TODO try this to get rid of the kitten of death
;; (with-open-file (exe #p"path/to/game.exe" :direction :io :element-type '(unsigned-byte 8))
;; (file-position exe #x3c)
;; (let* ((b0 (read-byte exe))
;; (b1 (read-byte exe))
;; (b2 (read-byte exe))
;; (b3 (read-byte exe))
;; (pe-header (dpb (dpb b3 (byte 8 8) b2)
;; (byte 16 16)
;; (dpb b1 (byte 8 8) b0))))
;; (file-position exe (+ pe-header #x5c))
;; (write-byte 3 exe)))