pgloader/bundle/Makefile
Dimitri Fontaine 6e325f67e0 Implement the save.lisp idea for the bundle.
This should make it easier to build pgloader with CCL rather than SBCL, all
from the bundle distribution, and also easier to support windows.

In passing, add a new file in the bundle distribution: version.sexp should
contain a CL string containing the pgloader version string.
2018-11-21 21:44:56 +01:00

68 lines
2.2 KiB
Makefile

# pgloader build tool for bundle tarball
# only supports SBCL
CL = sbcl
APP_NAME = pgloader
VERSION = %VERSION%
ifeq ($(OS),Windows_NT)
EXE = .exe
COMPRESS_CORE = no
DYNSIZE = 1024 # support for windows 32 bits
else
DYNSIZE = 4096
EXE =
endif
BUILDDIR = bin
BUILDAPP = $(BUILDDIR)/buildapp$(EXE)
PGLOADER = ./bin/pgloader
SRCDIR = local-projects/pgloader-$(VERSION)
BUILDAPP_OPTS = --require sb-posix \
--require sb-bsd-sockets \
--require sb-rotate-byte
CL_OPTS = --noinform --no-sysinit --no-userinit
COMPRESS_CORE ?= $(shell $(CL) --noinform \
--quit \
--eval '(when (member :sb-core-compression cl:*features*) (write-string "yes"))')
ifeq ($(COMPRESS_CORE),yes)
COMPRESS_CORE_OPT = --compress-core
endif
pgloader: $(PGLOADER) ;
buildapp: $(BUILDAPP) ;
$(BUILDAPP):
mkdir -p $(BUILDDIR)
$(CL) $(CL_OPTS) --load bundle.lisp \
--eval '(asdf:load-system :buildapp)' \
--eval '(buildapp:build-buildapp "$@")' \
--eval '(quit)'
$(PGLOADER): $(BUILDAPP)
$(BUILDAPP) --logfile /tmp/pgloader-bundle-build.log \
$(BUILDAPP_OPTS) \
--sbcl $(CL) \
--asdf-tree . \
--load-system $(APP_NAME) \
--eval '(setf pgloader.params::*version-string* "$(VERSION)")' \
--load $(SRCDIR)/src/hooks.lisp \
--entry pgloader:main \
--dynamic-space-size $(DYNSIZE) \
$(COMPRESS_CORE_OPT) \
--output $@.tmp
# that's ugly, but necessary when building on Windows :(
mv $@.tmp $@
test: $(PGLOADER)
$(MAKE) PGLOADER=$(realpath $(PGLOADER)) -C $(SRCDIR)/test regress
save:
sbcl --no-userinit --load ./save.lisp
check: test ;