Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Wed, 28 Jul 2021 12:35:14
Message-Id: 1627475692.edef7fcdd62179c622c5fac0b1be5b14684f532a.ulm@gentoo
1 commit: edef7fcdd62179c622c5fac0b1be5b14684f532a
2 Author: Martin Dummer <martin.dummer <AT> gmx <DOT> net>
3 AuthorDate: Sun Jun 27 15:05:23 2021 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 28 12:34:52 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=edef7fcd
7
8 vdr-plugin-2.eclass: add EAPI8 support, EAPI7+ fixes
9
10 - add EAPI8 support, no changes necessary
11 - add BDEPEND=pkgconfig
12 - remove outdated version numbers from (R)DEPEND
13 - fix calling of pkg-config
14 - add many "|| die" which should have been here already for EAPI7
15
16 Closes: https://github.com/gentoo/gentoo/pull/21447
17 Signed-off-by: Martin Dummer <martin.dummer <AT> gmx.net>
18 Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
19
20 eclass/vdr-plugin-2.eclass | 74 ++++++++++++++++++++++++++++------------------
21 1 file changed, 46 insertions(+), 28 deletions(-)
22
23 diff --git a/eclass/vdr-plugin-2.eclass b/eclass/vdr-plugin-2.eclass
24 index 3f3acc41208..8964ecbaf74 100644
25 --- a/eclass/vdr-plugin-2.eclass
26 +++ b/eclass/vdr-plugin-2.eclass
27 @@ -73,19 +73,17 @@
28
29 [[ ${EAPI} == [5] ]] && inherit multilib
30 [[ ${EAPI} == [56] ]] && inherit eutils
31 -inherit flag-o-matic toolchain-funcs unpacker
32 +inherit flag-o-matic strip-linguas toolchain-funcs unpacker
33
34 -case ${EAPI:-0} in
35 - 5|6|7)
36 +case ${EAPI} in
37 + 5|6|7|8)
38 ;;
39 - *) die "EAPI ${EAPI} unsupported."
40 + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported"
41 ;;
42 esac
43
44 EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm pkg_config
45
46 -IUSE=""
47 -
48 # Name of the plugin stripped from all vdrplugin-, vdr- and -cvs pre- and postfixes
49 VDRPLUGIN="${PN/#vdrplugin-/}"
50 VDRPLUGIN="${VDRPLUGIN/#vdr-/}"
51 @@ -97,10 +95,16 @@ DESCRIPTION="vdr Plugin: ${VDRPLUGIN} (based on vdr-plugin-2.eclass)"
52 S="${WORKDIR}/${VDRPLUGIN}-${PV}"
53
54 # depend on headers for DVB-driver and vdr-scripts
55 -DEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2
56 - virtual/linuxtv-dvb-headers"
57 -RDEPEND=">=media-tv/gentoo-vdr-scripts-0.4.2
58 - >=app-eselect/eselect-vdr-0.0.2"
59 +case ${EAPI} in
60 + 5|6) DEPEND="media-tv/gentoo-vdr-scripts
61 + virtual/linuxtv-dvb-headers
62 + virtual/pkgconfig" ;;
63 + *) BDEPEND="virtual/pkgconfig"
64 + DEPEND="media-tv/gentoo-vdr-scripts
65 + virtual/linuxtv-dvb-headers" ;;
66 +esac
67 +RDEPEND="media-tv/gentoo-vdr-scripts
68 + app-eselect/eselect-vdr"
69
70 if [[ "${GENTOO_VDR_CONDITIONAL:-no}" = "yes" ]]; then
71 IUSE="${IUSE} vdr"
72 @@ -151,7 +155,8 @@ vdr_create_header_checksum_file() {
73 local CHKSUM="header-md5-vdr"
74
75 if [[ -f ${VDR_CHECKSUM_DIR}/header-md5-vdr ]]; then
76 - cp "${VDR_CHECKSUM_DIR}/header-md5-vdr" "${CHKSUM}"
77 + cp "${VDR_CHECKSUM_DIR}/header-md5-vdr" "${CHKSUM}" \
78 + || die "Could not copy header-md5-vdr"
79 elif type -p md5sum >/dev/null 2>&1; then
80 (
81 cd "${VDR_INCLUDE_DIR}"
82 @@ -179,7 +184,8 @@ fix_vdr_libsi_include() {
83 for f; do
84 sed -i "${f}" \
85 -e '/#include/s:"\(.*libsi.*\)":<\1>:' \
86 - -e '/#include/s:<.*\(libsi/.*\)>:<vdr/\1>:'
87 + -e '/#include/s:<.*\(libsi/.*\)>:<vdr/\1>:' \
88 + || die "sed failed while fixing include of libsi-headers"
89 done
90 }
91
92 @@ -192,7 +198,7 @@ fix_vdr_libsi_include() {
93 vdr_patchmakefile() {
94 einfo "Patching Makefile"
95 [[ -e Makefile ]] || die "Makefile of plugin can not be found!"
96 - cp Makefile "${WORKDIR}"/Makefile.before
97 + cp Makefile "${WORKDIR}"/Makefile.before || die "Failed to copy Makefile"
98
99 # plugin makefiles use VDRDIR in strange ways
100 # assumptions:
101 @@ -216,14 +222,16 @@ vdr_patchmakefile() {
102 -e '/VDRINCDIR.*=/!s:$(VDRDIR)/include:$(VDRINCDIR):' \
103 \
104 -e 's:-I$(DVBDIR)/include::' \
105 - -e 's:-I$(DVBDIR)::'
106 + -e 's:-I$(DVBDIR)::' \
107 + || die "sed failed to set \$VDRDIR"
108
109 if ! grep -q APIVERSION Makefile; then
110 ebegin " Converting to APIVERSION"
111 sed -i Makefile \
112 -e 's:^APIVERSION = :APIVERSION ?= :' \
113 -e 's:$(LIBDIR)/$@.$(VDRVERSION):$(LIBDIR)/$@.$(APIVERSION):' \
114 - -e '/VDRVERSION =/a\APIVERSION = $(shell sed -ne '"'"'/define APIVERSION/s/^.*"\\(.*\\)".*$$/\\1/p'"'"' $(VDRDIR)/config.h)'
115 + -e '/VDRVERSION =/a\APIVERSION = $(shell sed -ne '"'"'/define APIVERSION/s/^.*"\\(.*\\)".*$$/\\1/p'"'"' $(VDRDIR)/config.h)' \
116 + || die "sed failed to change APIVERSION"
117 eend $?
118 fi
119
120 @@ -231,13 +239,15 @@ vdr_patchmakefile() {
121 # Do not overwrite CXXFLAGS, add LDFLAGS if missing
122 sed -i Makefile \
123 -e '/^CXXFLAGS[[:space:]]*=/s/=/?=/' \
124 - -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'
125 + -e '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:' \
126 + || die "sed failed to fix compile-flags"
127
128 # Disabling file stripping, the package manager takes care of it
129 sed -i Makefile \
130 -e '/@.*strip/d' \
131 -e '/strip \$(LIBDIR)\/\$@/d' \
132 - -e 's/STRIP.*=.*$/STRIP = true/'
133 + -e 's/STRIP.*=.*$/STRIP = true/' \
134 + || die "sed failed to fix file stripping"
135
136 # Use a file instead of a variable as single-stepping via ebuild
137 # destroys environment.
138 @@ -318,14 +328,16 @@ vdr_i18n() {
139 if [[ "${KEEP_I18NOBJECT:-no}" = "yes" ]]; then
140 eqawarn "Forced to keep i18n.o"
141 else
142 - sed -i "s:i18n.o::g" Makefile
143 + sed -i "s:i18n.o::g" Makefile \
144 + || die "sed failed to remove i18n from Makefile"
145 eqawarn "OBJECT i18n.o found, removed per sed"
146 fi
147 fi
148
149 local I18N_STRING=$( [[ -e i18n.h ]] && grep tI18nPhrase i18n.h )
150 if [[ -n ${I18N_STRING} ]]; then
151 - sed -i "s:^extern[[:space:]]*const[[:space:]]*tI18nPhrase://static const tI18nPhrase:" i18n.h
152 + sed -i "s:^extern[[:space:]]*const[[:space:]]*tI18nPhrase://static const tI18nPhrase:" i18n.h \
153 + || die "sed failed to replace tI18nPhrase"
154 eqawarn "obsolete tI18nPhrase found, disabled per sed, please recheck"
155 fi
156 }
157 @@ -341,7 +353,8 @@ vdr_remove_i18n_include() {
158 local f
159 for f; do
160 sed -i "${f}" \
161 - -e "s:^#include[[:space:]]*\"i18n.h\"://:"
162 + -e "s:^#include[[:space:]]*\"i18n.h\"://:" \
163 + || die "sed failed to remove i18n_include"
164 done
165
166 eqawarn "removed i18n.h include in ${@}"
167 @@ -393,7 +406,8 @@ vdr-plugin-2_pkg_setup() {
168 append-cxxflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
169
170 # Where should the plugins live in the filesystem
171 - VDR_PLUGIN_DIR=$(pkg-config --variable=libdir vdr)
172 + local PKG__CONFIG=$(tc-getPKG_CONFIG)
173 + VDR_PLUGIN_DIR=$(${PKG__CONFIG} --variable=libdir vdr)
174
175 VDR_CHECKSUM_DIR="${VDR_PLUGIN_DIR%/plugins}/checksums"
176
177 @@ -405,7 +419,7 @@ vdr-plugin-2_pkg_setup() {
178
179 TMP_LOCALE_DIR="${T}/tmp-locale"
180
181 - LOCDIR=$(pkg-config --variable=locdir vdr)
182 + LOCDIR=$(${PKG__CONFIG} --variable=locdir vdr)
183
184 if ! has_vdr; then
185 # set to invalid values to detect abuses
186 @@ -422,7 +436,7 @@ vdr-plugin-2_pkg_setup() {
187 fi
188
189 VDRVERSION=$(awk -F'"' '/define VDRVERSION/ {print $2}' "${VDR_INCLUDE_DIR}"/config.h)
190 - APIVERSION=$(pkg-config --variable=apiversion vdr)
191 + APIVERSION=$(${PKG__CONFIG} --variable=apiversion vdr)
192
193 einfo "Compiling against"
194 einfo "\tvdr-${VDRVERSION} [API version ${APIVERSION}]"
195 @@ -551,10 +565,13 @@ vdr-plugin-2_src_install() {
196
197 if [[ -n ${VDR_MAINTAINER_MODE} ]]; then
198 local mname="${P}-Makefile"
199 - cp "${S}"/Makefile "${mname}.patched"
200 - cp Makefile.before "${mname}.before"
201 + cp "${S}"/Makefile "${mname}.patched" \
202 + || die "could not copy to Makefile.patched"
203 + cp Makefile.before "${mname}.before" \
204 + || die "could not copy to Makefile.before"
205
206 diff -u "${mname}.before" "${mname}.patched" > "${mname}.diff"
207 + [[ $? -ge 2 ]] && die "problem with diff"
208
209 insinto "/usr/share/vdr/maintainer-data/makefile-changes"
210 doins "${mname}.diff"
211 @@ -564,7 +581,6 @@ vdr-plugin-2_src_install() {
212
213 insinto "/usr/share/vdr/maintainer-data/makefile-patched"
214 doins "${mname}.patched"
215 -
216 fi
217
218 cd "${S}" || die "could not change to plugin source directory (src_install)"
219 @@ -589,11 +605,13 @@ vdr-plugin-2_src_install() {
220 local linguas
221 for linguas in ${LINGUAS[*]}; do
222 insinto "${LOCDIR}"
223 - cp -r --parents ${linguas}* ${D%/}/${LOCDIR}
224 + cp -r --parents ${linguas}* ${D%/}/${LOCDIR} \
225 + || die "could not copy linguas files"
226 done
227 fi
228
229 - cd "${D%/}/usr/$(get_libdir)/vdr/plugins" || die "could not change to D/usr/libdir/vdr/plugins"
230 + cd "${D%/}/usr/$(get_libdir)/vdr/plugins" \
231 + || die "could not change to \$D/usr/libdir/vdr/plugins"
232
233 # create list of all created plugin libs
234 vdr_plugin_list=""