diff options
| author | Simon Tatham <anakin@pobox.com> | 2005-01-23 11:20:31 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2005-01-23 11:20:31 +0000 |
| commit | 0ae8782bc6a7ee69b3e7cf079f946e52546882bb (patch) | |
| tree | 5bf34e7dc5fef5226bf6fd8593cb637864a670a3 /mkfiles.pl | |
| parent | f80d9c6d49eaf08d65420a3a5b47db5165add724 (diff) | |
| download | puzzles-0ae8782bc6a7ee69b3e7cf079f946e52546882bb.zip puzzles-0ae8782bc6a7ee69b3e7cf079f946e52546882bb.tar.gz puzzles-0ae8782bc6a7ee69b3e7cf079f946e52546882bb.tar.bz2 puzzles-0ae8782bc6a7ee69b3e7cf079f946e52546882bb.tar.xz | |
Added a framework for putting things other than the binary into a
Mac OS X application bundle, and provided an icon for Puzzles.
Also renamed the OS X source file from macosx.m to osx.m, so that it
can sit beside other things such as osx-info.plist and not cause
enormously long filenames.
[originally from svn r5179]
Diffstat (limited to 'mkfiles.pl')
| -rwxr-xr-x | mkfiles.pl | 39 |
1 files changed, 31 insertions, 8 deletions
@@ -135,9 +135,7 @@ foreach $i (@prognames) { $file = "$1.r"; $depends{$j} = [$file]; push @scanlist, $file; - } elsif ($j =~ /\.lib$/) { - # libraries don't have dependencies - } else { + } elsif ($j !~ /\./) { $file = "$j.c"; $file = "$j.m" unless &findfile($file); $depends{$j} = [$file]; @@ -259,7 +257,7 @@ sub objects { } elsif ($i =~ /^(.*)\.lib/) { $y = $1; ($x = $ltmpl) =~ s/X/$y/; - } else { + } elsif ($i !~ /\./) { ($x = $otmpl) =~ s/X/$i/; } push @ret, $x if $x ne ""; @@ -267,6 +265,19 @@ sub objects { return join " ", @ret; } +sub special { + my ($prog, $suffix) = @_; + my @ret; + my ($i, $x, $y); + @ret = (); + foreach $i (@{$programs{$prog}}) { + if (substr($i, (length $i) - (length $suffix)) eq $suffix) { + push @ret, $i; + } + } + return join " ", @ret; +} + sub splitline { my ($line, $width, $splitchar) = @_; my ($result, $len); @@ -1133,10 +1144,22 @@ if (defined $makefiles{'osx'}) { foreach $p (&prognames("MX")) { ($prog, $type) = split ",", $p; $objstr = &objects($p, "X.o", undef, undef); - print "${prog}: ${prog}.app/Contents/MacOS/$prog\n\n"; - print "${prog}.app:\n\tmkdir \$\@\n"; - print "${prog}.app/Contents: ${prog}.app\n\tmkdir \$\@\n"; - print "${prog}.app/Contents/MacOS: ${prog}.app/Contents\n\tmkdir \$\@\n"; + $icon = &special($p, ".icns"); + $infoplist = &special($p, "info.plist"); + print "${prog}.app:\n\tmkdir -p \$\@\n"; + print "${prog}.app/Contents: ${prog}.app\n\tmkdir -p \$\@\n"; + print "${prog}.app/Contents/MacOS: ${prog}.app/Contents\n\tmkdir -p \$\@\n"; + $targets = "${prog}.app/Contents/MacOS/$prog"; + if (defined $icon) { + print "${prog}.app/Contents/Resources: ${prog}.app/Contents\n\tmkdir -p \$\@\n"; + print "${prog}.app/Contents/Resources/${prog}.icns: ${prog}.app/Contents/Resources $icon\n\tcp $icon \$\@\n"; + $targets .= " ${prog}.app/Contents/Resources/${prog}.icns"; + } + if (defined $infoplist) { + print "${prog}.app/Contents/Info.plist: ${prog}.app/Contents/Resources $infoplist\n\tcp $infoplist \$\@\n"; + $targets .= " ${prog}.app/Contents/Info.plist"; + } + print &splitline("${prog}: $targets", 69) . "\n\n"; print &splitline("${prog}.app/Contents/MacOS/$prog: ". "${prog}.app/Contents/MacOS " . $objstr), "\n"; $libstr = &objects($p, undef, undef, "-lX"); |