pattern : [G] WINDOWS COMMON pattern
# Mac OS X unified application containing all the puzzles.
-Puzzles : [MX] macosx COMMON ALL
+Puzzles : [MX] osx osx.icns osx-info.plist COMMON ALL
# The `nullgame' source file is a largely blank one, which contains
# all the correct function definitions to compile and link, but
$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];
} elsif ($i =~ /^(.*)\.lib/) {
$y = $1;
($x = $ltmpl) =~ s/X/$y/;
- } else {
+ } elsif ($i !~ /\./) {
($x = $otmpl) =~ s/X/$i/;
}
push @ret, $x if $x ne "";
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);
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");
* - configurability. Will no doubt involve learning all about the
* dialog control side of Cocoa.
*
- * - needs an icon.
- *
* - not sure what I should be doing about default window
* placement. Centring new windows is a bit feeble, but what's
* better? Is there a standard way to tell the OS "here's the
NSMenu *menu;
NSMenuItem *item;
AppController *controller;
+ NSImage *icon;
pool = [[NSAutoreleasePool alloc] init];
+
+ icon = [NSImage imageNamed:@"NSApplicationIcon"];
[NSApplication sharedApplication];
+ [NSApp setApplicationIconImage:icon];
controller = [[[AppController alloc] init] autorelease];