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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
# $FreeBSD$
PORTNAME= sbcl
PORTVERSION= 1.1.12
PORTEPOCH= 1
CATEGORIES= lang lisp
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTVERSION} \
ftp://ftp.SpringDaemons.com/soft/sbcl-binary/:binaries
DISTFILES= \
${PORTNAME}-${PORTVERSION}-source${EXTRACT_SUFX}
MAINTAINER= bf@FreeBSD.org
COMMENT= A Common Lisp development system derived from the CMU CL system
LIB_DEPENDS= libgmp.so:${PORTSDIR}/math/gmp
USE_BZIP2= yes
USES= gmake
OPTIONS_DEFINE = SBCL THREADS
SBCL_DESC= Bootstrap with installed SBCL binary, if available
THREADS_DESC= Experimental threading support
CONTRIB_MODULES= asdf \
asdf-install \
sb-aclrepl \
sb-bsd-sockets \
sb-cltl2 \
sb-concurrency \
sb-cover \
sb-executable \
sb-gmp \
sb-grovel \
sb-introspect \
sb-md5 \
sb-posix \
sb-queue \
sb-rotate-byte \
sb-rt \
sb-simple-streams \
sb-sprof
MAN1= sbcl.1
NEWBOOTNAME= ${PORTNAME}-${PORTVERSION}-${ARCH}-freebsd${OSREL:R}
ONLY_FOR_ARCHS= i386 amd64
ONLY_FOR_ARCHS_REASON= is a native code compiler, and has not been ported to\
this architecture yet
SBCL_HOME= ${PREFIX}/lib/sbcl
NO_STAGE= yes
.include <bsd.port.options.mk>
CFLAGS+= -fno-omit-frame-pointer
CPPFLAGS+= -I. -DSBCL_PREFIX=\\\"\$$(SBCL_PREFIX)\\\"
.if ${ARCH} == "i386"
DYNAMIC_SPACE_SIZE?= 512
PLIST_SUB+= I386_ONLY="" AMD64_ONLY="@comment "
SBCLCONFIG= Config.x86-freebsd
.else
DYNAMIC_SPACE_SIZE?= 1024
PLIST_SUB+= I386_ONLY="@comment " AMD64_ONLY=""
SBCLCONFIG= Config.x86-64-freebsd
.endif
MAKE_SH_ARGS?= --prefix=${PREFIX} --dynamic-space-size=${DYNAMIC_SPACE_SIZE} \
--with-sb-core-compression --with-sb-qshow
NM?= /usr/bin/nm
NMFLAGS?= -gp
.if ${PORT_OPTIONS:MDOCS} || make(makesum)
DISTFILES+= \
${PORTNAME}-${PORTVERSION}-documentation-html${EXTRACT_SUFX}
MANUALS= asdf.html sbcl.html
MODULESDOCS= asdf/README asdf/README.SBCL \
asdf-install/README \
sb-aclrepl/README \
sb-bsd-sockets/FAQ sb-bsd-sockets/NEWS \
sb-md5/README \
sb-posix/README \
sb-rotate-byte/README \
sb-simple-streams/README
TEXTDOCS= BUGS CREDITS COPYING NEWS PRINCIPLES TLA TODO
.endif
# If the SBCL option is enabled, try to use existing "sbcl" first:
.if empty(PORT_OPTIONS:MSBCL) || !exists(${LOCALBASE}/bin/sbcl) || make(makesum)
BOOT_VERSION= 1.0.31
. if make(makesum)
BOOT_ARCH_OS_LIST= amd64-freebsd8 amd64-freebsd7 i386-freebsd8 \
i386-freebsd7
. else
. if ${OSREL:R} > 8 # We'll use 8.x bootstrap for now
BOOT_ARCH_OS_LIST= ${ARCH}-freebsd8
. else
BOOT_ARCH_OS_LIST= ${ARCH}-freebsd${OSREL:R}
. endif
. endif
. for BOOT_ARCH_OS in ${BOOT_ARCH_OS_LIST}
BOOT_DISTNAME= ${PORTNAME}-${BOOT_VERSION}-${BOOT_ARCH_OS}
DISTFILES:= ${DISTFILES} ${BOOT_DISTNAME}-binary${EXTRACT_SUFX}:binaries
. endfor
XC_HOST?= ${WRKDIR}/${BOOT_DISTNAME}/src/runtime/sbcl --core \
${WRKDIR}/${BOOT_DISTNAME}/output/sbcl.core \
--dynamic-space-size ${DYNAMIC_SPACE_SIZE} \
--disable-debugger --userinit /dev/null --sysinit /dev/null
MAKE_SH_ARGS+= --xc-host='${XC_HOST}'
.endif # SBCL
.if ${PORT_OPTIONS:MTHREADS}
MAKE_SH_ARGS+= --with-sb-thread
.if defined(WITH_FUTEX)
MAKE_SH_ARGS+= --with-sb-futex
.else
MAKE_SH_ARGS+= --without-sb-futex
.endif
.if defined(WITH_SAFEPOINT) || defined(WITH_STRICT_SAFEPOINT)
MAKE_SH_ARGS+= --with-sb-safepoint --with-sb-thruption --with-sb-wtimer
.if defined(WITH_STRICT_SAFEPOINT)
MAKE_SH_ARGS+= --with-sb-safepoint-strictly
.else
MAKE_SH_ARGS+= --without-sb-safepoint-strictly
.endif
.else
MAKE_SH_ARGS+= --without-sb-safepoint --without-sb-safepoint-strictly \
--without-sb-thruption --without-sb-wtimer
.endif
.else
MAKE_SH_ARGS+= --without-sb-thread
.endif
pre-everything::
@${ECHO_MSG}
@${ECHO_MSG} "---------------------------------------------------------"
@${ECHO_MSG} "You might need to adjust memory limits in order to"
@${ECHO_MSG} "build SBCL."
@${ECHO_MSG}
@${ECHO_MSG} "You can use the DYNAMIC_SPACE_SIZE knob to change the size"
@${ECHO_MSG} "of SBCL dynamically-allocated memory."
@${ECHO_MSG} "---------------------------------------------------------"
@${ECHO_MSG}
post-patch:
@${ECHO_CMD} "CC=${CC}" >> ${WRKSRC}/src/runtime/${SBCLCONFIG}
@${ECHO_CMD} "CFLAGS=${CFLAGS}" >> \
${WRKSRC}/src/runtime/${SBCLCONFIG}
@${ECHO_CMD} "CPPFLAGS=${CPPFLAGS}" >> \
${WRKSRC}/src/runtime/${SBCLCONFIG}
@${ECHO_CMD} "GREP=${GREP}" >> ${WRKSRC}/src/runtime/${SBCLCONFIG}
@${ECHO_CMD} "LD=${LD}" >> ${WRKSRC}/src/runtime/${SBCLCONFIG}
@${ECHO_CMD} "LINKFLAGS=${LDFLAGS} -dynamic -rdynamic" >> \
${WRKSRC}/src/runtime/${SBCLCONFIG}
@${ECHO_CMD} "NM=${NM} ${NMFLAGS}" >> \
${WRKSRC}/src/runtime/${SBCLCONFIG}
@${REINPLACE_CMD} -E -e 's,-lthr,-pthread,g' \
-e 's,-lpthread,-pthread,g' ${WRKSRC}/src/runtime/${SBCLCONFIG}
@${GREP} -Fe '.core' -l -r ${WRKSRC} | ${XARGS} ${REINPLACE_CMD} \
-e 's|\.core|_core|g'
@${REINPLACE_CMD} \
-e 's|/usr/local|${PREFIX}|g' \
${WRKSRC}/doc/sbcl.1
@${REINPLACE_CMD} -E -e 's!-sbcl-shared!& ${CFLAGS}!' \
-e 's!\$$(TEST_FILESTEM|x|1)_core!$${\1}_core!g' \
${WRKSRC}/tests/core.test.sh \
${WRKSRC}/tests/foreign.test.sh
@${REINPLACE_CMD} -E -e 's!"-O3"!!' \
-e 's!("-sbcl-(pic|shared)"[[:blank:]]*)+!& ${CFLAGS:C/.*/"&"/}!' \
${WRKSRC}/tests/foreign-stack-alignment.impure.lisp \
${WRKSRC}/tests/kill-non-lisp-thread.impure.lisp \
${WRKSRC}/tests/swap-lispobjs.impure.lisp \
${WRKSRC}/tests/threads.impure.lisp
@${REINPLACE_CMD} -e 's|( cd ./doc ; sh ./clean.sh )|#&|' \
${WRKSRC}/clean.sh
@case "`${CC} --version`" in \
*clang*) \
${REINPLACE_CMD} -e '/#define END()/s/\.end//' \
${WRKSRC}/src/runtime/x86-assem.S \
${WRKSRC}/src/runtime/x86-64-assem.S ;; \
esac
${REINPLACE_CMD} -e 's!/bin/bash!${LOCALBASE}&!' \
${WRKSRC}/release.sh \
${WRKSRC}/src/code/run-program.lisp \
${WRKSRC}/tests/run-compiler.sh
do-build:
@${FIND} ${WRKSRC} \( -name '*.orig' -o -name '*.bak' \) -delete
@(cd ${WRKSRC} && ${SETENV} CC="${CC}" ${SH} make.sh ${MAKE_SH_ARGS})
@${RM} -rf ${WRKSRC}/contrib/sb-cover/test-output
@${REINPLACE_CMD} -E -e \
's|\$$Date\$$|'"`${SETENV} LANG=C /bin/date '+%B %d, %Y'`|g" \
${WRKSRC}/doc/sbcl.1
do-install:
${MKDIR} ${SBCL_HOME}/
${INSTALL_PROGRAM} ${WRKSRC}/src/runtime/sbcl ${PREFIX}/bin/
${INSTALL_DATA} ${WRKSRC}/output/sbcl_core ${SBCL_HOME}/
.for MOD in ${CONTRIB_MODULES}
${MKDIR} ${SBCL_HOME}/${MOD}
${INSTALL_DATA} ${WRKSRC}/contrib/${MOD}/*.lisp ${SBCL_HOME}/${MOD}/
${INSTALL_DATA} ${WRKSRC}/contrib/${MOD}/*.fasl ${SBCL_HOME}/${MOD}/
(if test -f ${WRKSRC}/contrib/${MOD}/${MOD}.asd; then ${INSTALL_DATA} \
${WRKSRC}/contrib/${MOD}/${MOD}.asd ${SBCL_HOME}/${MOD}/; fi)
.endfor
.if ${PORT_OPTIONS:MDOCS}
${MKDIR} ${DOCSDIR}/
${INSTALL_DATA} ${MANUALS:S,^, ${WRKSRC}/doc/manual/,g} ${DOCSDIR}/
${INSTALL_DATA} ${TEXTDOCS:S,^,${WRKSRC}/,g} ${DOCSDIR}/
${MKDIR} ${MODULESDOCS:C,/[^/]+$,,g:u:S,^,${DOCSDIR}/,g}
. for MODDOC in ${MODULESDOCS}
${INSTALL_DATA} ${WRKSRC}/contrib/${MODDOC} ${DOCSDIR}/${MODDOC}
. endfor
.endif
${INSTALL_MAN} ${WRKSRC}/doc/sbcl.1 ${MAN1PREFIX}/man/man1
${MKDIR} ${SBCL_HOME}/site-systems
@${TOUCH} ${SBCL_HOME}/site-systems/.keep_me
check regression-test test: build
(cd ${WRKSRC}/tests && ${SETENV} CC="${CC}" ${SH} run-tests.sh)
bootstrap:
${CP} -r ${WRKSRC} ${WRKDIR}/${NEWBOOTNAME}
(cd ${WRKDIR}/ && \
${WRKDIR}/${NEWBOOTNAME}/binary-distribution.sh ${NEWBOOTNAME})
(cd ${WRKDIR}/ && ${BZIP2_CMD} ${NEWBOOTNAME}-binary.tar)
.include <bsd.port.mk>
|