Bug 274619 - lang/gnat12: Makefile maintenance
Summary: lang/gnat12: Makefile maintenance
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: Thierry Thomas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-21 00:21 UTC by Alastair Hogge
Modified: 2023-10-29 13:19 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (thierry)


Attachments
Makefile maintenance; NLS support (14.55 KB, patch)
2023-10-21 00:21 UTC, Alastair Hogge
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alastair Hogge 2023-10-21 00:21:29 UTC
Created attachment 245767 [details]
Makefile maintenance; NLS support

Attempt to address all advice/warnings/errors from the
port{clippy,fmt,lint} tools, including correctly handling NLS.

* Move gettext-runtime to NLS helper, including pkg-plist updates;
* Prefix all custom variable with an underscore
* Sort Makefile Blocks into correct order; this meant breaking down the
  one if conditional covering MULTILIB into multiple conditionals spread
  between each Block
* Remove ${INFOS}; this was probably meant to be ${INFO}. The Info pages
  are removed later in the post-stage target, so there is no point
  defining any.
* No need to define ${GNU_CONFIGURE_MANPREFIX}, the Ports framework
  inherits this from ${MANPREFIX}, which is also defined in the port Makefile
* Explicitly enable C++ language to GNU configure; GNAT requires a
  working C++ toolchain to build itself
* Move to bsd.port.options.mk/bsd.port.mk Makefile inclusion pair
* Prefer ${DISTVERION} over ${PORTVERSION}
* Remove @ from some Makefile ${COMMANDS} to prefer verbose build output

There is still one warning from portlint:
> WARN: Makefile: possible use of absolute pathname "/sbin:/bin:/usr/sbin...".
I have not yet figured out how to handle that.

There is also an error reported during stage-qa with GCC6AUX:
Error: /usr/local/gnat12/lib/gcc/x86_64-portbld-freebsd15.0/12.2.0/plugin/libcc1plugin.so.0.0.0 is linked to /usr/local/gcc6-aux/lib/libstdc++.so.6 from lang/gcc6-aux but it is not declared as a dependency
Error: /usr/local/gnat12/lib/gcc/x86_64-portbld-freebsd15.0/12.2.0/plugin/libcc1plugin.so.0.0.0 is linked to /usr/local/gcc6-aux/lib/libgcc_s.so.1 from lang/gcc6-aux but it is not declared as a dependency
I have not been able to fix this using either helpers or an if ${PORT_OPTIONS} conditional.

Have tested with default options and the inverse of those on:
12.4-{amd64,i386} poudriere-testport OK
13.4-{amd64,i386} poudriere-testport OK
main-{amd64,i386} poudriere-testport OK
Comment 1 Thierry Thomas freebsd_committer freebsd_triage 2023-10-22 09:48:12 UTC
Thanks for your interest!

Remark: tools like portclippy, portlint, etc. offer some guidance, but there are no strict rules, and the aim is to have a Makefile logical and readable.

However the linkage with gcc6-aux is more problematic, and I'm going to investigate it, especially since I'm thinking of withdrawing it and build with the option PREVASSET by default.
Comment 2 Thierry Thomas freebsd_committer freebsd_triage 2023-10-27 15:44:40 UTC
Committed, thanks!

Note about the linkage error:

Error: /usr/local/gnat12/lib/gcc/x86_64-portbld-freebsd15.0/12.2.0/plugin/libcc1plugin.so.0.0.0 is linked to /usr/local/gcc6-aux/lib/libstdc++.so.6 from lang/gcc6-aux but it is not declared as a dependency
Error: /usr/local/gnat12/lib/gcc/x86_64-portbld-freebsd15.0/12.2.0/plugin/libcc1plugin.so.0.0.0 is linked to /usr/local/gcc6-aux/lib/libgcc_s.so.1 from lang/gcc6-aux but it is not declared as a dependency

And this is exact:
$ ldd /usr/local/gnat12/lib/gcc/x86_64-portbld-freebsd15.0/12.2.0/plugin/libcc1plugin.so.0.0.0
/usr/local/gnat12/lib/gcc/x86_64-portbld-freebsd15.0/12.2.0/plugin/libcc1plugin.so.0.0.0:
        libstdc++.so.6 => /usr/local/gcc6-aux/lib/libstdc++.so.6 (0x20faa0c4000)
        libm.so.5 => /lib/libm.so.5 (0x20fabb78000)
        libc.so.7 => /lib/libc.so.7 (0x20fab246000)
        libgcc_s.so.1 => /usr/local/gcc6-aux/lib/libgcc_s.so.1 (0x20faec8a000)

But if you deinstall gcc6-aux and re-check:
$ ldd /usr/local/gnat12/lib/gcc/x86_64-portbld-freebsd15.0/12.2.0/plugin/libcc1plugin.so.0.0.0
/usr/local/gnat12/lib/gcc/x86_64-portbld-freebsd15.0/12.2.0/plugin/libcc1plugin.so.0.0.0:
        libstdc++.so.6 => /usr/local/gnat12/lib/libstdc++.so.6 (0x196d03000000)
        libm.so.5 => /lib/libm.so.5 (0x196cfe6cb000)
        libc.so.7 => /lib/libc.so.7 (0x196cffe10000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x196cff382000)

I guess that for some reason the dynamic linker finds libgcc_s.so.1 under /usr/local/gcc6-aux/lib/ firstly, but once it is removed (this is only a BUILD_DEPENDS) it catches /lib/libgcc_s.so.1.

And of course, if you build it from a previous asset there is no problem.
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-10-27 15:45:30 UTC
A commit in branch main references this bug:

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

commit 8bb96e3f34f057bf41034902075e2ced885db33d
Author:     Alastair Hogge <agh@riseup.net>
AuthorDate: 2023-10-27 11:48:32 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2023-10-27 15:36:35 +0000

    lang/gnat12: Makefile maintenance

    * Move gettext-runtime to NLS helper, including pkg-plist updates;
    * Prefix all custom variable with an underscore
    * Sort Makefile Blocks into correct order; this meant breaking down the
      one if conditional covering MULTILIB into multiple conditionals spread
      between each Block
    * Remove ${INFOS}; this was probably meant to be ${INFO}. The Info pages
      are removed later in the post-stage target, so there is no point
      defining any.
    * No need to define ${GNU_CONFIGURE_MANPREFIX}, the Ports framework
      inherits this from ${MANPREFIX}, which is also defined in the port Makefile
    * Explicitly enable C++ language to GNU configure; GNAT requires a
      working C++ toolchain to build itself
    * Move to bsd.port.options.mk/bsd.port.mk Makefile inclusion pair
    * Prefer ${DISTVERION} over ${PORTVERSION}
    * Remove @ from some Makefile ${COMMANDS} to prefer verbose build output

    PR:             274619
    Approved by:    /me

 lang/gnat12/Makefile  | 204 +++++++++++++++++++++++++-------------------------
 lang/gnat12/pkg-plist |  80 ++++++++++----------
 2 files changed, 141 insertions(+), 143 deletions(-)
Comment 4 Alastair Hogge 2023-10-29 13:19:59 UTC
(In reply to Thierry Thomas from comment #2)
Thanks.