Search
lxdream.org :: lxdream :: r713:e5256202cc9e
lxdream 0.9.1
released Jun 29
Download Now
changeset713:e5256202cc9e
parent712:1ef156f22109
child714:009591ac251e
authornkeynes
dateSun Jun 29 03:51:33 2008 +0000 (11 years ago)
Add all non-core libraries to the OS X bundle
Makefile.am
Makefile.in
bundlelibs.pl
1.1 --- a/Makefile.am Sun Jun 29 03:10:19 2008 +0000
1.2 +++ b/Makefile.am Sun Jun 29 03:51:33 2008 +0000
1.3 @@ -45,6 +45,7 @@
1.4 mkdir -p lxdream.app/Contents/Resources
1.5 cp src/lxdream lxdream.app/Contents/MacOS
1.6 cp -R pixmaps/* lxdream.app/Contents/Resources
1.7 + $(srcdir)/bundlelibs.pl lxdream.app/Contents/MacOS/lxdream lxdream.app/Contents/Frameworks
1.8 @echo --- Done ---
1.9 endif
1.10
2.1 --- a/Makefile.in Sun Jun 29 03:10:19 2008 +0000
2.2 +++ b/Makefile.in Sun Jun 29 03:51:33 2008 +0000
2.3 @@ -759,6 +759,7 @@
2.4 @GUI_COCOA_TRUE@ mkdir -p lxdream.app/Contents/Resources
2.5 @GUI_COCOA_TRUE@ cp src/lxdream lxdream.app/Contents/MacOS
2.6 @GUI_COCOA_TRUE@ cp -R pixmaps/* lxdream.app/Contents/Resources
2.7 +@GUI_COCOA_TRUE@ $(srcdir)/bundlelibs.pl lxdream.app/Contents/MacOS/lxdream lxdream.app/Contents/Frameworks
2.8 @GUI_COCOA_TRUE@ @echo --- Done ---
2.9
2.10 bundle: all
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/bundlelibs.pl Sun Jun 29 03:51:33 2008 +0000
3.3 @@ -0,0 +1,45 @@
3.4 +#!/usr/bin/perl
3.5 +# Script for OS X to copy all non-core library dependencies into the bundle, and fixup the lib naming
3.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 +}
.