Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/dfshow/files/, app-misc/dfshow/
Date: Fri, 18 Jun 2021 21:07:46
Message-Id: 1624050422.4afd908c32d3bd1feceb96a602a759d4a7bf0e0a.soap@gentoo
1 commit: 4afd908c32d3bd1feceb96a602a759d4a7bf0e0a
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 18 21:07:02 2021 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 18 21:07:02 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4afd908c
7
8 app-misc/dfshow: use PKG_CHECK_MODULES for ncurses, libconfig
9
10 * Use PKG_CHECK_MODULES to find ncurses (and libconfig while we're
11 at it) rather than assuming e.g. split tinfo.
12
13 * Add the standard macOS LDFLAGS needed. No point in bothering upstream
14 with libtool just for this.
15
16 Signed-off-by: Sam James <sam <AT> gentoo.org>
17 Signed-off-by: David Seifert <soap <AT> gentoo.org>
18
19 app-misc/dfshow/dfshow-0.9.1_beta-r1.ebuild | 15 +++-
20 ...e-PKG_CHECK_MODULES-for-ncurses-libconfig.patch | 82 ++++++++++++++++++++++
21 2 files changed, 94 insertions(+), 3 deletions(-)
22
23 diff --git a/app-misc/dfshow/dfshow-0.9.1_beta-r1.ebuild b/app-misc/dfshow/dfshow-0.9.1_beta-r1.ebuild
24 index 883ebd7c7fe..d6a901fd6e7 100644
25 --- a/app-misc/dfshow/dfshow-0.9.1_beta-r1.ebuild
26 +++ b/app-misc/dfshow/dfshow-0.9.1_beta-r1.ebuild
27 @@ -3,7 +3,7 @@
28
29 EAPI=7
30
31 -inherit autotools bash-completion-r1
32 +inherit autotools bash-completion-r1 flag-o-matic
33
34 MY_PV="${PV//_beta/-beta}"
35 DESCRIPTION="DF-SHOW is a Unix-like rewrite of some of the applications from DF-EDIT"
36 @@ -19,11 +19,20 @@ DEPEND="dev-libs/libconfig:=
37 sys-libs/ncurses:0=
38 "
39 RDEPEND="${DEPEND}"
40 +BDEPEND="virtual/pkgconfig"
41 +
42 +PATCHES=(
43 + "${FILESDIR}"/${PN}-0.9.1_beta-use-PKG_CHECK_MODULES-for-ncurses-libconfig.patch
44 +)
45
46 src_prepare() {
47 default
48 - sed -i 's/LDADD = -lncursesw -lm -lconfig/LDADD = -lncursesw -lm -lconfig -ltinfow/' Makefile.am ||
49 - die "sed in Makefile.am failed"
50 +
51 + if [[ ${CHOST} == *-darwin* ]] ; then
52 + # Standard on macOS
53 + # No real motivation to push libtool upstream just for this
54 + append-ldflags -Wl,-undefined -Wl,dynamic_lookup
55 + fi
56
57 eautoreconf
58 }
59
60 diff --git a/app-misc/dfshow/files/dfshow-0.9.1_beta-use-PKG_CHECK_MODULES-for-ncurses-libconfig.patch b/app-misc/dfshow/files/dfshow-0.9.1_beta-use-PKG_CHECK_MODULES-for-ncurses-libconfig.patch
61 new file mode 100644
62 index 00000000000..33c5bc35dfb
63 --- /dev/null
64 +++ b/app-misc/dfshow/files/dfshow-0.9.1_beta-use-PKG_CHECK_MODULES-for-ncurses-libconfig.patch
65 @@ -0,0 +1,82 @@
66 +From a8185ad9270db54b9e0c66002e7ceebdc264af19 Mon Sep 17 00:00:00 2001
67 +From: Sam James <sam@g.o>
68 +Date: Fri, 30 Apr 2021 04:49:26 +0100
69 +Subject: [PATCH] Use PKG_CHECK_MODULES for ncurses, libconfig
70 +
71 +It's not always clear how to link against ncurses
72 +and the choices before us are:
73 +1) use a convoluted chain of autoconf checks
74 +2) use pkg-config (this commit)
75 +3) guess and hardcode the most popular values
76 +
77 +This is an iteration of a previous change [0] by a
78 +Gentoo contributor which landed upstream.
79 +
80 +The previous change ended up doing 3) which is fine
81 +but doesn't always work in strange situations. Gentoo
82 +_usually_ builds 'split tinfo' on Linux but this isn't
83 +guaranteed.
84 +
85 +This change now uses PKG_CHECK_MODULES which uses
86 +pkg-config behind the scenes to query ncurses
87 +for the correct way to build & link against it.
88 +
89 +(We do the same thing for libconfig too.)
90 +
91 +[0] https://github.com/roberthawdon/dfshow/pull/115
92 +---
93 + Makefile.am | 13 ++++---------
94 + configure.ac | 5 +++--
95 + 2 files changed, 7 insertions(+), 11 deletions(-)
96 +
97 +diff --git a/Makefile.am b/Makefile.am
98 +index 048ded5..6dcaa1f 100644
99 +--- a/Makefile.am
100 ++++ b/Makefile.am
101 +@@ -4,21 +4,16 @@ dfshowconfdir = $(sysconfdir)
102 + dfshowdatadir = $(datadir)/dfshow
103 +
104 + AM_CFLAGS = -DSYSCONFIG=\"$(dfshowconfdir)\" -DDATADIR=\"$(dfshowdatadir)\" -D_XOPEN_SOURCE_EXTENDED -fno-common
105 ++AM_CFLAGS += $(ncurses_CFLAGS) $(libconfig_CFLAGS)
106 +
107 +-LDADD = -lm -lconfig
108 +-
109 +-if DARWIN
110 +-LDADD += -lncurses
111 +-else
112 +-LDADD += -lncursesw
113 +-endif
114 ++LDADD = -lm $(ncurses_LIBS) $(libconfig_LIBS)
115 +
116 + if LINUX
117 +-LDADD += -lacl -ltinfo
118 ++LDADD += -lacl
119 + endif
120 +
121 + if HURD
122 +-LDADD += -lacl -ltinfo
123 ++LDADD += -lacl
124 + endif
125 +
126 + if SELINUX
127 +diff --git a/configure.ac b/configure.ac
128 +index f185b69..8acf1ab 100644
129 +--- a/configure.ac
130 ++++ b/configure.ac
131 +@@ -32,10 +32,11 @@ AC_CHECK_FUNCS(acl_get facl_get acl_set facl_set)
132 +
133 + AC_CHECK_MEMBERS([struct stat.st_author])
134 + AC_CHECK_HEADERS([stdio.h limits.h signal.h ctype.h wctype.h getopt.h sys/types.h sys/stat.h dirent.h fcntl.h pwd.h string.h stdlib.h unistd.h time.h sys/statvfs.h libgen.h errno.h wchar.h hurd.h math.h sys/sysmacros.h regex.h utime.h sys/xattr.h acl/libacl.h stdint.h])
135 +-AC_CHECK_HEADERS(ncurses.h, , AC_MSG_ERROR(ncurses header (ncurses.h) not found. You may need to install an ncurses development package.))
136 +-AC_CHECK_HEADERS(libconfig.h, , AC_MSG_ERROR(libconfig header (libconfig.h) not found. You may need to install a libconfig development package.))
137 + AC_CHECK_HEADERS(sys/acl.h, , AC_MSG_ERROR(libacl header (sys/acl.h) not found. You may need to install a libacl development package.))
138 +
139 ++PKG_CHECK_MODULES([ncurses], [ncurses])
140 ++PKG_CHECK_MODULES([libconfig], [libconfig])
141 ++
142 + AC_ARG_WITH([selinux], AS_HELP_STRING([--with-selinux], [Build with selinux library (default: disabled)]))
143 + AC_ARG_ENABLE([move-between-devices], AS_HELP_STRING([--enable-move-between-devices], [Enable moving objects between mounted devices (default: disabled)]))
144 +
145 +--
146 +2.31.1
147 +