Adding flavor support to vimpager

Hi. I want to add flavor support to sysutils/vimpager so that it can be used with other flavors of editors/vim port. I have to use x11 flavor of vim port for clipboard support on my desktop. I couldn't do it myself because the port is finding vim binary and doesn't check if the flavors are matching and as a result, specified flavor of vim doesn't get installed. I have x11 flavor of vim installed. Vim port has console flavor by default. make -V RUN_DEPENDS does show specified flavor of vim but it doesn't install it. Thanks in advance.

Code:
# make -V RUN_DEPENDS
vim:editors/vim@console
# make FLAVOR=tiny -V RUN_DEPENDS
vim:editors/vim@tiny
# pkg info -x -g vim\*
vim-x11-9.1.0915
vimpager-2.06.20200712_1

# pkg ins -r FreeBSD vimpager
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (1 conflicting)
  - vim-9.1.0915 [FreeBSD] conflicts with vim-x11-9.1.0915 [installed] on /usr/local/bin/evim
Checking integrity... done (0 conflicting)
The following 3 package(s) will be affected (of 0 checked):

Installed packages to be REMOVED:
        vim-x11: 9.1.0915

New packages to be INSTALLED:
        vim: 9.1.0915 [FreeBSD]

Installed packages to be REINSTALLED:
        vimpager-2.06.20200712_1 [FreeBSD] (direct dependency changed: vim)

Number of packages to be removed: 1
Number of packages to be installed: 1
Number of packages to be reinstalled: 1

Proceed with this action? [y/N]:

I had opened a bug report about it.
PR 283220

Here is the work in progress Makefile.

Makefile:
PORTNAME=    vimpager
DISTVERSION=    2.06.20200712
PORTREVISION=    1
CATEGORIES=    sysutils

MAINTAINER=    ports@FreeBSD.org
COMMENT=    Use Vim/NeoVim as a pager
.if ${FLAVOR:U} == gtk2
COMMENT+=    (gtk2 flavor)
.endif
.if ${FLAVOR:U} == gtk3
COMMENT+=    (gtk3 flavor)
.endif
.if ${FLAVOR:U} == motif
COMMENT+=    (motif flavor)
.endif
.if ${FLAVOR:U} == tiny
COMMENT+=    (tiny flavor)
.endif
.if ${FLAVOR:U} == x11
COMMENT+=    (x11 flavor)
.endif
WWW=        https://github.com/rkitover/vimpager

LICENSE=    BSD2CLAUSE
LICENSE_FILE=    ${WRKSRC}/LICENSE

FLAVORS=    console gtk2 gtk3 motif tiny x11
FLAVOR?=    ${FLAVORS:[1]}

.for f in ${FLAVORS:Nconsole}
${f}_PKGNAMESUFFIX=    -${f}
.endfor

#.for d in ${FLAVORS:Nconsole}
#${d}_RUN_DEPENDS=    vim-${d}:editors/vim@${FLAVOR}
#.endfor
#console_RUN_DEPENDS=    vim:editors/vim@${FLAVOR}
#gtk2_RUN_DEPENDS=    vim:editors/vim@${FLAVOR}
#gtk3_RUN_DEPENDS=    vim:editors/vim@${FLAVOR}
#motif_RUN_DEPENDS=    vim:editors/vim@${FLAVOR}
#tiny_RUN_DEPENDS=    vim:editors/vim@${FLAVOR}
#x11_RUN_DEPENDS=    vim:editors/vim@${FLAVOR}

USES=        gmake
USE_GITHUB=    yes
GH_ACCOUNT=    rkitover
GH_TAGNAME=    85004fd

# Register conflicts with all other flavors
CONFLICTS_INSTALL=    ${FLAVORS:N${FLAVOR}:S/^/vimpager-/}

NO_ARCH=    yes

OPTIONS_DEFINE=        DOCS
OPTIONS_DEFAULT=    VIM
OPTIONS_SINGLE=        BACKEND

OPTIONS_SINGLE_BACKEND=    NEOVIM VIM
BACKEND_DESC=        Choose your Vim backend
NEOVIM_DESC=        NeoVim
VIM_DESC=        Vim

NEOVIM_RUN_DEPENDS=    nvim:editors/neovim
VIM_RUN_DEPENDS=    vim:editors/vim@${FLAVOR}

.include <bsd.port.mk>
 

Attachments

When I use # make FLAVOR=x11, it does try to build x11 flavor of editors/vim but when I package all flavors of sysutils/vimpager and editors/vim to /usr/ports/packages local repository and then install any flavor of sysutils/vimpager with pkg, it still depends on vanilla editors/vim. It doesn't match with editors/vim's flavor. I wonder if this would make a problem FreeBSD build system builds it when my patch that improperly (?) added flavors support to sysutils/vimpager. The port has no maintainer and if I could get this flavor support working properly (?), I would want to take maintainership of this port.

Makefile:
PORTNAME=    vimpager
DISTVERSION=    2.06.20241028
CATEGORIES=    sysutils

MAINTAINER=    nxjoseph@protonmail.com
COMMENT=    Use Vim as a pager
.if ${FLAVOR:U} == console
COMMENT+=    (console flavor)
.endif
.if ${FLAVOR:U} == gtk2
COMMENT+=    (gtk2 flavor)
.endif
.if ${FLAVOR:U} == gtk3
COMMENT+=    (gtk3 flavor)
.endif
.if ${FLAVOR:U} == motif
COMMENT+=    (motif flavor)
.endif
.if ${FLAVOR:U} == tiny
COMMENT+=    (tiny flavor)
.endif
.if ${FLAVOR:U} == x11
COMMENT+=    (x11 flavor)
.endif
WWW=        https://github.com/rkitover/vimpager

LICENSE=    BSD2CLAUSE
LICENSE_FILE=    ${WRKSRC}/LICENSE

FLAVORS=    console gtk2 gtk3 motif tiny x11
FLAVOR?=    ${FLAVORS:[1]}

.for f in ${FLAVOR:Nconsole}
${f}_PKGNAMESUFFIX=    -${f}
.endfor

console_RUN_DEPENDS=    ${LOCALBASE}/bin/vim:editors/vim@console
gtk2_RUN_DEPENDS=    ${LOCALBASE}/bin/vim:editors/vim@gtk2
gtk3_RUN_DEPENDS=    ${LOCALBASE}/bin/vim:editors/vim@gtk3
motif_RUN_DEPENDS=    ${LOCALBASE}/bin/vim:editors/vim@motif
tiny_RUN_DEPENDS=    ${LOCALBASE}/bin/vim:editors/vim@tiny
x11_RUN_DEPENDS=    ${LOCALBASE}/bin/vim:editors/vim@x11

USES=        gmake
USE_GITHUB=    yes
GH_ACCOUNT=    rkitover
GH_TAGNAME=    ce697c4cf34549796e1b533be3e337ca24b62c09

# Register conflicts with all other flavors
CONFLICTS_INSTALL=    ${FLAVORS:N${FLAVOR}:S/^/vimpager-/} \
            ${FLAVORS:N${FLAVOR}:S/^/vim-/}

NO_ARCH=    yes

OPTIONS_DEFINE=    DOCS

.include <bsd.port.mk>

I found out that a port does it like that below but in just one RUN_DEPENDS.
Code:
# cat ../../output
./editors/cream/Makefile:RUN_DEPENDS=   ${LOCALBASE}/bin/gvim:editors/vim@gtk3
# pkg ins cream
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating custom repository catalogue...
Fetching meta.conf: 100%    178 B   0.2kB/s    00:01
Fetching data.pkg: 100%    5 KiB   4.7kB/s    00:01
Processing entries: 100%
The provides database is up-to-date.
custom repository update completed. 17 packages processed.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        cream: 0.43 [FreeBSD]
        vim-gtk3: 9.1.0764 [FreeBSD]

Number of packages to be installed: 2

The process will require 43 MiB more space.
10 MiB to be downloaded.

Proceed with this action? [y/N]:

Code:
# pkg ins -n -r custom vimpager-x11
Updating custom repository catalogue...
Fetching meta.conf: 100%    178 B   0.2kB/s    00:01
Fetching data.pkg: 100%    5 KiB   4.7kB/s    00:01
Processing entries: 100%
The provides database is up-to-date.
custom repository update completed. 17 packages processed.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        vim: 9.1.0915 [custom]
        vimpager-x11: 2.06.20241028 [custom]

Number of packages to be installed: 2

The process will require 41 MiB more space.
 
I've finally made it! Looking forward for committer check.

Diff:
From 39bdc46108e8dc240db21da0d0dded98e9899b21 Mon Sep 17 00:00:00 2001
From: Yusuf Yaman <nxjoseph@protonmail.com>
Date: Thu, 9 Jan 2025 19:14:56 +0300
Subject: [PATCH] sysutils/vimpager: Update to 2.06.20241028

* Fixes for vimcat.
* Fix vim bug: hang on blank Ins in scripts.
* Added flavor support to enable compatibility
  with flavors of editors/vim.
* Pet port{fmt,lint,clippy}.
* Submitter becomes maintainer.

ChangeLog:
https://github.com/rkitover/vimpager/compare/85004fd...ce697c4

PR:    283220
---
 sysutils/vimpager/Makefile  | 60 ++++++++++++++++++++++++++++++-------
 sysutils/vimpager/distinfo  |  6 ++--
 sysutils/vimpager/pkg-plist |  2 +-
 3 files changed, 54 insertions(+), 14 deletions(-)

diff --git a/sysutils/vimpager/Makefile b/sysutils/vimpager/Makefile
index 26466bb6f799..5d5a3bd7872c 100644
--- a/sysutils/vimpager/Makefile
+++ b/sysutils/vimpager/Makefile
@@ -1,32 +1,72 @@
 PORTNAME=    vimpager
-DISTVERSION=    2.06.20200712
-PORTREVISION=    1
+DISTVERSION=    2.06.20241028
 CATEGORIES=    sysutils
 
-MAINTAINER=    ports@FreeBSD.org
+MAINTAINER=    nxjoseph@protonmail.com
 COMMENT=    Use Vim/NeoVim as a pager
+.if ${FLAVOR:U} == console
+COMMENT+=    (console flavor)
+.endif
+.if ${FLAVOR:U} == gtk2
+COMMENT+=    (gtk2 flavor)
+.endif
+.if ${FLAVOR:U} == gtk3
+COMMENT+=    (gtk3 flavor)
+.endif
+.if ${FLAVOR:U} == motif
+COMMENT+=    (motif flavor)
+.endif
+.if ${FLAVOR:U} == tiny
+COMMENT+=    (tiny flavor)
+.endif
+.if ${FLAVOR:U} == x11
+COMMENT+=    (x11 flavor)
+.endif
 WWW=        https://github.com/rkitover/vimpager
 
 LICENSE=    BSD2CLAUSE
 LICENSE_FILE=    ${WRKSRC}/LICENSE
 
+FLAVORS=    console gtk2 gtk3 motif tiny x11
+FLAVOR?=    ${FLAVORS:[1]}
+
+gtk2_PKGNAMESUFFIX=    -gtk2
+gtk3_PKGNAMESUFFIX=    -gtk3
+motif_PKGNAMESUFFIX=    -motif
+tiny_PKGNAMESUFFIX=    -tiny
+x11_PKGNAMESUFFIX=    -x11
+
 USES=        gmake
 USE_GITHUB=    yes
 GH_ACCOUNT=    rkitover
-GH_TAGNAME=    85004fd
+GH_TAGNAME=    ce697c4
 
-NO_ARCH=    yes
+# Register conflicts with all other flavors
+CONFLICTS_INSTALL=    ${FLAVORS:N${FLAVOR}:S/^/vimpager-/}
 
-OPTIONS_DEFINE=    DOCS
-OPTIONS_SINGLE=    BACKEND
-OPTIONS_DEFAULT=VIM
+NO_ARCH=    yes
 
+OPTIONS_DEFINE=        DOCS
+OPTIONS_DEFAULT=    VIM
+OPTIONS_SINGLE=        BACKEND
 OPTIONS_SINGLE_BACKEND=    NEOVIM VIM
+OPTIONS_SUB=        yes
+
 BACKEND_DESC=    Choose your Vim backend
 NEOVIM_DESC=    NeoVim
 VIM_DESC=    Vim
 
-NEOVIM_RUN_DEPENDS=    nvim:editors/neovim
-VIM_RUN_DEPENDS=    vim:editors/vim
+NEOVIM_RUN_DEPENDS=    ${LOCALBASE}/bin/nvim:editors/neovim
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MVIM}
+console_RUN_DEPENDS=    ${LOCALBASE}/bin/vim:editors/vim@console
+gtk2_RUN_DEPENDS=    ${LOCALBASE}/bin/vim:editors/vim@gtk2
+gtk3_RUN_DEPENDS=    ${LOCALBASE}/bin/vim:editors/vim@gtk3
+motif_RUN_DEPENDS=    ${LOCALBASE}/bin/vim:editors/vim@motif
+tiny_RUN_DEPENDS=    ${LOCALBASE}/bin/vim:editors/vim@tiny
+x11_RUN_DEPENDS=    ${LOCALBASE}/bin/vim:editors/vim@x11
+.endif
 
 .include <bsd.port.mk>
diff --git a/sysutils/vimpager/distinfo b/sysutils/vimpager/distinfo
index 3be032fd4ec6..17be52c72c7c 100644
--- a/sysutils/vimpager/distinfo
+++ b/sysutils/vimpager/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1594537103
-SHA256 (rkitover-vimpager-2.06.20200712-85004fd_GH0.tar.gz) = 7bf5f4b7ac6ef0bfc2d7837ce4a4bab9d891ddd14739e0619ba3346e75c3fb4d
-SIZE (rkitover-vimpager-2.06.20200712-85004fd_GH0.tar.gz) = 164077
+TIMESTAMP = 1736445105
+SHA256 (rkitover-vimpager-2.06.20241028-ce697c4_GH0.tar.gz) = 03f5bb333f128a6c66a34df8f4c29f9c5ed16145d9f87788bb6ddea62cdc584d
+SIZE (rkitover-vimpager-2.06.20241028-ce697c4_GH0.tar.gz) = 164295
diff --git a/sysutils/vimpager/pkg-plist b/sysutils/vimpager/pkg-plist
index 0f3267375a4a..a80b9fe11765 100644
--- a/sysutils/vimpager/pkg-plist
+++ b/sysutils/vimpager/pkg-plist
@@ -1,6 +1,6 @@
 bin/vimcat
 bin/vimpager
-etc/vimpagerrc
+%%ETCDIR%%rc
 %%PORTDOCS%%%%DOCSDIR%%/ChangeLog_vimcat.yml
 %%PORTDOCS%%%%DOCSDIR%%/ChangeLog_vimpager.yml
 %%PORTDOCS%%%%DOCSDIR%%/DOC_AUTHORS.yml
--
2.47.1
 
Back
Top