Mon Nov 29 13:54:30 2021 UTC ()
Add a hack for NetBSD to make it start without crashing


(pho)
diff -r1.8 -r1.9 pkgsrc/audio/ncmpcpp/Makefile
diff -r0 -r1.1 pkgsrc/audio/ncmpcpp/hacks.mk

cvs diff -r1.8 -r1.9 pkgsrc/audio/ncmpcpp/Makefile (expand / switch to unified diff)

--- pkgsrc/audio/ncmpcpp/Makefile 2021/09/29 19:00:19 1.8
+++ pkgsrc/audio/ncmpcpp/Makefile 2021/11/29 13:54:29 1.9
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1# $NetBSD: Makefile,v 1.8 2021/09/29 19:00:19 adam Exp $ 1# $NetBSD: Makefile,v 1.9 2021/11/29 13:54:29 pho Exp $
2 2
3DISTNAME= ncmpcpp-0.9.2 3DISTNAME= ncmpcpp-0.9.2
4PKGREVISION= 3 4PKGREVISION= 4
5CATEGORIES= audio 5CATEGORIES= audio
6MASTER_SITES= https://rybczak.net/ncmpcpp/stable/ 6MASTER_SITES= https://rybczak.net/ncmpcpp/stable/
7EXTRACT_SUFX= .tar.bz2 7EXTRACT_SUFX= .tar.bz2
8 8
9MAINTAINER= pkgsrc-users@NetBSD.org 9MAINTAINER= pkgsrc-users@NetBSD.org
10HOMEPAGE= https://rybczak.net/ncmpcpp/ 10HOMEPAGE= https://rybczak.net/ncmpcpp/
11COMMENT= Featureful (n)curses based musicpd client inspired by ncmpc 11COMMENT= Featureful (n)curses based musicpd client inspired by ncmpc
12LICENSE= gnu-gpl-v2 12LICENSE= gnu-gpl-v2
13 13
14# C++14 14# C++14
15GCC_REQD+= 5 15GCC_REQD+= 5
16 16
17GNU_CONFIGURE= yes 17GNU_CONFIGURE= yes

File Added: pkgsrc/audio/ncmpcpp/hacks.mk
# $NetBSD: hacks.mk,v 1.1 2021/11/29 13:54:29 pho Exp $

### [Mon Nov 29 21:58:26 JST 2021 : pho]
### ncmpcpp is an unusual program which wants to use readline and ncursesw at
### the same time, and it crashes on startup without this hack. Things get
### really complicated in this scenario:
###
### * devel/readline is linked against native libterminfo.so because it is the
###   default termcap library (see mk/termcap.buildlink3.mk). Yes, termcap. It
###   has both termcap and terminfo implementations in a single library!
###
### * /usr/lib/libtermcap.so is actually a symlink to /usr/lib/libterminfo.so.
###
### * devel/ncursesw has its own terminfo implementation and wants to use it.
###
### * Since ncmpcpp is linked with -lreadline, -ltermcap, and -lncursesw at the
###   same time, the resulting executable ends up having DT_NEEDED for both
###   libterminfo.so and libncursesw.so.
###
### * But these two libraries aren't ABI compatible. When libncursesw calls a
###   function like, say, tigetnum(), it will actually call tigetnum() in native
###   libterminfo and then segfaults.
###
### * I don't know if NetBSD ld.elf_so creates a separate namespace of symbols
###   for each library DT_NEEDED'ed. I mean, I don't know what happens if the
###   main executable of ncmpcpp didn't have a DT_NEEDED for libterminfo. Will
###   libreadline use symbols in libterminfo and libncursesw use symbols in
###   itself? A quick test indicates it's plausible. ncmpcpp at least doesn't
###   crash when this hack is applied.
###
### * The situation is supposedly the same for devel/tig. It too uses readline
###   and ncursesw at the same time. But for some reason it doesn't crash. I
###   have absolutely no idea why it doesn't.
.if ${OPSYS} == "NetBSD"
PKG_HACKS+=		libtermcap-removal
BUILDLINK_TRANSFORM+=	rm:-ltermcap
.endif