Gentoo Archives: gentoo-commits

From: "Vadim A. Misbakh-Soloviov" <mva@×××.name>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/lua:master commit in: eclass/
Date: Fri, 27 May 2016 22:14:08
Message-Id: 1464181721.b88050a61100369a3563064c56bfba5dcd36bc0c.mva@gentoo
1 commit: b88050a61100369a3563064c56bfba5dcd36bc0c
2 Author: Vadim A. Misbakh-Soloviov <git <AT> mva <DOT> name>
3 AuthorDate: Wed May 25 13:08:41 2016 +0000
4 Commit: Vadim A. Misbakh-Soloviov <mva <AT> mva <DOT> name>
5 CommitDate: Wed May 25 13:08:41 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/lua.git/commit/?id=b88050a6
7
8 lua.eclass: some sugar
9
10 eclass/lua.eclass | 146 +++++++++++++++++++++++++++++++-----------------------
11 1 file changed, 85 insertions(+), 61 deletions(-)
12
13 diff --git a/eclass/lua.eclass b/eclass/lua.eclass
14 index 7e5af27..bf1e4fb 100644
15 --- a/eclass/lua.eclass
16 +++ b/eclass/lua.eclass
17 @@ -1,6 +1,5 @@
18 -# Copyright 1999-2015 Gentoo Foundation
19 +# Copyright 1999-2016 Gentoo Foundation
20 # Distributed under the terms of the GNU General Public License v2
21 -# $Id$
22
23 # @ECLASS: lua.eclass
24 # @MAINTAINER:
25 @@ -75,20 +74,55 @@
26
27 [[ -n "${IS_MULTILIB}" ]] && multilib="multilib-minimal"
28
29 -inherit base eutils ${multilib} toolchain-funcs flag-o-matic ${VCS}
30 +
31 +case ${VCS} in
32 + git)
33 + VCS="git-r3"
34 + ;;
35 + hg)
36 + VCS="mercurial"
37 + ;;
38 + svn)
39 + VCS="subversion"
40 + ;;
41 +esac
42 +
43 +[[ -n "${GITHUB_A}" && -n "${BITBUCKET_A}" ]] && die "Only one of GITHUB_A or BITBUCKET_A should be set!"
44 +if [[ -n "${GITHUB_A}" ]]; then
45 + GITHUB_PN="${GITHUB_PN:-${PN}}"
46 + EVCS_URI="https://github.com/${GITHUB_A}/${GITHUB_PN}"
47 + DL="archive"
48 +elif [[ -n "${BITBUCKET_A}" ]]; then
49 + BITBUCKET_PN="${BITBUCKET_PN:-${PN}}"
50 + EVCS_URI="https://bitbucket.org/${BITBUCKET_A}/${BITBUCKET_PN}"
51 + DL="get"
52 +fi
53 +if [[ -z "${EGIT_REPO_URI}" && -z "${EHG_REPO_URI}" && -z "${SRC_URI}" && -n "${EVCS_URI}" ]]; then
54 + if [[ "${VCS}" = git* ]]; then
55 + EGIT_REPO_URI="${EVCS_URI}"
56 + elif [[ "${VCS}" = "mercurial" ]]; then
57 + EHG_REPO_URI="${EVCS_URI}"
58 + elif [[ -z "${VCS}" && "${PV}" != *9999* ]]; then
59 + SRC_URI="${EVCS_URI}/${DL}/${GITHUB_PV:-${PV}}.tar.gz -> ${P}.tar.gz"
60 + fi
61 +fi
62 +
63 +inherit eutils ${multilib} toolchain-funcs flag-o-matic ${VCS}
64
65 EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install pkg_setup src_test
66
67 -case ${EAPI} in
68 - 0|1)
69 - die "Unsupported EAPI=${EAPI} (too old) for lua.eclass" ;;
70 - 2|3) ;;
71 - 4|5)
72 +case ${EAPI:-0} in
73 + 0|1|2|3)
74 + die "Unsupported EAPI=${EAPI} (too old) for lua.eclass"
75 + ;;
76 + 4|5|6)
77 # S is no longer automatically assigned when it doesn't exist.
78 S="${WORKDIR}"
79 ;;
80 *)
81 - die "Unknown EAPI=${EAPI} for lua.eclass"
82 + ewarn "Unknown EAPI=${EAPI} for lua.eclass. Some things may become broken"
83 + ewarn "Please, review lua.eclass for compatibility with new EAPI"
84 + ;;
85 esac
86
87 lua_implementation_depend() {
88 @@ -164,7 +198,7 @@ _lua_atoms_samelib_generic() {
89 ;;
90 *])
91 echo "${token%[*}[LUATARGET,${token/*[}"
92 - #" <= kludge for vim's syntax highlighting engine to don't mess up all
93 + #"]}" # <= kludge for vim's syntax highlighting engine to don't mess up all the things below this line
94 ;;
95 *)
96 echo "${token}[LUATARGET]"
97 @@ -309,49 +343,33 @@ IUSE+="$(lua_get_use_targets)"
98 if [[ ${LUA_OPTIONAL} != yes ]]; then
99 DEPEND="${DEPEND} $(lua_implementations_depend)"
100 RDEPEND="${RDEPEND} $(lua_implementations_depend)"
101 -
102 - case ${EAPI:-0} in
103 - 4|5)
104 - REQUIRED_USE+=" || ( $(lua_get_use_targets) )"
105 - ;;
106 - esac
107 + REQUIRED_USE+=" || ( $(lua_get_use_targets) )"
108 fi
109
110 _lua_invoke_environment() {
111 old_S=${S}
112 - case ${EAPI} in
113 - 4|5)
114 - if [ -z "${LUA_S}" ]; then
115 - sub_S=${P}
116 - else
117 - sub_S=${LUA_S}
118 - fi
119 - ;;
120 - *)
121 - sub_S=${S#${WORKDIR}/}
122 - ;;
123 - esac
124 + if [ -z "${LUA_S}" ]; then
125 + sub_S=${P}
126 + else
127 + sub_S=${LUA_S}
128 + fi
129
130 - # Special case, for the always-lovely GitHub fetches. With this,
131 + # Special case, for GitHub fetches of ancient packages. With this,
132 # we allow the star glob to just expand to whatever directory it's
133 # called.
134 if [[ "${sub_S}" = *"*"* ]]; then
135 - case ${EAPI} in
136 - 2|3)
137 - #The old method of setting S depends on undefined package
138 - # manager behaviour, so encourage upgrading to EAPI=4.
139 - eqawarn "Using * expansion of S is deprecated. Use EAPI and LUA_S instead."
140 - ;;
141 - esac
142 pushd "${WORKDIR}"/all &>/dev/null
143 sub_S=$(eval ls -d "${sub_S}" 2>/dev/null)
144 popd &>/dev/null
145 fi
146
147 - environment=$1; shift
148 + environment="${1}"; shift
149
150 - my_WORKDIR="${WORKDIR}"/${environment}
151 + my_WORKDIR="${WORKDIR}"/"${environment}"
152 S="${my_WORKDIR}"/"${sub_S}"
153 + EGIT_CHECKOUT_DIR="${S}"
154 + EHG_CHECKOUT_DIR="${S}"
155 + EBZR_UNPACK_DIR="${S}"
156 BUILD_DIR="${S}"
157 CMAKE_USE_DIR="${S}"
158
159 @@ -416,15 +434,22 @@ lua_src_unpack() {
160 # We don't support an each-unpack, it's either all or nothing!
161 if type all_lua_unpack &>/dev/null; then
162 _lua_invoke_environment all all_lua_unpack
163 + elif [[ -n ${VCS} ]] && declare -f ${VCS}_src_unpack >/dev/null; then
164 + _lua_invoke_environment all ${VCS}_src_unpack
165 + elif declare -f unpacker_src_unpack >/dev/null; then
166 + _lua_invoke_environment all unpacker_src_unpack
167 elif [[ -n ${A} ]]; then
168 unpack ${A}
169 - elif [[ -n ${VCS} ]] && declare -f ${VCS}_src_unpack >/dev/null; then
170 - _lua_invoke_environment all ${VCS}_src_unpack
171 + elif [[ -z "${GITHUB_A}" && -z "${BITBUCKET_A}" ]]; then
172 + eerror "Either GITHUB_A or BITBUCKET_A (author nick) should be set for magic SRC/REPO URI filling to work"
173 + eerror "You should either set one of them, or fill the proper URI variable manually!"
174 + die "See above eerror messages."
175 fi
176
177 - # hack for VCS-eclasses (git-r3 and darcs, for now) which defaults unpack dir to WD/P instead of S
178 - if [[ '*9999*' =~ ${PV} ]] && [[ -d ${WORKDIR}/${P} ]] && [[ ! -d ${WORKDIR}/all/${P} ]] ; then
179 - mv ${WORKDIR}/${P} ${WORKDIR}/all/${P}
180 + # hack for VCS-eclasses (darcs, for example) which defaults unpack dir to WD/P instead of S
181 + if [[ "${PV}" = *9999* ]] && [[ -d "${WORKDIR}/${P}" ]] && [[ ! -d "${WORKDIR}/all/${P}" ]] ; then
182 + die "darcs-patching :: git test"
183 + mv "${WORKDIR}/${P}" "${WORKDIR}/all/${P}"
184 fi
185
186 popd &>/dev/null
187 @@ -485,7 +510,7 @@ lua_src_prepare() {
188 _lua_invoke_environment all ${VCS}_src_prepare
189 fi
190
191 - _lua_invoke_environment all base_src_prepare
192 + _lua_invoke_environment all default_src_prepare
193
194 if ! declare -f all_lua_prepare >/dev/null; then
195 all_lua_prepare() {
196 @@ -903,11 +928,12 @@ _lua_default_all_prepare() {
197
198 _lua_default_all_compile() {
199 local doc_target="${DOC_MAKE_TARGET:=doc}"
200 +
201 has doc ${IUSE} &&
202 use doc &&
203 grep -qs "${doc_target}[[:space:]]*:" {GNUm,m,M}akefile && (
204 [[ -f ${T}/.lua_ecl_conf ]] && touch .lua_eclass_config
205 - base_src_compile "${doc_target[@]}"
206 + emake "${doc_target[@]}"
207 )
208 }
209
210 @@ -921,7 +947,7 @@ _lua_default_each_configure() {
211 confargs+=("${myeconfargs[@]}")
212 confargs+=("${@}")
213
214 - base_src_configure "${confargs[@]}"
215 + [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf "${confargs[@]}"
216
217 if [[ -f ${T}/.lua_ecl_conf ]]; then
218 touch .lua_eclass_config
219 @@ -949,12 +975,6 @@ _lua_default_each_configure() {
220
221 _lua_default_each_compile() {
222 local makeargs=();
223 -
224 - makeargs+=(
225 - "${myemakeargs[@]}"
226 - "${@}"
227 - )
228 -
229 if has ccache ${FEATURES} && [[ "${NOCCACHE}" = "true" ]]; then
230 export CCACHE_DISABLE=1;
231 fi
232 @@ -963,18 +983,22 @@ _lua_default_each_compile() {
233 export DISTCC_DISABLE=1;
234 fi
235
236 - base_src_compile "${makeargs[@]}"
237 + if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
238 + makeargs+=("${myemakeargs[@]}")
239 + makeargs+=("${@}")
240 + emake "${makeargs[@]}"
241 + fi
242 +
243 }
244
245 _lua_default_each_install() {
246 local instargs=();
247 - instargs+=(
248 - DESTDIR="${D}"
249 - "${@}"
250 - "${myeinstallargs[@]}"
251 - install
252 - )
253 -
254 - base_src_make "${instargs[@]}"
255 + if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
256 + instargs+=(DESTDIR="${D}")
257 + instargs+=("${@}")
258 + instargs+=("${myeinstallargs[@]}")
259 + instargs+=("install")
260 + emake "${instargs[@]}"
261 + fi
262 }