Ticket #51333: Portfile

File Portfile, 7.8 KB (added by slewsys (Andrew L. Moore), 8 years ago)

Portfile for new port `nodejs-6'.

Line 
1# -*- 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
2# $Id: Portfile 147726 2016-04-13 07:36:32Z ciserlohn@macports.org $
3
4PortSystem              1.0
5PortGroup               compiler_blacklist_versions 1.0
6
7name                    nodejs
8version                 6.1.0
9
10categories              devel net
11platforms               darwin
12license                 {MIT BSD}
13maintainers             ciserlohn
14
15description             Evented I/O for V8 ES6 JavaScript.
16
17long_description        Node's goal is to provide an easy way to build scalable network programs in JavaScript. \
18                        Node is similar in design to and influenced by systems like Ruby's Event \
19                        Machine or Python's Twisted. Node takes the event model a bit further-it \
20                        presents the event loop as a runtime construct instead of as a library.
21
22conflicts               nodejs nodejs-devel
23
24homepage                http://nodejs.org/
25master_sites            ${homepage}dist/v${version}
26
27checksums               rmd160  384a04f194b2e09eac9b5b1264888a95a4dd7ea8 \
28                        sha256  9e67ef0b8611e16e6e311eccf0489a50fe76ceebeea3023ef4f51be647ae4bc3
29
30distname                node-v${version}
31
32depends_build           port:pkgconfig
33
34depends_lib             port:icu
35
36proc rec_glob {basedir pattern} {
37    set files [glob -directory $basedir -nocomplain -type f $pattern]
38    foreach dir [glob -directory $basedir -nocomplain -type d *] {
39        eval lappend files [rec_glob $dir $pattern]
40    }
41    return $files
42}
43
44configure.python ${prefix}/bin/python2.7
45
46post-patch {
47    foreach f [concat ${worksrcpath}/configure \
48                   ${worksrcpath}/tools/gyp/gyp \
49                   ${worksrcpath}/deps/cares/gyp_cares \
50                   ${worksrcpath}/deps/v8/build/gyp_v8 \
51                   ${worksrcpath}/deps/v8/tools/mingw-generate-makefiles.sh \
52                   [rec_glob ${worksrcpath} *.py]] {
53        reinplace "s|/usr/bin/env python|${configure.python}|" ${f}
54    }
55    foreach gypfile [rec_glob ${worksrcpath} *.gyp*] {
56        reinplace "s|'python'|'${configure.python}'|" ${gypfile}
57    }
58    reinplace "s|python|${configure.python}|" ${worksrcpath}/deps/v8/build/toolchain.gypi
59    reinplace "s|/usr/bin/env node|${prefix}/bin/node|" ${worksrcpath}/tools/doc/node_modules/marked/bin/marked
60}
61
62configure.args          --prefix=${prefix}
63configure.args-append   --without-ssl
64configure.args-append   --without-npm
65configure.args-append   --with-intl=system-icu
66
67variant python26 conflicts python27 description {Use python 2.6} {
68    depends_lib-append  port:python26
69    configure.python    ${prefix}/bin/python2.6
70}
71
72variant python27 conflicts python26 description {Use python 2.7} {
73    depends_lib-append  port:python27
74    configure.python    ${prefix}/bin/python2.7
75}
76
77if {![variant_isset python26]} {
78    default_variants +python27
79}
80
81variant ssl description {Add secure socket layer support} {
82    depends_build-append    port:pkgconfig
83    depends_lib-append      path:lib/libssl.dylib:openssl
84    configure.args-delete   --without-ssl
85    configure.args-append   --shared-openssl
86    configure.args-append   --shared-openssl-includes=${prefix}/include/openssl
87    configure.args-append   --shared-openssl-libpath=${prefix}/lib
88}
89
90default_variants        +ssl
91
92# V8 only supports ARM and IA-32 processors
93supported_archs         i386 x86_64
94
95universal_variant       no
96
97# "V8 doesn't like cache."
98configure.ccache        no
99
100test.run                yes
101
102use_parallel_build      no
103
104switch $build_arch {
105    i386 {
106        configure.args-append   --dest-cpu=ia32
107    }
108    x86_64 {
109        configure.args-append   --dest-cpu=x64
110    }
111}
112
113build.args-append   CC=${configure.cc} \
114                    CXX=${configure.cxx} \
115                    PYTHON=${configure.python} \
116                    V=1
117
118                    # CXX.host=${configure.cxx} \
119                    # CPP=${configure.cpp} \
120                    # CFLAGS="${configure.cflags}" \
121                    # CXXFLAGS="${configure.cxxflags}" \
122                    # LDFLAGS="${configure.ldflags}" \
123
124destroot {
125    set bindir ${destroot}${prefix}/bin
126    set libdir ${destroot}${prefix}/lib
127    set libndir ${libdir}/node
128    set libddir ${libdir}/dtrace
129    set incdir ${destroot}${prefix}/include/node
130    set docdir ${destroot}${prefix}/share/doc/${name}
131
132    xinstall -d ${bindir}
133    xinstall -d ${libdir}
134    xinstall -d ${libndir}
135    xinstall -d ${libddir}
136    xinstall -d ${incdir}
137    xinstall -d ${docdir}
138
139# install binaries
140    xinstall -m 755 -W ${worksrcpath} \
141        out/Release/node \
142        ${bindir}
143
144# install headers
145    xinstall -m 644 -W ${worksrcpath} \
146        src/async-wrap-inl.h \
147        src/async-wrap.h \
148        src/base-object-inl.h \
149        src/base-object.h \
150        src/env-inl.h \
151        src/env.h \
152        src/handle_wrap.h \
153        src/node.h \
154        src/node_buffer.h \
155        src/node_constants.h \
156        src/node_counters.h \
157        src/node_crypto.h \
158        src/node_crypto_bio.h \
159        src/node_crypto_clienthello-inl.h \
160        src/node_crypto_clienthello.h \
161        src/node_crypto_groups.h \
162        src/node_dtrace.h \
163        src/node_file.h \
164        src/node_http_parser.h \
165        src/node_i18n.h \
166        src/node_internals.h \
167        src/node_javascript.h \
168        src/node_lttng_tp.h \
169        src/node_object_wrap.h \
170        src/node_revert.h \
171        src/node_root_certs.h \
172        src/node_stat_watcher.h \
173        src/node_version.h \
174        src/node_watchdog.h \
175        src/node_wrap.h \
176        src/pipe_wrap.h \
177        src/spawn_sync.h \
178        src/stream_base-inl.h \
179        src/stream_base.h \
180        src/stream_wrap.h \
181        src/string_bytes.h \
182        src/string_search.h \
183        src/tcp_wrap.h \
184        src/tls_wrap.h \
185        src/tree.h \
186        src/tty_wrap.h \
187        src/udp_wrap.h \
188        src/util-inl.h \
189        src/util.h \
190        src/v8abbr.h \
191        deps/v8/include/v8-debug.h \
192        deps/v8/include/v8-experimental.h \
193        deps/v8/include/v8-platform.h \
194        deps/v8/include/v8-profiler.h \
195        deps/v8/include/v8-testing.h \
196        deps/v8/include/v8-util.h \
197        deps/v8/include/v8-version.h \
198        deps/v8/include/v8.h \
199        deps/v8/include/v8config.h \
200        deps/uv/include/android-ifaddrs.h \
201        deps/uv/include/pthread-fixes.h \
202        deps/uv/include/tree.h \
203        deps/uv/include/uv-bsd.h \
204        deps/uv/include/uv-darwin.h \
205        deps/uv/include/uv-errno.h \
206        deps/uv/include/uv-linux.h \
207        deps/uv/include/uv-threadpool.h \
208        deps/uv/include/uv-unix.h \
209        deps/uv/include/uv-version.h \
210        deps/uv/include/uv.h \
211        deps/cares/include/ares.h \
212        deps/cares/include/ares_build.h \
213        deps/cares/include/ares_rules.h \
214        deps/cares/include/ares_version.h \
215        deps/cares/include/nameser.h \
216        ${incdir}
217
218# install dtrace script
219    xinstall -m 644 -W ${worksrcpath} \
220        src/node.d \
221        ${libddir}
222
223# install manpage
224    xinstall -m 644 -W ${worksrcpath} \
225        doc/node.1 \
226        ${destroot}${prefix}/share/man/man1
227
228# install docs
229    xinstall -d ${docdir}/README
230
231    xinstall -m 644 -W ${worksrcpath} \
232        AUTHORS \
233        LICENSE \
234        ${docdir}/README
235
236    foreach f [glob -directory ${worksrcpath} -nocomplain -type f *.md] {
237        xinstall -m 644 ${f} ${docdir}/README
238    }
239
240# install full docs
241    foreach d [glob -directory ${worksrcpath}/doc -nocomplain *] {
242        copy ${d} ${docdir}
243    }
244       
245# install
246}
247
248compiler.blacklist *gcc* {clang < 300}
249
250if {${os.major} < 10} {
251    pre-fetch {
252        ui_error "${name} ${version} requires Mac OS X 10.6 or greater."
253        return -code error "incompatible Mac OS X version"
254    }
255}
256
257livecheck.url       ${homepage}dist/
258livecheck.type      regex
259livecheck.regex     {v(6\.\d+\.\d+)}