Index: ebuild.sh =================================================================== RCS file: /var/cvsroot/gentoo-src/portage/bin/ebuild.sh,v retrieving revision 1.201.2.11 diff -u -4 -p -r1.201.2.11 ebuild.sh --- ebuild.sh 2 Jan 2005 09:36:02 -0000 1.201.2.11 +++ ebuild.sh 3 Jan 2005 08:37:24 -0000 @@ -293,18 +293,20 @@ diefunc() { } #if no perms are specified, dirs/files will have decent defaults #(not secretive, but not stupid) -umask 022 -export DESTTREE=/usr -export INSDESTTREE="" -export EXEDESTTREE="" -export DOCDESTTREE="" -export INSOPTIONS="-m0644" -export EXEOPTIONS="-m0755" -export LIBOPTIONS="-m0644" -export DIROPTIONS="-m0755" -export MOPREFIX=${PN} +reset_dests() { + umask 022 + export DESTTREE=/usr + export INSDESTTREE="" + export EXEDESTTREE="" + export DOCDESTTREE="" + export INSOPTIONS="-m0644" + export EXEOPTIONS="-m0755" + export LIBOPTIONS="-m0644" + export DIROPTIONS="-m0755" + export MOPREFIX=${PN} +} check_KV() { if [ -z "${KV}" ]; then @@ -614,11 +616,87 @@ dyn_setup() fi pkg_setup } +set_abi() { + export ABI=${1} + + if [ "$#" != "1" ]; then + die "set_abi needs to be given the ABI to use." + fi + + if [ -d "${WORKDIR}" ]; then + unset_abi + fi + + if [ -d "${WORKDIR}.${ABI}" ]; then + # If it doesn't exist, then we're making it soon in dyn_unpack + mv ${WORKDIR}.${ABI} ${WORKDIR} || die "IO Failure -- Failed to 'mv work.${ABI} work'" + fi + + echo "${ABI}" > ${BUILDDIR}/.abi || die "IO Failure -- Failed to create .abi." + echo ">>> ABI=${ABI}" + + local VAR + VAR="CFLAGS_${ABI}" + [ -n "${!VAR}" ] && eval export ${VAR} + VAR="ASFLAGS_${ABI}" + [ -n "${!VAR}" ] && eval export ${VAR} +} + +unset_abi() { + if [ -f "${BUILDDIR}/.abi" ]; then + local ABI=$(cat ${BUILDDIR}/.abi) + [ ! -d "${WORKDIR}" ] && die "unset_abi: .abi present (${ABI}) but workdir not present." + + mv ${WORKDIR} ${WORKDIR}.${ABI} || die "IO Failure -- Failed to 'mv work work.${ABI}'." + rm -rf ${BUILDDIR}/.abi || die "IO Failure -- Failed to 'rm -rf .abi'." + fi +} + +get_abi_order() { + local order="" + + if ! hasq multilib-pkg ${FEATURES}; then + order="NOMULTILIB" + elif ! hasq multilib-pkg ${RESTRICT}; then + order="${DEFAULT_ABI}" + else + for x in ${MULTILIB_ABIS}; do + if [ "${x}" != "${DEFAULT_ABI}" ]; then + hasq ${x} ${ABI_DENY} || ordera="${ordera} ${x}" + fi + done + hasq ${DEFAULT_ABI} ${ABI_DENY} || order="${ordera} ${DEFAULT_ABI}" + + if [ -n "${ABI_ALLOW}" ]; then + local ordera="" + for x in ${order}; do + if hasq ${x} ${ABI_ALLOW}; then + ordera="${ordera} ${x}" + fi + done + order="${ordera}" + fi + fi + + if [ -z "${order}" ]; then + die "The ABI list is empty. Are you using a proper multilib profile? Perhaps your USE flags or MULTILIB_ABIS are too restrictive for this package." + fi + + echo ${order} +} + dyn_unpack() { trap "abort_unpack" SIGINT SIGQUIT local newstuff="no" + + for ABI in $(get_abi_order); do + if [ "${ABI}" = "NOMULTILIB" ]; then + unset ABI + else + set_abi ${ABI} + fi if [ -e "${WORKDIR}" ]; then local x local checkme for x in ${AA}; do @@ -640,26 +718,30 @@ dyn_unpack() { rm -rf "${WORKDIR}" fi fi if [ -e "${WORKDIR}" ]; then - if [ "$newstuff" == "no" ]; then + if [ "${newstuff}" == "no" ]; then echo ">>> WORKDIR is up-to-date, keeping..." - return 0 + unset_abi + continue fi fi install -m0700 -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'" - [ -d "$WORKDIR" ] && cd "${WORKDIR}" + [ -d "${WORKDIR}" ] && cd "${WORKDIR}" echo ">>> Unpacking source..." src_unpack + unset_abi + done + unset ABI touch "${BUILDDIR}/.unpacked" || die "IO Failure -- Failed 'touch .unpacked' in BUILDIR" echo ">>> Source unpacked." - cd "$BUILDDIR" + cd "${BUILDDIR}" trap SIGINT SIGQUIT } dyn_clean() { - if [ "$USERLAND" == "BSD" ] && type -p chflags &>/dev/null; then + if [ "${USERLAND}" == "BSD" ] && type -p chflags &>/dev/null; then chflags -R noschg,nouchg,nosappnd,nouappnd,nosunlnk,nouunlnk \ "${BUILDDIR}" fi @@ -671,13 +753,14 @@ dyn_clean() { mv "${T}/environment" "${T}/environment.keeptemp" fi if ! hasq keepwork $FEATURES; then - rm -rf "${BUILDDIR}/.compiled" + rm -rf "${BUILDDIR}/.abi" + rm -rf "${BUILDDIR}/.compiled*" rm -rf "${BUILDDIR}/.unpacked" rm -rf "${BUILDDIR}/.installed" rm -rf "${BUILDDIR}/build-info" - rm -rf "${WORKDIR}" + rm -rf "${WORKDIR}*" fi if [ -f "${BUILDDIR}/.unpacked" ]; then find "${BUILDDIR}" -type d ! -regex "^${WORKDIR}" | sort -r | tr "\n" "\0" | $XARGS -0 rmdir &>/dev/null @@ -793,15 +876,16 @@ abort_handler() { abort_compile() { abort_handler "src_compile" $1 rm -f "${BUILDDIR}/.compiled" + [ -n "${ABI}" ] && rm -f "${BUILDDIR}/.compiled.${ABI}" exit 1 } abort_unpack() { abort_handler "src_unpack" $1 rm -f "${BUILDDIR}/.unpacked" - rm -rf "${BUILDDIR}/work" + rm -rf "${BUILDDIR}/work*" exit 1 } abort_package() { @@ -862,27 +946,52 @@ dyn_compile() { mkdir build-info fi cp "${EBUILD}" "build-info/${PF}.ebuild" - if [ ${BUILDDIR}/.compiled -nt "${WORKDIR}" ]; then + if [ "$(get_abi_order)" = "NOMULTILIB" -a \ + ${BUILDDIR}/.compiled -nt "${WORKDIR}" ]; then echo ">>> It appears that ${PN} is already compiled; skipping." echo ">>> (clean to force compilation)" trap SIGINT SIGQUIT return fi - if [ -d "${S}" ]; then - cd "${S}" - fi #our custom version of libtool uses $S and $D to fix #invalid paths in .la files export S D #some packages use an alternative to $S to build in, cause #our libtool to create problematic .la files export PWORKDIR="$WORKDIR" - src_compile + + for ABI in $(get_abi_order); do + if [ "${ABI}" = "NOMULTILIB" ]; then + unset ABI + else + set_abi ${ABI} + + if [ ${BUILDDIR}/.compiled.${ABI} -nt "${WORKDIR}" ]; then + echo ">>> It appears that ${PN} is already compiled for ABI=${ABI}; skipping." + echo ">>> (clean to force compilation)" + unset_abi + continue + fi + fi + + if [ -d "${S}" ]; then + cd "${S}" + fi + src_compile + + if [ "${ABI}" != "NOMULTILIB" ]; then + cd "${BUILDDIR}" + touch .compiled.${ABI} || die "IO Failure -- Failed to 'touch .compiled.${ABI}'" + unset_abi + fi + done + unset ABI + #|| abort_compile "fail" cd "${BUILDDIR}" - touch .compiled + touch .compiled || "IO Failure -- Failed to 'touch .compiled'" cd build-info echo "$ASFLAGS" > ASFLAGS echo "$CATEGORY" > CATEGORY @@ -913,8 +1022,12 @@ dyn_compile() { echo "$RESTRICT" > RESTRICT echo "$SLOT" > SLOT echo "$USE" > USE + if [ "$(get_abi_order)" != "NOMULTILIB" ]; then + echo "$(get_abi_order)" > MULTILIB_ABIS + fi + set > environment export -p | sed 's:declare -rx:declare -x:' >> environment bzip2 -9 environment @@ -946,18 +1059,31 @@ dyn_package() { dyn_test() { trap "abort_test" SIGINT SIGQUIT - if [ -d "${S}" ]; then - cd "${S}" - fi if hasq maketest $RESTRICT; then ewarn "Skipping make test/check due to ebuild restriction." echo ">>> Test phase [explicitly disabled]: ${CATEGORY}/${PF}" elif ! hasq maketest $FEATURES; then echo ">>> Test phase [not enabled]: ${CATEGORY}/${PF}" else - src_test + for ABI in $(get_abi_order); do + if [ "${ABI}" = "NOMULTILIB" ]; then + unset ABI + else + set_abi ${ABI} + fi + + if [ -d "${S}" ]; then + cd "${S}" + fi + src_test + + if [ "${ABI}" != "NOMULTILIB" ]; then + unset_abi + fi + done + unset ABI fi cd "${BUILDDIR}" touch .tested || die "Failed to 'touch .tested' in ${BUILDDIR}" @@ -969,20 +1095,37 @@ dyn_test() { dyn_install() { trap "abort_install" SIGINT SIGQUIT rm -rf "${BUILDDIR}/image" mkdir "${BUILDDIR}/image" - if [ -d "${S}" ]; then - cd "${S}" - fi echo echo ">>> Install ${PF} into ${D} category ${CATEGORY}" #our custom version of libtool uses $S and $D to fix #invalid paths in .la files export S D #some packages uses an alternative to $S to build in, cause #our libtool to create problematic .la files export PWORKDIR="$WORKDIR" - src_install + + for ABI in $(get_abi_order); do + if [ "${ABI}" = "NOMULTILIB" ]; then + unset ABI + else + set_abi ${ABI} + fi + + reset_dests + + if [ -d "${S}" ]; then + cd "${S}" + fi + src_install + + if [ "${ABI}" != "NOMULTILIB" ]; then + unset_abi + fi + done + unset ABI + #|| abort_install "fail" prepall cd "${D}"