| 1 |
# $FreeBSD$ |
| 2 |
|
| 3 |
PORTNAME= node |
| 4 |
PORTVERSION= 8.1.2 |
| 5 |
DISTVERSIONPREFIX= v |
| 6 |
CATEGORIES= www |
| 7 |
MASTER_SITES= http://nodejs.org/dist/v${PORTVERSION}/ |
| 8 |
|
| 9 |
MAINTAINER= bhughes@FreeBSD.org |
| 10 |
COMMENT= V8 JavaScript for client and server |
| 11 |
|
| 12 |
LICENSE= MIT |
| 13 |
LICENSE_FILE= ${WRKSRC}/LICENSE |
| 14 |
|
| 15 |
OPTIONS_DEFINE= BUNDLED_SSL DOCS NLS DTRACE |
| 16 |
OPTIONS_DEFAULT=DTRACE |
| 17 |
OPTIONS_SUB= yes |
| 18 |
|
| 19 |
OPTIONS_DEFAULT_FreeBSD_10= BUNDLED_SSL |
| 20 |
OPTIONS_DEFAULT+= ${OPTIONS_DEFAULT_${OPSYS}_${OSREL:R}} |
| 21 |
|
| 22 |
.if !exists(/usr/sbin/dtrace) |
| 23 |
OPTIONS_EXCLUDE+= DTRACE |
| 24 |
.endif |
| 25 |
|
| 26 |
OPTIONS_EXCLUDE_FreeBSD_10= DTRACE |
| 27 |
|
| 28 |
BUNDLED_SSL_DESC= Use node.js's bundled OpenSSL implementation |
| 29 |
BUNDLED_SSL_USES_OFF= ssl |
| 30 |
BUNDLED_SSL_CONFIGURE_OFF= --shared-openssl --openssl-use-def-ca-store |
| 31 |
BUNDLED_SSL_RUN_DEPENDS_OFF= ca_root_nss>=0:security/ca_root_nss |
| 32 |
|
| 33 |
NLS_CONFIGURE_ON= --with-intl=system-icu |
| 34 |
NLS_LIB_DEPENDS= libicui18n.so:devel/icu |
| 35 |
|
| 36 |
USES= compiler:c++11-lib execinfo gmake python:2,build pkgconfig \ |
| 37 |
localbase shebangfix |
| 38 |
|
| 39 |
HAS_CONFIGURE= yes |
| 40 |
USE_LDCONFIG= yes |
| 41 |
|
| 42 |
CONFLICTS_INSTALL= node[456]-[0-9]* node01[02]-[0-9]* node-devel-[0-9]* iojs-[0-9]* |
| 43 |
|
| 44 |
ONLY_FOR_ARCHS= amd64 armv6 i386 |
| 45 |
|
| 46 |
CONFIGURE_ARGS= --prefix=${PREFIX_RELDEST} \ |
| 47 |
--without-npm \ |
| 48 |
--shared-cares \ |
| 49 |
--shared-libuv \ |
| 50 |
--shared-zlib |
| 51 |
|
| 52 |
SHEBANG_FILES= tools/specialize_node_d.py tools/genv8constants.py |
| 53 |
|
| 54 |
PREFIX_RELDEST= ${PREFIX:S,^${DESTDIR},,} |
| 55 |
REINPLACE_ARGS= -i '' |
| 56 |
MAKE_ENV+= CC.host=${CC} CXX.host=${CXX} LINK.host=${CXX} LINK.target=${CXX} |
| 57 |
|
| 58 |
LIB_DEPENDS+= libcares.so:dns/c-ares\ |
| 59 |
libuv.so:devel/libuv |
| 60 |
|
| 61 |
.include <bsd.port.options.mk> |
| 62 |
|
| 63 |
.if empty(PORT_OPTIONS:MBUNDLED_SSL) |
| 64 |
|
| 65 |
.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100085 && ${SSL_DEFAULT} == base |
| 66 |
IGNORE= node.js requires openssl 1.0.2, add DEFAULT_VERSIONS+=ssl=openssl to /etc/make.conf or enable BUNDLED_SSL option |
| 67 |
.endif |
| 68 |
|
| 69 |
.if !empty(SSL_DEFAULT:Mlibressl*) |
| 70 |
IGNORE= cannot build node.js with LibreSSL. You must enable BUNDLED_SSL |
| 71 |
.endif |
| 72 |
|
| 73 |
.endif |
| 74 |
|
| 75 |
.include <bsd.port.pre.mk> |
| 76 |
|
| 77 |
.if ${ARCH} == "armv6" |
| 78 |
CONFIGURE_ARGS+=--openssl-no-asm |
| 79 |
.endif |
| 80 |
|
| 81 |
.if ${COMPILER_TYPE} == gcc |
| 82 |
# GCC does not expose std::snprintf() without this define |
| 83 |
CXXFLAGS+= -D_GLIBCXX_USE_C99 |
| 84 |
.endif |
| 85 |
|
| 86 |
.if ${COMPILER_TYPE} == clang && ${COMPILER_VERSION} < 40 |
| 87 |
# Conditinal work around for a bug in libc++ included with clang 3.x: |
| 88 |
# https://bugs.llvm.org/show_bug.cgi?id=18249 |
| 89 |
# https://bugs.llvm.org/show_bug.cgi?id=18350 |
| 90 |
# https://bugs.llvm.org/show_bug.cgi?id=18853 |
| 91 |
# |
| 92 |
# Upstream Node.js adds the define to all FreeBSD builds. This breaks |
| 93 |
# the build with clang 4.0, so we patch it out (files/patch-common.gypi) |
| 94 |
# and add it here instead. |
| 95 |
CXXFLAGS+= -D_LIBCPP_TRIVIAL_PAIR_COPY_CTOR |
| 96 |
.endif |
| 97 |
|
| 98 |
.if ${PORT_OPTIONS:MDTRACE} |
| 99 |
CONFIGURE_ARGS+= --with-dtrace |
| 100 |
.endif |
| 101 |
|
| 102 |
post-patch: |
| 103 |
@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' \ |
| 104 |
${WRKSRC}/deps/v8/src/v8.gyp |
| 105 |
# So many different ways to run python. Fix them all. |
| 106 |
@${REINPLACE_CMD} -e 's|/usr/bin/env python|${PYTHON_CMD}|' \ |
| 107 |
${WRKSRC}/configure |
| 108 |
@${FIND} ${WRKSRC} -type f -name '*.gyp*' -print0 \ |
| 109 |
| ${XARGS} -0 ${REINPLACE_CMD} \ |
| 110 |
-e "s|'python'|'${PYTHON_CMD}'|" \ |
| 111 |
-e 's|<!(python |<!(${PYTHON_CMD} |' \ |
| 112 |
-e 's|\&\& python |\&\& ${PYTHON_CMD} |' |
| 113 |
|
| 114 |
post-configure: |
| 115 |
# Post-process Makefile and *.mk files created by node-gyp and remove |
| 116 |
# all occurrences of -I${LOCALBASE}/include. C*FLAGS include this |
| 117 |
# before all -I../deps/* for bundled code. This can cause build |
| 118 |
# breakages if the dependency is installed in ${LOCALBASE}. The |
| 119 |
# USES+=localbase # above will ensure that we pick up includes for real |
| 120 |
# external dependencies. |
| 121 |
${FIND} ${WRKSRC}/out -type f -print0 \ |
| 122 |
| ${XARGS} -0 ${REINPLACE_CMD} -e "s|-I${LOCALBASE}/include||g" |
| 123 |
|
| 124 |
post-install: |
| 125 |
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/node |
| 126 |
|
| 127 |
.include <bsd.port.post.mk> |