/[gentoo-alt]/trunk/toolchain-prefix-wrapper/binutils-config.in
Gentoo

Diff of /trunk/toolchain-prefix-wrapper/binutils-config.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1599 Revision 1600
8# TARGET-VER: has a TARGET and VER variable 8# TARGET-VER: has a TARGET and VER variable
9 9
10VERSION="@VERSION@" 10VERSION="@VERSION@"
11BPREFIX="@GENTOO_PORTAGE_EPREFIX@" 11BPREFIX="@GENTOO_PORTAGE_EPREFIX@"
12CFLAGS="@CFLAGS@" 12CFLAGS="@CFLAGS@"
13CC="@CC@" 13BUILD_CC="@CC@"
14[[ -z ${EPREFIX} ]] && EPREFIX=${BPREFIX} 14[[ -z ${EPREFIX} ]] && EPREFIX=${BPREFIX}
15 15
16[[ -z ${ROOT} ]] && ROOT="/" 16[[ -z ${ROOT} ]] && ROOT="/"
17[[ ${ROOT} != /* ]] && ROOT="${PWD}${ROOT}" 17[[ ${ROOT} != /* ]] && ROOT="${PWD}${ROOT}"
18EROOT="${ROOT%/}${EPREFIX}/" 18EROOT="${ROOT%/}${EPREFIX}/"
160 echo -n "int DEBUG(void) { return " 160 echo -n "int DEBUG(void) { return "
161 [[ ${DEBUG} == yes ]] && echo "1; }" || echo "0; }" 161 [[ ${DEBUG} == yes ]] && echo "1; }" || echo "0; }"
162 ) > "${ctargetfile}" || return 1 162 ) > "${ctargetfile}" || return 1
163 umask ${oldumask} || return 1 163 umask ${oldumask} || return 1
164 local cc=$(type -p "${CC}") 164 local cc=$(type -p "${CC}")
165 [[ -z ${cc} ]] && set_BUILD
166 [[ -z ${cc} ]] && [[ ${HOST} == ${BUILD} ]] && cc=$(type -p "${BUILD_CC}")
165 [[ -n ${cc} ]] || cc=$(type -p ${HOST}-gcc) 167 [[ -z ${cc} ]] && cc=$(type -p "${HOST}-gcc")
166 [[ -n ${cc} ]] || cc=$(type -p ${HOST}-cc) 168 [[ -z ${cc} ]] && cc=$(type -p "${HOST}-cc")
167 [[ -n ${cc} ]] || set_BUILD
168 if [[ ${HOST} == ${BUILD} ]]; then 169 if [[ -z ${cc} && ${HOST} == ${BUILD} ]]; then
169 [[ -n ${cc} ]] || cc=$(type -p gcc) 170 [[ -z ${cc} ]] && cc=$(type -p gcc)
170 [[ -n ${cc} ]] || cc=$(type -p cc) 171 [[ -z ${cc} ]] && cc=$(type -p cc)
171 fi 172 fi
172 if [[ -z ${cc} ]]; then 173 if [[ -z ${cc} ]]; then
173 echo -n "Cannot find compiler for ${HOST} (tried '${HOST}-gcc', '${HOST}-cc'" 174 echo -n "Cannot find compiler for ${HOST} (try setting CC)"
174 [[ ${HOST} != ${BUILD} ]] || echo -n ", gcc, cc"
175 echo ")"
176 return 1 175 return 1
177 fi 176 fi
178 rm -f "${EROOT}${BINPATH_LINKS}/${x}.new" > /dev/null || return 1 177 rm -f "${EROOT}${BINPATH_LINKS}/${x}.new" > /dev/null || return 1
179 "${cc}" -o "${EROOT}${BINPATH_LINKS}/${x}.new" "${ctargetfile}" \ 178 "${cc}" -o "${EROOT}${BINPATH_LINKS}/${x}.new" "${ctargetfile}" \
180 "-I${wrapper}" "${wrapper}/libbinutils-config.a" ${CFLAGS} || return 1 179 "-I${wrapper}" "${wrapper}/libbinutils-config.a" ${CFLAGS} || return 1
181 [[ ${DEBUG} == yes ]] || rm -f "${ctargetfile}" || return 1 180 [[ ${DEBUG} == yes ]] || rm -f "${ctargetfile}" || return 1
182 rm -f "${EROOT}${BINPATH_LINKS}/${x}" || return 1
183 mv "${EROOT}${BINPATH_LINKS}/${x}"{.new,} || return 1 181 mv -f "${EROOT}${BINPATH_LINKS}/${x}"{.new,} || return 1
184 touch -r "${EPREFIX}/${BINPATH}/${x}" "${EROOT}${BINPATH_LINKS}/${x}" || return 1 182 touch -r "${EROOT}/${BINPATH}/${x}" "${EROOT}${BINPATH_LINKS}/${x}" || return 1
185 ;; 183 ;;
186 *) 184 *)
187 ln -sf "${EPREFIX}/${BINPATH}/${x}" "${EROOT}${BINPATH_LINKS}/${x}" || return 1 185 ln -sf "${EPREFIX}/${BINPATH}/${x}" "${EROOT}${BINPATH_LINKS}/${x}" || return 1
188 ;; 186 ;;
189 esac 187 esac
419 417
420set_BUILD() { 418set_BUILD() {
421 [[ -n ${BUILD} ]] && return 0 419 [[ -n ${BUILD} ]] && return 0
422 420
423 if [[ -z ${CBUILD} ]] ; then 421 if [[ -z ${CBUILD} ]] ; then
424 BUILD=$(portageq envvar CBUILD) 422 BUILD=$(env -i "${BPREFIX}"/usr/bin/portageq envvar CBUILD)
425 else 423 else
426 BUILD=${CBUILD} 424 BUILD=${CBUILD}
427 fi 425 fi
428} 426}
429 427

Legend:
Removed from v.1599  
changed lines
  Added in v.1600

  ViewVC Help
Powered by ViewVC 1.1.20