blob: 52efcb06fa1cc53bcc830f9bcef5cf9d3a475992 (
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
|
PORTNAME= nim
DISTVERSION= 1.6.10
CATEGORIES= lang
MASTER_SITES= https://nim-lang.org/download/
MAINTAINER= ports@nicandneal.net
COMMENT= Nim programming language
WWW= https://nim-lang.org/
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/copying.txt
BROKEN_sparc64= fails to build: build.sh: clang: not found
LIB_DEPENDS= libpcre.so:devel/pcre
TEST_DEPENDS= node>=0:www/node
USES= compiler:c11 cpe tar:xz
CPE_VENDOR= nim-lang
OPTIONS_DEFINE= DOCS TOOLS
OPTIONS_DEFAULT= TOOLS
OPTIONS_EXCLUDE_powerpc64= DOCS
OPTIONS_SUB= yes
TOOLS_DESC= Build and install nim tools, not including nimble nor nimfind
TEST_BINARY_ALIAS= node=nodejs
.include <bsd.port.pre.mk>
TLIST= nimgrep nimpretty nimsuggest testament
.if ${CHOSEN_COMPILER_TYPE} == "gcc"
EXTRA_PATCHES= ${PATCHDIR}/elfv1-patch-build.sh
.else
EXTRA_PATCHES= ${PATCHDIR}/clang-patch-build.sh
.endif
post-patch:
.if defined(PPC_ABI) && ${PPC_ABI} == ELFv1
@${REINPLACE_CMD} -e '/cc =/s/clang/gcc/' ${WRKSRC}/config/nim.cfg
@${REINPLACE_CMD} -e s/%%GCC_DEFAULT%%/${GCC_DEFAULT}/ \
${WRKSRC}/build.sh ${WRKSRC}/config/nim.cfg
.endif
# Make a fake nimdoc.css so that we can change the expected target
# to where it should be, instead of where the nim project hard
# code it to be.
${MKDIR} ${WRKSRC}/share/doc/nim
${LN} -s ${WRKSRC}/doc/nimdoc.css ${WRKSRC}/share/doc/nim/nimdoc.css
${MKDIR} ${WRKSRC}/share/nim
${LN} -s ${WRKSRC}/tools/dochack ${WRKSRC}/share/nim/dochack
do-build:
cd ${WRKSRC} && ${SETENV} CC="${CC}" LINKER="${CC}" \
COMP_FLAGS="${CPPFLAGS} ${CFLAGS}" LINK_FLAGS="${LDFLAGS}" \
${SH} build.sh
cd ${WRKSRC} && bin/nim c --parallelBuild=${MAKE_JOBS_NUMBER} \
--nimcache=${WRKDIR}/nimcache -d:release koch
cd ${WRKSRC} && ./koch boot --parallelBuild=${MAKE_JOBS_NUMBER} \
-d:release --nimcache=${WRKDIR}/nimcache
cd ${WRKSRC} && bin/nim c --parallelBuild=${MAKE_JOBS_NUMBER} \
-d:release --nimcache=${WRKDIR}/nimcache --app:lib \
-d:createNimRtl lib/nimrtl.nim
do-build-DOCS-on:
cd ${WRKSRC} && ./koch --localdocs docs \
-d:release --nimcache=${WRKDIR}/nimcache --docCmd=skip
do-build-TOOLS-on:
cd ${WRKSRC} && ./koch tools --parallelBuild=${MAKE_JOBS_NUMBER} \
-d:release --nimcache=${WRKSRC}/nimcache
do-install:
# Install nim compiler
${INSTALL_PROGRAM} ${WRKSRC}/bin/nim ${STAGEDIR}${PREFIX}/bin
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/nim
# Install lib nim rtl
${INSTALL_LIB} ${WRKSRC}/lib/libnimrtl.so ${STAGEDIR}${PREFIX}/lib
# Install nim lib files
${MKDIR} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}
(cd ${WRKSRC}/lib && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/lib/${PORTNAME} "! -name libnimrtl.so")
${MKDIR} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/compiler
(cd ${WRKSRC}/compiler && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/compiler "! -name nim ! -name nim1")
# Configuration files
${MKDIR} ${STAGEDIR}${ETCDIR}
.for file in nim.cfg nimdoc.cfg nimdoc.tex.cfg
${INSTALL_DATA} ${WRKSRC}/config/${file} ${STAGEDIR}${ETCDIR}
.endfor
do-install-DOCS-on:
${FIND} ${WRKSRC}/doc -name "*.idx" -delete
${MKDIR} ${STAGEDIR}${DOCSDIR}
(cd ${WRKSRC}/doc && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR})
do-install-TOOLS-on:
.for t in ${TLIST}
${INSTALL_PROGRAM} ${WRKSRC}/bin/${t} ${STAGEDIR}${PREFIX}/bin
.endfor
${MKDIR} ${STAGEDIR}${PREFIX}/share/nim/dochack
${INSTALL_SCRIPT} ${WRKSRC}/tools/dochack/dochack.nim ${STAGEDIR}${PREFIX}/share/nim/dochack
${INSTALL_SCRIPT} ${WRKSRC}/tools/dochack/dochack.js ${STAGEDIR}${PREFIX}/share/nim/dochack
${INSTALL_SCRIPT} ${WRKSRC}/tools/dochack/fuzzysearch.nim ${STAGEDIR}${PREFIX}/share/nim/dochack
do-test:
cd ${WRKSRC} && ${SETENV} ./koch test all -d:release \
--nimcache=${WRKDIR}/nimcache --putenv:"PATH=${PATH}"
.include <bsd.port.post.mk>
|