Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: Gentoo Developer Mailing List <gentoo-dev@l.g.o>
Cc: reavertm@g.o, multilib@g.o
Subject: [gentoo-dev] [PATCHES] Sub-phase functions in autotools-utils & autotools-multilib
Date: Thu, 02 May 2013 12:26:52
Message-Id: 20130502142611.18a76960@gentoo.org
1 Hi,
2
3 I've thought for a bit and got the conclusion that the best solution
4 for quite an irritating syntax of autotools-multilib is to use
5 sub-phase functions. To increase consistency between ebuilds, the same
6 phases can be used in autotools-utils directly.
7
8 The idea is that current ebuild looking like:
9
10 src_prepare() {
11 sed ...
12 autotools-utils_src_prepare
13 }
14
15 src_configure() {
16 local myeconfargs=(
17 --with-foo
18 --with-bar
19 )
20 autotools-utils_src_configure
21 }
22
23 src_install() {
24 use doc && local HTML_DOCS=...
25
26 autotools-utils_src_install
27
28 doinitd ...
29 dobin "${BUILD_DIR}"/something/something
30 }
31
32 could be written as:
33
34 autotools_configure() {
35 local myeconfargs=(
36 --with-foo
37 --with-bar
38 )
39 edefault
40 }
41
42 autotools_install() {
43 edefault
44 dobin something/something
45 }
46
47 autotools_install_all() {
48 use doc && local HTML_DOCS=...
49
50 edefault
51
52 doinitd ...
53 }
54
55 While this seems rather cosmetic, it becomes incredibly helpful when it
56 comes to multilib or working inside BUILD_DIR.
57
58 The sub-phases without '_all' suffix are run inside BUILD_DIR, and
59 repeated for each multilib ABI. The sub-phases with '_all' are always
60 run only once, and inside S.
61
62 This provides a meaningful split between the two parts
63 of autotools-utils_src_install (and default_src_install too), and makes
64 it possible to hack stuff in multilib without having to rewrite
65 the 'multilib_foreach_impl' lines all the time.
66
67 For example:
68
69 src_configure() {
70 my_configure() {
71 local myeconfargs=(
72 ... # something ABI-conditional here
73 )
74 autotools-utils_src_configure
75 }
76 multilib_parallel_foreach_abi my_configure
77 }
78
79 can be replaced with much simpler:
80
81 autotools_configure() {
82 local myeconfargs=(
83 ... # something ABI-conditional here
84 )
85 edefault
86 }
87
88 What are your thoughts? The patch is sent in reply to this mail.
89
90 --
91 Best regards,
92 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies