Bug 278203 - www/nift: update from 2.4.11 to 3.0.3
Summary: www/nift: update from 2.4.11 to 3.0.3
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Zsolt Udvari
URL: https://nift.dev
Keywords:
: 254980 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-04-06 18:21 UTC by yds
Modified: 2024-09-05 05:30 UTC (History)
2 users (show)

See Also:
info: maintainer-feedback+


Attachments
[UPGRADE] www/nift from 2.4.11 to 3.0.3 (7.06 KB, patch)
2024-04-06 18:21 UTC, yds
no flags Details | Diff
[UPGRADE] www/nift from 2.4.11 to 3.0.3 (7.22 KB, patch)
2024-04-06 18:27 UTC, yds
no flags Details | Diff
fixed-patch v2.4.11_1 to v3.0.3 (7.46 KB, patch)
2024-04-15 09:05 UTC, Mamadou Babaei
info: maintainer-approval+
Details | Diff
www_nift_v2.4.11_1_to_v3.0.3.patch (9.13 KB, patch)
2024-08-19 04:03 UTC, Mamadou Babaei
info: maintainer-approval+
Details | Diff
www_nift_v2.4.11_1_to_v3.0.3.patch (8.81 KB, patch)
2024-09-03 06:42 UTC, Mamadou Babaei
info: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description yds 2024-04-06 18:21:50 UTC
Created attachment 249770 [details]
[UPGRADE] www/nift from 2.4.11 to 3.0.3

this upgrade removes www/nift/files/patch-Makefile and upgrades www/nift to the latest version 3.0.3
Comment 1 yds 2024-04-06 18:27:18 UTC
Created attachment 249771 [details]
[UPGRADE] www/nift from 2.4.11 to 3.0.3

update WWW to Nift.dev
Comment 2 Mamadou Babaei 2024-04-07 03:35:02 UTC
Thank you for the patch!

However, two things:

1. The following is unnecessary:
PORTREVISION=	0

You could just remove the line.

2. I just ran applied the patch and ran a make and I get:

 make
===>  Building for nift-3.0.3
clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o GitInfo.o GitInfo.cpp
clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o Expr.o Expr.cpp
clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o Variables.o Variables.cpp
clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o Lolcat.o Lolcat.cpp
clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o Lua.o Lua.cpp
clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o Pagination.o Pagination.cpp
In file included from Lua.cpp:1:
./Lua.h:41:12: fatal error: '/usr/local/include/luajit-2.1/lua.hpp' file not found
                #include "/usr/local/include/luajit-2.1/lua.hpp"
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
gmake: *** [Makefile:258: Lua.o] Error 1
gmake: *** Waiting for unfinished jobs....
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/home/mamadou/www/nift
*** Error code 1

Stop.
make: stopped in /usr/home/mamadou/www/nift


I will investigate this later when I have a bit more time since I haven't touched this port for quite a while. In the meantime feel free to submit a new patch if you feel you could fix it.
Comment 3 Mamadou Babaei 2024-04-07 03:35:31 UTC
Thank you for the patch!

However, two things:

1. The following is unnecessary:
PORTREVISION=	0

You could just remove the line.

2. I just ran applied the patch and ran a make and I get:

 make
===>  Building for nift-3.0.3
clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o GitInfo.o GitInfo.cpp
clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o Expr.o Expr.cpp
clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o Variables.o Variables.cpp
clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o Lolcat.o Lolcat.cpp
clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o Lua.o Lua.cpp
clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o Pagination.o Pagination.cpp
In file included from Lua.cpp:1:
./Lua.h:41:12: fatal error: '/usr/local/include/luajit-2.1/lua.hpp' file not found
                #include "/usr/local/include/luajit-2.1/lua.hpp"
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
gmake: *** [Makefile:258: Lua.o] Error 1
gmake: *** Waiting for unfinished jobs....
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/home/mamadou/www/nift
*** Error code 1

Stop.
make: stopped in /usr/home/mamadou/www/nift


I will investigate this later when I have a bit more time since I haven't touched this port for quite a while. In the meantime feel free to submit a new patch if you feel you could fix it.
Comment 4 yds 2024-04-07 13:29:46 UTC
Regarding:
```
./Lua.h:41:12: fatal error: '/usr/local/include/luajit-2.1/lua.hpp' file not found
                #include "/usr/local/include/luajit-2.1/lua.hpp"
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
I built and installed the updated nift 3.0.3 on 5 separate boxen with luajit-openresty-2.1.20240314 as the dependency -- unable to reproduce this build failure. ¯\_(ツ)_/¯
Comment 5 Mamadou Babaei 2024-04-07 19:36:37 UTC
Well, it seems lang/luajit port on FreeBSD is version 2.0 and lang/luajit-devel is version 2.1:

https://cgit.freebsd.org/ports/tree/lang/luajit/Makefile

https://cgit.freebsd.org/ports/tree/lang/luajit-devel/Makefile

Though, somehow LUAJIT_LUAVER is set to 2.1.

PORTS_LUAJIT_MAKE_ARGS=		BUNDLED=0 LUAJIT_VERSION=${LUAJIT_LUAVER}

And, interestingly I don't have anything lua-related set in my make.conf as the cat output is empty:

cat /etc/make.conf | grep lua
Comment 6 yds 2024-04-07 19:52:25 UTC
(In reply to Mohammad S. Babaei from comment #5)

according to Mk/bsd.default-versions.mk on line 100:
LUAJIT_DEFAULT?=        luajit-devel

I believe you would need to explicitly set:
DEFAULT_VERSIONS+=      luajit=luajit
or
LUAJIT_DEFAULT?=        luajit
otherwise LUAJIT_LUAVER will default to 2.1

it seems like 2.0 is no longer the default and has to be explicitly chosen, having the plain old luajit port installed is not enough to change LUAJIT_LUAVER without explicitly adding luajit=luajit to DEFAULT_VERSIONS in make.conf
Comment 7 Mamadou Babaei 2024-04-15 09:05:35 UTC
Created attachment 249991 [details]
fixed-patch v2.4.11_1 to v3.0.3

OK, it seems luajit 2.0 has no maintainer and it emits this message when installed:

Installing luajit-2.0.5_7...
===>   NOTICE:

The luajit port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:

https://bugs.freebsd.org/bugzilla

More information about port maintainership is available at:

https://docs.freebsd.org/en/articles/contributing/#ports-contributing


For some reason FreeBSD ports installs luajit-devel when you do USES=luajit but keeps the value of LUAJIT_LUAVER to 2.0 not 2.1. That's why we have to explicitly set it to 2.1.

This patch passes all tests on my side.
Comment 8 Mamadou Babaei 2024-04-15 09:07:26 UTC
Comment on attachment 249771 [details]
[UPGRADE] www/nift from 2.4.11 to 3.0.3

This patch is broken.
Comment 9 Zsolt Udvari freebsd_committer freebsd_triage 2024-04-27 18:16:41 UTC
Is it any reason to (optionally) use bundled lua/luajit? See https://docs.freebsd.org/en/books/porters-handbook/book/#bundled-libs-why-bad

What do you think about lua:flavors? See https://docs.freebsd.org/en/books/porters-handbook/book/#lua-version-flavors
Your Makefile would be cleaner and will build and available in package repositories with every lua version.
I suggest it.
Comment 10 Mamadou Babaei 2024-08-19 04:03:49 UTC
Created attachment 252908 [details]
www_nift_v2.4.11_1_to_v3.0.3.patch

@Zsolt Udvari

Thank you very much for the links and the extra info.

There were no specific reasons other than the port itself had Lua bundled so I wanted to give the choice to the user. But, it seems reasonable after studying the reasoning from the handbook to remove those.

Indeed the Makefile became much simpler using the flavours as well.

Here's another patch that passes all tests.
Comment 11 Zsolt Udvari freebsd_committer freebsd_triage 2024-08-24 17:32:21 UTC
(In reply to Mamadou Babaei from comment #10)
It's more simpler than this patch:
https://docs.freebsd.org/en/books/porters-handbook/book/#lua-version-flavors

You don't need lua-versions in options and can remove them. You need only lua:modules in your USES-line and set PKGNAMEPREFIX.

But now I see it's an application you don't need specify lua version (https://docs.freebsd.org/en/books/porters-handbook/book/#flavors-auto-lua) - this is done by DEFAULT_VERSIONS. Please review the www/luakit: https://cgit.freebsd.org/ports/tree/www/luakit/Makefile
Comment 12 Mamadou Babaei 2024-09-03 06:12:48 UTC
Well, I tried your suggestion, but the problem lies here:

LUA51_USES=		lua:51
LUA51_MAKE_ARGS=	BUNDLED=0 LUA_VERSION=5.1
LUA52_USES=		lua:52
LUA52_MAKE_ARGS=	BUNDLED=0 LUA_VERSION=5.2
LUA53_USES=		lua:53
LUA53_MAKE_ARGS=	BUNDLED=0 LUA_VERSION=5.3
LUA54_USES=		lua:54
LUA54_MAKE_ARGS=	BUNDLED=0 LUA_VERSION=5.4
LUAJIT_USES=		luajit
LUAJIT_MAKE_ARGS=	BUNDLED=0 LUAJIT_VERSION=2.1

The Makefile that came with the project expects to declare a LUA_VERSION otherwise it fallbacks to LUAJIT_VERSION=2.1 and results in build failure.

But, when I pass the LUA_VERSION to the port's Makefile through the options:

clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUA_VERSION_5_4__ -c -o NumFns.o NumFns.cpp

It builds fine. I am not sure how I can achieve that by simply:

USES=		compiler:c++11-lang gmake lua:modules


I'd appreciate more clarification.
Comment 13 Mamadou Babaei 2024-09-03 06:32:03 UTC
I'm not sure if this is the best approach to implement it:

PORTNAME=	nift
DISTVERSIONPREFIX=	v
DISTVERSION=	3.0.3
CATEGORIES=	www

MAINTAINER=	info@babaei.net
COMMENT=	Cross-platform open source website generator
WWW=		https://www.nift.dev

LICENSE=	MIT
LICENSE_FILE=	${WRKSRC}/LICENSE

USES=		compiler:c++11-lang gmake
USE_GITHUB=	yes
GH_ACCOUNT=	nifty-site-manager
GH_PROJECT=	nsm

PLIST_FILES=	bin/nift \
		bin/nsm

OPTIONS_DEFINE=		LUAJIT
OPTIONS_DEFAULT=	LUAJIT
LUAJIT_DESC=		Use the Just-In-Time compiler for lua
LUAJIT_USES=		luajit
LUAJIT_MAKE_ARGS=	BUNDLED=0 LUAJIT_VERSION=${LUAJIT_LUAVER}
LUAJIT_MAKE_ARGS_OFF=	BUNDLED=0 LUA_VERSION=${LUA_VER}

. if empty(PORT_OPTIONS:MLUAJIT)
USES+=		lua:modules
.endif

post-patch:
	${REINPLACE_CMD} -Ee 's|^(PREFIX\?=)/usr/local$$|\1${LOCALBASE}|g' \
		${WRKSRC}/Makefile

post-install:
	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/nift
	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/nsm

.include <bsd.port.mk>



It works when LUAJIT is OFF, but when enabled:

clang -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -std=c++11 -Wall -Wextra -pedantic -O3 -Dexprtk_disable_caseinsensitivity -s -Qunused-arguments -lstdc++ -D__LUAJIT_VERSION_2_1__ -c -o Lua.o Lua.cpp
In file included from Lua.cpp:1:
./Lua.h:41:12: fatal error: '/usr/local/include/luajit-2.1/lua.hpp' file not found
                #include "/usr/local/include/luajit-2.1/lua.hpp"
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comment 14 Mamadou Babaei 2024-09-03 06:35:49 UTC
Explicitly settings:

LUAJIT_MAKE_ARGS=	BUNDLED=0 LUAJIT_VERSION=2.0

works as I have:

pkg info | grep lua
lua52-5.2.4_1                  Small, compilable scripting language providing easy access to C code
lua53-5.3.6_1                  Powerful, efficient, lightweight, embeddable scripting language
lua54-5.4.6_1                  Powerful, efficient, lightweight, embeddable scripting language
lua54-bitop-1.0.2_2            Bitwise operations on numbers
lua54-lpeg-1.1.0               PEG-based pattern-matching library for Lua
luajit-2.0.5_7                 Just-In-Time Compiler for Lua
luv-1.48.0.2                   libuv bindings for lua
Comment 15 Mamadou Babaei 2024-09-03 06:42:52 UTC
Created attachment 253284 [details]
www_nift_v2.4.11_1_to_v3.0.3.patch

OK, it seems the issue was neovim on my system, it was using luajit 2.0. Removed and reinstalled and it seems to work now.

Here's the new patch. Please let me know your opinion.
Comment 16 Zsolt Udvari freebsd_committer freebsd_triage 2024-09-05 05:29:31 UTC
*** Bug 254980 has been marked as a duplicate of this bug. ***
Comment 17 commit-hook freebsd_committer freebsd_triage 2024-09-05 05:30:02 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b5688f6d033b41d422a8962af69239981a3ad841

commit b5688f6d033b41d422a8962af69239981a3ad841
Author:     Mamadou Babaei <info@babaei.net>
AuthorDate: 2024-09-05 05:21:56 +0000
Commit:     Zsolt Udvari <uzsolt@FreeBSD.org>
CommitDate: 2024-09-05 05:28:55 +0000

    www/nift: Update to 3.0.3

    Don't use bundled lua or luajit.
    Remove options about lua versions, set via DEFAULT_VERSIONS.
    Add LUAJIT option.
    Update WWW.

    Changelog:
    https://github.com/nifty-site-manager/nsm/blob/master/ReleaseNotes.md

    PR:             278203
    Reported by:    yds <yds@Necessitu.de>
    Approved by:    submitter is maintainer

 www/nift/Makefile                    |  49 +++--------
 www/nift/distinfo                    |   6 +-
 www/nift/files/patch-Makefile (gone) | 159 -----------------------------------
 3 files changed, 16 insertions(+), 198 deletions(-)
Comment 18 Zsolt Udvari freebsd_committer freebsd_triage 2024-09-05 05:30:51 UTC
Great work! Committed, thanks!