diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-09-21 02:50:37 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-09-21 02:50:37 +0000 |
commit | aa8e749127dca1d288333d64b5721703e5d3a353 (patch) | |
tree | 0852d432ed462c5ea970c40225bf299cf99dfced /eclass | |
parent | touchup syntax so the code is easier to read (diff) | |
download | gentoo-2-aa8e749127dca1d288333d64b5721703e5d3a353.tar.gz gentoo-2-aa8e749127dca1d288333d64b5721703e5d3a353.tar.bz2 gentoo-2-aa8e749127dca1d288333d64b5721703e5d3a353.zip |
redo syntax/quoting to properly support spacing in CDEFINE variables
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/multilib.eclass | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass index a5c2de366fe8..c8ea52726016 100644 --- a/eclass/multilib.eclass +++ b/eclass/multilib.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.32 2005/08/22 16:20:30 swegener Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.33 2005/09/21 02:50:37 vapier Exp $ # # Author: Jeremy Huddleston <eradicator@gentoo.org> # @@ -177,7 +177,7 @@ get_libdir_override() { # # Jeremy Huddleston <eradicator@gentoo.org> get_abi_var() { - local flag=${1} + local flag=$1 local abi if [ $# -gt 1 ]; then abi=${2} @@ -193,46 +193,46 @@ get_abi_var() { echo ${!var} } -get_abi_CFLAGS() { get_abi_var CFLAGS "${@}"; } -get_abi_LDFLAGS() { get_abi_var LDFLAGS "${@}"; } -get_abi_CHOST() { get_abi_var CHOST "${@}"; } -get_abi_FAKE_TARGETS() { get_abi_var FAKE_TARGETS "${@}"; } -get_abi_CDEFINE() { get_abi_var CDEFINE "${@}"; } -get_abi_LIBDIR() { get_abi_var LIBDIR "${@}"; } +get_abi_CFLAGS() { get_abi_var CFLAGS "$@"; } +get_abi_LDFLAGS() { get_abi_var LDFLAGS "$@"; } +get_abi_CHOST() { get_abi_var CHOST "$@"; } +get_abi_FAKE_TARGETS() { get_abi_var FAKE_TARGETS "$@"; } +get_abi_CDEFINE() { get_abi_var CDEFINE "$@"; } +get_abi_LIBDIR() { get_abi_var LIBDIR "$@"; } # Return a list of the ABIs we want to install for with # the last one in the list being the default. get_install_abis() { local order="" - if [ -z "${MULTILIB_ABIS}" ]; then + if [[ -z ${MULTILIB_ABIS} ]] ; then echo "default" return 0 fi if hasq multilib-pkg-force ${RESTRICT} || { hasq multilib-pkg ${FEATURES} && hasq multilib-pkg ${RESTRICT}; }; then - for x in ${MULTILIB_ABIS}; do - if [ "${x}" != "${DEFAULT_ABI}" ]; then + 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 + if [[ -n ${ABI_ALLOW} ]] ; then local ordera="" - for x in ${order}; do - if hasq ${x} ${ABI_ALLOW}; then + for x in ${order} ; do + if hasq ${x} ${ABI_ALLOW} ; then ordera="${ordera} ${x}" fi done - order="${ordera}" + order=${ordera} fi else - order="${DEFAULT_ABI}" + order=${DEFAULT_ABI} fi - if [ -z "${order}" ]; then + 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 @@ -303,8 +303,8 @@ number_abis() { get_ml_incdir() { local dir=/usr/include - if [[ ${#} -gt 0 ]]; then - incdir=${1} + if [[ $# -gt 0 ]]; then + incdir=$1 shift fi @@ -314,8 +314,8 @@ get_ml_incdir() { fi local abi=${ABI-${DEFAULT_ABI}} - if [[ ${#} -gt 0 ]]; then - abi=${1} + if [[ $# -gt 0 ]]; then + abi=$1 shift fi @@ -342,37 +342,40 @@ get_ml_incdir() { # } prep_ml_includes() { - if [ $(number_abis) -gt 1 ]; then + if [[ $(number_abis) -gt 1 ]] ; then local dir local dirs local base - if [ ${#} -eq 0 ]; then - dirs="/usr/include" + if [[ $# -eq 0 ]] ; then + dirs=/usr/include else - dirs="${@}" + dirs="$@" fi - for dir in ${dirs}; do + for dir in ${dirs} ; do base=${T}/gentoo-multilib/${dir}/gentoo-multilib - mkdir -p ${base} - [ -d ${base}/${ABI} ] && rm -rf ${base}/${ABI} - mv ${D}/${dir} ${base}/${ABI} + mkdir -p "${base}" + [[ -d ${base}/${ABI} ]] && rm -rf "${base}/${ABI}" + mv "${D}/${dir}" "${base}/${ABI}" done if is_final_abi; then base=${T}/gentoo-multilib - pushd ${base} + pushd "${base}" find . | tar -c -T - -f - | tar -x --no-same-owner -f - -C ${D} popd - for dir in ${dirs}; do - local args=${dir} + # This 'set' stuff is required by mips profiles to properly pass + # CDEFINE's (which have spaces) to sub-functions + set -- + for dir in ${dirs} ; do + set -- "$@" "${dir}" local abi for abi in $(get_install_abis); do - args="${args} $(get_abi_CDEFINE ${abi}):${dir}/gentoo-multilib/${abi}" + set -- "$@" "$(get_abi_CDEFINE ${abi}):${dir}/gentoo-multilib/${abi}" done - create_ml_includes ${args} + create_ml_includes "$@" done fi fi @@ -389,42 +392,43 @@ prep_ml_includes() { # create_ml_includes /usr/include/asm __sparc__:/usr/include/asm-sparc __sparc64__:/usr/include/asm-sparc64 # create_ml_includes /usr/include/asm __i386__:/usr/include/asm-i386 __x86_64__:/usr/include/asm-x86_64 create_ml_includes() { - local dest="${1}" + local dest=$1 shift - local mlinfo="${@}" - local basedirs=$(create_ml_includes-listdirs ${mlinfo}) + local basedirs=$(create_ml_includes-listdirs "$@") create_ml_includes-makedestdirs ${dest} ${basedirs} local file - for file in $(create_ml_includes-allfiles ${basedirs}); do - local name="$(echo $file | tr a-z A-Z | sed 's:[^A-Z]:_:g')" - { - echo "/* Common header file autogenerated by create_ml_includes in multilib.eclass */" + for file in $(create_ml_includes-allfiles ${basedirs}) ; do + #local name=$(echo ${file} | tr '[:lower:]' '[:upper:]' | sed 's:[^[:upper:]]:_:g') + ( + echo "/* Autogenerated by create_ml_includes() in multilib.eclass */" local dir for dir in ${basedirs}; do - if [ -f "${D}/${dir}/${file}" ]; then - local sym=$(create_ml_includes-sym_for_dir ${dir} ${mlinfo}) - if [[ ${sym::1} == "!" ]]; then + if [[ -f ${D}/${dir}/${file} ]] ; then + echo "" + local sym=$(create_ml_includes-sym_for_dir ${dir} "$@") + if [[ ${sym/=} != "${sym}" ]] ; then + echo "#if ${sym}" + elif [[ ${sym::1} == "!" ]] ; then echo "#ifndef ${sym:1}" else echo "#ifdef ${sym}" fi - echo "#include <$(create_ml_includes-absolute ${dir}/${file})>" + echo "# include <$(create_ml_includes-absolute ${dir}/${file})>" echo "#endif /* ${sym} */" - echo "" fi done #echo "#endif /* __CREATE_ML_INCLUDES_STUB_${name}__ */" - } > ${D}/${dest}/${file} + ) > "${D}/${dest}/${file}" done } # Helper function for create_ml_includes create_ml_includes-absolute() { - local dst="$(create_ml_includes-tidy_path ${1})" + local dst="$(create_ml_includes-tidy_path $1)" dst=(${dst//\// }) @@ -444,7 +448,7 @@ create_ml_includes-absolute() { # Helper function for create_ml_includes create_ml_includes-tidy_path() { - local removed="${1}" + local removed=$1 if [ -n "${removed}" ]; then # Remove multiple slashes @@ -480,7 +484,7 @@ create_ml_includes-tidy_path() { create_ml_includes-listdirs() { local dirs local data - for data in ${@}; do + for data in "$@"; do dirs="${dirs} ${data/*:/}" done echo ${dirs:1} @@ -488,9 +492,9 @@ create_ml_includes-listdirs() { # Helper function for create_ml_includes create_ml_includes-makedestdirs() { - local dest=${1} + local dest=$1 shift - local basedirs=${@} + local basedirs=$@ dodir ${dest} @@ -505,12 +509,9 @@ create_ml_includes-makedestdirs() { # Helper function for create_ml_includes create_ml_includes-allfiles() { - local basedirs=${@} - - local basedir - for basedir in ${basedirs}; do - local file - for file in $(find ${D}/${basedir} -type f); do + local basedir file + for basedir in "$@" ; do + for file in $(find "${D}"/${basedir} -type f); do echo ${file/${D}\/${basedir}\//} done done | sort | uniq @@ -518,16 +519,16 @@ create_ml_includes-allfiles() { # Helper function for create_ml_includes create_ml_includes-sym_for_dir() { - local dir="${1}" + local dir=$1 shift local data - for data in ${@}; do - if [ "${dir}" = "${data/*:/}" ]; then + for data in "$@"; do + if [[ ${data} == *:${dir} ]] ; then echo ${data/:*/} return 0 fi done - echo "Shouldn't be here -- create_ml_includes-sym_for_dir ${1} ${@}" + echo "Shouldn't be here -- create_ml_includes-sym_for_dir $1 $@" # exit because we'll likely be called from a subshell exit 1 } @@ -548,4 +549,3 @@ get_libname() { fi fi } - |