Port's Makefile with variable version?

From: Milan Obuch <freebsd-ports_at_dino.sk>
Date: Fri, 30 Jul 2021 12:44:29 UTC

is there any possibility for a port's Makefile to define variable
version? I did some research and the answer seems to be 'no' currently,
I'd like to ask, however.

My port of interest is mail/claws-mail. It was recently upgraded to
version 3.18.0, uses GTK2 framework and upstream created first version
using GTK3, numbered as 4.0.0. I tried and verify it builds with almost
no changes to the port itself...

First change - Makefile:

--- Makefile.gtk2	2021-07-15 07:05:05.355402000 +0200
+++ Makefile.gtk3	2021-07-15 07:09:42.161819000 +0200
@@ -26,5 +26,5 @@
 USE_XORG=	ice sm
-USE_GNOME=	cairo gtk20 librsvg2
+USE_GNOME=	cairo gtk30 librsvg2
 SHEBANG_FILES=	tools/*.pl tools/*.py tools/tb2claws-mail

Second change - Makefile.claws:

--- Makefile.claws.gtk2	2021-07-15 07:06:03.491680000 +0200
+++ Makefile.claws.gtk3	2021-07-15 07:09:23.416226000 +0200
@@ -1,4 +1,4 @@

Third change - distinfo:

--- distinfo.gtk2	2021-07-15 07:46:52.734820000 +0200
+++ distinfo.gtk3	2021-07-15 07:47:22.478838000 +0200
@@ -1,4 +1,3 @@
-TIMESTAMP = 1626114302
-SHA256 (claws-mail-3.18.0.tar.xz) = cb5819e66b4bb3bbd44eb79c58f516a932389367a7900554321c24b509ece6bb
-SHA512 (claws-mail-3.18.0.tar.xz) = 3f73e11fc75234c44c0faf266a196c7f1c80b837fb920fc4a3979ede81f37efd180c006ab6436ae9c2dffde2d6c3bf6340a90d93e1e3fa8821fb09693d030811
-SIZE (claws-mail-3.18.0.tar.xz) = 6517632
+TIMESTAMP = 1626328037
+SHA256 (claws-mail-4.0.0.tar.xz) = 4af2bd26a5d91eacb2a9c09f67a6a46c2222b40817c1f525dc050bdc7b0ee475
+SIZE (claws-mail-4.0.0.tar.xz) = 6390300

Last change - pkg-plist (works for me, however, no guaranty for

--- pkg-plist.gtk2	2021-07-15 07:05:30.162500000 +0200
+++ pkg-plist.gtk3	2021-07-15 08:41:25.194732000 +0200
@@ -105,7 +105,6 @@
@@ -293,7 +292,6 @@

While first idea, create mail/claws-mail-gtk3 port, seems natural,
there is one problem. In ports tree, we have 26 or so plugin ports
(various claws-mail plugins have additional dependencies, that's the
main reason they were done this way, I think). So there is need to
create 26 basically identical plugin ports for this approach, difference
being just the master port reference.

With all the above changes applied to normal claws-mail port, all
plugin ports builds and works. Plugin ports get their version from
master port and everything just works, both Claws Mail itself and all
plugins as well. Important thing is, plugin ports require no change in
their Makefile, thus I think this way has its advantage.

I am looking for some way to integrate both GTK2 and GTK3 versions into
one port, using some OPTION to choose desired version. One problem is
GTK2 and GTK3 version actually conflict with the other one, they could
not be installed concurrently, at least with my current knowledge
level. Maybe this port could be FLAVORed? I have no experiences in this

Anybody out there with any idea on this? Currently, I have *.gtk2 and
*.gtk3 versions for files mentioned above and copy them over when I'd
like to switch with simple script, but this is not ideal, and I like to
offer simple way to test new version for anybody interested to test...
In the long run, in future, GTK2 version will be obsolete and not
developed anymore. When this time comes, mail/claws-mail port version
would be 4.x.y. For the time being, GTK2 version is still the 'master'