summaryrefslogtreecommitdiffstats
path: root/remote/setup_target
diff options
context:
space:
mode:
authorSimon Rettberg2014-01-02 19:36:42 +0100
committerSimon Rettberg2014-01-02 19:36:42 +0100
commit61c9b1c97b1f5d07183987c2256637e523d1ff17 (patch)
tree5c5fa89bb09873edceae121c2222948083636972 /remote/setup_target
parent<setup_target> Add check for changed .build/.conf file of modules, autoclean ... (diff)
downloadtm-scripts-61c9b1c97b1f5d07183987c2256637e523d1ff17.tar.gz
tm-scripts-61c9b1c97b1f5d07183987c2256637e523d1ff17.tar.xz
tm-scripts-61c9b1c97b1f5d07183987c2256637e523d1ff17.zip
!! Split up 'mltk' into 'mltk' and 'openslx' !!
'mltk remote' is now 'mltk' 'mltk server' is now 'openslx' Also changed the export type (-e) stage31 to 'cpio' and stage32 and addons to 'sqfs' It should describe what it's packed as, not what the meaning of the content is; you can already tell from the file name.
Diffstat (limited to 'remote/setup_target')
-rwxr-xr-xremote/setup_target45
1 files changed, 42 insertions, 3 deletions
diff --git a/remote/setup_target b/remote/setup_target
index 8f9b9708..1d5fb921 100755
--- a/remote/setup_target
+++ b/remote/setup_target
@@ -181,7 +181,6 @@ copy_files_with_deps () {
fi
for FILE in $FINAL_LIST; do
pdebug "* $FILE"
- strip "$FILE" || pdebug "Could not strip '${FILE}'"
get_link_chain "${MODULE_BUILD_DIR}/${FILE}" "${MODULE_BUILD_DIR}" >> "${COPYFILES_LIST}"
get_dynamic_dependencies -l "${MODULE_BUILD_DIR}" "${FILE}" >> "${COPYFILES_LIST}"
done
@@ -195,7 +194,6 @@ copy_files_with_deps () {
[ -z "$FILE_CANDIDATES" ] && perror "Cannot find required library $LIB"
for LOCATION in $FILE_CANDIDATES; do
pdebug "* $LOCATION"
- strip "$LOCATION" || pdebug "Could not strip '${LOCATION}'"
get_link_chain "${MODULE_BUILD_DIR}/${LOCATION}" "${MODULE_BUILD_DIR}" >> "${COPYFILES_LIST}"
get_dynamic_dependencies -l "${MODULE_BUILD_DIR}" "${LOCATION}" >> "${COPYFILES_LIST}"
done
@@ -212,7 +210,6 @@ copy_files_with_deps () {
echo "${ENTRY}" >> "${COPYFILES_LIST}"
for BIN in $(find "${ENTRY}" -type f -a \( -executable -o -name '*.so*' \) -a -not -name '*.a'); do
#pdebug "\tSearching libs for ${BIN}..."
- strip "$BIN" || pdebug "Could not strip '${LOCATION}'"
get_link_chain "${MODULE_BUILD_DIR}/${BIN}" "${MODULE_BUILD_DIR}" >> "${COPYFILES_LIST}"
get_dynamic_dependencies -l "${MODULE_BUILD_DIR}" "${BIN}" >> "${COPYFILES_LIST}"
done
@@ -398,6 +395,7 @@ process_module() {
pinfo "## Building"
cd "${MODULE_DIR}" || perror "cd to '${MODULE_DIR}' failed."
build # calls perror if something fails, no need to do that here
+ strip_recursive "$MODULE_BUILD_DIR"
touch "$BUILD_FLAG" || pwarning "Error setting built-flag"
fi
# Remove *.la files as they might confuse libtool/linker of other tool packages
@@ -548,3 +546,44 @@ clean_kernel_module() {
fi
pinfo "Done cleaning kernel."
}
+
+# Recursively strip binaries and libraries in the given directory
+strip_recursive() {
+ local DIR="$1"
+ [ -n "$DIR" -a -d "$DIR" ] || perror "strip_recursive(): No such directory: '$DIR'"
+ # Will try to strip shell scripts too but shouldn't do any harm
+ find "$DIR" -type f -a \( -executable -o -name "*.so*" \) -exec strip {} \; 2> /dev/null
+}
+
+# copies static data files from <MODULE>/data/ to <TARGET_BUILD_DIR>
+copy_static_data() {
+ [ ! -d "${MODULE_DIR}/data" ] && pinfo "${MODULE} has no static 'data' directory." && return
+ cp -r "${MODULE_DIR}/data/"* ${TARGET_BUILD_DIR} || perror "Could not copy static data of ${MODULE}"
+}
+
+# Copies files with their absolute paths in $REQUIRED_SYSTEM_FILES to $TARGET_BUILD_DIR
+copy_system_files() {
+ [ ! -z "$REQUIRED_SYSTEM_FILES" ] && tarcopy "$REQUIRED_SYSTEM_FILES" "$TARGET_BUILD_DIR"
+}
+
+# Tries to calculate the size of modules - doesn't seem to work all the time
+calc_size() {
+
+ local CURRENT_BUILD_SIZE=$(du -bc "${TARGET_BUILD_DIR}" | awk 'END {print $1}')
+
+ [ ! -z "${BUILD_SIZE[$MODULE]}" ] && local OLD_MODULE_SIZE=${BUILD_SIZE[$MODULE]} || local OLD_MODULE_SIZE=0
+ local diff=$((CURRENT_BUILD_SIZE-TARGET_BUILD_SIZE+OLD_MODULE_SIZE))
+
+ if [ -z "${BUILD_SIZE[$MODULE]}" ]; then
+ echo "BUILD_SIZE[$MODULE]=${diff}" >> "${ROOT_DIR}/logs/${TARGET}.size"
+ else
+ sed -i "s/^BUILD_SIZE\[${MODULE}\]=.*$/BUILD_SIZE\[${MODULE}\]=${diff}/g" "${ROOT_DIR}/logs/${TARGET}.size"
+ fi
+
+ MODULE_BUILD_SIZE=$(echo $diff | awk '{ sum=$1; hum[1024^3]="GB"; hum[1024^2]="MB"; hum[1024]="KB";
+ for (x=1024^3; x>=1024; x/=1024){
+ if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break }
+ }
+ }')
+}
+