File: macos-import-arch.sh

package info (click to toggle)
swi-prolog 9.2.9%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 84,456 kB
  • sloc: ansic: 401,705; perl: 374,799; lisp: 9,080; cpp: 8,920; java: 5,525; sh: 3,282; javascript: 2,690; python: 2,655; ruby: 1,594; yacc: 845; makefile: 440; xml: 317; sed: 12; sql: 6
file content (40 lines) | stat: -rwxr-xr-x 706 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/zsh

from=$1

usage()
{
cat <<_EOF_
Usage: $0 dir
_EOF_
exit 1
}

if [ ! -d $from ]; then
    usage
fi

files=( $(find . -type f \( -perm -0700 -o -name '*.dylib' -o -name '*.so' \) -a \! -name '*.pl' -a \! -name '*.la') )

for f in $files; do
    if file $f | grep Mach-O > /dev/null; then
	if [ -f $f -a -f $from/$f ]; then
	    if lipo -info $f | grep -q x86_64; then
		echo "$f already contains x86_64"
	    else
		echo -n "Joining $f and $from/$f ... "
		if lipo -create $f $from/$f -output $f.U; then
		    mv $f.U $f
		    echo ok
		else
		    echo "FAILED"
		fi
	    fi
	else
	    echo "WARNING: Cannot find $from/$f"
	fi
    else
	echo "WARNING: $f is not a native executable"
    fi
done