Page MenuHomeFreeBSD

Mk/Uses/ncurses.mk: Fix broken ports ncurses support
AbandonedPublic

Authored by bapt on Jan 30 2016, 10:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 31 2023, 7:32 PM
Unknown Object (File)
Dec 3 2023, 1:36 PM
Unknown Object (File)
Sep 16 2023, 9:37 AM
Unknown Object (File)
Aug 27 2023, 2:58 PM
Unknown Object (File)
Aug 17 2023, 1:04 PM
Unknown Object (File)
Aug 13 2023, 12:44 PM
Unknown Object (File)
Aug 6 2023, 7:33 AM
Unknown Object (File)
Jun 15 2023, 11:33 AM
Subscribers

Details

Reviewers
antoine
marino
Group Reviewers
portmgr
Summary

Background: DragonFly master has effectively removed ncurses from base
(it's still there, but in a private area dports won't find). As a result,
literally hundreds of ports broken. That's how many are missing
USES=ncurses. That's not a big problem because the infrastructure blanket
will allow me to fix those.

The problem is that ports ncurces handling is broken in two ways:

  1. There is no library path (-L) set in LDFLAGS. For compilers that do no automatically search /usr/local/lib, that's broken, and of course if a non-default localbase is used, it's broken
  1. The LDFLAGS that are set regarding rpath is wrong. It uses the -Wl, prefix which is for the compiler, not the linker.

The commit fixes both problem by:
A) adding -L${LOCALBASE}/lib to LDFLAGS

  1. correcting -Wl,-rpath=${NCURSESPATH} to "-rpath ${NCURSESPATH}"

DragonFly will be extremely helpful to FreeBSD because we have to fix
all these ncurses ports, which will be very nice for FreeBSD if/when
they privatize ncurses library in a similar fashion.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 2386
Build 2402: arc lint + arc unit

Event Timeline

marino retitled this revision from to Fix broken ports ncurses support.
marino updated this object.

hmmm, hold on, it should be
LDFLAGS+= -L${NCURSESRPATH}

Let me update quickly.

marino edited edge metadata.

Update -L flag to use NCURSESPATH

antoine requested changes to this revision.Jan 30 2016, 1:33 PM
antoine added a reviewer: antoine.
antoine added a subscriber: antoine.

This change breaks some ports (guile, cone, libcdio, probably others)

This revision now requires changes to proceed.Jan 30 2016, 1:33 PM

which change?
the -L or the -rpath?

Secondly, put aside the ports for a minute and look at this in a vacuum. Is the statement that ncurses.mk is wrong correct or not?

I don't see how -L could be wrong, so I will assume you are talking about -rpath.

It is a fact that modern linkers do not accept -Wl, arguments. LDFLAGS is for the linker. So if a port is breaking, then it is using LDFLAGS for the compiler, meaning the port is wrong.

If you want, I can show you error messages from LD saying it does not recognize -Wl,

to be fair, though, I've seen LDFLAGS passed to a compiler too.

if the "-L" change by itself can be approved, that would still be an improvement. the -rpath change will clearly require an exp-run

Yes the -rpath breaks some ports.
And I agree USES=ncurses doesn't really work now.

in any case, it should be "-rpath=${NCURSESRPATH}" not "-rpath ${NCURSESRPATH}"

some applications mishandle 2 arguments rather than one.

So far I have not identified any fallout with the "=" version. I'm effectively doing an exp-run right now because we're using this patch

antoine, why is rpath even defined on the base ncurses case?

rtld searches there unconditionally.

It seems to me that -rpath should only be defined for the ports ncurses case in any event. Thoughts? Can you think of a base ncurses case that requires -rpath set?

it seems my -rpath change is not correct in any case:
"LDFLAGS: Extra flags to give to compilers when they are supposed to invoke the linker, ‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable instead."

However, there are definitely ports that send LDFLAGS to the linker, so those ports are wrong.

the "ports ncurses" probably needs CFLAGS set for -I (to point to ncurses ports headers) though

Ask bapt@ as he wrote the code?

marino edited edge metadata.

This is what I had in mind (will test in next few days)

Okay, based on Antoine's (confirmed) feedback, I'm modifying the
patch, which I will test under a few bulk run in a few days:

  1. editorial, fix indents of conditional statements to match previous
  2. Add -I to cflags for "ports" version. This will be required should base ncurses headers not be present
  3. relocate -rpath switches to "ports" ncurses branch. Unless I am missing something, having -rpath on base ncurses has no impact (unless maybe there's a rtld switch to ignore base libs? but in that case, I would think the switch would override -rpath anyway)

obviously #3 is the biggest change, so maybe bapt can explain why this
was being applied to the base and why it has an effect (I don't think
it does)

marino edited edge metadata.

Fix typo (I transferred it by hand)

Tidy up by combining LDFLAGS and tabbing CFLAGS (it is also more logical)

Mk/Uses/ncurses.mk
80

I think this should be CPPFLAGS, not CFLAGS

linimon retitled this revision from Fix broken ports ncurses support to Mk/Uses/ncurses.mk: Fix broken ports ncurses support.Jul 18 2018, 1:00 PM
This revision now requires changes to proceed.Jul 18 2018, 1:00 PM
bapt added a reviewer: marino.