Allows to build pgloader image using CCL.

Too many Makefile commands where hard-coded using SBCL, which prevented
from building successfully against CCL. That's now fixed.
This commit is contained in:
Dimitri Fontaine 2014-04-29 11:47:22 +02:00
parent 40128dbd75
commit c0d9bb4d8f
4 changed files with 53 additions and 18 deletions

View File

@ -1,16 +1,31 @@
# pgloader build tool
APP_NAME = pgloader
SBCL = sbcl
SBCL_OPTS = --no-sysinit --no-userinit
# use either sbcl or ccl
CL = sbcl
ifeq ($(CL),sbcl)
CL_OPTS = --no-sysinit --no-userinit
else
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 \
--require sb-bsd-sockets \
--require sb-rotate-byte
endif
BUILDDIR = build
LIBS = $(BUILDDIR)/libs.stamp
@ -35,14 +50,14 @@ qmynd: $(QLDIR)/local-projects/qmynd
$(QLDIR)/setup.lisp:
mkdir -p $(BUILDDIR)
curl -o $(BUILDDIR)/quicklisp.lisp http://beta.quicklisp.org/quicklisp.lisp
$(SBCL) $(SBCL_OPTS) --load $(BUILDDIR)/quicklisp.lisp \
$(CL) $(CL_OPTS) --load $(BUILDDIR)/quicklisp.lisp \
--eval '(quicklisp-quickstart:install :path "$(BUILDDIR)/quicklisp")' \
--eval '(quit)'
quicklisp: $(QLDIR)/setup.lisp ;
$(LIBS): quicklisp qmynd
$(SBCL) $(SBCL_OPTS) --load $(QLDIR)/setup.lisp \
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(ql:quickload "pgloader")' \
--eval '(quit)'
touch $@
@ -50,7 +65,7 @@ $(LIBS): quicklisp qmynd
libs: $(LIBS) ;
$(MANIFEST): libs
$(SBCL) $(SBCL_OPTS) --load $(QLDIR)/setup.lisp \
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(ql:write-asdf-manifest-file "$(MANIFEST)")' \
--eval '(quit)'
@ -58,7 +73,7 @@ manifest: $(MANIFEST) ;
$(BUILDAPP): quicklisp
mkdir -p $(BUILDDIR)/bin
$(SBCL) $(SBCL_OPTS) --load $(QLDIR)/setup.lisp \
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(ql:quickload "buildapp")' \
--eval '(buildapp:build-buildapp "$(BUILDAPP)")' \
--eval '(quit)'
@ -68,9 +83,8 @@ buildapp: $(BUILDAPP) ;
$(PGLOADER): manifest buildapp
mkdir -p $(BUILDDIR)/bin
$(BUILDAPP) --logfile /tmp/build.log \
--require sb-posix \
--require sb-bsd-sockets \
--require sb-rotate-byte \
$(BUILDAPP_OPTS) \
--sbcl $(CL) \
--asdf-path . \
--asdf-tree $(QLDIR)/local-projects \
--manifest-file $(MANIFEST) \

View File

@ -77,16 +77,26 @@ Binary file for pgloader, named `pgloader.exe`:
$ make pgloader
Note that the `Makefile` uses the `--compress-core` option, that should be
enabled in your local copy of `SBCL`. If that's not the case, it's probably
because you did compile and install `SBCL` yourself, so that you have a
decently recent version to use. Then you need to compile it with the
`--with-sb-core-compression` option.
By default, the `Makefile` uses [SBCL](http://sbcl.org/) to compile your
binary image, though it's possible to also build using
[CCL](http://ccl.clozure.com/).
You can also remove the `--compress-core` option by editing the `Makefile`
and removing the line where it appears.
$ make CC=ccl pgloader
The `make pgloader` command when successful outputs a `./build/pgloader.exe`
Note that the `Makefile` uses the `--compress-core` option when using SBCL,
that should be enabled in your local copy of `SBCL`. If that's not the case,
it's probably because you did compile and install `SBCL` yourself, so that
you have a decently recent version to use. Then you need to compile it with
the `--with-sb-core-compression` option.
You can also remove the `--compress-core` option that way:
$ make COMPRESS_CORE=no pgloader
The `--compress-core` is unique to SBCL, so not used when `CC` is different
from the `sbcl` value.
The `make pgloader` command when successful outputs a `./build/bin/pgloader`
file for you to use.
## Usage

View File

@ -11,6 +11,14 @@
(in-package #:cl-user)
#+ccl
(progn
(push (lambda () (cffi:close-foreign-library 'CL+SSL::LIBSSL))
*save-exit-functions*)
(push (lambda () (cffi:load-foreign-library 'CL+SSL::LIBSSL))
*lisp-startup-functions*))
#+sbcl
(progn
(push (lambda () (cffi:close-foreign-library 'CL+SSL::LIBSSL))

View File

@ -116,7 +116,10 @@
(format t "tmpdir: ~s~%" *default-tmpdir*))
(when version
(format t "pgloader version ~s~%" *version-string*))
(format t "pgloader version ~s~%" *version-string*)
(format t "compiled with ~a ~a~%"
(lisp-implementation-type)
(lisp-implementation-version)))
(when help
(usage argv))