summaryrefslogtreecommitdiffstats
path: root/remote/setup_tools
diff options
context:
space:
mode:
authorJonathan Bauer2013-02-27 17:15:49 +0100
committerJonathan Bauer2013-02-27 17:15:49 +0100
commit60c6a93345ed696ce975e36ceca4d3733717666a (patch)
tree50ca2e872b2cc2cbcecffc67e04e97108140c144 /remote/setup_tools
parentbinutil.inc fixed functionality, see comments (diff)
downloadtm-scripts-60c6a93345ed696ce975e36ceca4d3733717666a.tar.gz
tm-scripts-60c6a93345ed696ce975e36ceca4d3733717666a.tar.xz
tm-scripts-60c6a93345ed696ce975e36ceca4d3733717666a.zip
using binutils EVERYWHERE
Diffstat (limited to 'remote/setup_tools')
-rwxr-xr-xremote/setup_tools103
1 files changed, 24 insertions, 79 deletions
diff --git a/remote/setup_tools b/remote/setup_tools
index bf3f5157..0660e2ef 100755
--- a/remote/setup_tools
+++ b/remote/setup_tools
@@ -40,66 +40,32 @@ copyfileswithdependencies ()
cd build
- local COPYFILES_LIST="list_wanted_stage3.2"
+ COPYFILES_LIST="list_wanted_stage3.2"
[ -e ${COPYFILES_LIST} ] && rm ${COPYFILES_LIST}
[ ! -z "${REQUIRED_BINARIES}" ] && pinfo "Gathering required binaries from config file..."
for FILENAME in ${REQUIRED_BINARIES}
do
- FILE=$(find . -name "${FILENAME}" -type f -executable | xargs grep -l -E '^(.ELF|#!)' | head -1)
- if [ -z "$FILE" ]; then
- pwarning "\tNo Binary found for ${FILENAME}. Skipping."
- continue
- fi
- pdebug "\tFound ${FILENAME} at ${FILE}"
- echo "${FILE}" >> "${COPYFILES_LIST}"
- # fetch dependencies
- # quick fix to exclude libc*, else it copies unneeded libs...
- # workaround for
- ldd "${FILE}" &>/dev/null
- local ldd_exit_code=$?
- if [ "x$ldd_exit_code" != "x0" ];
- then
- pdebug "\tldd $FILE failed."
- continue
- fi
- for i in $(ldd "${FILE}" | awk '{print $1 $2 $3}' | grep -v ld-linux | grep -v libc.so | grep -v linux-gate | grep -v linux-vdso)
- do
- arrIN=(${i//=>/ })
- pdebug "Processing lib ${arrIN[0]}"
- LOCAL_MATCHES=$(find . -name "$(echo ${arrIN[0]} | awk -F '.' '{print $1}')".so\*)
- if [ "x${LOCAL_MATCHES}" != "x" ];
- then
- for llib in ${LOCAL_MATCHES};
- do
- pdebug " at ${llib}"
- echo ${llib} >> "${COPYFILES_LIST}"
- done
- else
- if [ -e ${arrIN[1]} ];
- then
- echo ${arrIN[1]} >> "${COPYFILES_LIST}"
-
- if [ ! -L ${arrIN[1]} ];
- then
- pdebug " at ${arrIN[1]}"
- else
- pdebug " at ${arrIN[1]} -> $(readlink -f ${arrIN[1]})"
- echo $(readlink -f ${arrIN[1]}) >> ${COPYFILES_LIST}
- fi
- fi
+ FILE=$(find . -name "${FILENAME}" -type f -executable | xargs grep -l -E '^(.ELF|#!)' | head -1)
+ if [ -z "$FILE" ]; then
+ pwarning "\tNo Binary found for ${FILENAME}. Skipping."
+ continue
fi
- done
- done
+
+ pdebug "\tFound ${FILENAME} at ${FILE}"
+ get_link_chain "${TOOL_DIR}/${TOOL}/build/${FILE}" "${TOOL_DIR}/${TOOL}/build" >> "${COPYFILES_LIST}"
+ get_dynamic_dependencies -l "${TOOL_DIR}/${TOOL}/build" "${FILE}" >> "${COPYFILES_LIST}"
+ done
[ ! -z "${REQUIRED_LIBRARIES}" ] && pinfo "Gathering required libraries from config file..."
for LIB in ${REQUIRED_LIBRARIES}
do
- for LOCATION in $(find . -name ${LIB}*)
+ for LOCATION in $(find . -name ${LIB}.so\*)
do
pdebug "* $LOCATION"
- echo ${LOCATION} >> ${COPYFILES_LIST}
+ get_link_chain "${TOOL_DIR}/${TOOL}/build/${LOCATION}" "${TOOL_DIR}/${TOOL}/build" >> "${COPYFILES_LIST}"
+ get_dynamic_dependencies -l "${TOOL_DIR}/${TOOL}/build" "${LOCATION}" >> "${COPYFILES_LIST}"
done
done
@@ -112,37 +78,16 @@ copyfileswithdependencies ()
for BIN in $(find "./${ENTRY}" -type f -not -name '*.a' | xargs grep -l '^.ELF')
do
pdebug " Searching libs for ${BIN}..."
- for i in $(ldd ${BIN} | awk '{print $1 $2 $3}' | grep -v ld-linux | grep -v libc.so | grep -v linux-gate | grep -v linux-vdso)
- do
- arrIN=(${i//=>/ })
- pdebug " Searching for ${arrIN[0]}...($i)"
- local LOCAL_MATCHES=$(find . -name "$(echo ${arrIN[0]} | awk -F '.' '{print $1}')".so\*)
- if [ "x${LOCAL_MATCHES}" != "x" ];
- then
- for llib in ${LOCAL_MATCHES};
- do
- pdebug " Found locally, copying ${llib}"
- echo ${llib} >> "${COPYFILES_LIST}"
- done
- else
- if [ ! -z ${arrIN[1]} ] && [ "x${arrIN[1]}" != "xnot" ];
- then
- pdebug " Not found locally but in system, copying ${arrIN[1]}"
- echo ${arrIN[1]} >> "${COPYFILES_LIST}"
- [ -L ${arrIN[1]} ] && echo $(readlink -f "${arrIN[1]}") >> "${COPYFILES_LIST}"
- else
- pwarning "Lib '${arrIN[0]}' from required dir '$ENTRY' neither found in build directory nor on this system."
- pwarning "If this lib is not supplied by another module, this module will probably fail in your final system"
- fi
- fi
- done
+ get_link_chain "${TOOL_DIR}/${TOOL}/build/${BIN}" "${TOOL_DIR}/${TOOL}/build" >> "${COPYFILES_LIST}"
+ get_dynamic_dependencies -l "${TOOL_DIR}/${TOOL}/build" "${BIN}" >> "${COPYFILES_LIST}"
done
done
[ ! -z "${REQUIRED_FILES}" ] && pinfo "Gathering required files from config file..."
for ENTRY in ${REQUIRED_FILES}
do
- echo "./${ENTRY}" >> "${COPYFILES_LIST}"
+ get_link_chain "${TOOL_DIR}/${TOOL}/build/${ENTRY}" "${TOOL_DIR}/${TOOL}/build" >> "${COPYFILES_LIST}"
+ get_dynamic_dependencies -l "${TOOL_DIR}/${TOOL}/build" "${TOOL_DIR}/${TOOL}/build/.${ENTRY}" >> "${COPYFILES_LIST}"
done
@@ -151,7 +96,9 @@ copyfileswithdependencies ()
if [ -s "$COPYFILES_LIST" ]; then
local CLISTCOUNT=$(cat "$COPYFILES_LIST" | wc -l)
pinfo "Copying $CLISTCOUNT files to stage 3.2 target directory."
- tarcopy "$(cat ${COPYFILES_LIST}|sort -u)" "${INIT_DIR}"
+ tar -cp $(cat ${COPYFILES_LIST}|sort -u) | tar -xp -C "${INIT_DIR}"
+ local RET=$?
+ [ "x$RET" != "x0" ] && perror "Could not tar-copy to $INIT_DIR"
fi
unset REQUIRED_BINARIES
unset REQUIRED_LIBRARIES
@@ -174,7 +121,9 @@ get_basic_libs () {
BASICLIBS="${BASICLIBS} $i $(readlink -f "$i")"
fi
done
- tarcopy "${BASICLIBS}" "${INIT_DIR}"
+ tar -cp ${BASICLIBS} | tar -xp -C ${INIT_DIR}
+ local RET=$?
+ [ "x$RET" != "x0" ] && perror "Could not tar-copy to $INIT_DIR"
}
generate_stage32 () {
@@ -238,9 +187,8 @@ clean_tools() {
if [ "x$1" = "x" -o "x$1" = "xall" ]; then
#clean all
if [ -d ${INIT_DIR} ]; then
- pinfo "Cleaning ${INIT_DIR}..."
rm -rf "${INIT_DIR}" || perror "Error deleting $INIT_DIR"
- pinfo "done."
+ pinfo "Cleaned ${INIT_DIR}"
fi
for TOOL in $(ls ${TOOL_DIR}); do
clean_tool $TOOL
@@ -275,7 +223,4 @@ clean_tool() {
if [ -e ${TOOLDIR}/list_binaries_and_files ]; then
rm "${TOOLDIR}/list_binaries_and_files" || perror "Could not delete list_binaries_and_files"
fi
- pinfo "done."
}
-
-#generate_stage32 $@