-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Portfile
196 lines (158 loc) · 6.42 KB
/
Portfile
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
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup compiler_blacklist_versions 1.0
PortGroup legacysupport 1.1
PortGroup openssl 1.0
PortGroup deprecated 1.0
# EOL 2022-04-30
# https://github.com/nodejs/Release
deprecated.eol_version yes
# Peg back to openssl 1.1 release
openssl.branch 1.1
openssl.configure pkgconfig build_flags
# on macOS nodejs only builds against libc++
# this force is OK as node does not link against any other c++ libs
depends_lib-append port:libcxx
configure.cxx_stdlib libc++
compiler.cxx_standard 2014
name nodejs12
version 12.22.12
revision 4
categories devel net
platforms darwin
license {MIT BSD}
maintainers {ciserlohn @ci42} openmaintainer
description Evented I/O for V8 JavaScript
long_description Node's goal is to provide an easy way to build scalable network programs in JavaScript. \
Node is similar in design to and influenced by systems like Ruby's Event \
Machine or Python's Twisted. Node takes the event model a bit further-it \
presents the event loop as a language construct instead of as a library.
conflicts nodejs8 nodejs10 nodejs13 nodejs14 nodejs15 nodejs16 nodejs17 nodejs18 nodejs19 nodejs20 nodejs21 nodejs22
homepage https://nodejs.org/
master_sites ${homepage}dist/v${version}
use_xz yes
checksums rmd160 684502d48e0d2c64759184e3efc1d8aae1610e00 \
sha256 bc42b7f8495b9bfc7f7850dd180bb02a5bdf139cc232b8c6f02a6967e20714f2 \
size 24088012
distname node-v${version}
depends_build-append port:pkgconfig
set py_ver 3.9
set py_ver_nodot [string map {. {}} ${py_ver}]
depends_lib-append path:lib/pkgconfig/icu-uc.pc:icu \
port:python${py_ver_nodot} \
port:zlib
use_xcode yes
proc rec_glob {basedir pattern} {
set files [glob -directory $basedir -nocomplain -type f $pattern]
foreach dir [glob -directory $basedir -nocomplain -type d *] {
lappend files {*}[rec_glob $dir $pattern]
}
return $files
}
configure.python ${prefix}/bin/python${py_ver}
patchfiles patch-common.gypi.diff
post-patch {
foreach f [concat ${worksrcpath}/configure \
${worksrcpath}/tools/gyp/gyp \
${worksrcpath}/deps/v8/tools/objdump-v8 \
[rec_glob ${worksrcpath} *.py]] {
reinplace -q "s|/usr/bin/env python3|${configure.python}|" ${f}
reinplace -q "s|/usr/bin/env python|${configure.python}|" ${f}
}
foreach gypfile [rec_glob ${worksrcpath} *.gyp*] {
reinplace -q "s|'python3'|'${configure.python}'|" ${gypfile}
reinplace -q "s|'python'|'${configure.python}'|" ${gypfile}
}
}
# use the system libuv instead of the bundled version, as it is fixed for older systems
if { ${os.platform} eq "darwin" && ${os.major} < 11 } {
depends_lib-append path:lib/libuv.dylib:libuv
configure.args-append --shared-libuv
}
pre-configure {
# Copy zlib headers here because we do not want to prepend the entire
# ${prefix}/include to the include path (the build will then attempt to use
# ICU 67 headers)
file mkdir ${workpath}/zlib-inc
file copy ${prefix}/include/zconf.h ${prefix}/include/zlib.h \
${workpath}/zlib-inc/
}
configure.args-append --without-npm
configure.args-append --with-intl=system-icu
configure.args-append --shared-openssl
configure.args-append --shared-openssl-includes=[openssl::include_dir]
configure.args-append --shared-openssl-libpath=[openssl::lib_dir]
configure.args-append --shared-zlib
configure.args-append --shared-zlib-includes=${workpath}/zlib-inc
configure.args-append --shared-zlib-libpath=${prefix}/lib
# V8 only supports ARM and IA-32 processors
supported_archs i386 x86_64 arm64
universal_variant no
# "V8 doesn't like cache."
configure.ccache no
test.run yes
test.cmd ${build.cmd} -j${build.jobs}
switch $build_arch {
i386 {
configure.args-append --dest-cpu=ia32
}
x86_64 {
configure.args-append --dest-cpu=x64
}
arm64 {
configure.args-append --dest-cpu=arm64
}
}
compiler.blacklist-append {clang < 800}
build.args-append CC=${configure.cc} \
CXX=${configure.cxx} \
CXX.host=${configure.cxx} \
CPP=${configure.cpp} \
CFLAGS="${configure.cflags}" \
CXXFLAGS="${configure.cxxflags}" \
LDFLAGS="${configure.ldflags} [legacysupport::get_library_link_flags]" \
PYTHON=${configure.python} \
V=1
destroot {
set bindir ${destroot}${prefix}/bin
set libdir ${destroot}${prefix}/lib
set libndir ${libdir}/node
set libddir ${libdir}/dtrace
set incdir ${destroot}${prefix}/include/node
set docdir ${destroot}${prefix}/share/doc/${name}
xinstall -d ${bindir}
xinstall -d ${libdir}
xinstall -d ${libndir}
xinstall -d ${libddir}
xinstall -d ${incdir}
xinstall -d ${docdir}
# install binaries
xinstall -m 755 -W ${worksrcpath} \
out/Release/node \
${bindir}
# install headers
xinstall -m 644 {*}[glob ${worksrcpath}/src/*.h] ${incdir}
xinstall -m 644 {*}[glob ${worksrcpath}/deps/v8/include/*.h] ${incdir}
xinstall -m 644 {*}[glob ${worksrcpath}/deps/uv/include/*.h] ${incdir}
xinstall -m 644 {*}[glob ${worksrcpath}/deps/cares/include/*.h] ${incdir}
# install dtrace script
xinstall -m 644 -W ${worksrcpath} \
src/node.d \
${libddir}
# install manpage
xinstall -m 644 -W ${worksrcpath} \
doc/node.1 \
${destroot}${prefix}/share/man/man1
# install docs
xinstall -m 644 -W ${worksrcpath} \
AUTHORS \
CHANGELOG.md \
CONTRIBUTING.md \
GOVERNANCE.md \
LICENSE \
README.md \
${docdir}
}
livecheck.url ${homepage}dist/
livecheck.type regex
livecheck.regex {v(12\.\d+\.\d+)}