File: copy_libs.sh

package info (click to toggle)
storm-lang 0.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 51,832 kB
  • sloc: ansic: 261,420; cpp: 138,870; sh: 14,877; perl: 9,846; python: 2,525; lisp: 2,504; asm: 860; makefile: 678; pascal: 70; java: 52; xml: 37; awk: 12
file content (28 lines) | stat: -rwxr-xr-x 452 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

# Copy libraries required by an .so-file to the target path.
if [[ $# -lt 3 ]]
then
    echo "Not enough arguments supplied."
    echo "Expected <.so> <target> <library...>"
    exit 1
fi

so=$1
shift
outdir=$1
shift

# Clean up old files.
for i in $(find $outdir -name "lib*.so*")
do
    rm $i
done

all=$(ldd $so)

for i in $@
do
    lib=$(echo "$all" | grep $i | sed -E 's/^.*=> (.*) \(0x[0-9A-Fa-f]+\)$/\1/')
    cp $lib $outdir/
done