Browse Source

macos: fix cp and fix dep paths

copy-dylibs-in-bottle
Alexandros Theodotou 2 years ago
parent
commit
212e64dcfa
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 47
      tools/osx/cp_and_fix_dependency_paths.sh
  2. 9
      tools/osx/zrythm.rb

47
tools/osx/cp_and_fix_dependency_paths.sh

@ -3,19 +3,42 @@ @@ -3,19 +3,42 @@
exe="$1"
prefix_before="$2"
prefix_after="$3"
mode="$4"
recurse="$5"
# fix binary/library paths
echo "processing executable $exe..."
changes=""
for lib in `otool -L "$exe" | egrep "($prefix_before)" | awk '{print $1}'` ; do
base=`basename $lib`
echo "copying $base from $(dirname $lib) to $prefix_after"
mkdir -p "$prefix_after"
cp "$lib" "$prefix_after"/
changes="$changes -change $lib $prefix_after/$base"
done
if test "x$changes" != "x" ; then
install_name_tool $changes $exe
#set -x
if [[ "$mode" == "fix-in-dir" ]]; then
dir_name="$prefix_after"
for file in `ls "$dir_name"`; do
bash $0 "$dir_name/$file" $2 $3 "fix" "false"
done
else
echo "processing executable $exe..."
changes=""
libs=`otool -L "$exe" | sed '1d' | egrep "($prefix_before|$prefix_after)" | awk '{print $1}'`
if [[ "$mode" == "copy" ]] && [[ "$exe" == *".dylib" ]]; then
libs="$(echo "$libs" | grep -v $(basename $exe))"
fi
echo "libs: $libs"
for lib in $libs; do
base=`basename $lib`
mkdir -p "$prefix_after"
if [[ "$mode" == "copy" ]]; then
echo "copying $base from $(dirname $lib) to $prefix_after"
cp "$lib" "$prefix_after"/
chmod +rw "$prefix_after"/"$base"
fi
changes="$changes -change $lib $prefix_after/$base"
if [[ "$recurse" == "true" ]]; then
bash $0 "$prefix_after/$base" $2 $3 $4 $5
fi
done
if [[ "$mode" == "fix" ]] && test "x$changes" != "x" ; then
echo "install_name_tool $changes $exe"
install_name_tool $changes $exe
fi
fi
echo "done"

9
tools/osx/zrythm.rb

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
class Zrythm < Formula
resource("fix_paths_script") do
url "https://git.zrythm.org/cgit/zrythm-installer/plain/tools/osx/cp_and_fix_dependency_paths.sh"
sha256 "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
sha256 "385d934730e48516261f7f8fd927cc7a232b5c86ab63e3a4e40dda8e0bff7d57"
end
desc "Digital audio workstation"
homepage "https://www.zrythm.org"
@ -44,8 +44,11 @@ class Zrythm < Formula @@ -44,8 +44,11 @@ class Zrythm < Formula
system "cp", "-r", "/tmp/breeze-dark", "#{share}/icons/breeze-dark"
# copy all libs
resource("fix_paths_script").stage do
system "./cp_and_fix_dependency_paths.sh", "#{bin}/zrythm", "/usr/local/opt", "#{lib}/zrythm"
system "./cp_and_fix_dependency_paths.sh", "#{bin}/zrythm", "@@HOMEBREW_PREFIX@@", "#{lib}/zrythm"
system "mkdir", "-p", "#{lib}/zrythm"
system "ls", "-la"
system "bash", "cp_and_fix_dependency_paths.sh", "#{bin}/zrythm", "/usr/local/opt", "#{lib}/zrythm", "copy", "true"
system "bash", "cp_and_fix_dependency_paths.sh", "#{bin}/zrythm", "/usr/local/opt", "#{lib}/zrythm", "fix-in-dir", "false"
system "bash", "cp_and_fix_dependency_paths.sh", "#{bin}/zrythm", "/usr/local/opt", "#{lib}/zrythm", "fix", "false"
end
end
end

Loading…
Cancel
Save