#!/bin/sh usage () { echo echo USAGE: $(basename $0) echo echo This script builds a production executable from an asdf system by echo loading all necessary dependencies and dumping an SBCL executable image. echo It needs the following environment variables to be declared: echo echo " DWIM_WORKSPACE - the directory where the dwim libs are checked out" echo " DWIM_INSTALL_PATH - the directory where you will install the binary on the target system" echo " DWIM_EXECUTABLE_CORE_FILE - the name of the executable core file" echo " DWIM_TOPLEVEL_FUNCTION - the \"main\" function which is called when the binary is started" echo " DWIM_ASDF_SYSTEM_NAME - the asdf system which will be loaded before dumping the executable core" echo " DWIM_MAXIMUM_MEMORY_SIZE - sets the SBCL --dynamic-space-size of the executable, e.g. 250M" echo } if [ -z "$DWIM_WORKSPACE" \ -o -z "$DWIM_INSTALL_PATH" \ -o -z "$DWIM_EXECUTABLE_CORE_FILE" \ -o -z "$DWIM_TOPLEVEL_FUNCTION" \ -o -z "$DWIM_ASDF_SYSTEM_NAME" \ -o -z "$DWIM_MAXIMUM_MEMORY_SIZE" \ ] ; then usage exit 1 fi echo "*** "`date`" Building '${DWIM_PROJECT_NAME}' from workspace '${DWIM_WORKSPACE}'" BUILD_LOG_FILE="${DWIM_EXECUTABLE_CORE_FILE}.build-log" env CL_SOURCE_REGISTRY="(:source-registry (:tree \"${DWIM_WORKSPACE}\") (:also-exclude \"sbcl\") :ignore-inherited-configuration)" \ ASDF_OUTPUT_TRANSLATIONS="(:output-translations (\"${DWIM_WORKSPACE}\" (\"${DWIM_INSTALL_PATH}/.cache/common-lisp/\" :implementation)) :ignore-inherited-configuration)" \ "${DWIM_WORKSPACE}"/hu.dwim.build/bin/hu.dwim.build.sh --load-swank --swank-directory "${DWIM_WORKSPACE}/slime/" --production-build --overwrite-output-file --executable-output \ --maximum-memory-size "${DWIM_MAXIMUM_MEMORY_SIZE}" --toplevel-function "${DWIM_TOPLEVEL_FUNCTION}" --output-filename "${DWIM_EXECUTABLE_CORE_FILE}" \ "${DWIM_ASDF_SYSTEM_NAME}" 2>&1 | tee ${BUILD_LOG_FILE} chown ${DWIM_DAEMON_USER}:${DWIM_DAEMON_USER} "${DWIM_EXECUTABLE_CORE_FILE}" chmod o-rwx "${DWIM_EXECUTABLE_CORE_FILE}" echo "*** "`date`" Finished building ${DWIM_PROJECT_NAME}, executable is at ${DWIM_EXECUTABLE_CORE_FILE}"