Re: [PATCH] www/unit: enable njs

2023-09-05 Thread Sergey A. Osokin
Hi Landry,

thank you for the review, comments and suggestions.

> Le Sat, May 27, 2023 at 09:55:48AM +0200, Landry Breuil a écrit :

[...]

> +post-patch:
> +   ${SUBST_CMD} ${WRKSRC}/auto/make
> +
>  do-install:

[...]

I have decided to split existing lang/njs port into two ports:
- devel/libnjs
- lang/njs
That will be consistent with the same family of NJS ports in
FreeBSD ports and NetBSD packages tree.

Based on that, there are two files are attached to this email:
- openbsd-libnjs.shar, new devel/libnjs port, v0.8.0;
- openbsd-njs-0.8.0.diff, the update of existing lang/njs port
  to v0.8.0, reduce targets from two to one (njs), move library
  specific files to the new port.

Also, both patches from lang/njs/patches directory (patch-auto_make and
patch-external_njs_fs_module_c) can be safely removed with this
update.

Thank you.

-- 
Sergey A. Osokin
Index: Makefile
===
RCS file: /cvs/ports/lang/njs/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- Makefile	17 Jun 2023 03:03:18 -	1.2
+++ Makefile	5 Sep 2023 14:17:28 -
@@ -1,8 +1,8 @@
-COMMENT=	NGINX JavaScript command line utility and static library
+COMMENT=	NGINX JavaScript command line utility
 
 GH_ACCOUNT=	nginx
 GH_PROJECT=	njs
-GH_TAGNAME=	0.7.12
+GH_TAGNAME=	0.8.0
 
 CATEGORIES=	lang www
 
@@ -23,13 +23,9 @@ LIB_DEPENDS=	devel/pcre2 \
 
 CONFIGURE_STYLE=simple
 
-ALL_TARGET=	libnjs njs
+ALL_TARGET=	njs
 
 do-install:
 	${INSTALL_PROGRAM} ${WRKDIST}/build/njs ${PREFIX}/bin
-	${INSTALL_DATA} ${WRKSRC}/src/*.h ${PREFIX}/include
-	${INSTALL_DATA} ${WRKSRC}/build/njs_auto_config.h ${PREFIX}/include
-	${INSTALL_DATA} ${WRKSRC}/build/libnjs.a ${PREFIX}/lib
-	${INSTALL_DATA} ${WRKSRC}/build/njs.pc ${PREFIX}/lib/pkgconfig
 
 .include 
Index: distinfo
===
RCS file: /cvs/ports/lang/njs/distinfo,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 distinfo
--- distinfo	25 May 2023 09:29:24 -	1.1.1.1
+++ distinfo	5 Sep 2023 14:17:28 -
@@ -1,2 +1,2 @@
-SHA256 (njs-0.7.12.tar.gz) = enWjkCLftY2/RhBTkDoHzEjdSUL32CpGYBgZwbAHdoc=
-SIZE (njs-0.7.12.tar.gz) = 662554
+SHA256 (njs-0.8.0.tar.gz) = uYAz//aq3LuOEIuW6AwNlMbiEDvL51hGta4LVgaWCEs=
+SIZE (njs-0.8.0.tar.gz) = 715391
Index: pkg/PLIST
===
RCS file: /cvs/ports/lang/njs/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 PLIST
--- pkg/PLIST	25 May 2023 09:29:24 -	1.1.1.1
+++ pkg/PLIST	5 Sep 2023 14:17:28 -
@@ -1,75 +1 @@
 @bin bin/njs
-include/njs.h
-include/njs_addr2line.h
-include/njs_arr.h
-include/njs_array.h
-include/njs_array_buffer.h
-include/njs_assert.h
-include/njs_async.h
-include/njs_auto_config.h
-include/njs_boolean.h
-include/njs_buffer.h
-include/njs_chb.h
-include/njs_clang.h
-include/njs_date.h
-include/njs_diyfp.h
-include/njs_djb_hash.h
-include/njs_dtoa.h
-include/njs_dtoa_fixed.h
-include/njs_encoding.h
-include/njs_error.h
-include/njs_event.h
-include/njs_file.h
-include/njs_function.h
-include/njs_generator.h
-include/njs_iterator.h
-include/njs_json.h
-include/njs_lexer.h
-include/njs_lexer_tables.h
-include/njs_lvlhsh.h
-include/njs_main.h
-include/njs_malloc.h
-include/njs_math.h
-include/njs_md5.h
-include/njs_module.h
-include/njs_mp.h
-include/njs_murmur_hash.h
-include/njs_number.h
-include/njs_object.h
-include/njs_object_hash.h
-include/njs_object_prop_declare.h
-include/njs_parser.h
-include/njs_promise.h
-include/njs_queue.h
-include/njs_random.h
-include/njs_rbtree.h
-include/njs_regex.h
-include/njs_regexp.h
-include/njs_regexp_pattern.h
-include/njs_scope.h
-include/njs_sha1.h
-include/njs_sha2.h
-include/njs_sprintf.h
-include/njs_str.h
-include/njs_string.h
-include/njs_strtod.h
-include/njs_symbol.h
-include/njs_time.h
-include/njs_timer.h
-include/njs_trace.h
-include/njs_typed_array.h
-include/njs_types.h
-include/njs_unicode.h
-include/njs_unicode_lower_case.h
-include/njs_unicode_upper_case.h
-include/njs_unix.h
-include/njs_utf16.h
-include/njs_utf8.h
-include/njs_utils.h
-include/njs_value.h
-include/njs_value_conversion.h
-include/njs_variable.h
-include/njs_vm.h
-include/njs_vmcode.h
-@static-lib lib/libnjs.a
-lib/pkgconfig/njs.pc


openbsd-libnjs.shar
Description: Unix shell archive


Re: [PATCH] www/unit: enable njs

2023-09-05 Thread Landry Breuil
Le Tue, Sep 05, 2023 at 02:29:03PM +, Sergey A. Osokin a écrit :
> Hi Landry,
> 
> thank you for the review, comments and suggestions.
> 
> > Le Sat, May 27, 2023 at 09:55:48AM +0200, Landry Breuil a écrit :
> 
> [...]
> 
> > +post-patch:
> > +   ${SUBST_CMD} ${WRKSRC}/auto/make
> > +
> >  do-install:
> 
> [...]
> 
> I have decided to split existing lang/njs port into two ports:
> - devel/libnjs
> - lang/njs
> That will be consistent with the same family of NJS ports in
> FreeBSD ports and NetBSD packages tree.

i get that for you as a maintainer it might be better/consistent, but i
have to disagree here. What do we gain from having them split ? users
wanting just a binary without the header/library ? disk space ? the two
ports would build from the same tarball/distfile anyway.

In addition, a @pkgpath/@conflict would be needed to handle the upgrade
path.

Landry


Re: [PATCH] www/unit: enable njs

2023-09-05 Thread Stuart Henderson

We don't use shars, please send a tar instead

--
 Sent from a phone, apologies for poor formatting.

On 5 September 2023 15:29:30 "Sergey A. Osokin"  wrote:


Hi Landry,

thank you for the review, comments and suggestions.


Le Sat, May 27, 2023 at 09:55:48AM +0200, Landry Breuil a écrit :


[...]


+post-patch:
+   ${SUBST_CMD} ${WRKSRC}/auto/make
+
 do-install:


[...]

I have decided to split existing lang/njs port into two ports:
- devel/libnjs
- lang/njs
That will be consistent with the same family of NJS ports in
FreeBSD ports and NetBSD packages tree.

Based on that, there are two files are attached to this email:
- openbsd-libnjs.shar, new devel/libnjs port, v0.8.0;
- openbsd-njs-0.8.0.diff, the update of existing lang/njs port
 to v0.8.0, reduce targets from two to one (njs), move library
 specific files to the new port.

Also, both patches from lang/njs/patches directory (patch-auto_make and
patch-external_njs_fs_module_c) can be safely removed with this
update.

Thank you.

--
Sergey A. Osokin




Re: [PATCH] www/unit: enable njs

2023-09-05 Thread Sergey A. Osokin
On Tue, Sep 05, 2023 at 04:35:50PM +0200, Landry Breuil wrote:
[...]

> i get that for you as a maintainer it might be better/consistent, but i
> have to disagree here. What do we gain from having them split ? users
> wanting just a binary without the header/library ? disk space ? the two
> ports would build from the same tarball/distfile anyway.
> 
> In addition, a @pkgpath/@conflict would be needed to handle the upgrade
> path.
> 
> Landry

Alright, let's keep it as is and update the lang/njs to v0.8.0, the patch
is attached, thank you.

-- 
Sergey A. Osokin
Index: Makefile
===
RCS file: /cvs/ports/lang/njs/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- Makefile	17 Jun 2023 03:03:18 -	1.2
+++ Makefile	5 Sep 2023 14:57:24 -
@@ -2,7 +2,7 @@ COMMENT=	NGINX JavaScript command line u
 
 GH_ACCOUNT=	nginx
 GH_PROJECT=	njs
-GH_TAGNAME=	0.7.12
+GH_TAGNAME=	0.8.0
 
 CATEGORIES=	lang www
 
@@ -24,6 +24,9 @@ LIB_DEPENDS=	devel/pcre2 \
 CONFIGURE_STYLE=simple
 
 ALL_TARGET=	libnjs njs
+
+post-patch:
+	${SUBST_CMD} ${WRKSRC}/auto/make
 
 do-install:
 	${INSTALL_PROGRAM} ${WRKDIST}/build/njs ${PREFIX}/bin
Index: distinfo
===
RCS file: /cvs/ports/lang/njs/distinfo,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 distinfo
--- distinfo	25 May 2023 09:29:24 -	1.1.1.1
+++ distinfo	5 Sep 2023 14:57:24 -
@@ -1,2 +1,2 @@
-SHA256 (njs-0.7.12.tar.gz) = enWjkCLftY2/RhBTkDoHzEjdSUL32CpGYBgZwbAHdoc=
-SIZE (njs-0.7.12.tar.gz) = 662554
+SHA256 (njs-0.8.0.tar.gz) = uYAz//aq3LuOEIuW6AwNlMbiEDvL51hGta4LVgaWCEs=
+SIZE (njs-0.8.0.tar.gz) = 715391
Index: patches/patch-auto_make
===
RCS file: /cvs/ports/lang/njs/patches/patch-auto_make,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-auto_make
--- patches/patch-auto_make	25 May 2023 09:29:24 -	1.1.1.1
+++ patches/patch-auto_make	5 Sep 2023 14:57:24 -
@@ -1,23 +1,13 @@
-should no longer be needed after
-https://github.com/nginx/njs/commit/e9d814a0a8c1857f78fdc85ed1461cb9101ebf4e
-
-Index: auto/make
 auto/make.orig
+--- auto/make.orig	2023-07-11 23:27:41 UTC
 +++ auto/make
-@@ -320,11 +320,11 @@ cat << END >> $NJS_MAKEFILE
+@@ -320,9 +320,7 @@ cat << END >> $NJS_MAKEFILE
  pc: $NJS_BUILD_DIR/njs.pc
  
  $NJS_BUILD_DIR/njs.pc: $NJS_BUILD_DIR/njs_auto_config.h
--	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," \\
--		-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|" \\
-+		-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 > \$@
- END
- 
--- /dev/null	Tue Sep  5 09:58:00 2023
+++ patches/patch-src_njs.pc.in	Tue Sep  5 09:44:23 2023
@@ -0,0 +1,13 @@
+--- src/njs.pc.in.orig	2023-07-11 23:13:20 UTC
 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


Re: [PATCH] www/unit: enable njs

2023-09-05 Thread Landry Breuil
Le Tue, Sep 05, 2023 at 02:59:37PM +, Sergey A. Osokin a écrit :
> On Tue, Sep 05, 2023 at 04:35:50PM +0200, Landry Breuil wrote:
> [...]
> 
> > i get that for you as a maintainer it might be better/consistent, but i
> > have to disagree here. What do we gain from having them split ? users
> > wanting just a binary without the header/library ? disk space ? the two
> > ports would build from the same tarball/distfile anyway.
> > 
> > In addition, a @pkgpath/@conflict would be needed to handle the upgrade
> > path.
> > 
> > Landry
> 
> Alright, let's keep it as is and update the lang/njs to v0.8.0, the patch
> is attached, thank you.

with the order of includes:
-I/usr/local/include  -Isrc  -Ibuild  -I/usr/local/include/libxml2 
-I/usr/local/include -Injs

that new version fails to build if 0.7.12 happens to be installed. Not a
big deal but good to know, and usually should be fixed upstream.

i guess patches/patch-external_njs_fs_module_c should be removed, doesnt
apply anymore

the previous comment in the patch

> +++ patches/patch-auto_make   5 Sep 2023 14:57:24 -
> @@ -1,23 +1,13 @@
> -should no longer be needed after
> -https://github.com/nginx/njs/commit/e9d814a0a8c1857f78fdc85ed1461cb9101ebf4e

was a lie ? since we keep the patch and add a new one to patch njs.pc.in
? isnt there a way to make all that patching/subst'ing simpler ?

in the end the build does this after auto/make is patched:
sed -e "s#@PREFIX@#/usr/local#"  -e "s#@VERSION@#0.8.0#"  -e 
"s#@EXTRA_LIBS@#-lm   -L/usr/local/lib -Wl,-R/usr/local/lib -lpcre2-8 -lcrypto 
-L/usr/local/lib -lxml2 -lz#"  src/njs.pc.in > build/njs.pc

the original unpatched sed was this:

$NJS_BUILD_DIR/njs.pc: $NJS_BUILD_DIR/njs_auto_config.h
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#" \\
-e "s#@VERSION@#\$(NJS_VER)#" \\
-e "s#@EXTRA_LIBS@#-lm $NJS_LIBS $NJS_LIB_AUX_LIBS#" \\
src/njs.pc.in > \$@

you remove @CFLAGS@ & @LIBDIR@ from njs.pc.in so at that point..  maybe
we could/should remove patch-auto_make too and directly set what we want
(${TRUEPREFIX} ?) in the njs.pc.in file ? all this seems.. convoluted to
me.

Landry


Re: [PATCH] www/unit: enable njs

2023-09-05 Thread Sergey A. Osokin
On Tue, Sep 05, 2023 at 05:42:45PM +0200, Landry Breuil wrote:
> Le Tue, Sep 05, 2023 at 02:59:37PM +, Sergey A. Osokin a écrit :
> > 
> > Alright, let's keep it as is and update the lang/njs to v0.8.0, the patch
> > is attached, thank you.
> 
> with the order of includes:
> -I/usr/local/include  -Isrc  -Ibuild  -I/usr/local/include/libxml2 
> -I/usr/local/include -Injs
> 
> that new version fails to build if 0.7.12 happens to be installed. Not a
> big deal but good to know, and usually should be fixed upstream.
> 
> i guess patches/patch-external_njs_fs_module_c should be removed, doesnt
> apply anymore

Sure, forgot to mention that in my previous email.

> the previous comment in the patch
> 
> > +++ patches/patch-auto_make 5 Sep 2023 14:57:24 -
> > @@ -1,23 +1,13 @@
> > -should no longer be needed after
> > -https://github.com/nginx/njs/commit/e9d814a0a8c1857f78fdc85ed1461cb9101ebf4e
> 
> was a lie ? since we keep the patch and add a new one to patch njs.pc.in
> ? isnt there a way to make all that patching/subst'ing simpler ?

Actually, there was another issue.

> in the end the build does this after auto/make is patched:
> sed -e "s#@PREFIX@#/usr/local#"  -e "s#@VERSION@#0.8.0#"  -e 
> "s#@EXTRA_LIBS@#-lm   -L/usr/local/lib -Wl,-R/usr/local/lib -lpcre2-8 
> -lcrypto -L/usr/local/lib -lxml2 -lz#"  src/njs.pc.in > build/njs.pc
> 
> the original unpatched sed was this:
> 
> $NJS_BUILD_DIR/njs.pc: $NJS_BUILD_DIR/njs_auto_config.h
> 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#" \\
> -e "s#@VERSION@#\$(NJS_VER)#" \\
> -e "s#@EXTRA_LIBS@#-lm $NJS_LIBS $NJS_LIB_AUX_LIBS#" \\
> src/njs.pc.in > \$@
> 
> you remove @CFLAGS@ & @LIBDIR@ from njs.pc.in so at that point..  maybe
> we could/should remove patch-auto_make too and directly set what we want
> (${TRUEPREFIX} ?) in the njs.pc.in file ? all this seems.. convoluted to
> me.

Not sure what's the latest suggestion means, could you provide a bit more
detail on this, thank you.

-- 
Sergey A. Osokin


Re: [PATCH] www/unit: enable njs

2023-09-05 Thread Landry Breuil
Le Tue, Sep 05, 2023 at 04:07:41PM +, Sergey A. Osokin a écrit :
> On Tue, Sep 05, 2023 at 05:42:45PM +0200, Landry Breuil wrote:
> > Le Tue, Sep 05, 2023 at 02:59:37PM +, Sergey A. Osokin a écrit :
> > > 
> > > Alright, let's keep it as is and update the lang/njs to v0.8.0, the patch
> > > is attached, thank you.
> > 
> > with the order of includes:
> > -I/usr/local/include  -Isrc  -Ibuild  -I/usr/local/include/libxml2 
> > -I/usr/local/include -Injs
> > 
> > that new version fails to build if 0.7.12 happens to be installed. Not a
> > big deal but good to know, and usually should be fixed upstream.
> > 
> > i guess patches/patch-external_njs_fs_module_c should be removed, doesnt
> > apply anymore
> > you remove @CFLAGS@ & @LIBDIR@ from njs.pc.in so at that point..  maybe
> > we could/should remove patch-auto_make too and directly set what we want
> > (${TRUEPREFIX} ?) in the njs.pc.in file ? all this seems.. convoluted to
> > me.
> 
> Not sure what's the latest suggestion means, could you provide a bit more
> detail on this, thank you.

the attached patch produces the same njs.pc file here.
? njs-0.8.0.diff
Index: Makefile
===
RCS file: /cvs/ports/lang/njs/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile17 Jun 2023 03:03:18 -  1.2
+++ Makefile5 Sep 2023 16:39:48 -
@@ -2,7 +2,7 @@
 
 GH_ACCOUNT=nginx
 GH_PROJECT=njs
-GH_TAGNAME=0.7.12
+GH_TAGNAME=0.8.0
 
 CATEGORIES=lang www
 
@@ -24,6 +24,9 @@
 CONFIGURE_STYLE=simple
 
 ALL_TARGET=libnjs njs
+
+post-patch:
+   ${SUBST_CMD} ${WRKSRC}/src/njs.pc.in
 
 do-install:
${INSTALL_PROGRAM} ${WRKDIST}/build/njs ${PREFIX}/bin
Index: distinfo
===
RCS file: /cvs/ports/lang/njs/distinfo,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 distinfo
--- distinfo25 May 2023 09:29:24 -  1.1.1.1
+++ distinfo5 Sep 2023 16:39:48 -
@@ -1,2 +1,2 @@
-SHA256 (njs-0.7.12.tar.gz) = enWjkCLftY2/RhBTkDoHzEjdSUL32CpGYBgZwbAHdoc=
-SIZE (njs-0.7.12.tar.gz) = 662554
+SHA256 (njs-0.8.0.tar.gz) = uYAz//aq3LuOEIuW6AwNlMbiEDvL51hGta4LVgaWCEs=
+SIZE (njs-0.8.0.tar.gz) = 715391
Index: patches/patch-auto_make
===
RCS file: patches/patch-auto_make
diff -N patches/patch-auto_make
--- patches/patch-auto_make 25 May 2023 09:29:24 -  1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,23 +0,0 @@
-should no longer be needed after
-https://github.com/nginx/njs/commit/e9d814a0a8c1857f78fdc85ed1461cb9101ebf4e
-
-Index: auto/make
 auto/make.orig
-+++ auto/make
-@@ -320,11 +320,11 @@ cat << END >> $NJS_MAKEFILE
- pc: $NJS_BUILD_DIR/njs.pc
- 
- $NJS_BUILD_DIR/njs.pc: $NJS_BUILD_DIR/njs_auto_config.h
--  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," \\
--  -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|" \\
-+  -e "s|@VERSION@|\$(NJS_VER)|" \\
-+  -e "s|@EXTRA_LIBS@|-lm $NJS_LIBS $NJS_LIB_AUX_LIBS|" \\
-   src/njs.pc.in > \$@
- END
- 
Index: patches/patch-external_njs_fs_module_c
===
RCS file: patches/patch-external_njs_fs_module_c
diff -N patches/patch-external_njs_fs_module_c
--- patches/patch-external_njs_fs_module_c  25 May 2023 09:29:24 -  
1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,14 +0,0 @@
-Index: external/njs_fs_module.c
 external/njs_fs_module.c.orig
-+++ external/njs_fs_module.c
-@@ -3297,8 +3297,8 @@ njs_fs_to_stat(njs_stat_t *dst, struct stat *st)
- dst->st_mtim.tv_nsec = st->st_mtimespec.tv_nsec;
- dst->st_ctim.tv_sec = st->st_ctimespec.tv_sec;
- dst->st_ctim.tv_nsec = st->st_ctimespec.tv_nsec;
--dst->st_birthtim.tv_sec = st->st_birthtimespec.tv_sec;
--dst->st_birthtim.tv_nsec = st->st_birthtimespec.tv_nsec;
-+dst->st_birthtim.tv_sec = st->__st_birthtimespec.tv_sec;
-+dst->st_birthtim.tv_nsec = st->__st_birthtimespec.tv_nsec;
- 
- #elif (NJS_HAVE_STAT_ATIM)
- 
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 -
+++ patches/patch-src_njs.pc.in 5 Sep 2023 16:39:48 -
@@ -0,0 +1,15 @@
+Index: src/njs.pc.in
+--- src/njs.pc.in.orig
 src/njs.pc.in
+@@ -1,8 +1,8 @@
+-prefix=@PREFIX@
+-libdir=@LIBDIR@
++prefix=${TRUEPREFIX}
++libdir=${prefix}/lib
+ 
+ Name: njs
+ Description: library to embed nj

Re: [PATCH] www/unit: enable njs

2023-09-05 Thread Sergey A. Osokin
On Tue, Sep 05, 2023 at 06:43:30PM +0200, Landry Breuil wrote:
[...]
> 
> the attached patch produces the same njs.pc file here.
[...]

Thanks, Landry, for the details.  The patch looks good to me.

-- 
Sergey A. Osokin


Re: [PATCH] www/unit: enable njs

2023-09-05 Thread Sergey A. Osokin
Landry,

the recent update in lang/njs you made includes a fix for the
njs.pc, so we may have to return to this one?  Or am I missing
something?

Thank you.

-- 
Sergey A. Osokin

On Fri, May 26, 2023 at 03:45:53PM +, Sergey A. Osokin wrote:
> Hi,
> 
> lang/njs has been added to the ports tree recently, so
> here's the patch to enable nginx javascript for www/unit.
> 
> Thank you.
> 
> -- 
> Sergey A. Osokin

> Index: Makefile.inc
> ===
> RCS file: /cvs/ports/www/unit/Makefile.inc,v
> retrieving revision 1.8
> diff -u -p -r1.8 Makefile.inc
> --- Makefile.inc  16 May 2023 08:21:08 -  1.8
> +++ Makefile.inc  26 May 2023 15:43:21 -
> @@ -28,6 +28,7 @@ CONFIGURE_ARGS= --prefix=${PREFIX} \
>   --runstatedir=${LOCALSTATEDIR}/run/unit \
>   --statedir=${LOCALSTATEDIR}/db/unit \
>   --tmpdir=${LOCALSTATEDIR}/tmp/unit \
> + --njs \
>   --openssl \
>   --user=_unit \
>   --group=_unit
> Index: unit/Makefile
> ===
> RCS file: /cvs/ports/www/unit/unit/Makefile,v
> retrieving revision 1.5
> diff -u -p -r1.5 Makefile
> --- unit/Makefile 26 Apr 2023 15:57:28 -  1.5
> +++ unit/Makefile 26 May 2023 15:43:21 -
> @@ -2,7 +2,8 @@ COMMENT=  dynamic web application server
>  
>  WANTLIB= c crypto m pcre2-8 pthread ssl
>  
> -LIB_DEPENDS= devel/pcre2
> +LIB_DEPENDS= devel/pcre2 \
> + lang/njs
>  
>  MODULES= lang/python
>  MODPY_BUILDDEP=  No



Re: [PATCH] www/unit: enable njs

2023-09-05 Thread Landry Breuil
Le Tue, Sep 05, 2023 at 05:57:09PM +, Sergey A. Osokin a écrit :
> Landry,
> 
> the recent update in lang/njs you made includes a fix for the
> njs.pc, so we may have to return to this one?  Or am I missing
> something?

maybe, dont remember the context :)

in all cases it needs REVISION bumps since it changes the dependencies..

Landry

> On Fri, May 26, 2023 at 03:45:53PM +, Sergey A. Osokin wrote:
> > Hi,
> > 
> > lang/njs has been added to the ports tree recently, so
> > here's the patch to enable nginx javascript for www/unit.
> > 
> > Thank you.
> > 
> > -- 
> > Sergey A. Osokin
> 
> > Index: Makefile.inc
> > ===
> > RCS file: /cvs/ports/www/unit/Makefile.inc,v
> > retrieving revision 1.8
> > diff -u -p -r1.8 Makefile.inc
> > --- Makefile.inc16 May 2023 08:21:08 -  1.8
> > +++ Makefile.inc26 May 2023 15:43:21 -
> > @@ -28,6 +28,7 @@ CONFIGURE_ARGS=   --prefix=${PREFIX} \
> > --runstatedir=${LOCALSTATEDIR}/run/unit \
> > --statedir=${LOCALSTATEDIR}/db/unit \
> > --tmpdir=${LOCALSTATEDIR}/tmp/unit \
> > +   --njs \
> > --openssl \
> > --user=_unit \
> > --group=_unit
> > Index: unit/Makefile
> > ===
> > RCS file: /cvs/ports/www/unit/unit/Makefile,v
> > retrieving revision 1.5
> > diff -u -p -r1.5 Makefile
> > --- unit/Makefile   26 Apr 2023 15:57:28 -  1.5
> > +++ unit/Makefile   26 May 2023 15:43:21 -
> > @@ -2,7 +2,8 @@ COMMENT=dynamic web application server
> >  
> >  WANTLIB=   c crypto m pcre2-8 pthread ssl
> >  
> > -LIB_DEPENDS=   devel/pcre2
> > +LIB_DEPENDS=   devel/pcre2 \
> > +   lang/njs
> >  
> >  MODULES=   lang/python
> >  MODPY_BUILDDEP=No
> 



Re: [PATCH] www/unit: enable njs

2023-09-06 Thread Sergey A. Osokin
On Wed, Sep 06, 2023 at 05:13:24AM +0200, Landry Breuil wrote:
> Le Tue, Sep 05, 2023 at 05:57:09PM +, Sergey A. Osokin a écrit :
> > Landry,
> > 
> > the recent update in lang/njs you made includes a fix for the
> > njs.pc, so we may have to return to this one?  Or am I missing
> > something?
> 
> maybe, dont remember the context :)
> 
> in all cases it needs REVISION bumps since it changes the dependencies..

Sure, here's the updated patch.

--
Sergey A. Osokin
Index: Makefile.inc
===
RCS file: /cvs/ports/www/unit/Makefile.inc,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile.inc
--- Makefile.inc	5 Sep 2023 11:31:17 -	1.9
+++ Makefile.inc	6 Sep 2023 14:10:35 -
@@ -27,6 +27,7 @@ CONFIGURE_ARGS=	--prefix=${PREFIX} \
 		--pid=${LOCALSTATEDIR}/run/unit/unit.pid \
 		--runstatedir=${LOCALSTATEDIR}/run/unit \
 		--statedir=${LOCALSTATEDIR}/db/unit \
+		--njs \
 		--tmpdir=${LOCALSTATEDIR}/tmp/unit \
 		--openssl \
 		--user=_unit \
Index: unit/Makefile
===
RCS file: /cvs/ports/www/unit/unit/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- unit/Makefile	4 Sep 2023 17:02:21 -	1.6
+++ unit/Makefile	6 Sep 2023 14:10:35 -
@@ -1,8 +1,11 @@
 COMMENT=	dynamic web application server
 
+REVISION=	0
+
 WANTLIB=	c crypto m pcre2-8 pthread ssl
 
-LIB_DEPENDS=	devel/pcre2
+LIB_DEPENDS=	devel/pcre2 \
+		lang/njs
 
 MODULES=	lang/python
 MODPY_BUILDDEP=	No


Re: [PATCH] www/unit: enable njs

2023-09-07 Thread Landry Breuil
Le Wed, Sep 06, 2023 at 02:12:20PM +, Sergey A. Osokin a écrit :
> On Wed, Sep 06, 2023 at 05:13:24AM +0200, Landry Breuil wrote:
> > Le Tue, Sep 05, 2023 at 05:57:09PM +, Sergey A. Osokin a écrit :
> > > Landry,
> > > 
> > > the recent update in lang/njs you made includes a fix for the
> > > njs.pc, so we may have to return to this one?  Or am I missing
> > > something?
> > 
> > maybe, dont remember the context :)
> > 
> > in all cases it needs REVISION bumps since it changes the dependencies..
> 
> Sure, here's the updated patch.

i've checked and something is wrong somewhere, because njs is detected
at configure, the unitd binary is supposedly linked against it

cc -Wl,-E -L/usr/local/lib -o build/sbin/unitd -pipe -fPIC
-fvisibility=hidden -W -Wall -Wextra -Wno-unused-parameter
-Wwrite-strings -fstrict-aliasing -Wstrict-overflow=5
-Wmissing-prototypes  -O2 -pipe -g -I/usr/local/include
build/src/nxt_main.o   build/lib/libnxt.a  -lm -lpthread
-L/usr/local/lib -Wl,-R/usr/local/lib -lnjs -lm -lpcre2-8 -lcrypto
-lxml2 -lz -lssl -lcrypto-L/usr/local/lib -Wl,-R/usr/local/lib
-lpcre2-8

but packaging fails:
Create /usr/ports/packages/amd64/all/unit-1.31.0p0.tgz
LIB_DEPENDS lang/njs not needed for www/unit/unit ?

and looking at the binary the dependency on the njs library isnt
registered

$objdump -p build/sbin/unitd|grep NEED
  NEEDED  libm.so.10.1
  NEEDED  libpthread.so.27.1
  NEEDED  libpcre2-8.so.0.6
  NEEDED  libcrypto.so.52.0
  NEEDED  libxml2.so.19.0
  NEEDED  libz.so.7.0
  NEEDED  libssl.so.55.0
  NEEDED  libc.so.97.1

that's .. puzzling. is anyone seeing the same failure ?

Landry



Re: [PATCH] www/unit: enable njs

2023-09-07 Thread Sergey A. Osokin
On Thu, Sep 07, 2023 at 12:16:39PM +0200, Landry Breuil wrote:
> Le Wed, Sep 06, 2023 at 02:12:20PM +, Sergey A. Osokin a écrit :
[...]
> > 
> > Sure, here's the updated patch.
> 
> i've checked and something is wrong somewhere, because njs is detected
> at configure, the unitd binary is supposedly linked against it
> 
> cc -Wl,-E -L/usr/local/lib -o build/sbin/unitd -pipe -fPIC
> -fvisibility=hidden -W -Wall -Wextra -Wno-unused-parameter
> -Wwrite-strings -fstrict-aliasing -Wstrict-overflow=5
> -Wmissing-prototypes  -O2 -pipe -g -I/usr/local/include
> build/src/nxt_main.o   build/lib/libnxt.a  -lm -lpthread
> -L/usr/local/lib -Wl,-R/usr/local/lib -lnjs -lm -lpcre2-8 -lcrypto
> -lxml2 -lz -lssl -lcrypto-L/usr/local/lib -Wl,-R/usr/local/lib
> -lpcre2-8
> 
> but packaging fails:
> Create /usr/ports/packages/amd64/all/unit-1.31.0p0.tgz
> LIB_DEPENDS lang/njs not needed for www/unit/unit ?
> 
> and looking at the binary the dependency on the njs library isnt
> registered
> 
> $objdump -p build/sbin/unitd|grep NEED
>   NEEDED  libm.so.10.1
>   NEEDED  libpthread.so.27.1
>   NEEDED  libpcre2-8.so.0.6
>   NEEDED  libcrypto.so.52.0
>   NEEDED  libxml2.so.19.0
>   NEEDED  libz.so.7.0
>   NEEDED  libssl.so.55.0
>   NEEDED  libc.so.97.1

There's no shared library for NJS at the moment, only static
library is available.

-- 
Sergey A. Osokin


Re: [PATCH] www/unit: enable njs

2023-09-07 Thread Landry Breuil
Le Thu, Sep 07, 2023 at 02:47:58PM +, Sergey A. Osokin a écrit :
> On Thu, Sep 07, 2023 at 12:16:39PM +0200, Landry Breuil wrote:
> > Le Wed, Sep 06, 2023 at 02:12:20PM +, Sergey A. Osokin a écrit :
> [...]
> > > 
> > > Sure, here's the updated patch.
> > 
> > i've checked and something is wrong somewhere, because njs is detected
> > at configure, the unitd binary is supposedly linked against it
> > 
> > cc -Wl,-E -L/usr/local/lib -o build/sbin/unitd -pipe -fPIC
> > -fvisibility=hidden -W -Wall -Wextra -Wno-unused-parameter
> > -Wwrite-strings -fstrict-aliasing -Wstrict-overflow=5
> > -Wmissing-prototypes  -O2 -pipe -g -I/usr/local/include
> > build/src/nxt_main.o   build/lib/libnxt.a  -lm -lpthread
> > -L/usr/local/lib -Wl,-R/usr/local/lib -lnjs -lm -lpcre2-8 -lcrypto
> > -lxml2 -lz -lssl -lcrypto-L/usr/local/lib -Wl,-R/usr/local/lib
> > -lpcre2-8
> > 
> > but packaging fails:
> > Create /usr/ports/packages/amd64/all/unit-1.31.0p0.tgz
> > LIB_DEPENDS lang/njs not needed for www/unit/unit ?
> > 
> > and looking at the binary the dependency on the njs library isnt
> > registered
> > 
> > $objdump -p build/sbin/unitd|grep NEED
> >   NEEDED  libm.so.10.1
> >   NEEDED  libpthread.so.27.1
> >   NEEDED  libpcre2-8.so.0.6
> >   NEEDED  libcrypto.so.52.0
> >   NEEDED  libxml2.so.19.0
> >   NEEDED  libz.so.7.0
> >   NEEDED  libssl.so.55.0
> >   NEEDED  libc.so.97.1
> 
> There's no shared library for NJS at the moment, only static
> library is available.

right. then ... i think BUILD_DEPENDS + RUN_DEPENDS is needed in the
static case instead.

you might want to check WANTLIB too (make port-lib-depends-check), here
it complains about missing xml2/z

Landry



Re: [PATCH] www/unit: enable njs

2023-09-07 Thread Sergey A. Osokin
On Thu, Sep 07, 2023 at 05:08:11PM +0200, Landry Breuil wrote:
> Le Thu, Sep 07, 2023 at 02:47:58PM +, Sergey A. Osokin a écrit :
> > 
> > There's no shared library for NJS at the moment, only static
> > library is available.
> 
> right. then ... i think BUILD_DEPENDS + RUN_DEPENDS is needed in the
> static case instead.
> 
> you might want to check WANTLIB too (make port-lib-depends-check), here
> it complains about missing xml2/z

Done.

A note here.  The /usr/ports/infrastructure/bin/portcheck reports about
xml2, that shared library is required for NJS functionality, it's
mentioned in NJS pkgconfig file, /usr/local/lib/pkgconfig/njs.pc, so I
added it to WANTLIB.  Hope that's OK.

-- 
Sergey A. Osokin

Index: Makefile.inc
===
RCS file: /cvs/ports/www/unit/Makefile.inc,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile.inc
--- Makefile.inc	5 Sep 2023 11:31:17 -	1.9
+++ Makefile.inc	7 Sep 2023 15:29:22 -
@@ -27,6 +27,7 @@ CONFIGURE_ARGS=	--prefix=${PREFIX} \
 		--pid=${LOCALSTATEDIR}/run/unit/unit.pid \
 		--runstatedir=${LOCALSTATEDIR}/run/unit \
 		--statedir=${LOCALSTATEDIR}/db/unit \
+		--njs \
 		--tmpdir=${LOCALSTATEDIR}/tmp/unit \
 		--openssl \
 		--user=_unit \
Index: unit/Makefile
===
RCS file: /cvs/ports/www/unit/unit/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- unit/Makefile	4 Sep 2023 17:02:21 -	1.6
+++ unit/Makefile	7 Sep 2023 15:29:22 -
@@ -1,8 +1,12 @@
 COMMENT=	dynamic web application server
 
-WANTLIB=	c crypto m pcre2-8 pthread ssl
+REVISION=	0
+
+WANTLIB=	c crypto m pcre2-8 pthread ssl xml2 z
 
 LIB_DEPENDS=	devel/pcre2
+BUILD_DEPENDS=	${RUN_DEPENDS}
+RUN_DEPENDS=	lang/njs
 
 MODULES=	lang/python
 MODPY_BUILDDEP=	No


Re: [PATCH] www/unit: enable njs

2023-05-27 Thread Landry Breuil
Le Fri, May 26, 2023 at 03:45:53PM +, 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

also www/unit/unit could use a WANTLIB update, you might want to run
make port-lib-depends-check upon each update:

unit-1.30.0(www/unit/unit):
09:13:56 [605/1480]
Missing: xml2.19 from libxml-2.11.4 (/usr/local/sbin/unitd)
Missing: z.7 (/usr/local/sbin/unitd) (system lib)
WANTLIB += xml2 z
*** Error 1 in target 'port-lib-depends-check' (ignored)



Re: [PATCH] www/unit: enable njs

2023-05-27 Thread Landry Breuil
Le Sat, May 27, 2023 at 09:19:24AM +0200, Landry Breuil a écrit :
> Le Fri, May 26, 2023 at 03:45:53PM +, 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
--- Makefile25 May 2023 09:29:24 -  1.1.1.1
+++ Makefile27 May 2023 07:54:10 -
@@ -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 -  1.1.1.1
+++ patches/patch-auto_make 27 May 2023 07:54:10 -
@@ -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 > \$@



Re: [PATCH] www/unit: enable njs

2023-05-27 Thread Landry Breuil
Le Sat, May 27, 2023 at 09:55:48AM +0200, Landry Breuil a écrit :
> Le Sat, May 27, 2023 at 09:19:24AM +0200, Landry Breuil a écrit :
> > Le Fri, May 26, 2023 at 03:45:53PM +, 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
> --- Makefile25 May 2023 09:29:24 -  1.1.1.1
> +++ Makefile27 May 2023 07:54:10 -
> @@ -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 -  1.1.1.1
> +++ patches/patch-auto_make 27 May 2023 07:54:10 -
> @@ -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 :)



Re: [PATCH] www/unit: enable njs

2023-05-27 Thread Landry Breuil
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
> > --- Makefile25 May 2023 09:29:24 -  1.1.1.1
> > +++ Makefile27 May 2023 07:54:10 -
> > @@ -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 -  1.1.1.1
> > +++ patches/patch-auto_make 27 May 2023 07:54:10 -
> > @@ -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
--- Makefile25 May 2023 09:29:24 -  1.1.1.1
+++ Makefile27 May 2023 07:54:10 -
@@ -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 -  1.1.1.1
+++ patches/patch-auto_make 27 May 2023 08:29:26 -
@@ -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 -
+++ patches/patch-src_njs_pc_in 27 May 2023 08:29:26 -
@@ -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