revision 713:e5256202cc9e
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 713:e5256202cc9e |
parent | 712:1ef156f22109 |
child | 714:009591ac251e |
author | nkeynes |
date | Sun Jun 29 03:51:33 2008 +0000 (14 years ago) |
Add all non-core libraries to the OS X bundle
![]() | Makefile.am | view | annotate | diff | log | |
![]() | Makefile.in | view | annotate | diff | log | |
![]() | bundlelibs.pl | view | annotate | diff | log |
1.1 --- a/Makefile.am Sun Jun 29 03:10:19 2008 +00001.2 +++ b/Makefile.am Sun Jun 29 03:51:33 2008 +00001.3 @@ -45,6 +45,7 @@1.4 mkdir -p lxdream.app/Contents/Resources1.5 cp src/lxdream lxdream.app/Contents/MacOS1.6 cp -R pixmaps/* lxdream.app/Contents/Resources1.7 + $(srcdir)/bundlelibs.pl lxdream.app/Contents/MacOS/lxdream lxdream.app/Contents/Frameworks1.8 @echo --- Done ---1.9 endif
2.1 --- a/Makefile.in Sun Jun 29 03:10:19 2008 +00002.2 +++ b/Makefile.in Sun Jun 29 03:51:33 2008 +00002.3 @@ -759,6 +759,7 @@2.4 @GUI_COCOA_TRUE@ mkdir -p lxdream.app/Contents/Resources2.5 @GUI_COCOA_TRUE@ cp src/lxdream lxdream.app/Contents/MacOS2.6 @GUI_COCOA_TRUE@ cp -R pixmaps/* lxdream.app/Contents/Resources2.7 +@GUI_COCOA_TRUE@ $(srcdir)/bundlelibs.pl lxdream.app/Contents/MacOS/lxdream lxdream.app/Contents/Frameworks2.8 @GUI_COCOA_TRUE@ @echo --- Done ---2.10 bundle: all
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00003.2 +++ b/bundlelibs.pl Sun Jun 29 03:51:33 2008 +00003.3 @@ -0,0 +1,45 @@3.4 +#!/usr/bin/perl3.5 +# Script for OS X to copy all non-core library dependencies into the bundle, and fixup the lib naming3.6 +# Run after the executable is already in the bundle.3.7 +3.8 +if( $#ARGV <= 0 ) {3.9 + die( "Usage: bundlelibs.pl <target-binary> <target-lib-path>\n" );3.10 +}3.11 +3.12 +my $BINARY=shift();3.13 +my $TARGETDIR=shift();3.14 +my $OTOOL="otool";3.15 +my $NTOOL="install_name_tool";3.16 +3.17 +mkdir $TARGETDIR;3.18 +3.19 +my %done=();3.20 +my @worklist = ($BINARY);3.21 +3.22 +while( $#worklist >= 0 ) {3.23 + my $target = shift @worklist;3.24 + $done{$target} = 2;3.25 +3.26 + open FH, "$OTOOL -L $target|" || die "Unable to run otool";3.27 + $skip = <FH>;3.28 +3.29 + while(<FH>){3.30 + $lib = $_;3.31 + $lib =~ s/^\s+([^\s]+)\s.*$/$1/s;3.32 + if( $lib !~ /^\/System\/Library/ && $lib !~ /^\/usr\/lib/ && $lib !~ /^\@executable_path\// ) {3.33 + $libname = $lib;3.34 + $libname =~ s#^.*/##;3.35 + $targetpath = "$TARGETDIR/$libname";3.36 + $libid = "\@executable_path/../Frameworks/$libname";3.37 + if( !$done{$libname} ) {3.38 + $done{libname} = 1;3.39 + push @worklist, $targetpath;3.40 + system( ("cp", $lib, $targetpath) ) == 0 || die "Failed to copy $lib to $targetpath";3.41 + system( ($NTOOL, "-id", $libid, $targetpath) ) == 0 || die "Failed to set $lib ID to $libid";3.42 + print "Copied $lib => $targetpath\n";3.43 + }3.44 + system( ($NTOOL, "-change", $lib, $libid, $target ) ) == 0 || die "Failed to change $lib ID to $libid";3.45 + }3.46 + }3.47 + close FH;3.48 +}
.