diff deploy/linux/deploy-appimage.sh @ 1888:f8f3fa1b1286 appimage

Recursive dependencies
author Chris Cannam
date Wed, 27 Jun 2018 15:57:08 +0100
parents 033fcd33e125
children d8dfd30d6d41
line wrap: on
line diff
--- a/deploy/linux/deploy-appimage.sh	Wed Jun 27 14:17:01 2018 +0100
+++ b/deploy/linux/deploy-appimage.sh	Wed Jun 27 15:57:08 2018 +0100
@@ -22,10 +22,19 @@
 
 cp "$program" "$checker" "$piper" "$targetdir"/usr/bin/
 
-for lib in $(ldd "$program" | grep '=> /usr/lib/' | sed 's/^.*=> //' | sed 's/ .*$//'); do
-    mkdir -p "$targetdir/$(dirname $lib)"
-    cp -L "$lib" "$targetdir/$lib"
-done
+add_dependencies() {
+    local binary="$1"
+    for lib in $(ldd "$binary" | grep '=> /usr/lib/' | sed 's/^.*=> //' | sed 's/ .*$//' | grep -v 'libc.so' | grep -v 'libm.so'); do
+        mkdir -p "$targetdir/$(dirname $lib)"
+        if [ ! -f "$targetdir/$lib" ]; then
+            cp -Lv "$lib" "$targetdir/$lib"
+            chmod +x "$targetdir/$lib"
+            add_dependencies "$lib"
+        fi
+    done
+}
+
+add_dependencies "$program"
 
 cp "$program.desktop" "$targetdir/"