From 8b5cde896afb5d6f97a63aff9877e83946196fc5 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sat, 5 May 2018 21:27:14 -0700 Subject: [PATCH] Incorporate and alter framework IDs so the app bundle is fully self-contained --- .../unix_installer/copy_mac_frameworks.pl | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 sc2/build/unix_installer/copy_mac_frameworks.pl diff --git a/sc2/build/unix_installer/copy_mac_frameworks.pl b/sc2/build/unix_installer/copy_mac_frameworks.pl new file mode 100755 index 000000000..89ac644eb --- /dev/null +++ b/sc2/build/unix_installer/copy_mac_frameworks.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +my @frameworks = ( 'Ogg', 'Vorbis', 'libpng', 'SDL', 'SDL_image' ); +my $target = 'The Ur-Quan Masters'; +my $execfile = "$target.app/Contents/MacOS/$target"; + +foreach my $fw (@frameworks) { + my $src = "/Library/Frameworks/$fw.framework"; + my $dest = "$target.app/Contents/Frameworks/$fw.framework"; + system("ditto \"$src\" \"$dest\""); +} + +foreach my $fw (@frameworks) { + my $src = "$target.app/Contents/Frameworks/$fw.framework/$fw"; + my $oldfwid = `otool -L '$src' | head -n 2 | tail -n 1`; + $oldfwid =~ s/^\s+//; + $oldfwid =~ s/\s.*$//g; + my $newfwid = $oldfwid; + $newfwid =~ s/^\/Library/\@executable_path\/../; + + system("install_name_tool -id $newfwid \"$src\""); + foreach my $fw2 (@frameworks) { + next if $fw eq $fw2; + my $src2 = "$target.app/Contents/Frameworks/$fw2.framework/$fw2"; + system("install_name_tool -change $oldfwid $newfwid \"$src2\""); + } + system("install_name_tool -change $oldfwid $newfwid \"$execfile\""); +}