Bug 276244 - [NEW PORT] games/freeciv21: Freeciv for the 21st century
Summary: [NEW PORT] games/freeciv21: Freeciv for the 21st century
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Daniel Engberg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-10 17:13 UTC by Tobias Rehbein
Modified: 2024-01-18 19:24 UTC (History)
1 user (show)

See Also:


Attachments
Patch that adds games/freeciv21 (182.26 KB, patch)
2024-01-10 17:13 UTC, Tobias Rehbein
no flags Details | Diff
Patch that adds games/freeciv21 (182.36 KB, patch)
2024-01-13 14:55 UTC, Tobias Rehbein
no flags Details | Diff
Patch that adds games/freeciv21 (179.15 KB, patch)
2024-01-14 13:49 UTC, Tobias Rehbein
no flags Details | Diff
Patch that adds games/freeciv21 (179.08 KB, patch)
2024-01-14 13:52 UTC, Tobias Rehbein
no flags Details | Diff
Patch that adds games/freeciv21 (179.21 KB, patch)
2024-01-14 15:33 UTC, Tobias Rehbein
no flags Details | Diff
Patch that adds games/freeciv21 (179.22 KB, patch)
2024-01-15 06:56 UTC, Tobias Rehbein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Rehbein 2024-01-10 17:13:22 UTC
Created attachment 247572 [details]
Patch that adds games/freeciv21

Freeciv21 takes its roots in the well-known FOSS game Freeciv (games/freeciv) and extends it for more fun, with a revived focus on competitive multiplayer environments. Players can choose from over 500 nations and can play against the computer or other people in an active online community.

All local patches have been upstreamed and will no longer be required with release 3.1 at the latest.

QA:
* portclippy: ok
* portlint -AC: looks fine
* poudriere testport: 14.0 amd64 okay (for the different port options)
* I am currently playing a match on longturn.net using this port.
Comment 1 Tobias Rehbein 2024-01-12 19:02:06 UTC
Additional QA:
* stage-qa: passes
Comment 2 Tobias Rehbein 2024-01-13 14:55:22 UTC
Created attachment 247625 [details]
Patch that adds games/freeciv21

Updated patch to depend on devel/elfutils for libdw to enable better debugging information when anything goes wrong.
Comment 3 Daniel Engberg freebsd_committer freebsd_triage 2024-01-14 12:00:05 UTC
Hi,

Please use DISTVERSION instead of PORTVERSION and avoid being elaborative. 
Is there a reason why we can't use the official release archives?
https://github.com/longturn/freeciv21/releases/tag/v3.0-patch.2

See warning in Porters Handbook
https://docs.freebsd.org/en/books/porters-handbook/makefiles/#makefile-master_sites-github

You can also use this approach to reference backports of patches on GitHub
https://cgit.freebsd.org/ports/tree/irc/irssi/Makefile?id=bc97cc7b70dea8f491605a7670932805dcb9ea97#n7

Best regards,
Daniel
Comment 4 Tobias Rehbein 2024-01-14 13:49:31 UTC
Created attachment 247642 [details]
Patch that adds games/freeciv21

(In reply to Daniel Engberg from comment #3)
Hi Daniel,

I applied your tip to fetch the upstream patches from github, instead of keeping them local.

I don't think I can use DISTVERSION. DISTVERSION v3.0-patch.2 would result in PORTVERSION 3.0.p.2 and `pkg version` interprets the `p` not as `patch` but as `prerelease` and messes up the version comparisons.

You are right, we could use the official release archives, but I don't know how to fetch them and the Porters Handbook is not very helpful in this case. I guess it would work automatically if I would set DISTVERSION and DISTVERSIONPREFIX and drop GH_TAGNAME, but I can't set DISTVERSION. Will I have to drop USE_GITHUB and set MASTER_SITE and DISTNAME explicitly?

Thanks for taking the time to help me on this PR.

Best regards,
Tobias
Comment 5 Tobias Rehbein 2024-01-14 13:52:20 UTC
Created attachment 247643 [details]
Patch that adds games/freeciv21

Updated patch fixes the commit message.

Sorry for the noise.
Comment 6 Daniel Engberg freebsd_committer freebsd_triage 2024-01-14 14:47:15 UTC
Hi,

USE_GITHUB isn't aware of release assets and is only intended when there aren't any available or suitable for some reason. Otherwise you should use MASTER_SITES and handle it like any other site.

In this case the framework will get it wrong due to odd naming. If you use MASTER_SITES follow the directions in Porters Handbook. (PORTVERSION + DISTNAME)
https://docs.freebsd.org/en/books/porters-handbook/book/#makefile-distname .

If you were to use USE_GITHUB:
DISTVERSION (set something sane) + GH_TAGNAME to whatever upstream names it or commit.
https://docs.freebsd.org/en/books/porters-handbook/book/#makefile-master_sites-github

Hope that helps

Best regards,
Daniel
Comment 7 Tobias Rehbein 2024-01-14 15:33:53 UTC
Created attachment 247651 [details]
Patch that adds games/freeciv21

Patch updated: Remove USE_GITHUB and friends, fetch the release archive instead.

I hope I am getting closer.
I am learning a lot along the way :)
Comment 8 Daniel Engberg freebsd_committer freebsd_triage 2024-01-15 00:28:26 UTC
Hmm...

You probably want to add the following so it doesn't pick up Sphinx by accident and starts building documentation or add it as an option
CMAKE_ON= CMAKE_DISABLE_FIND_PACKAGE_Sphinx 
https://github.com/longturn/freeciv21/blob/master/docs/CMakeLists.txt

And possibly CMAKE_DISABLE_FIND_PACKAGE_Git
https://github.com/longturn/freeciv21/blob/master/cmake/AutoRevision.cmake#L24

I would also argue that FC21_VERSION= should be placed before CMAKE_* and menu options definitions.

Best regards,
Daniel
Comment 9 Tobias Rehbein 2024-01-15 06:56:35 UTC
Created attachment 247674 [details]
Patch that adds games/freeciv21

I didn't explicitly disable the optional dependencies because the packages are built in a clean environment. But of course, at this point it's better to be defensive in case someone builds directly from the ports tree. Done.

I moved FC21_VERSION up as far as it will go without portlint complaining. I could drag it before the USE_* declarations, but that looks wrong.
Comment 10 commit-hook freebsd_committer freebsd_triage 2024-01-18 19:21:08 UTC
A commit in branch main references this bug:

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

commit 35a287f77a4a5b38296eaccdda7d281b1a275cfb
Author:     Tobias Rehbein <tobias.rehbein@web.de>
AuthorDate: 2024-01-18 19:17:22 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2024-01-18 19:20:35 +0000

    games/freeciv21: New port: Freeciv for the 21st century

    Freeciv21 takes its roots in the well-known FOSS game Freeciv
    (games/freeciv) and extends it for more fun, with a revived focus on
    competitive multiplayer environments. Players can choose from over 500
    nations and can play against the computer or other people in an active
    online community.

    PR:             276244

 games/Makefile                  |    1 +
 games/freeciv21/Makefile (new)  |   48 +
 games/freeciv21/distinfo (new)  |   15 +
 games/freeciv21/pkg-descr (new) |   11 +
 games/freeciv21/pkg-plist (new) | 3954 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 4029 insertions(+)
Comment 11 Daniel Engberg freebsd_committer freebsd_triage 2024-01-18 19:24:48 UTC
While portfmt utils disagrees (they do work well in general however) a general rule of thumb is to have build system options last before defining menu options simply because of readability reasons.

Committed, thanks for your patience!