Gentoo Archives: gentoo-commits

From: Matt Turner <mattst88@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Thu, 28 Feb 2019 05:47:48
Message-Id: 1551332686.761eaebfa3fcdab03044258faf3592b45adb4011.mattst88@gentoo
1 commit: 761eaebfa3fcdab03044258faf3592b45adb4011
2 Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
3 AuthorDate: Thu Feb 21 04:58:12 2019 +0000
4 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 28 05:44:46 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=761eaebf
7
8 xorg-3.eclass: Copy from xorg-2.eclass and add EAPI 7 support
9
10 Nearly all the work is just removing uses of autotools-multilib and
11 autotools-utils.
12
13 I dropped font support for a couple of reasons:
14 1) it's not a small amount of code
15 2) font.eclass does not support EAPI 7
16 3) none of the fonts packages have changed since the git import
17
18 Closes: https://bugs.gentoo.org/619832
19 Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
20
21 eclass/xorg-3.eclass | 372 +++++++++++++++++++++++++++++++++++++++++++++++++++
22 1 file changed, 372 insertions(+)
23
24 diff --git a/eclass/xorg-3.eclass b/eclass/xorg-3.eclass
25 new file mode 100644
26 index 00000000000..4577767a77b
27 --- /dev/null
28 +++ b/eclass/xorg-3.eclass
29 @@ -0,0 +1,372 @@
30 +# Copyright 1999-2019 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +# @ECLASS: xorg-3.eclass
34 +# @MAINTAINER:
35 +# x11@g.o
36 +# @AUTHOR:
37 +# Author: Tomáš Chvátal <scarabeus@g.o>
38 +# Author: Donnie Berkholz <dberkholz@g.o>
39 +# Author: Matt Turner <mattst88@g.o>
40 +# @SUPPORTED_EAPIS: 7
41 +# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
42 +# @DESCRIPTION:
43 +# This eclass makes trivial X ebuilds possible for apps, drivers,
44 +# and more. Many things that would normally be done in various functions
45 +# can be accessed by setting variables instead, such as patching,
46 +# running eautoreconf, passing options to configure and installing docs.
47 +#
48 +# All you need to do in a basic ebuild is inherit this eclass and set
49 +# DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted
50 +# with the other X packages, you don't need to set SRC_URI. Pretty much
51 +# everything else should be automatic.
52 +
53 +GIT_ECLASS=""
54 +if [[ ${PV} == *9999* ]]; then
55 + GIT_ECLASS="git-r3"
56 + XORG_EAUTORECONF="yes"
57 +fi
58 +
59 +# @ECLASS-VARIABLE: XORG_MULTILIB
60 +# @DESCRIPTION:
61 +# If set to 'yes', the multilib support for package will be enabled. Set
62 +# before inheriting this eclass.
63 +: ${XORG_MULTILIB:="no"}
64 +
65 +# we need to inherit autotools first to get the deps
66 +inherit autotools eutils libtool multilib toolchain-funcs \
67 + flag-o-matic ${GIT_ECLASS}
68 +
69 +if [[ ${XORG_MULTILIB} == yes ]]; then
70 + inherit multilib-minimal
71 +fi
72 +
73 +EXPORTED_FUNCTIONS="src_prepare src_configure src_unpack src_compile src_install"
74 +case "${EAPI:-0}" in
75 + 7) ;;
76 + *) die "EAPI=${EAPI} is not supported" ;;
77 +esac
78 +
79 +# exports must be ALWAYS after inherit
80 +EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
81 +
82 +IUSE=""
83 +HOMEPAGE="https://www.x.org/wiki/ https://cgit.freedesktop.org/"
84 +
85 +# @ECLASS-VARIABLE: XORG_EAUTORECONF
86 +# @DESCRIPTION:
87 +# If set to 'yes' and configure.ac exists, eautoreconf will run. Set
88 +# before inheriting this eclass.
89 +: ${XORG_EAUTORECONF:="no"}
90 +
91 +# @ECLASS-VARIABLE: XORG_BASE_INDIVIDUAL_URI
92 +# @DESCRIPTION:
93 +# Set up SRC_URI for individual modular releases. If set to an empty
94 +# string, no SRC_URI will be provided by the eclass.
95 +: ${XORG_BASE_INDIVIDUAL_URI="https://www.x.org/releases/individual"}
96 +
97 +# @ECLASS-VARIABLE: XORG_MODULE
98 +# @DESCRIPTION:
99 +# The subdirectory to download source from. Possible settings are app,
100 +# doc, data, util, driver, lib, proto, xserver. Set above the
101 +# inherit to override the default autoconfigured module.
102 +: ${XORG_MODULE:="auto"}
103 +if [[ ${XORG_MODULE} == auto ]]; then
104 + case ${CATEGORY} in
105 + app-doc) XORG_MODULE=doc/ ;;
106 + x11-apps|x11-wm) XORG_MODULE=app/ ;;
107 + x11-misc|x11-themes) XORG_MODULE=util/ ;;
108 + x11-base) XORG_MODULE=xserver/ ;;
109 + x11-drivers) XORG_MODULE=driver/ ;;
110 + x11-libs) XORG_MODULE=lib/ ;;
111 + *) XORG_MODULE= ;;
112 + esac
113 +fi
114 +
115 +# @ECLASS-VARIABLE: XORG_PACKAGE_NAME
116 +# @DESCRIPTION:
117 +# For git checkout the git repository might differ from package name.
118 +# This variable can be used for proper directory specification
119 +: ${XORG_PACKAGE_NAME:=${PN}}
120 +
121 +if [[ -n ${GIT_ECLASS} ]]; then
122 + : ${EGIT_REPO_URI:="https://anongit.freedesktop.org/git/xorg/${XORG_MODULE}${XORG_PACKAGE_NAME}.git"}
123 +elif [[ -n ${XORG_BASE_INDIVIDUAL_URI} ]]; then
124 + SRC_URI="${XORG_BASE_INDIVIDUAL_URI}/${XORG_MODULE}${P}.tar.bz2"
125 +fi
126 +
127 +: ${SLOT:=0}
128 +
129 +# Set the license for the package. This can be overridden by setting
130 +# LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages
131 +# are under the MIT license. (This is what Red Hat does in their rpms)
132 +: ${LICENSE:=MIT}
133 +
134 +# Set up autotools shared dependencies
135 +# Remember that all versions here MUST be stable
136 +XORG_EAUTORECONF_ARCHES="ppc-aix x86-winnt"
137 +EAUTORECONF_DEPEND+="
138 + >=sys-devel/libtool-2.2.6a
139 + sys-devel/m4"
140 +if [[ ${PN} != util-macros ]] ; then
141 + EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.18 >=media-fonts/font-util-1.2.0"
142 +fi
143 +WANT_AUTOCONF="latest"
144 +WANT_AUTOMAKE="latest"
145 +for arch in ${XORG_EAUTORECONF_ARCHES}; do
146 + EAUTORECONF_DEPENDS+=" ${arch}? ( ${EAUTORECONF_DEPEND} )"
147 +done
148 +DEPEND+=" ${EAUTORECONF_DEPENDS}"
149 +[[ ${XORG_EAUTORECONF} != no ]] && BDEPEND+=" ${EAUTORECONF_DEPEND}"
150 +unset EAUTORECONF_DEPENDS
151 +unset EAUTORECONF_DEPEND
152 +
153 +# @ECLASS-VARIABLE: XORG_STATIC
154 +# @DESCRIPTION:
155 +# Enables static-libs useflag. Set to no, if your package gets:
156 +#
157 +# QA: configure: WARNING: unrecognized options: --disable-static
158 +: ${XORG_STATIC:="yes"}
159 +
160 +# Add static-libs useflag where useful.
161 +if [[ ${XORG_STATIC} == yes \
162 + && ${CATEGORY} != app-doc \
163 + && ${CATEGORY} != x11-apps \
164 + && ${CATEGORY} != x11-drivers \
165 + && ${PN} != util-macros \
166 + && ${PN} != xbitmaps \
167 + && ${PN} != xorg-cf-files \
168 + && ${PN/xcursor} = ${PN} ]]; then
169 + IUSE+=" static-libs"
170 +fi
171 +
172 +DEPEND+=" virtual/pkgconfig"
173 +
174 +# @ECLASS-VARIABLE: XORG_DRI
175 +# @DESCRIPTION:
176 +# Possible values are "always" or the value of the useflag DRI capabilities
177 +# are required for. Default value is "no"
178 +#
179 +# Eg. XORG_DRI="opengl" will pull all dri dependent deps for opengl useflag
180 +: ${XORG_DRI:="no"}
181 +
182 +DRI_COMMON_DEPEND="
183 + x11-base/xorg-server[-minimal]
184 + x11-libs/libdrm
185 +"
186 +case ${XORG_DRI} in
187 + no)
188 + ;;
189 + always)
190 + COMMON_DEPEND+=" ${DRI_COMMON_DEPEND}"
191 + ;;
192 + *)
193 + COMMON_DEPEND+=" ${XORG_DRI}? ( ${DRI_COMMON_DEPEND} )"
194 + IUSE+=" ${XORG_DRI}"
195 + ;;
196 +esac
197 +unset DRI_COMMON_DEPEND
198 +
199 +if [[ ${PN} == xf86-video-* || ${PN} == xf86-input-* ]]; then
200 + DEPEND+=" x11-base/xorg-proto"
201 + RDEPEND+=" x11-base/xorg-server:="
202 + COMMON_DEPEND+=" >=x11-base/xorg-server-1.20[xorg]"
203 + [[ ${PN} == xf86-video-* ]] && COMMON_DEPEND+=" >=x11-libs/libpciaccess-0.14"
204 +fi
205 +
206 +
207 +# @ECLASS-VARIABLE: XORG_DOC
208 +# @DESCRIPTION:
209 +# Possible values are "always" or the value of the useflag doc packages
210 +# are required for. Default value is "no"
211 +#
212 +# Eg. XORG_DOC="manual" will pull all doc dependent deps for manual useflag
213 +: ${XORG_DOC:="no"}
214 +
215 +DOC_DEPEND="
216 + doc? (
217 + || ( app-text/asciidoc dev-ruby/asciidoctor )
218 + app-text/xmlto
219 + app-doc/doxygen
220 + app-text/docbook-xml-dtd:4.1.2
221 + app-text/docbook-xml-dtd:4.2
222 + app-text/docbook-xml-dtd:4.3
223 + )
224 +"
225 +case ${XORG_DOC} in
226 + no)
227 + ;;
228 + always)
229 + BDEPEND+=" ${DOC_DEPEND}"
230 + ;;
231 + *)
232 + BDEPEND+=" ${XORG_DOC}? ( ${DOC_DEPEND} )"
233 + IUSE+=" ${XORG_DOC}"
234 + ;;
235 +esac
236 +unset DOC_DEPEND
237 +
238 +DEPEND+=" ${COMMON_DEPEND}"
239 +RDEPEND+=" ${COMMON_DEPEND}"
240 +unset COMMON_DEPEND
241 +
242 +debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND=${DEPEND}"
243 +debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND=${RDEPEND}"
244 +debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: PDEPEND=${PDEPEND}"
245 +debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: BDEPEND=${BDEPEND}"
246 +
247 +# @FUNCTION: xorg-3_src_unpack
248 +# @DESCRIPTION:
249 +# Simply unpack source code.
250 +xorg-3_src_unpack() {
251 + debug-print-function ${FUNCNAME} "$@"
252 +
253 + if [[ -n ${GIT_ECLASS} ]]; then
254 + git-r3_src_unpack
255 + else
256 + unpack ${A}
257 + fi
258 +}
259 +
260 +# @FUNCTION: xorg-3_reconf_source
261 +# @DESCRIPTION:
262 +# Run eautoreconf if necessary, and run elibtoolize.
263 +xorg-3_reconf_source() {
264 + debug-print-function ${FUNCNAME} "$@"
265 +
266 + case ${CHOST} in
267 + *-aix* | *-winnt*)
268 + # some hosts need full eautoreconf
269 + [[ -e "./configure.ac" || -e "./configure.in" ]] \
270 + && XORG_EAUTORECONF=yes
271 + ;;
272 + *)
273 + # elibtoolize required for BSD
274 + [[ ${XORG_EAUTORECONF} != no && ( -e "./configure.ac" || -e "./configure.in" ) ]] \
275 + && XORG_EAUTORECONF=yes
276 + ;;
277 + esac
278 +
279 + [[ ${XORG_EAUTORECONF} != no ]] && eautoreconf
280 + elibtoolize --patch-only
281 +}
282 +
283 +# @FUNCTION: xorg-3_src_prepare
284 +# @DESCRIPTION:
285 +# Prepare a package after unpacking, performing all X-related tasks.
286 +xorg-3_src_prepare() {
287 + debug-print-function ${FUNCNAME} "$@"
288 +
289 + default
290 + xorg-3_reconf_source
291 +}
292 +
293 +# @FUNCTION: xorg-3_flags_setup
294 +# @DESCRIPTION:
295 +# Set up CFLAGS for a debug build
296 +xorg-3_flags_setup() {
297 + debug-print-function ${FUNCNAME} "$@"
298 +
299 + # Win32 require special define
300 + [[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__
301 + # hardened ldflags
302 + [[ ${PN} == xorg-server || ${PN} == xf86-video-* || ${PN} == xf86-input-* ]] \
303 + && append-ldflags -Wl,-z,lazy
304 +
305 + # Quite few libraries fail on runtime without these:
306 + if has static-libs ${IUSE//+}; then
307 + filter-flags -Wl,-Bdirect
308 + filter-ldflags -Bdirect
309 + filter-ldflags -Wl,-Bdirect
310 + fi
311 +}
312 +
313 +multilib_src_configure() {
314 + ECONF_SOURCE="${S}" econf "${econfargs[@]}"
315 +}
316 +
317 +# @FUNCTION: xorg-3_src_configure
318 +# @DESCRIPTION:
319 +# Perform any necessary pre-configuration steps, then run configure
320 +xorg-3_src_configure() {
321 + debug-print-function ${FUNCNAME} "$@"
322 +
323 + xorg-3_flags_setup
324 +
325 + # @VARIABLE: XORG_CONFIGURE_OPTIONS
326 + # @DESCRIPTION:
327 + # Array of an additional options to pass to configure.
328 + # @DEFAULT_UNSET
329 + local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}")
330 +
331 + # Check if package supports disabling of dep tracking
332 + # Fixes warnings like:
333 + # WARNING: unrecognized options: --disable-dependency-tracking
334 + if grep -q -s "disable-depencency-tracking" ${ECONF_SOURCE:-.}/configure; then
335 + local dep_track="--disable-dependency-tracking"
336 + fi
337 +
338 + # Check if package supports disabling of selective -Werror=...
339 + if grep -q -s "disable-selective-werror" ${ECONF_SOURCE:-.}/configure; then
340 + local selective_werror="--disable-selective-werror"
341 + fi
342 +
343 + local econfargs=(
344 + ${dep_track}
345 + ${selective_werror}
346 + "${xorgconfadd[@]}"
347 + )
348 +
349 + # Handle static-libs found in IUSE, disable them by default
350 + if in_iuse static-libs; then
351 + econfargs+=(
352 + --enable-shared
353 + $(use_enable static-libs static)
354 + )
355 + fi
356 +
357 + if [[ ${XORG_MULTILIB} == yes ]]; then
358 + multilib-minimal_src_configure "$@"
359 + else
360 + econf "${econfargs[@]}" "$@"
361 + fi
362 +}
363 +
364 +multilib_src_compile() {
365 + emake "$@" || die 'emake failed'
366 +}
367 +
368 +# @FUNCTION: xorg-3_src_compile
369 +# @DESCRIPTION:
370 +# Compile a package, performing all X-related tasks.
371 +xorg-3_src_compile() {
372 + debug-print-function ${FUNCNAME} "$@"
373 +
374 + if [[ ${XORG_MULTILIB} == yes ]]; then
375 + multilib-minimal_src_compile "$@"
376 + else
377 + emake "$@" || die 'emake failed'
378 + fi
379 +}
380 +
381 +multilib_src_install() {
382 + emake DESTDIR="${D}" "${install_args[@]}" "$@" install || die "emake install failed"
383 +}
384 +
385 +# @FUNCTION: xorg-3_src_install
386 +# @DESCRIPTION:
387 +# Install a built package to ${D}, performing any necessary steps.
388 +xorg-3_src_install() {
389 + debug-print-function ${FUNCNAME} "$@"
390 +
391 + local install_args=( docdir="${EPREFIX}/usr/share/doc/${PF}" )
392 +
393 + if [[ ${XORG_MULTILIB} == yes ]]; then
394 + multilib-minimal_src_install "$@"
395 + else
396 + emake DESTDIR="${D}" "${install_args[@]}" "$@" install || die "emake install failed"
397 + fi
398 +
399 + # Don't install libtool archives (even for modules)
400 + find "${D}" -type f -name '*.la' -delete || die
401 +}