Stuart Henderson writes:

> On 2022/07/25 19:12, Nam Nguyen wrote:
>> 2. Should the meson.build patch be used? It patches
>> /usr/local/share/irssi --> /usr/local/share/examples/irssi. I'm
>> preserving the behavior from before but I'm also fine not carrying this
>> patch. The important part is that /etc/irssi/irssi.conf is used, via the
>> @sample tags.
>
> I think the package should install those files under share/examples,
> that is the location where users expect to find them. Just make sure that
> the /etc/irssi bits are used at runtime. Would be worth running strings
> on the object files and search output for share/examples which should
> probably not show up.

strings revealed that share/examples was used for themes. I followed:
https://www.openbsd.org/faq/ports/specialtopics.html#Config

  Note the distinction between configuration files and example
  configuration files:...

I learned that the port must use /etc but it must install files only
under /usr/local. (incorrectly installing to /etc was caught by
update-plist: "Can't put into any plist (no applicable prefix)".) The
solution was to add a post-install snippet to mv files from /etc to
share/examples.

Now, the previous port behavior of using /etc/irssi is restored. I am
able to use themes and scripts from /etc and ~/.irssi, and it never
uses share/examples.

$ strings /usr/local/bin/irssi | ag share/examples
$ strings /usr/local/bin/irssi | ag /etc/irssi     
/etc/irssi/irssi.conf
/etc/irssi/themes/%s.theme
$ strings /usr/local/lib/irssi/modules/libfe_perl.so | ag share/examples
$ strings /usr/local/lib/irssi/modules/libfe_perl.so | ag /etc/irssi
/etc/irssi/scripts
$ strings /usr/local/lib/irssi/modules/libperl_core.so
use lib qw(%s/scripts /etc/irssi/scripts %s);
/etc/irssi/scripts/%s

>> - MACHINE_ARCH stuff has been removed from the perl paths.
>>   libdata/perl5/site_perl/${MACHINE_ARCH}-openbsd/Irssi/
>>   This seems harmless because net/twirssi still works.
>
> Perl will still search there, but this is not correct, and no other
> port installs binary modules there:
>
> $ pkglocate /site_perl/|grep '\.so$'|grep -v site_perl/amd64-openbsd/ | wc -l
>        0
>
> Just remove the -Dwith-perl-lib line and regen plist.

this fresh diff additionally:
- restores perl ${MACHINE_ARCH} paths
- uses SUBST_CMD, meson.build patch and post-install snippet to
  configure the port to use /etc/irssi/ and install sample configuration
  files to share/examples/irssi/

@sample ${SYSCONFDIR}/irssi/{,scripts,themes} keep getting shoved to
near the top of the file so I left them there to make future updates
less noisy.

Index: Makefile
===================================================================
RCS file: /cvs/ports/net/irssi/Makefile,v
retrieving revision 1.97
diff -u -p -u -p -r1.97 Makefile
--- Makefile    23 Jun 2022 02:21:35 -0000      1.97
+++ Makefile    27 Jul 2022 02:01:02 -0000
@@ -6,7 +6,7 @@ MULTI_PACKAGES = -main -otr
 COMMENT-main = modular IRC client with many features
 COMMENT-otr =  OTR (off-the-record) plugin for irssi
 
-V =            1.4.1
+V =            1.4.2
 DISTNAME =     irssi-$V
 PKGSPEC-main = irssi-=$V
 PKGNAME-main = irssi-$V
@@ -19,43 +19,41 @@ HOMEPAGE =  https://www.irssi.org/
 # GPLv2+
 PERMIT_PACKAGE =       Yes
 
-WANTLIB +=     c crypto curses glib-2.0 gmodule-2.0 \
-               iconv intl m pcre perl pthread ssl
+WANTLIB +=     c crypto curses glib-2.0 gmodule-2.0 m perl ssl
 
 MASTER_SITES = https://github.com/irssi/irssi/releases/download/${V}/
 
 DEBUG_PACKAGES =       ${BUILD_PACKAGES}
 
+MODULES =      devel/meson
+
 LIB_DEPENDS =  devel/glib2>=2.28.0
 
-RUN_DEPENDS-otr = net/irssi,-main
-LIB_DEPENDS-otr = security/libgcrypt>=1.2.0 \
-               security/libotr>=4.1.0
-WANTLIB-otr =  gcrypt gpg-error iconv intl otr
-
-LIBTOOL_FLAGS +=       --tag=disable-static
-
-CONFIGURE_STYLE =      gnu
-CONFIGURE_ARGS =       --disable-utf8proc \
-                       --with-otr=module \
-                       --with-perl-lib=${PREFIX}/libdata/perl5/site_perl \
-                       --with-perl=yes \
-                       --with-pic \
-                       --with-proxy
-CONFIGURE_ENV +=       CPPFLAGS="-I${LOCALBASE}/include" \
-                       LDFLAGS="-L${LOCALBASE}/lib"
-SEPARATE_BUILD =       Yes
-
-MAKE_FLAGS =   scriptdir="${SYSCONFDIR}/irssi/scripts" \
-               themedir="${SYSCONFDIR}/irssi/themes"
-FAKE_FLAGS =   confdir="${PREFIX}/share/examples/irssi" \
-               scriptdir="${PREFIX}/share/examples/irssi/scripts" \
-               themedir="${PREFIX}/share/examples/irssi/themes"
+MODMESON_CONFIGURE_ARGS +=     -Ddisable-utf8proc=yes \
+                               -Dwith-otr=yes \
+                               -Dwith-perl=yes \
+                               -Dwith-proxy=yes
+
+RUN_DEPENDS-otr =      net/irssi,-main
+LIB_DEPENDS-otr =      devel/glib2>=2.28.0 \
+                       security/libgcrypt>=1.2.0 \
+                       security/libotr>=4.1.0
+
+WANTLIB-otr =  gcrypt glib-2.0 otr
 
 # tests write to it
 PORTHOME =     ${WRKDIR}
 
 post-patch:
-       ${SUBST_CMD} ${WRKSRC}/docs/irssi.1
+       ${SUBST_CMD} ${WRKSRC}/meson.build
+
+post-install:
+       ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/irssi/
+       ${INSTALL_DATA} ${WRKSRC}/irssi.conf ${PREFIX}/share/examples/irssi/
+.for l in themes scripts
+       ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/irssi/${l}/
+       mv ${WRKINST}${SYSCONFDIR}/irssi/${l}/* \
+               ${PREFIX}/share/examples/irssi/${l}/
+.endfor
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/net/irssi/distinfo,v
retrieving revision 1.37
diff -u -p -u -p -r1.37 distinfo
--- distinfo    23 Jun 2022 02:21:36 -0000      1.37
+++ distinfo    27 Jul 2022 02:01:02 -0000
@@ -1,2 +1,2 @@
-SHA256 (irssi-1.4.1.tar.gz) = hmO9DzoxPj5rTA1NJDgd6ZCusidhpJr0erlYvpsOKy8=
-SIZE (irssi-1.4.1.tar.gz) = 1923982
+SHA256 (irssi-1.4.2.tar.gz) = LXLJoXi/XL5N+rSZgYAFq7hfeTdkdvkk/AnJacschBk=
+SIZE (irssi-1.4.2.tar.gz) = 1924981
Index: patches/patch-meson_build
===================================================================
RCS file: patches/patch-meson_build
diff -N patches/patch-meson_build
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-meson_build   27 Jul 2022 02:01:02 -0000
@@ -0,0 +1,14 @@
+Index: meson.build
+--- meson.build.orig
++++ meson.build
+@@ -22,8 +22,8 @@ includedir          = get_option('includedir')
+ incdir              = 'irssi'
+ moduledir           = get_option('libdir') / incdir / 'modules'
+ helpdir             = get_option('datadir') / incdir / 'help'
+-themedir            = get_option('datadir') / incdir / 'themes'
+-scriptdir           = get_option('datadir') / incdir / 'scripts'
++themedir            = '${SYSCONFDIR}' / incdir / 'themes'
++scriptdir           = '${SYSCONFDIR}' / incdir / 'scripts'
+ docdir              = get_option('docdir') != '' ? get_option('docdir') : 
(get_option('datadir') / 'doc' / incdir)
+ 
+ want_textui         = get_option('without-textui') != 'yes'
Index: patches/patch-src_fe-common_core_Makefile_in
===================================================================
RCS file: patches/patch-src_fe-common_core_Makefile_in
diff -N patches/patch-src_fe-common_core_Makefile_in
--- patches/patch-src_fe-common_core_Makefile_in        23 Jun 2022 02:21:36 
-0000      1.16
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-Index: src/fe-common/core/Makefile.in
---- src/fe-common/core/Makefile.in.orig
-+++ src/fe-common/core/Makefile.in
-@@ -424,7 +424,7 @@ AM_CPPFLAGS = \
-       -I$(top_builddir) \
-       $(GLIB_CFLAGS) \
-       -DHELPDIR=\""$(datadir)/irssi/help"\" \
--      -DTHEMESDIR=\""$(datadir)/irssi/themes"\"
-+      -DTHEMESDIR=\""$(sysconfdir)/irssi/themes"\"
- 
- libfe_common_core_a_SOURCES = chat-completion.c command-history.c \
-       completion.c fe-channels.c fe-common-core.c fe-core-commands.c \
Index: patches/patch-src_perl_Makefile_in
===================================================================
RCS file: patches/patch-src_perl_Makefile_in
diff -N patches/patch-src_perl_Makefile_in
--- patches/patch-src_perl_Makefile_in  23 Jun 2022 02:21:36 -0000      1.16
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-Index: src/perl/Makefile.in
---- src/perl/Makefile.in.orig
-+++ src/perl/Makefile.in
-@@ -412,7 +412,7 @@ AM_CPPFLAGS = \
-       -I$(top_builddir) \
-       -I$(builddir) \
-       $(GLIB_CFLAGS) \
--      -DSCRIPTDIR=\""$(datadir)/irssi/scripts"\" \
-+      -DSCRIPTDIR=\""$(sysconfdir)/irssi/scripts"\" \
-       -DPERL_USE_LIB=\""$(PERL_USE_LIB)"\" \
-       -DPERL_STATIC_LIBS=$(PERL_STATIC_LIBS) \
-       $(PERL_CFLAGS)
Index: pkg/PLIST-main
===================================================================
RCS file: /cvs/ports/net/irssi/pkg/PLIST-main,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 PLIST-main
--- pkg/PLIST-main      23 Jun 2022 02:21:36 -0000      1.6
+++ pkg/PLIST-main      27 Jul 2022 02:01:02 -0000
@@ -1,4 +1,7 @@
 @pkgpath net/irssi,socks
+@sample ${SYSCONFDIR}/irssi/
+@sample ${SYSCONFDIR}/irssi/scripts/
+@sample ${SYSCONFDIR}/irssi/themes/
 @bin bin/irssi
 include/irssi/
 include/irssi/irssi-config.h
@@ -150,8 +153,9 @@ include/irssi/src/lib-config/iconfig.h
 include/irssi/src/lib-config/module.h
 lib/irssi/
 lib/irssi/modules/
-lib/irssi/modules/libirc_proxy.la
+@so lib/irssi/modules/libfe_perl.so
 @so lib/irssi/modules/libirc_proxy.so
+@so lib/irssi/modules/libperl_core.so
 lib/pkgconfig/irssi-1.pc
 libdata/perl5/site_perl/${MACHINE_ARCH}-openbsd/
 libdata/perl5/site_perl/${MACHINE_ARCH}-openbsd/Irssi/
@@ -183,19 +187,15 @@ share/doc/irssi/special_vars.txt
 share/doc/irssi/startup-HOWTO.html
 share/doc/irssi/startup-HOWTO.txt
 share/examples/irssi/
-@sample ${SYSCONFDIR}/irssi/
 share/examples/irssi/irssi.conf
 @sample ${SYSCONFDIR}/irssi/irssi.conf
 share/examples/irssi/scripts/
-@sample ${SYSCONFDIR}/irssi/scripts/
 share/examples/irssi/scripts/autoop.pl
 @sample ${SYSCONFDIR}/irssi/scripts/autoop.pl
 share/examples/irssi/scripts/autorejoin.pl
 @sample ${SYSCONFDIR}/irssi/scripts/autorejoin.pl
 share/examples/irssi/scripts/buf.pl
 @sample ${SYSCONFDIR}/irssi/scripts/buf.pl
-share/examples/irssi/scripts/command.pl
-@sample ${SYSCONFDIR}/irssi/scripts/command.pl
 share/examples/irssi/scripts/dns.pl
 @sample ${SYSCONFDIR}/irssi/scripts/dns.pl
 share/examples/irssi/scripts/kills.pl
@@ -204,18 +204,13 @@ share/examples/irssi/scripts/mail.pl
 @sample ${SYSCONFDIR}/irssi/scripts/mail.pl
 share/examples/irssi/scripts/mlock.pl
 @sample ${SYSCONFDIR}/irssi/scripts/mlock.pl
-share/examples/irssi/scripts/msg-event.pl
-@sample ${SYSCONFDIR}/irssi/scripts/msg-event.pl
 share/examples/irssi/scripts/quitmsg.pl
 @sample ${SYSCONFDIR}/irssi/scripts/quitmsg.pl
-share/examples/irssi/scripts/redirect.pl
-@sample ${SYSCONFDIR}/irssi/scripts/redirect.pl
 share/examples/irssi/scripts/scriptassist.pl
 @sample ${SYSCONFDIR}/irssi/scripts/scriptassist.pl
 share/examples/irssi/scripts/usercount.pl
 @sample ${SYSCONFDIR}/irssi/scripts/usercount.pl
 share/examples/irssi/themes/
-@sample ${SYSCONFDIR}/irssi/themes/
 share/examples/irssi/themes/colorless.theme
 @sample ${SYSCONFDIR}/irssi/themes/colorless.theme
 share/examples/irssi/themes/default.theme
Index: pkg/PLIST-otr
===================================================================
RCS file: /cvs/ports/net/irssi/pkg/PLIST-otr,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 PLIST-otr
--- pkg/PLIST-otr       11 Mar 2022 19:46:10 -0000      1.4
+++ pkg/PLIST-otr       27 Jul 2022 02:01:02 -0000
@@ -1,4 +1,3 @@
 @conflict irssi-<1.2.1
 @pkgpath net/irssi-otr
-lib/irssi/modules/libotr_core.la
 @so lib/irssi/modules/libotr_core.so

Reply via email to