--- branches/magellan-next/include/multilib.sminc 2012/01/10 16:09:38 9756 +++ trunk/include/multilib.sminc 2018/12/20 13:40:54 31852 @@ -1,9 +1,18 @@ # $Id$ # multilib abis +# tell the buildsystem that we are doing a multilib build +export MULTILIB_BUILD="true" + # be verbose or nor (true|false} : ${MULTILIB_VERBOSE="true"} +# enter the abi srcdir as default setting +: ${MULTILIB_ENTER_SRCDIR="true"} + +# multilib should call all dependant includes, which gets overridden +sminclude mtools + # do not define EMUL_LINUX_32 after inherit of multlib !! # it may break i*86 builds @@ -36,10 +45,10 @@ # the var ist decided with our common eval+echo magic if [[ -z ${SDEPEND} ]] then - SDEPEND="\$(eval echo \\\$EMUL_LINUX_32_SDEPEND_\${ARCH/i*86/x86} | tr ';' '\n')" + SDEPEND="$(marchsdepend EMUL_LINUX_32_SDEPEND)" else SDEPEND="${SDEPEND} - \$(eval echo \\\$EMUL_LINUX_32_SDEPEND_\${ARCH/i*86/x86} | tr ';' '\n')" + $(marchsdepend EMUL_LINUX_32_SDEPEND)" fi fi @@ -66,12 +75,22 @@ export ABI_LIBDIR="lib" if [[ ${EXPORT_ABI_LDFLAGS} != false ]] then - export LDFLAGS="-L/${ABI_LIBDIR} -L/usr/${ABI_LIBDIR}" + local saved_ldflags="${LDFLAGS}" + export LDFLAGS="${LDFLAGS} -L/${ABI_LIBDIR} -L/usr/${ABI_LIBDIR}" fi # keep pkgconfig clean local orig_pkg_config_path="${PKG_CONFIG_PATH}" export PKG_CONFIG_PATH="/usr/${ABI_LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}" + # honor rust + case ${ARCH} in + # use native abi as RUST_TARGET + i686) export RUST_TARGET="${ARCH}-unknown-linux-gnu" ;; + # use i686 as RUST_TARGET for i{3,4,5}86 targets and on multilib-x86_64 target too + i*86|x86_64) export RUST_TARGET="i686-unknown-linux-gnu" ;; + *) die "unknown RUST_TARGET '${ARCH}'" ;; + esac + if [[ ${MULTILIB_VERBOSE} = true ]] then echo -e "${COLBLUE}*** ${COLGREEN}running with -${ABI} ABI${COLDEFAULT}" @@ -85,6 +104,8 @@ else echo -e "${COLBLUE}*** ${COLGREEN} LDFLAGS${COLDEFAULT}='${COLYELLOW}not exported${COLDEFAULT}'" fi + echo -e "${COLBLUE}*** ${COLGREEN} CHOST${COLDEFAULT}='${CHOST}'" + echo -e "${COLBLUE}*** ${COLGREEN} SRCDIR${COLDEFAULT}='${SRCDIR}/${SRCSUBDIR}'" echo -e "${COLBLUE}*** ${COLGREEN} PKG_CONFIG_PATH${COLDEFAULT}='${PKG_CONFIG_PATH}'" fi @@ -96,7 +117,7 @@ echo -e "${COLBLUE}*** ${COLGREEN} EMUL_LINUX_32${COLDEFAULT}='${EMUL_LINUX_32}'" fi uname(){ linux32 uname $@; } && export -f uname - ORIG_CHOST="${CHOST}" && export CHOST="i686-pc-linux-gnu" + local orig_chost="${CHOST}" && export CHOST="i686-pc-linux-gnu" fi if [[ ${MULTILIB_VERBOSE} = true ]] then @@ -104,17 +125,22 @@ fi # run any given command + if [[ ${MULTILIB_VERBOSE} = true ]] + then + echo -e "${COLGREEN}Executing:${COLDEFAULT} '$@'" + fi eval $@ || die - unset ABI CC CXX ABI_LIBDIR LDFLAGS + unset ABI CC CXX ABI_LIBDIR RUST_TARGET # keep pkgconfig clean export PKG_CONFIG_PATH="${orig_pkg_config_path}" + export LDFLAGS="${saved_ldflags}" # restore original settings if [[ ${EMUL_LINUX_32} = true ]] then unset uname - export CHOST="${ORIG_CHOST}" && unset ORIG_CHOST + export CHOST="${orig_chost}" && unset orig_chost fi } @@ -126,12 +152,20 @@ export ABI_LIBDIR="lib64" if [[ ${EXPORT_ABI_LDFLAGS} != false ]] then + local saved_ldflags="${LDFLAGS}" export LDFLAGS="-L/${ABI_LIBDIR} -L/usr/${ABI_LIBDIR}" fi # keep pkgconfig clean local orig_pkg_config_path="${PKG_CONFIG_PATH}" export PKG_CONFIG_PATH="/usr/${ABI_LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}" + # honor rust + case ${ARCH} in + # use native abi as RUST_TARGET + x86_64) export RUST_TARGET="${ARCH}-unknown-linux-gnu" ;; + *) die "unknown RUST_TARGET '${ARCH}'" ;; + esac + if [[ ${MULTILIB_VERBOSE} = true ]] then echo -e "${COLBLUE}*** ${COLGREEN}running with -${ABI} ABI${COLDEFAULT}" @@ -146,15 +180,21 @@ echo -e "${COLBLUE}*** ${COLGREEN} LDFLAGS${COLDEFAULT}='${COLYELLOW}not exported${COLDEFAULT}'" fi echo -e "${COLBLUE}*** ${COLGREEN} CHOST${COLDEFAULT}='${CHOST}'" + echo -e "${COLBLUE}*** ${COLGREEN} SRCDIR${COLDEFAULT}='${SRCDIR}/${SRCSUBDIR}'" echo -e "${COLBLUE}*** ${COLGREEN} PKG_CONFIG_PATH${COLDEFAULT}='${PKG_CONFIG_PATH}'" fi # run any given command + if [[ ${MULTILIB_VERBOSE} = true ]] + then + echo -e "${COLGREEN}Executing:${COLDEFAULT} '$@'" + fi eval $@ || die - unset ABI CC CXX ABI_LIBDIR LDFLAGS + unset ABI CC CXX ABI_LIBDIR RUST_TARGET # keep pkgconfig clean export PKG_CONFIG_PATH="${orig_pkg_config_path}" + export LDFLAGS="${saved_ldflags}" } only-m32() @@ -169,7 +209,10 @@ # export this for mpatch etc (to repect only-${abi}) export MULTILIB_ONLY_ABI=${abi} - cd ${SRCDIR}-${abi} + if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] + then + cd ${SRCDIR}-${abi}/${SRCSUBDIR} + fi abi-${abi} $@ || die # unset this is very important @@ -190,7 +233,10 @@ # export this for mpatch etc (to repect only-${abi}) export MULTILIB_ONLY_ABI=${abi} - cd ${SRCDIR}-${abi} + if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] + then + cd ${SRCDIR}-${abi}/${SRCSUBDIR} + fi abi-${abi} $@ || die # unset this is very important @@ -204,7 +250,10 @@ local abi for abi in ${MULTILIB_ABIS} do - cd ${SRCDIR}-${abi} + if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] + then + cd ${SRCDIR}-${abi}/${SRCSUBDIR} + fi abi-${abi} $@ || die done } @@ -214,6 +263,31 @@ echo \${ABI} } +mabi-cc() +{ + echo "gcc -\${ABI}" +} + +mabi-cxx() +{ + echo "g++ -\${ABI}" +} + +mabi-cflags() +{ + echo "\${CFLAGS}" +} + +mabi-cxxflags() +{ + echo "\${CXXFLAGS}" +} + +mabi-ldflags() +{ + echo "\${LDFLAGS}" +} + ## # multilib compile functions ## @@ -223,7 +297,7 @@ # rename the old one old_mconfigure=old$(typeset -f mconfigure) eval "${old_mconfigure}" -fi + mconfigure() { local abi @@ -234,42 +308,21 @@ for abi in ${abis_to_run} do - cd ${SRCDIR}-${abi} + if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] + then + cd ${SRCDIR}-${abi}/${SRCSUBDIR} + fi abi-${abi} oldmconfigure $@ || die done } - -if [[ ! -z $(typeset -f cmake_configure) ]] -then - # rename the old one - old_cmake_configure=old$(typeset -f cmake_configure) - eval "${old_cmake_configure}" 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} - abi-${abi} oldcmake_configure $@ || die - done - # restore SRCDIR - SRCDIR="${saved_SRCDIR}" -} if [[ ! -z $(typeset -f munpack) ]] then # rename the old one old_munpack=old$(typeset -f munpack) eval "${old_munpack}" -fi + munpack() { local abi @@ -281,17 +334,18 @@ for abi in ${abis_to_run} do echo -e "${COLBLUE}*** ${COLGREEN}unpacking for ABI -${abi}${COLDEFAULT}" - oldmunpack ${SRCFILE} || die + oldmunpack $@ || die mv ${SRCDIR} ${SRCDIR}-${abi} || die done } +fi if [[ ! -z $(typeset -f mmake) ]] then # rename the old one old_mmake=old$(typeset -f mmake) eval "${old_mmake}" -fi + mmake() { local abi @@ -303,17 +357,21 @@ for abi in ${abis_to_run} do echo -e "${COLBLUE}*** ${COLGREEN}compiling for ABI -${abi}${COLDEFAULT}" - cd ${SRCDIR}-${abi} + if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] + then + cd ${SRCDIR}-${abi}/${SRCSUBDIR} + fi abi-${abi} oldmmake $@ || die done } +fi if [[ ! -z $(typeset -f minstall) ]] then # rename the old one old_minstall=old$(typeset -f minstall) eval "${old_minstall}" -fi + minstall() { local abi @@ -325,10 +383,14 @@ for abi in ${abis_to_run} do echo -e "${COLBLUE}*** ${COLGREEN}installing for ABI -${abi}${COLDEFAULT}" - cd ${SRCDIR}-${abi} + if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] + then + cd ${SRCDIR}-${abi}/${SRCSUBDIR} + fi abi-${abi} oldminstall $@ || die done } +fi minstall_destdir() { @@ -341,7 +403,10 @@ for abi in ${abis_to_run} do echo -e "${COLBLUE}*** ${COLGREEN}installing for ABI -${abi}${COLDEFAULT}" - cd ${SRCDIR}-${abi} + if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] + then + cd ${SRCDIR}-${abi}/${SRCSUBDIR} + fi make DESTDIR=${BINDIR} $@ install || die done } @@ -351,7 +416,7 @@ # rename the old one old_mpatch=old$(typeset -f mpatch) eval "${old_mpatch}" -fi + mpatch() { local abi @@ -363,17 +428,21 @@ for abi in ${abis_to_run} do echo -e "${COLBLUE}*** ${COLGREEN}appling patch for ABI -${abi}${COLDEFAULT}" - cd ${SRCDIR}-${abi} + if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] + then + cd ${SRCDIR}-${abi}/${SRCSUBDIR} + fi oldmpatch $@ || die done } +fi if [[ ! -z $(typeset -f mlibtoolize) ]] then # rename the old one old_mlibtoolize=old$(typeset -f mlibtoolize) eval "${old_mlibtoolize}" -fi + mlibtoolize() { local abi @@ -385,17 +454,21 @@ for abi in ${abis_to_run} do echo -e "${COLBLUE}*** ${COLGREEN}running mlibtoolize for ABI -${abi}${COLDEFAULT}" - cd ${SRCDIR}-${abi} + if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] + then + cd ${SRCDIR}-${abi}/${SRCSUBDIR} + fi oldmlibtoolize $@ || die done } +fi if [[ ! -z $(typeset -f mautoreconf) ]] then # rename the old one old_mautoreconf=old$(typeset -f mautoreconf) eval "${old_mautoreconf}" -fi + mautoreconf() { local abi @@ -407,17 +480,21 @@ for abi in ${abis_to_run} do echo -e "${COLBLUE}*** ${COLGREEN}running mautoreconf for ABI -${abi}${COLDEFAULT}" - cd ${SRCDIR}-${abi} + if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] + then + cd ${SRCDIR}-${abi}/${SRCSUBDIR} + fi oldmautoreconf $@ || die done } +fi if [[ ! -z $(typeset -f minstalldocs) ]] then # rename the old one old_minstalldocs=old$(typeset -f minstalldocs) eval "${old_minstalldocs}" -fi + minstalldocs() { local abi @@ -430,42 +507,11 @@ for abi in ${abis_to_run} do - cd ${SRCDIR}-${abi} + if [[ ${MULTILIB_ENTER_SRCDIR} = true ]] + then + cd ${SRCDIR}-${abi}/${SRCSUBDIR} + fi oldminstalldocs $@ || die done } - -## -# multilib mbuild wrappers -## -multilib_src_prepare() -{ - munpack -} - -multilib_src_compile() -{ - mconfigure - mmake -} - -multilib_src_install() -{ - minstall_destdir - - local i - for abi in ${MULTILIB_ABIS} - do - cd ${SRCDIR}-${abi} - 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_install +fi