Saturday, May 27, 2023

Re: [PATCH] www/unit: enable njs

Le Sat, May 27, 2023 at 09:19:24AM +0200, Landry Breuil a écrit :
> Le Fri, May 26, 2023 at 03:45:53PM +0000, Sergey A. Osokin a écrit :
> > Hi,
> >
> > lang/njs has been added to the ports tree recently, so
> > here's the patch to enable nginx javascript for www/unit.
>
> i've had a look and thought this was mostly ok, but first there's
> something to fix in the current njs port, because the njs.pc file
> shipped has very wrong paths:
>
> [09:16] c64:/usr/obj/ports/unit-perl-1.30.0/unit-1.30.0/ $cat/usr/local/lib/pkgconfig/njs.pc
> prefix=/usr/obj/ports/njs-0.7.12/njs-0.7.12/build
> libdir=/usr/obj/ports/njs-0.7.12/njs-0.7.12/build
>
> Name: njs
> Description: library to embed njs scripting language
> Version: 0.7.12
> Libs: -L${libdir} -lnjs -lm -L/usr/local/lib -Wl,-R/usr/local/lib
> -lpcre2-8 -lcrypto -L/usr/local/lib -lxml2 -lz
> Cflags: -I/usr/obj/ports/njs-0.7.12/njs-0.7.12/build -I/usr/obj/ports/njs-0.7.12/njs-0.7.12/src

the below patch might not be the 'best' one, but it produces a much more
correct pc file. checking that www/unit still detects njs with that.

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/njs/Makefile,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile
--- Makefile 25 May 2023 09:29:24 -0000 1.1.1.1
+++ Makefile 27 May 2023 07:54:10 -0000
@@ -22,6 +22,9 @@

ALL_TARGET= libnjs njs

+post-patch:
+ ${SUBST_CMD} ${WRKSRC}/auto/make
+
do-install:
${INSTALL_PROGRAM} ${WRKDIST}/build/njs ${PREFIX}/bin
${INSTALL_DATA} ${WRKSRC}/src/*.h ${PREFIX}/include
Index: patches/patch-auto_make
===================================================================
RCS file: /cvs/ports/lang/njs/patches/patch-auto_make,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 patch-auto_make
--- patches/patch-auto_make 25 May 2023 09:29:24 -0000 1.1.1.1
+++ patches/patch-auto_make 27 May 2023 07:54:10 -0000
@@ -13,9 +13,9 @@
- -e "s,@CFLAGS@,-I$(pwd)/$NJS_BUILD_DIR -I$(pwd)/src," \\
- -e "s,@VERSION@,\$(NJS_VER)," \\
- -e "s,@EXTRA_LIBS@,-lm $NJS_LIBS $NJS_LIB_AUX_LIBS," \\
-+ sed -e "s|@PREFIX@|$(pwd)/$NJS_BUILD_DIR|" \\
-+ -e "s|@LIBDIR@|$(pwd)/$NJS_BUILD_DIR|" \\
-+ -e "s|@CFLAGS@|-I$(pwd)/$NJS_BUILD_DIR -I$(pwd)/src|" \\
++ sed -e "s|@PREFIX@|${TRUEPREFIX}|" \\
++ -e "s|@LIBDIR@|${TRUEPREFIX}|" \\
++ -e "s|@CFLAGS@|-I${TRUEPREFIX}/include|" \\
+ -e "s|@VERSION@|\$(NJS_VER)|" \\
+ -e "s|@EXTRA_LIBS@|-lm $NJS_LIBS $NJS_LIB_AUX_LIBS|" \\
src/njs.pc.in > \$@

No comments:

Post a Comment