-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
135 lines (105 loc) · 4 KB
/
Makefile
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# ql-to-deb build tool
APP_NAME = ql-to-deb
# use either sbcl or ccl
CL = sbcl
LISP_SRC = $(wildcard src/*lisp) ql-to-deb.asd
BUILDDIR = build
LIBS = $(BUILDDIR)/libs.stamp
QLDIR = $(BUILDDIR)/quicklisp
QUICKLISP = $(BUILDDIR)/quicklisp.lisp
MANIFEST = $(BUILDDIR)/manifest.ql
QL_TO_DEB = $(BUILDDIR)/bin/$(APP_NAME)
BUILDAPP_CCL = $(BUILDDIR)/bin/buildapp.ccl
BUILDAPP_SBCL = $(BUILDDIR)/bin/buildapp.sbcl
ifeq ($(CL),sbcl)
BUILDAPP = $(BUILDAPP_SBCL)
CL_OPTS = --no-sysinit --no-userinit
else
BUILDAPP = $(BUILDAPP_CCL)
CL_OPTS = --no-init
endif
COMPRESS_CORE ?= yes
ifeq ($(CL),sbcl)
ifeq ($(COMPRESS_CORE),yes)
COMPRESS_CORE_OPT = --compress-core
else
COMPRESS_CORE_OPT =
endif
endif
# ifeq ($(CL),sbcl)
# BUILDAPP_OPTS = --require sb-posix
# endif
DEBUILD_ROOT = /tmp/ql-to-deb/debian/ql-to-deb
all: $(QL_TO_DEB)
docs:
ronn -roff ql-to-deb.1.md
clean:
rm -rf $(LIBS) $(QUICKLISP) $(QLDIR) $(MANIFEST) $(BUILDAPP) $(QL_TO_DEB)
$(QLDIR)/setup.lisp:
mkdir -p $(BUILDDIR)
curl -o $(QUICKLISP) http://beta.quicklisp.org/quicklisp.lisp
$(CL) $(CL_OPTS) --load $(QUICKLISP) \
--eval '(quicklisp-quickstart:install :path "$(BUILDDIR)/quicklisp")' \
--eval '(quit)'
quicklisp: $(QLDIR)/setup.lisp ;
$(LIBS): $(QLDIR)/setup.lisp
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(require :asdf)' \
--eval '(asdf:load-system :asdf)' \
--eval '(push "$(PWD)/" asdf:*central-registry*)' \
--eval '(ql:quickload "ql-to-deb")' \
--eval '(quit)' #> /dev/null 2>&1
touch $@
libs: $(LIBS) ;
$(MANIFEST): $(LIBS)
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(ql:write-asdf-manifest-file "$(MANIFEST)")' \
--eval '(quit)'
manifest: $(MANIFEST) ;
$(BUILDAPP_CCL): $(QLDIR)/setup.lisp
mkdir -p $(BUILDDIR)/bin
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(ql:quickload "buildapp")' \
--eval '(buildapp:build-buildapp "$@")' \
--eval '(quit)'
$(BUILDAPP_SBCL): $(QLDIR)/setup.lisp
mkdir -p $(BUILDDIR)/bin
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(ql:quickload "buildapp")' \
--eval '(buildapp:build-buildapp "$@")' \
--eval '(quit)'
buildapp: $(BUILDAPP) ;
$(QL_TO_DEB): $(MANIFEST) $(BUILDAPP) $(LISP_SRC)
mkdir -p $(BUILDDIR)/bin
$(BUILDAPP) --logfile /tmp/build.log \
$(BUILDAPP_OPTS) \
--sbcl $(CL) \
--require asdf \
--load-system asdf \
--asdf-tree $(QLDIR)/dists \
--asdf-path . \
--load-system $(APP_NAME) \
--entry ql-to-deb:main \
--dynamic-space-size 512 \
$(COMPRESS_CORE_OPT) \
--output $@
ql-to-deb: $(QL_TO_DEB) ;
deb:
# intended for use on a debian system
mkdir -p $(DEBUILD_ROOT) && rm -rf $(DEBUILD_ROOT)
rsync -Ca --exclude=build/* --exclude=.vagrant ./ $(DEBUILD_ROOT)/
mkdir -p $(DEBUILD_ROOT)/build/bin
cd $(DEBUILD_ROOT) && make -f debian/rules orig
cd $(DEBUILD_ROOT) && debuild -us -uc -sa
cp -a /tmp/ql-to-deb/debian/ql-to-deb_* build/
swank:
sbcl --load conf/start-swank-server.lisp
status: $(QL_TO_DEB)
$(QL_TO_DEB) --status
packages:
docker build -t qldeb .
sign:
docker run -it qldeb /bin/bash
secring:
docker cp ~/.gnupg/secring.gpg $(shell docker ps --filter "ancestor=qldeb" --format "{{.Names}}"):/home/dim/.gnupg/secring.gpg
.PHONY: packages sign secring