--- trunk/include/multilib.sminc 2012/03/02 15:27:45 11300 +++ trunk/include/multilib.sminc 2018/12/18 13:15:14 31848 @@ -1,9 +1,15 @@ # $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 @@ -39,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 @@ -89,6 +95,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 @@ -100,7 +108,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 @@ -108,6 +116,10 @@ fi # run any given command + if [[ ${MULTILIB_VERBOSE} = true ]] + then + echo -e "${COLGREEN}Executing:${COLDEFAULT} '$@'" + fi eval $@ || die unset ABI CC CXX ABI_LIBDIR @@ -119,7 +131,7 @@ if [[ ${EMUL_LINUX_32} = true ]] then unset uname - export CHOST="${ORIG_CHOST}" && unset ORIG_CHOST + export CHOST="${orig_chost}" && unset orig_chost fi } @@ -152,10 +164,15 @@ 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 @@ -176,7 +193,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 @@ -197,7 +217,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 @@ -211,7 +234,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 } @@ -221,6 +247,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 ## @@ -230,7 +281,7 @@ # rename the old one old_mconfigure=old$(typeset -f mconfigure) eval "${old_mconfigure}" -fi + mconfigure() { local abi @@ -241,42 +292,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 @@ -288,17 +318,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 @@ -310,17 +341,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 @@ -332,10 +367,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() { @@ -348,7 +387,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 } @@ -358,7 +400,7 @@ # rename the old one old_mpatch=old$(typeset -f mpatch) eval "${old_mpatch}" -fi + mpatch() { local abi @@ -370,17 +412,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 @@ -392,17 +438,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 @@ -414,17 +464,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 @@ -437,47 +491,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_check() -{ - mmake -j1 -k check || die -} - -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_check src_install +fi