7 |
# be verbose or nor (true|false} |
# be verbose or nor (true|false} |
8 |
: ${MULTILIB_VERBOSE="true"} |
: ${MULTILIB_VERBOSE="true"} |
9 |
|
|
10 |
|
# enter the abi srcdir as default setting |
11 |
|
: ${MULTILIB_ENTER_SRCDIR="true"} |
12 |
|
|
13 |
# multilib should call all dependant includes, which gets overridden |
# multilib should call all dependant includes, which gets overridden |
14 |
sminclude mtools |
sminclude mtools |
15 |
|
|
45 |
# the var ist decided with our common eval+echo magic |
# the var ist decided with our common eval+echo magic |
46 |
if [[ -z ${SDEPEND} ]] |
if [[ -z ${SDEPEND} ]] |
47 |
then |
then |
48 |
SDEPEND="\$(eval echo \\\$EMUL_LINUX_32_SDEPEND_\${ARCH/i*86/x86} | tr ';' '\n')" |
SDEPEND="$(marchsdepend EMUL_LINUX_32_SDEPEND)" |
49 |
else |
else |
50 |
SDEPEND="${SDEPEND} |
SDEPEND="${SDEPEND} |
51 |
\$(eval echo \\\$EMUL_LINUX_32_SDEPEND_\${ARCH/i*86/x86} | tr ';' '\n')" |
$(marchsdepend EMUL_LINUX_32_SDEPEND)" |
52 |
fi |
fi |
53 |
fi |
fi |
54 |
|
|
82 |
local orig_pkg_config_path="${PKG_CONFIG_PATH}" |
local orig_pkg_config_path="${PKG_CONFIG_PATH}" |
83 |
export PKG_CONFIG_PATH="/usr/${ABI_LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}" |
export PKG_CONFIG_PATH="/usr/${ABI_LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}" |
84 |
|
|
85 |
|
# honor rust |
86 |
|
case ${ARCH} in |
87 |
|
# use native abi as RUST_TARGET |
88 |
|
i686) export RUST_TARGET="${ARCH}-unknown-linux-gnu" ;; |
89 |
|
# use i686 as RUST_TARGET for i{3,4,5}86 targets and on multilib-x86_64 target too |
90 |
|
i*86|x86_64) export RUST_TARGET="i686-unknown-linux-gnu" ;; |
91 |
|
*) die "unknown RUST_TARGET '${ARCH}'" ;; |
92 |
|
esac |
93 |
|
|
94 |
if [[ ${MULTILIB_VERBOSE} = true ]] |
if [[ ${MULTILIB_VERBOSE} = true ]] |
95 |
then |
then |
96 |
echo -e "${COLBLUE}*** ${COLGREEN}running with -${ABI} ABI${COLDEFAULT}" |
echo -e "${COLBLUE}*** ${COLGREEN}running with -${ABI} ABI${COLDEFAULT}" |
117 |
echo -e "${COLBLUE}*** ${COLGREEN} EMUL_LINUX_32${COLDEFAULT}='${EMUL_LINUX_32}'" |
echo -e "${COLBLUE}*** ${COLGREEN} EMUL_LINUX_32${COLDEFAULT}='${EMUL_LINUX_32}'" |
118 |
fi |
fi |
119 |
uname(){ linux32 uname $@; } && export -f uname |
uname(){ linux32 uname $@; } && export -f uname |
120 |
ORIG_CHOST="${CHOST}" && export CHOST="i686-pc-linux-gnu" |
local orig_chost="${CHOST}" && export CHOST="i686-pc-linux-gnu" |
121 |
fi |
fi |
122 |
if [[ ${MULTILIB_VERBOSE} = true ]] |
if [[ ${MULTILIB_VERBOSE} = true ]] |
123 |
then |
then |
125 |
fi |
fi |
126 |
|
|
127 |
# run any given command |
# run any given command |
128 |
|
if [[ ${MULTILIB_VERBOSE} = true ]] |
129 |
|
then |
130 |
|
echo -e "${COLGREEN}Executing:${COLDEFAULT} '$@'" |
131 |
|
fi |
132 |
eval $@ || die |
eval $@ || die |
133 |
|
|
134 |
unset ABI CC CXX ABI_LIBDIR |
unset ABI CC CXX ABI_LIBDIR RUST_TARGET |
135 |
# keep pkgconfig clean |
# keep pkgconfig clean |
136 |
export PKG_CONFIG_PATH="${orig_pkg_config_path}" |
export PKG_CONFIG_PATH="${orig_pkg_config_path}" |
137 |
export LDFLAGS="${saved_ldflags}" |
export LDFLAGS="${saved_ldflags}" |
140 |
if [[ ${EMUL_LINUX_32} = true ]] |
if [[ ${EMUL_LINUX_32} = true ]] |
141 |
then |
then |
142 |
unset uname |
unset uname |
143 |
export CHOST="${ORIG_CHOST}" && unset ORIG_CHOST |
export CHOST="${orig_chost}" && unset orig_chost |
144 |
fi |
fi |
145 |
} |
} |
146 |
|
|
159 |
local orig_pkg_config_path="${PKG_CONFIG_PATH}" |
local orig_pkg_config_path="${PKG_CONFIG_PATH}" |
160 |
export PKG_CONFIG_PATH="/usr/${ABI_LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}" |
export PKG_CONFIG_PATH="/usr/${ABI_LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}" |
161 |
|
|
162 |
|
# honor rust |
163 |
|
case ${ARCH} in |
164 |
|
# use native abi as RUST_TARGET |
165 |
|
x86_64) export RUST_TARGET="${ARCH}-unknown-linux-gnu" ;; |
166 |
|
*) die "unknown RUST_TARGET '${ARCH}'" ;; |
167 |
|
esac |
168 |
|
|
169 |
if [[ ${MULTILIB_VERBOSE} = true ]] |
if [[ ${MULTILIB_VERBOSE} = true ]] |
170 |
then |
then |
171 |
echo -e "${COLBLUE}*** ${COLGREEN}running with -${ABI} ABI${COLDEFAULT}" |
echo -e "${COLBLUE}*** ${COLGREEN}running with -${ABI} ABI${COLDEFAULT}" |
185 |
fi |
fi |
186 |
|
|
187 |
# run any given command |
# run any given command |
188 |
|
if [[ ${MULTILIB_VERBOSE} = true ]] |
189 |
|
then |
190 |
|
echo -e "${COLGREEN}Executing:${COLDEFAULT} '$@'" |
191 |
|
fi |
192 |
eval $@ || die |
eval $@ || die |
193 |
|
|
194 |
unset ABI CC CXX ABI_LIBDIR |
unset ABI CC CXX ABI_LIBDIR RUST_TARGET |
195 |
# keep pkgconfig clean |
# keep pkgconfig clean |
196 |
export PKG_CONFIG_PATH="${orig_pkg_config_path}" |
export PKG_CONFIG_PATH="${orig_pkg_config_path}" |
197 |
export LDFLAGS="${saved_ldflags}" |
export LDFLAGS="${saved_ldflags}" |
209 |
# export this for mpatch etc (to repect only-${abi}) |
# export this for mpatch etc (to repect only-${abi}) |
210 |
export MULTILIB_ONLY_ABI=${abi} |
export MULTILIB_ONLY_ABI=${abi} |
211 |
|
|
212 |
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] |
213 |
|
then |
214 |
|
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
215 |
|
fi |
216 |
abi-${abi} $@ || die |
abi-${abi} $@ || die |
217 |
|
|
218 |
# unset this is very important |
# unset this is very important |
233 |
# export this for mpatch etc (to repect only-${abi}) |
# export this for mpatch etc (to repect only-${abi}) |
234 |
export MULTILIB_ONLY_ABI=${abi} |
export MULTILIB_ONLY_ABI=${abi} |
235 |
|
|
236 |
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] |
237 |
|
then |
238 |
|
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
239 |
|
fi |
240 |
abi-${abi} $@ || die |
abi-${abi} $@ || die |
241 |
|
|
242 |
# unset this is very important |
# unset this is very important |
250 |
local abi |
local abi |
251 |
for abi in ${MULTILIB_ABIS} |
for abi in ${MULTILIB_ABIS} |
252 |
do |
do |
253 |
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] |
254 |
|
then |
255 |
|
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
256 |
|
fi |
257 |
abi-${abi} $@ || die |
abi-${abi} $@ || die |
258 |
done |
done |
259 |
} |
} |
265 |
|
|
266 |
mabi-cc() |
mabi-cc() |
267 |
{ |
{ |
268 |
echo "\"gcc -\${ABI}\"" |
echo "gcc -\${ABI}" |
269 |
} |
} |
270 |
|
|
271 |
mabi-cxx() |
mabi-cxx() |
272 |
{ |
{ |
273 |
echo "\"g++ -\${ABI}\"" |
echo "g++ -\${ABI}" |
274 |
} |
} |
275 |
|
|
276 |
mabi-cflags() |
mabi-cflags() |
277 |
{ |
{ |
278 |
echo "\"\${CFLAGS}\"" |
echo "\${CFLAGS}" |
279 |
} |
} |
280 |
|
|
281 |
mabi-cxxflags() |
mabi-cxxflags() |
282 |
{ |
{ |
283 |
echo "\"\${CXXFLAGS}\"" |
echo "\${CXXFLAGS}" |
284 |
} |
} |
285 |
|
|
286 |
mabi-ldflags() |
mabi-ldflags() |
287 |
{ |
{ |
288 |
echo "\"\${LDFLAGS}\"" |
echo "\${LDFLAGS}" |
289 |
} |
} |
290 |
|
|
291 |
## |
## |
297 |
# rename the old one |
# rename the old one |
298 |
old_mconfigure=old$(typeset -f mconfigure) |
old_mconfigure=old$(typeset -f mconfigure) |
299 |
eval "${old_mconfigure}" |
eval "${old_mconfigure}" |
300 |
fi |
|
301 |
mconfigure() |
mconfigure() |
302 |
{ |
{ |
303 |
local abi |
local abi |
308 |
|
|
309 |
for abi in ${abis_to_run} |
for abi in ${abis_to_run} |
310 |
do |
do |
311 |
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] |
312 |
|
then |
313 |
|
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
314 |
|
fi |
315 |
abi-${abi} oldmconfigure $@ || die |
abi-${abi} oldmconfigure $@ || die |
316 |
done |
done |
317 |
} |
} |
|
|
|
|
if [[ ! -z $(typeset -f cmake_configure) ]] |
|
|
then |
|
|
# rename the old one |
|
|
old_cmake_configure=old$(typeset -f cmake_configure) |
|
|
eval "${old_cmake_configure}" |
|
318 |
fi |
fi |
|
cmake_configure() |
|
|
{ |
|
|
local abi |
|
|
local abis_to_run="${MULTILIB_ABIS}" |
|
|
|
|
|
# respect MULTILIB_ONLY_ABI variable |
|
|
[[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" |
|
|
|
|
|
local saved_SRCDIR="${SRCDIR}" |
|
|
for abi in ${abis_to_run} |
|
|
do |
|
|
SRCDIR="${saved_SRCDIR}-${abi}" |
|
|
cd ${SRCDIR}/${SRCSUBDIR} |
|
|
abi-${abi} oldcmake_configure $@ || die |
|
|
done |
|
|
# restore SRCDIR |
|
|
SRCDIR="${saved_SRCDIR}" |
|
|
} |
|
319 |
|
|
320 |
if [[ ! -z $(typeset -f munpack) ]] |
if [[ ! -z $(typeset -f munpack) ]] |
321 |
then |
then |
322 |
# rename the old one |
# rename the old one |
323 |
old_munpack=old$(typeset -f munpack) |
old_munpack=old$(typeset -f munpack) |
324 |
eval "${old_munpack}" |
eval "${old_munpack}" |
325 |
fi |
|
326 |
munpack() |
munpack() |
327 |
{ |
{ |
328 |
local abi |
local abi |
334 |
for abi in ${abis_to_run} |
for abi in ${abis_to_run} |
335 |
do |
do |
336 |
echo -e "${COLBLUE}*** ${COLGREEN}unpacking for ABI -${abi}${COLDEFAULT}" |
echo -e "${COLBLUE}*** ${COLGREEN}unpacking for ABI -${abi}${COLDEFAULT}" |
337 |
oldmunpack ${SRCFILE} || die |
oldmunpack $@ || die |
338 |
mv ${SRCDIR} ${SRCDIR}-${abi} || die |
mv ${SRCDIR} ${SRCDIR}-${abi} || die |
339 |
done |
done |
340 |
} |
} |
341 |
|
fi |
342 |
|
|
343 |
if [[ ! -z $(typeset -f mmake) ]] |
if [[ ! -z $(typeset -f mmake) ]] |
344 |
then |
then |
345 |
# rename the old one |
# rename the old one |
346 |
old_mmake=old$(typeset -f mmake) |
old_mmake=old$(typeset -f mmake) |
347 |
eval "${old_mmake}" |
eval "${old_mmake}" |
348 |
fi |
|
349 |
mmake() |
mmake() |
350 |
{ |
{ |
351 |
local abi |
local abi |
357 |
for abi in ${abis_to_run} |
for abi in ${abis_to_run} |
358 |
do |
do |
359 |
echo -e "${COLBLUE}*** ${COLGREEN}compiling for ABI -${abi}${COLDEFAULT}" |
echo -e "${COLBLUE}*** ${COLGREEN}compiling for ABI -${abi}${COLDEFAULT}" |
360 |
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] |
361 |
|
then |
362 |
|
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
363 |
|
fi |
364 |
abi-${abi} oldmmake $@ || die |
abi-${abi} oldmmake $@ || die |
365 |
done |
done |
366 |
} |
} |
367 |
|
fi |
368 |
|
|
369 |
if [[ ! -z $(typeset -f minstall) ]] |
if [[ ! -z $(typeset -f minstall) ]] |
370 |
then |
then |
371 |
# rename the old one |
# rename the old one |
372 |
old_minstall=old$(typeset -f minstall) |
old_minstall=old$(typeset -f minstall) |
373 |
eval "${old_minstall}" |
eval "${old_minstall}" |
374 |
fi |
|
375 |
minstall() |
minstall() |
376 |
{ |
{ |
377 |
local abi |
local abi |
383 |
for abi in ${abis_to_run} |
for abi in ${abis_to_run} |
384 |
do |
do |
385 |
echo -e "${COLBLUE}*** ${COLGREEN}installing for ABI -${abi}${COLDEFAULT}" |
echo -e "${COLBLUE}*** ${COLGREEN}installing for ABI -${abi}${COLDEFAULT}" |
386 |
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] |
387 |
|
then |
388 |
|
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
389 |
|
fi |
390 |
abi-${abi} oldminstall $@ || die |
abi-${abi} oldminstall $@ || die |
391 |
done |
done |
392 |
} |
} |
393 |
|
fi |
394 |
|
|
395 |
minstall_destdir() |
minstall_destdir() |
396 |
{ |
{ |
403 |
for abi in ${abis_to_run} |
for abi in ${abis_to_run} |
404 |
do |
do |
405 |
echo -e "${COLBLUE}*** ${COLGREEN}installing for ABI -${abi}${COLDEFAULT}" |
echo -e "${COLBLUE}*** ${COLGREEN}installing for ABI -${abi}${COLDEFAULT}" |
406 |
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] |
407 |
|
then |
408 |
|
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
409 |
|
fi |
410 |
make DESTDIR=${BINDIR} $@ install || die |
make DESTDIR=${BINDIR} $@ install || die |
411 |
done |
done |
412 |
} |
} |
416 |
# rename the old one |
# rename the old one |
417 |
old_mpatch=old$(typeset -f mpatch) |
old_mpatch=old$(typeset -f mpatch) |
418 |
eval "${old_mpatch}" |
eval "${old_mpatch}" |
419 |
fi |
|
420 |
mpatch() |
mpatch() |
421 |
{ |
{ |
422 |
local abi |
local abi |
428 |
for abi in ${abis_to_run} |
for abi in ${abis_to_run} |
429 |
do |
do |
430 |
echo -e "${COLBLUE}*** ${COLGREEN}appling patch for ABI -${abi}${COLDEFAULT}" |
echo -e "${COLBLUE}*** ${COLGREEN}appling patch for ABI -${abi}${COLDEFAULT}" |
431 |
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] |
432 |
|
then |
433 |
|
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
434 |
|
fi |
435 |
oldmpatch $@ || die |
oldmpatch $@ || die |
436 |
done |
done |
437 |
} |
} |
438 |
|
fi |
439 |
|
|
440 |
if [[ ! -z $(typeset -f mlibtoolize) ]] |
if [[ ! -z $(typeset -f mlibtoolize) ]] |
441 |
then |
then |
442 |
# rename the old one |
# rename the old one |
443 |
old_mlibtoolize=old$(typeset -f mlibtoolize) |
old_mlibtoolize=old$(typeset -f mlibtoolize) |
444 |
eval "${old_mlibtoolize}" |
eval "${old_mlibtoolize}" |
445 |
fi |
|
446 |
mlibtoolize() |
mlibtoolize() |
447 |
{ |
{ |
448 |
local abi |
local abi |
454 |
for abi in ${abis_to_run} |
for abi in ${abis_to_run} |
455 |
do |
do |
456 |
echo -e "${COLBLUE}*** ${COLGREEN}running mlibtoolize for ABI -${abi}${COLDEFAULT}" |
echo -e "${COLBLUE}*** ${COLGREEN}running mlibtoolize for ABI -${abi}${COLDEFAULT}" |
457 |
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] |
458 |
|
then |
459 |
|
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
460 |
|
fi |
461 |
oldmlibtoolize $@ || die |
oldmlibtoolize $@ || die |
462 |
done |
done |
463 |
} |
} |
464 |
|
fi |
465 |
|
|
466 |
if [[ ! -z $(typeset -f mautoreconf) ]] |
if [[ ! -z $(typeset -f mautoreconf) ]] |
467 |
then |
then |
468 |
# rename the old one |
# rename the old one |
469 |
old_mautoreconf=old$(typeset -f mautoreconf) |
old_mautoreconf=old$(typeset -f mautoreconf) |
470 |
eval "${old_mautoreconf}" |
eval "${old_mautoreconf}" |
471 |
fi |
|
472 |
mautoreconf() |
mautoreconf() |
473 |
{ |
{ |
474 |
local abi |
local abi |
480 |
for abi in ${abis_to_run} |
for abi in ${abis_to_run} |
481 |
do |
do |
482 |
echo -e "${COLBLUE}*** ${COLGREEN}running mautoreconf for ABI -${abi}${COLDEFAULT}" |
echo -e "${COLBLUE}*** ${COLGREEN}running mautoreconf for ABI -${abi}${COLDEFAULT}" |
483 |
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] |
484 |
|
then |
485 |
|
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
486 |
|
fi |
487 |
oldmautoreconf $@ || die |
oldmautoreconf $@ || die |
488 |
done |
done |
489 |
} |
} |
490 |
|
fi |
491 |
|
|
492 |
if [[ ! -z $(typeset -f minstalldocs) ]] |
if [[ ! -z $(typeset -f minstalldocs) ]] |
493 |
then |
then |
494 |
# rename the old one |
# rename the old one |
495 |
old_minstalldocs=old$(typeset -f minstalldocs) |
old_minstalldocs=old$(typeset -f minstalldocs) |
496 |
eval "${old_minstalldocs}" |
eval "${old_minstalldocs}" |
497 |
fi |
|
498 |
minstalldocs() |
minstalldocs() |
499 |
{ |
{ |
500 |
local abi |
local abi |
507 |
|
|
508 |
for abi in ${abis_to_run} |
for abi in ${abis_to_run} |
509 |
do |
do |
510 |
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] |
511 |
|
then |
512 |
|
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
513 |
|
fi |
514 |
oldminstalldocs $@ || die |
oldminstalldocs $@ || die |
515 |
done |
done |
516 |
} |
} |
517 |
|
fi |
|
## |
|
|
# multilib mbuild wrappers |
|
|
## |
|
|
multilib_src_prepare() |
|
|
{ |
|
|
munpack |
|
|
} |
|
|
|
|
|
multilib_src_compile() |
|
|
{ |
|
|
mconfigure |
|
|
mmake |
|
|
} |
|
|
|
|
|
multilib_src_check() |
|
|
{ |
|
|
mmake -j1 -k check || die |
|
|
} |
|
|
|
|
|
multilib_src_install() |
|
|
{ |
|
|
minstall_destdir |
|
|
|
|
|
local i |
|
|
for abi in ${MULTILIB_ABIS} |
|
|
do |
|
|
cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
|
|
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
|
|
FAQ LICENSE NEWS README TODO |
|
|
do |
|
|
if [ -f ${SRCDIR}-${abi}/${i} ] |
|
|
then |
|
|
minstalldocs ${i} || die |
|
|
fi |
|
|
done |
|
|
done |
|
|
} |
|
|
|
|
|
export_inherits multilib src_prepare src_compile src_check src_install |
|