Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149504002
D29362.1790311438.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D29362.1790311438.diff
View Options
Index: www/unit-nodejs/Makefile
===================================================================
--- /dev/null
+++ www/unit-nodejs/Makefile
@@ -0,0 +1,113 @@
+# Created by: Sergey Osokin <osa@FreeBSD.org>
+# $FreeBSD$
+
+MASTER_SITES= https://unit.nginx.org/download/:unit \
+ https://codeload.github.com/nodejs/node-gyp/tar.gz/v${NODE_GYP_VERSION}?dummy=/:node_gyp
+PKGNAMESUFFIX= -${UNIT_MODNAME}
+DISTFILES= unit-${UNIT_VERSION}${EXTRACT_SUFX}:unit \
+ node-gyp-${NODE_GYP_VERSION}${EXTRACT_SUFX}:node_gyp
+
+COMMENT= NodeJS module for NGINX Unit
+
+DISTINFO_FILE= ${.CURDIR}/distinfo
+
+PATCHDIR= ${.CURDIR}/files
+
+UNIT_MODNAME= nodejs
+
+BUILD_DEPENDS= ${LOCALBASE}/lib/libunit.a:devel/libunit \
+ node:www/node \
+ npm:www/npm
+RUN_DEPENDS= unitd:www/unit
+
+UNIT_VERSION= 1.22.0
+NODE_GYP_VERSION= 7.1.2
+
+USES= python:build
+
+MAKE_ENV+= DISTDIR="${DISTDIR}"
+MAKE_ENV+= NODEJS_VERSION="${NODEJS_VERSION}"
+MAKE_ENV+= PYTHON="${PYTHON_CMD}"
+MAKE_ENV+= _DEVDIR="${_DEVDIR}"
+
+USE_RC_SUBR?= # reset to empty
+
+MASTERDIR= ${.CURDIR}/../unit
+
+PLIST_DIRS=
+PLIST_FILES= lib/node_modules/unit-http/addon.cpp \
+ lib/node_modules/unit-http/binding_pub.gyp \
+ lib/node_modules/unit-http/binding.gyp \
+ lib/node_modules/unit-http/http_server.js \
+ lib/node_modules/unit-http/http.js \
+ lib/node_modules/unit-http/nxt_napi.h \
+ lib/node_modules/unit-http/package.json \
+ lib/node_modules/unit-http/README.md \
+ lib/node_modules/unit-http/socket.js \
+ lib/node_modules/unit-http/unit.cpp \
+ lib/node_modules/unit-http/unit.h \
+ lib/node_modules/unit-http/utils.js \
+ lib/node_modules/unit-http/version.h \
+ lib/node_modules/unit-http/websocket_connection.js \
+ lib/node_modules/unit-http/websocket_frame.js \
+ lib/node_modules/unit-http/websocket_request.js \
+ lib/node_modules/unit-http/websocket_router_request.js \
+ lib/node_modules/unit-http/websocket_router.js \
+ lib/node_modules/unit-http/websocket_server.js \
+ lib/node_modules/unit-http/websocket.js \
+ lib/node_modules/unit-http/build/binding.Makefile \
+ lib/node_modules/unit-http/build/config.gypi \
+ lib/node_modules/unit-http/build/unit-http.target.mk \
+ lib/node_modules/unit-http/build/Release/unit-http.node
+
+_NODECMD= ${LOCALBASE}/bin/node --version
+_DEVDIR:= ${WRKDIR}/.devdir
+
+post-extract:
+ ${MKDIR} ${_DEVDIR}/bin
+ (cd ${WRKDIR}/node-gyp-${NODE_GYP_VERSION} && \
+ ${COPYTREE_SHARE} . ${_DEVDIR}/lib/node_modules/node-gyp \
+ "! ( -name \.* -or -path *\/\.github\/* -or -name test -or -path *\/test\/* )")
+ ${RLN} ${_DEVDIR}/lib/node_modules/node-gyp/bin/node-gyp.js \
+ ${_DEVDIR}/bin/node-gyp && \
+ ${CHMOD} 0755 ${_DEVDIR}/bin/node-gyp && \
+ ${LN} -s ${LOCALBASE}/lib/node_modules/npm/node_modules \
+ ${_DEVDIR}/lib/node_modules/node-gyp/node_modules
+
+post-patch:
+ ${REINPLACE_CMD} -i "" -e "s|%%PREFIX%%|${PREFIX}|g" \
+ ${WRKSRC}/src/nodejs/unit-http/binding.gyp
+ ${REINPLACE_CMD} -i "" -e "s|%%DEVDIR%%|${_DEVDIR}|g" \
+ ${WRKSRC}/src/nodejs/unit-http/package.json
+
+pre-configure:
+ (_NODEVER=$$(${_NODECMD} | ${SED} -n 's|^v\(.*\)|\1|p') && \
+ ${MKDIR} ${_DEVDIR}/$${_NODEVER}/include && \
+ ${RLN} ${LOCALBASE}/include/node ${_DEVDIR}/$${_NODEVER}/include/node && \
+ ${ECHO} "9" > ${_DEVDIR}/$${_NODEVER}/installVersion \
+ )
+
+post-configure:
+ @cd ${CONFIGURE_WRKSRC} && \
+ ${SETENV} ${MAKE_ENV} ${CONFIGURE_CMD} nodejs \
+ --node-gyp=${_DEVDIR}/bin/node-gyp \
+ --local=${STAGEDIR}${PREFIX}/lib/node_modules/unit-http
+
+do-build:
+ @cd ${CONFIGURE_WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} node
+
+do-install:
+ @cd ${CONFIGURE_WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} node-local-install
+
+post-install:
+ ${INSTALL_DATA} ${WRKSRC}/src/nodejs/unit-http/package.json.orig \
+ ${STAGEDIR}${PREFIX}/lib/node_modules/unit-http/package.json
+ ${RM} -rf ${STAGEDIR}${PREFIX}/lib/node_modules/unit-http/build/Release/.deps \
+ ${STAGEDIR}${PREFIX}/lib/node_modules/unit-http/build/Release/obj.target
+ ${RM} ${STAGEDIR}${PREFIX}/lib/node_modules/unit-http/build/Makefile \
+ ${STAGEDIR}${PREFIX}/lib/node_modules/unit-http/build/Release/binding.Makefile \
+ ${STAGEDIR}${PREFIX}/lib/node_modules/unit-http/build/Release/config.gypi \
+ ${STAGEDIR}${PREFIX}/lib/node_modules/unit-http/build/Release/unit-http.target.mk \
+ ${STAGEDIR}${PREFIX}/lib/package-lock.json
+
+.include "${MASTERDIR}/Makefile"
Index: www/unit-nodejs/distinfo
===================================================================
--- /dev/null
+++ www/unit-nodejs/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1616016838
+SHA256 (unit-1.22.0.tar.gz) = d244e99ab7ff81c2926bdb97dd7d38e54a3361c7b8d3097e7dfbb2d155306b4b
+SIZE (unit-1.22.0.tar.gz) = 824763
+SHA256 (node-gyp-7.1.2.tar.gz) = e9a42f7afa3e5386c1dee094b8751f6924e75d6921166d1cad6ebafc19c54957
+SIZE (node-gyp-7.1.2.tar.gz) = 439880
Index: www/unit-nodejs/files/patch-auto-modules-nodejs
===================================================================
--- /dev/null
+++ www/unit-nodejs/files/patch-auto-modules-nodejs
@@ -0,0 +1,20 @@
+--- auto/modules/nodejs.orig 2021-02-04 10:22:33.000000000 -0500
++++ auto/modules/nodejs 2021-03-17 10:19:41.888060000 -0400
+@@ -147,7 +147,7 @@
+
+ ${NXT_NODE}: ${NXT_NODE}-copy $NXT_BUILD_DIR/$NXT_LIB_UNIT_STATIC
+ ${NXT_NODE_EXPORTS} && \\
+- cd ${NXT_NODE_TMP} && ${NXT_NODE_GYP} configure build clean
++ cd ${NXT_NODE_TMP} && ${NXT_NODE_GYP} configure build clean --devdir=${_DEVDIR} --offline
+
+ ${NXT_NODE}-copy: ${NXT_NODE_VERSION_FILE}
+ mkdir -p ${NXT_BUILD_DIR}/src/
+@@ -158,7 +158,7 @@
+ $echo '#define NXT_NODE_VERNUM \$(NXT_VERNUM)' > $NXT_NODE_VERSION_FILE
+
+ ${NXT_NODE_TARBALL}: ${NXT_NODE}-copy
+- sed -e 's/"version"\s*:.*/"version": "\$(NXT_VERSION)",/' \
++ sed -e 's/"version"[[:space:]]*:.*/"version": "\$(NXT_VERSION)",/' \
+ ${NXT_NODE_TMP}/package.json > ${NXT_NODE_TMP}/package.json.tmp
+ mv ${NXT_NODE_TMP}/package.json.tmp ${NXT_NODE_TMP}/package.json
+ tar -zcvf ${NXT_NODE_TARBALL} -C ${NXT_NODE_TMP} .
Index: www/unit-nodejs/files/patch-src-nodejs-unit--http-binding.gyp
===================================================================
--- /dev/null
+++ www/unit-nodejs/files/patch-src-nodejs-unit--http-binding.gyp
@@ -0,0 +1,15 @@
+--- src/nodejs/unit-http/binding.gyp.orig 2021-03-10 13:58:22.190304000 -0500
++++ src/nodejs/unit-http/binding.gyp 2021-03-10 13:59:53.258512000 -0500
+@@ -12,10 +12,10 @@
+ ],
+ 'sources': ["unit.cpp", "addon.cpp"],
+ 'include_dirs': [
+- "<!(echo $UNIT_SRC_PATH)", "<!(echo $UNIT_BUILD_PATH)"
++ "/usr/include", "%%PREFIX%%/include"
+ ],
+ 'libraries': [
+- "<!(echo $UNIT_LIB_STATIC_PATH)"
++ "%%PREFIX%%/lib/libunit.a"
+ ]
+ }]
+ }
Index: www/unit-nodejs/files/patch-src-nodejs-unit--http-package.json
===================================================================
--- /dev/null
+++ www/unit-nodejs/files/patch-src-nodejs-unit--http-package.json
@@ -0,0 +1,15 @@
+--- src/nodejs/unit-http/package.json.orig 2021-03-19 15:58:15.259816000 -0400
++++ src/nodejs/unit-http/package.json 2021-03-19 15:58:52.582214000 -0400
+@@ -25,9 +25,9 @@
+ ],
+ "scripts": {
+ "clean": "node-gyp clean",
+- "configure": "node-gyp configure",
+- "build": "node-gyp build",
+- "install": "node-gyp configure build"
++ "configure": "node-gyp configure --offline --devdir=%%DEVDIR%%",
++ "build": "node-gyp build --offline --devdir=%%DEVDIR%%",
++ "install": "node-gyp configure build --offline --devdir=%%DEVDIR%%"
+ },
+ "author": "Alexander Borisov",
+ "license": "Apache-2.0",
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Sep 25, 4:43 AM (5 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29908923
Default Alt Text
D29362.1790311438.diff (7 KB)
Attached To
Mode
D29362: Add www/unit-nodejs port, nodejs module for NGINX Unit
Attached
Detach File
Event Timeline
Log In to Comment