Saturday, May 27, 2023

Re: [PATCH] www/unit: enable njs

Le Sat, May 27, 2023 at 10:02:29AM +0200, Landry Breuil a écrit :
> Le Sat, May 27, 2023 at 09:55:48AM +0200, Landry Breuil a écrit :
> > 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}|" \\
> sorry, missing /lib here -^
> > ++ -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 > \$@
> >
>
> the problem we have so far with the existing lang/njs port is that paths
> in the pc file reference the objdir where njs was build, that wont work
> for anything trying to use njs during the build if njs objdir was
> cleaned. it has to reference paths where njs is actually installed (eg
> libdir=/usr/local/lib, prefix=/usr/local, cflags=-I/usr/local/include
> etc..)
>
> a 'better' fix might be to patch njs.pc.in. dunno :)

something along those lines, eg one only needs to subst TRUEPREFIX once, libdir
and cflags derive from it:

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 08:29:26 -0000
@@ -4,7 +4,7 @@
Index: auto/make
--- auto/make.orig
+++ auto/make
-@@ -320,11 +320,11 @@ cat << END >> $NJS_MAKEFILE
+@@ -320,11 +320,9 @@ cat << END >> $NJS_MAKEFILE
pc: $NJS_BUILD_DIR/njs.pc

$NJS_BUILD_DIR/njs.pc: $NJS_BUILD_DIR/njs_auto_config.h
@@ -13,9 +13,7 @@
- -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|@VERSION@|\$(NJS_VER)|" \\
+ -e "s|@EXTRA_LIBS@|-lm $NJS_LIBS $NJS_LIB_AUX_LIBS|" \\
src/njs.pc.in > \$@
Index: patches/patch-src_njs_pc_in
===================================================================
RCS file: patches/patch-src_njs_pc_in
diff -N patches/patch-src_njs_pc_in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_njs_pc_in 27 May 2023 08:29:26 -0000
@@ -0,0 +1,14 @@
+Index: src/njs.pc.in
+--- src/njs.pc.in.orig
++++ src/njs.pc.in
+@@ -1,8 +1,8 @@
+ prefix=@PREFIX@
+-libdir=@LIBDIR@
++libdir=${prefix}/lib
+
+ Name: njs
+ Description: library to embed njs scripting language
+ Version: @VERSION@
+ Libs: -L${libdir} -lnjs @EXTRA_LIBS@
+-Cflags: @CFLAGS@
++Cflags: -I${prefix}/include

No comments:

Post a Comment