Index: build-cc ================================================================== --- build-cc +++ build-cc @@ -317,33 +317,14 @@ bzip2 -dc "${ADDONS_TARBALL}" | "${TAR:-tar}" --keep-old-files -xf - >/dev/null 2>/dev/null fixPerms='true' fi if [ "${fixPerms}" = 'true' ]; then - find . -type d -exec chmod u+rx '{}' ';' - find . -type f -exec chmod u+r '{}' ';' - fi -) - -### Set use_multilib authoritatively if possible -if [ -f "${CCDIR}/${CCNAME}/multilib" ]; then - use_multilib="$(cat "${CCDIR}/${CCNAME}/multilib")" - rm -f "${CCDIR}/${CCNAME}/multilib" -fi - -### Set C compiler flags from tarball -if [ -f "${CCDIR}/${CCNAME}/BUILD_CC_GCC_CONFIGURE_EXTRA" ]; then - add="$(cat "${CCDIR}/${CCNAME}/BUILD_CC_GCC_CONFIGURE_EXTRA")" - - #### Ensure these flags aren't malicious - ##### XXX: TODO: Build the extra flags as an array for safety - if ! echo "${add}" | grep '[;|<>]' >/dev/null; then - BUILD_CC_GCC_CONFIGURE_EXTRA="${BUILD_CC_GCC_CONFIGURE_EXTRA} ${add}" - fi - - rm -f "${CCDIR}/${CCNAME}/BUILD_CC_GCC_CONFIGURE_EXTRA" -fi + find . -type d -exec chmod u+rwx '{}' ';' + find . -type f -exec chmod u+rw '{}' ';' + fi +) ## Determine stage of build process STAGE="$2" ### If we have a platform tarball and a stage has not been specified, assume we are at stage 2 @@ -362,10 +343,34 @@ ### Normalize stage names if [ "${STAGE}" != "stage1" ]; then STAGE="stage2" fi export STAGE + +### Set use_multilib authoritatively if possible +if [ -f "${CCDIR}/${CCNAME}/multilib" ]; then + use_multilib="$(cat "${CCDIR}/${CCNAME}/multilib")" + + if [ "${STAGE}" = 'stage2' ]; then + rm -f "${CCDIR}/${CCNAME}/multilib" + fi +fi + +### Set C compiler flags from tarball +if [ -f "${CCDIR}/${CCNAME}/BUILD_CC_GCC_CONFIGURE_EXTRA" ]; then + add="$(cat "${CCDIR}/${CCNAME}/BUILD_CC_GCC_CONFIGURE_EXTRA")" + + #### Ensure these flags aren't malicious + ##### XXX: TODO: Build the extra flags as an array for safety + if ! echo "${add}" | grep '[;|<>]' >/dev/null; then + BUILD_CC_GCC_CONFIGURE_EXTRA="${BUILD_CC_GCC_CONFIGURE_EXTRA} ${add}" + fi + + if [ "${STAGE}" = 'stage2' ]; then + rm -f "${CCDIR}/${CCNAME}/BUILD_CC_GCC_CONFIGURE_EXTRA" + fi +fi # Determine flags for this build, to pass to sub-scripts FLAGS='' if [ "${use_multilib}" = '1' ]; then FLAGS="${FLAGS} multilib"