aboutsummaryrefslogtreecommitdiffstats
path: root/lang/sbcl/Makefile
blob: ebc2228b004ff250f04c7813dbfd87d042e3914a (plain) (blame)
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# $FreeBSD$

# All *-sbcl ports and any other port [1] with SBCL fasl files must get a
# PORTREVISION bump when lang/sbcl is updated.  The compiled fasl files are
# pinned to exact versions of everything used to build them.
#
# [1] x11-wm/stumpwm

PORTNAME=   sbcl
DISTVERSION=    1.4.11
PORTREVISION=   1
DISTVERSIONSUFFIX=  -source
PORTEPOCH=  1
CATEGORIES= lang lisp
MASTER_SITES=   SF/${PORTNAME}/${PORTNAME}/${DISTVERSION} \
        SF/${PORTNAME}/${PORTNAME}/${BOOTVERSION}:binaries
DISTFILES=  ${DISTNAME}${EXTRACT_SUFX}

MAINTAINER= krion@FreeBSD.org
COMMENT=    Common Lisp development system derived from the CMU CL system

LICENSE=    ${PORTNAME}
LICENSE_NAME=   public domain | FreeBSD
LICENSE_FILE=   ${WRKSRC}/COPYING
LICENSE_PERMS=  dist-mirror pkg-mirror auto-accept dist-sell pkg-sell

ONLY_FOR_ARCHS= amd64 i386

LIB_DEPENDS=    libgmp.so:math/gmp \
        libmpfr.so:math/mpfr
RUN_DEPENDS=    cl-asdf>=0:devel/cl-asdf

USES=       gmake makeinfo tar:bzip2

BOOTVERSION=    1.2.7
SBCL_BOOT_LIST= ${BOOTVERSION}-x86-64-freebsd \
        ${BOOTVERSION}-x86-freebsd \
        ${BOOTVERSION}-x86-64-dragonfly

CONMODULES= asdf sb-aclrepl sb-bsd-sockets sb-cltl2 sb-concurrency \
        sb-cover sb-executable sb-gmp sb-grovel sb-introspect \
        sb-md5 sb-mpfr sb-posix sb-queue sb-rotate-byte sb-rt \
        sb-simple-streams sb-sprof

WRKSRC=     ${WRKDIR}/${PORTNAME}-${PORTVERSION}

MAKE_SH_ARGS?=  --prefix="${PREFIX}" \
        --xc-host="${XC_HOST}"

# You can use the DYNAMIC_SPACE_SIZE knob to change the size of SBCL dynamically-allocated memory.
# Default for arch: i386 = 512Mb, amd64 = 1Gb.
.if defined(DYNAMIC_SPACE_SIZE)
MAKE_SH_ARGS+=  --dynamic-space-size=${DYNAMIC_SPACE_SIZE}
.endif

SUB_FILES=  pkg-message sbclrc

# All options explained into file: ${WRKSRC}/base-target-features.lisp-expr
OPTIONS_DEFINE= DOCS QSHOW RENAME SAFEPOINT THREADS UNICODE XREF ZLIB
OPTIONS_DEFAULT=    RENAME SBCL THREADS UNICODE

QSHOW_DESC= C runtime with low-level debugging output
RENAME_DESC=    Rename suffix .core to _core
SAFEPOINT_DESC= Using safepoints instead of signals
XREF_DESC=  XREF data for SBCL internals

OPTIONS_SINGLE= BOOTSTRAP
OPTIONS_SINGLE_BOOTSTRAP=   ABCL CCL CMUCL SBCL

ABCL_DESC=  Armed Bear Common Lisp
BOOTSTRAP_DESC= Supported languages of the build host
CCL_DESC=   Clozure Common Lisp
CMUCL_DESC= Carnegie Mellon University Common Lisp
SBCL_DESC=  Steel Bank Common Lisp

# On this moment CMUCL doesn't builds sbcl correctly
# ABCL - I haven't tested. Welcome volunteers.
OPTIONS_EXCLUDE=    ABCL CMUCL

ABCL_VARS=      XC_HOST="abcl"
ABCL_BUILD_DEPENDS= abcl:lang/abcl

CCL_VARS=       XC_HOST="ccl --no-init --batch --quiet"
CCL_BUILD_DEPENDS=  ccl:lang/ccl

CMUCL_VARS=     XC_HOST="lisp -nositeinit -noinit -batch -quiet"
CMUCL_BUILD_DEPENDS=    lisp:lang/cmucl

DOCS_VARS=      INFO="asdf sbcl"

QSHOW_VARS=     MAKE_SH_ARGS+="--with-sb-qshow"
QSHOW_VARS_OFF=     MAKE_SH_ARGS+="--without-sb-qshow"

RENAME_PLIST_SUB=   CORE_SUFFIX="_core"
RENAME_PLIST_SUB_OFF=   CORE_SUFFIX=".core"

SAFEPOINT_VARS=     MAKE_SH_ARGS+="--with-sb-safepoint --with-sb-thruption --with-sb-wtimer"
SAFEPOINT_VARS_OFF= MAKE_SH_ARGS+="--without-sb-safepoint --without-sb-thruption --without-sb-wtimer"
SAFEPOINT_IMPLIES=  THREADS

SBCL_VARS=      XC_HOST="${BOOT_WRKSRC}/src/runtime/sbcl --core ${BOOT_WRKSRC}/output/${CORE} --noinform --disable-debugger --no-sysinit --no-userinit"
SBCL_DISTFILES=     ${PORTNAME}-${SBCL_BOOT_LIST:M${ARCHOS_PATTERN}}-binary${EXTRACT_SUFX}:binaries

THREADS_VARS=       MAKE_SH_ARGS+="--with-sb-thread --with-restore-fs-segment-register-from-tls"
THREADS_VARS_OFF=   MAKE_SH_ARGS+="--without-sb-thread --without-restore-fs-segment-register-from-tls"

UNICODE_VARS=       MAKE_SH_ARGS+="--with-sb-unicode"
UNICODE_VARS_OFF=   MAKE_SH_ARGS+="--without-sb-unicode"

XREF_VARS=      MAKE_SH_ARGS+="--with-sb-xref-for-internals"
XREF_VARS_OFF=      MAKE_SH_ARGS+="--without-sb-xref-for-internals"

ZLIB_VARS=      MAKE_SH_ARGS+="--with-sb-core-compression"
ZLIB_VARS_OFF=      MAKE_SH_ARGS+="--without-sb-core-compression"

PORTDOCS=   *

.include <bsd.port.options.mk>

ARCHOS_PATTERN= *-${ARCH:S/amd64/x86-64/:S/i386/x86/}-${OPSYS:tl}*
BOOT_WRKSRC=    ${WRKDIR}/${PORTNAME}-${SBCL_BOOT_LIST:M${ARCHOS_PATTERN}}

# for port maintenance, invoke "make makesum PLUS_BOOTSTRAPS=1"
.if defined (PLUS_BOOTSTRAPS)
. for B in ${SBCL_BOOT_LIST}
.  if ! ${DISTFILES:Msbcl-${B}-*}
DISTFILES:= ${DISTFILES} ${PORTNAME}-${B}-binary${EXTRACT_SUFX}:binaries
.  endif
. endfor
.endif

# Old FreeBSD bootstraps feature the older core name for SBCL bootstrap
.if ${OPSYS} == FreeBSD
CORE=   sbcl.core
.else
CORE=   sbcl_core
.endif

post-patch-RENAME-on:
    ${GREP} -Frl '.core' ${WRKSRC} | ${XARGS} ${REINPLACE_CMD} -e 's|\.core|_core|g'

post-patch:
    @${REINPLACE_CMD} -e 's|/etc|${PREFIX}/etc|' \
        ${WRKSRC}/src/code/toplevel.lisp \
        ${WRKSRC}/doc/${PORTNAME}.1 \
        ${WRKSRC}/doc/manual/start-stop.texinfo

do-build:
    (cd ${WRKSRC} && ${SH} make.sh ${MAKE_SH_ARGS})

do-install:
    (cd ${WRKSRC} && ${SETENV} \
    INSTALL_ROOT="${STAGEDIR}${PREFIX}" \
    MAN_DIR="${STAGEDIR}${MANPREFIX}/man" \
    INFO_DIR="${STAGEDIR}${PREFIX}/${INFO_PATH}" \
    DOC_DIR="${STAGEDIR}${DOCSDIR}" \
    ${SH} install.sh)
.for M in ${CONMODULES}
    ${MKDIR} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/${M}
    ${INSTALL_DATA} ${WRKSRC}/contrib/${M}/*.[la]* \
        ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/${M}/
.endfor
    ${INSTALL_DATA} ${WRKDIR}/sbclrc ${STAGEDIR}${PREFIX}/etc/sbclrc.sample

post-build-DOCS-on:
    ${DO_MAKE_BUILD} -C ${WRKSRC}/doc/manual info html

post-install:
    ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}

post-install-DOCS-on:
    ${RM} ${STAGEDIR}${PREFIX}/${INFO_PATH}/dir # don't requered with INFO=
    ${RM} -r ${STAGEDIR}${DOCSDIR}/html # empty directory created by install.sh

check regression-test test: build
    (cd ${WRKSRC}/tests && ${SH} run-tests.sh)

.include <bsd.port.mk>