From d27d3bb8b68f1e0f066a0749601ff32431325983 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 29 Nov 2009 22:50:17 +0000 Subject: Add other missing files to dist. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1743 --- pkg/win32/GNUmakefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'pkg') diff --git a/pkg/win32/GNUmakefile.am b/pkg/win32/GNUmakefile.am index edd57b6e..ed86d2cc 100644 --- a/pkg/win32/GNUmakefile.am +++ b/pkg/win32/GNUmakefile.am @@ -17,6 +17,7 @@ DOC_FILES=README \ CMDLINE \ TODO +EXTRA_DIST=README noinst_DATA=@PACKAGE_TARNAME@-@PACKAGE_VERSION@-win32.zip @PACKAGE_TARNAME@-@PACKAGE_VERSION@-win32.zip : staging -- cgit v1.2.3 From 6921f30a44e0bdf1c3a2f8982e4a8cd290c22462 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 4 Jan 2010 22:01:32 +0000 Subject: Import OS X launcher code to trunk. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1784 --- pkg/osx/AppController.h | 51 ++++ pkg/osx/AppController.m | 87 ++++++ pkg/osx/Execute.h | 30 ++ pkg/osx/Execute.m | 111 +++++++ pkg/osx/GNUmakefile | 52 ++++ pkg/osx/IWADController.h | 53 ++++ pkg/osx/IWADController.m | 329 +++++++++++++++++++++ pkg/osx/IWADLocation.h | 44 +++ pkg/osx/IWADLocation.m | 74 +++++ pkg/osx/Info.plist | 32 ++ pkg/osx/Info.plist.in | 30 ++ pkg/osx/LauncherManager.h | 47 +++ pkg/osx/LauncherManager.m | 98 ++++++ pkg/osx/app-skeleton/Contents/PkgInfo | 1 + .../app-skeleton/Contents/Resources/128x128.png | Bin 0 -> 23029 bytes pkg/osx/app-skeleton/Contents/Resources/app.icns | Bin 0 -> 51625 bytes .../Contents/Resources/launcher.nib/classes.nib | 40 +++ .../Contents/Resources/launcher.nib/info.nib | 23 ++ .../Resources/launcher.nib/keyedobjects.nib | Bin 0 -> 17192 bytes pkg/osx/config.h | 27 ++ pkg/osx/config.make | 10 + pkg/osx/config.make.in | 9 + pkg/osx/main.m | 32 ++ 23 files changed, 1180 insertions(+) create mode 100644 pkg/osx/AppController.h create mode 100644 pkg/osx/AppController.m create mode 100644 pkg/osx/Execute.h create mode 100644 pkg/osx/Execute.m create mode 100644 pkg/osx/GNUmakefile create mode 100644 pkg/osx/IWADController.h create mode 100644 pkg/osx/IWADController.m create mode 100644 pkg/osx/IWADLocation.h create mode 100644 pkg/osx/IWADLocation.m create mode 100755 pkg/osx/Info.plist create mode 100755 pkg/osx/Info.plist.in create mode 100644 pkg/osx/LauncherManager.h create mode 100644 pkg/osx/LauncherManager.m create mode 100644 pkg/osx/app-skeleton/Contents/PkgInfo create mode 100644 pkg/osx/app-skeleton/Contents/Resources/128x128.png create mode 100644 pkg/osx/app-skeleton/Contents/Resources/app.icns create mode 100644 pkg/osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib create mode 100644 pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib create mode 100644 pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib create mode 100644 pkg/osx/config.h create mode 100644 pkg/osx/config.make create mode 100644 pkg/osx/config.make.in create mode 100644 pkg/osx/main.m (limited to 'pkg') diff --git a/pkg/osx/AppController.h b/pkg/osx/AppController.h new file mode 100644 index 00000000..80f9a461 --- /dev/null +++ b/pkg/osx/AppController.h @@ -0,0 +1,51 @@ +/* ... */ +//----------------------------------------------------------------------------- +// +// Copyright(C) 2009 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- + +#ifndef LAUNCHER_APPCONTROLLER_H +#define LAUNCHER_APPCONTROLLER_H + +#include +// Uncomment if your application is Renaissance-based +//#include + +@interface AppController : NSObject +{ +} + ++ (void)initialize; + +- (id)init; +- (void)dealloc; + +- (void)awakeFromNib; + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotif; +- (BOOL)applicationShouldTerminate:(id)sender; +- (void)applicationWillTerminate:(NSNotification *)aNotif; +- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName; + +- (void)showPrefPanel:(id)sender; + +@end + +#endif + diff --git a/pkg/osx/AppController.m b/pkg/osx/AppController.m new file mode 100644 index 00000000..81dc56a9 --- /dev/null +++ b/pkg/osx/AppController.m @@ -0,0 +1,87 @@ +/* ... */ +//----------------------------------------------------------------------------- +// +// Copyright(C) 2009 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- + +#include "AppController.h" + +@implementation AppController + ++ (void)initialize +{ + NSMutableDictionary *defaults = [NSMutableDictionary dictionary]; + + /* + * Register your app's defaults here by adding objects to the + * dictionary, eg + * + * [defaults setObject:anObject forKey:keyForThatObject]; + * + */ + + [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +- (id)init +{ + if ((self = [super init])) + { + } + + return self; +} + +- (void)dealloc +{ + [super dealloc]; +} + +- (void)awakeFromNib +{ + [[NSApp mainMenu] setTitle:@"ChocolateDoom"]; +} + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotif +{ +// Uncomment if your application is Renaissance-based +// [NSBundle loadGSMarkupNamed:@"Main" owner:self]; +} + +- (BOOL)applicationShouldTerminate:(id)sender +{ + return YES; +} + +- (void)applicationWillTerminate:(NSNotification *)aNotif +{ +} + +- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName +{ + return NO; +} + +- (void)showPrefPanel:(id)sender +{ +} + +@end + diff --git a/pkg/osx/Execute.h b/pkg/osx/Execute.h new file mode 100644 index 00000000..e92d3a11 --- /dev/null +++ b/pkg/osx/Execute.h @@ -0,0 +1,30 @@ +/* ... */ +//----------------------------------------------------------------------------- +// +// Copyright(C) 2009 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- + +#ifndef LAUNCHER_EXECUTE_H +#define LAUNCHER_EXECUTE_H + +void SetProgramLocation(const char *path); +void ExecuteProgram(const char *executable, const char *iwad, const char *args); + +#endif /* #ifndef LAUNCHER_EXECUTE_H */ + diff --git a/pkg/osx/Execute.m b/pkg/osx/Execute.m new file mode 100644 index 00000000..1afcab1f --- /dev/null +++ b/pkg/osx/Execute.m @@ -0,0 +1,111 @@ +/* ... */ +//----------------------------------------------------------------------------- +// +// Copyright(C) 2009 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include + +#define RESPONSE_FILE "/tmp/launcher.rsp" + +static char *executable_path; + +// Called on startup to save the location of the launcher program +// (within a package, other executables should be in the same directory) + +void SetProgramLocation(const char *path) +{ + char *p; + + executable_path = strdup(path); + + p = strrchr(executable_path, '/'); + *p = '\0'; +} + +// Write out the response file containing command line arguments. + +static void WriteResponseFile(const char *iwad, const char *args) +{ + FILE *fstream; + + fstream = fopen(RESPONSE_FILE, "w"); + + if (iwad != NULL) + { + fprintf(fstream, "-iwad \"%s\"", iwad); + } + + if (args != NULL) + { + fprintf(fstream, "%s", args); + } + + fclose(fstream); +} + +static void DoExec(const char *executable, const char *iwad, const char *args) +{ + char *argv[3]; + + argv[0] = malloc(strlen(executable_path) + strlen(executable) + 3); + sprintf(argv[0], "%s/%s", executable_path, executable); + + if (iwad != NULL || args != NULL) + { + WriteResponseFile(iwad, args); + + argv[1] = "@" RESPONSE_FILE; + argv[2] = NULL; + } + else + { + argv[1] = NULL; + } + + execv(argv[0], argv); + exit(-1); +} + +// Execute the specified executable contained in the same directory +// as the launcher, with the specified arguments. + +void ExecuteProgram(const char *executable, const char *iwad, const char *args) +{ + pid_t childpid; + + childpid = fork(); + + if (childpid == 0) + { + signal(SIGCHLD, SIG_DFL); + + DoExec(executable, iwad, args); + } + else + { + signal(SIGCHLD, SIG_IGN); + } +} + diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile new file mode 100644 index 00000000..8d89ef50 --- /dev/null +++ b/pkg/osx/GNUmakefile @@ -0,0 +1,52 @@ + +include config.make + +STAGING_DIR=staging +DMG=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).dmg + +# DMG file containing package: + +$(DMG) : $(STAGING_DIR) + rm -f $@ + hdiutil create -volname "$(PACKAGE_STRING)" -srcdir $(STAGING_DIR) $@ + +clean : launcher_clean + rm -f $(DMG) + rm -rf $(STAGING_DIR) + +# Staging dir build for package: + +APP_DIR=$(STAGING_DIR)/$(PACKAGE_NAME).app + +$(STAGING_DIR): launcher + rm -rf $(STAGING_DIR) + mkdir $(STAGING_DIR) + cp -R app-skeleton "$(APP_DIR)" + cp Info.plist "$(APP_DIR)/Contents/" + cp launcher "$(APP_DIR)/Contents/MacOS/" + # TODO: copy Doom and setup binaries into app dir + # TODO: copy other documentation into staging dir + find $(STAGING_DIR) -name .svn -delete -exec rm -rf {} \; + +# Launcher build: + +CFLAGS=-Wall +LDFLAGS=-framework Cocoa + +LAUNCHER_OBJS= \ + AppController.o \ + Execute.o \ + IWADController.o \ + IWADLocation.o \ + LauncherManager.o \ + main.o + +launcher : $(LAUNCHER_OBJS) + $(CC) $(LDFLAGS) $(LAUNCHER_OBJS) -o $@ + +%.o : %.m + $(CC) -c $(CFLAGS) $^ -o $@ + +launcher_clean : + rm -f $(LAUNCHER_OBJS) launcher + diff --git a/pkg/osx/IWADController.h b/pkg/osx/IWADController.h new file mode 100644 index 00000000..8bdd0d55 --- /dev/null +++ b/pkg/osx/IWADController.h @@ -0,0 +1,53 @@ +/* ... */ +//----------------------------------------------------------------------------- +// +// Copyright(C) 2009 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- + +#ifndef LAUNCHER_IWADCONTROLLER_H +#define LAUNCHER_IWADCONTROLLER_H + +#include +#include + +@interface IWADController : NSObject +{ + id iwadSelector; + id configWindow; + + id chex; + id doom1; + id doom2; + id plutonia; + id tnt; +} + +- (void) closeConfigWindow: (id)sender; +- (void) openConfigWindow: (id)sender; +- (NSString *) getIWADLocation; +- (void) awakeFromNib; +- (BOOL) setDropdownList; +- (void) setDropdownSelection; +- (void) saveConfig; +- (void) setEnvironment; + +@end + +#endif /* #ifndef LAUNCHER_IWADCONTROLLER_H */ + diff --git a/pkg/osx/IWADController.m b/pkg/osx/IWADController.m new file mode 100644 index 00000000..f1860301 --- /dev/null +++ b/pkg/osx/IWADController.m @@ -0,0 +1,329 @@ +/* ... */ +//----------------------------------------------------------------------------- +// +// Copyright(C) 2009 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- + +#include +#include +#include +#include "IWADController.h" +#include "IWADLocation.h" + +typedef enum +{ + IWAD_DOOM1, + IWAD_DOOM2, + IWAD_TNT, + IWAD_PLUTONIA, + IWAD_CHEX, + NUM_IWAD_TYPES +} IWAD; + +static NSString *IWADLabels[NUM_IWAD_TYPES] = +{ + @"Doom", + @"Doom II: Hell on Earth", + @"Final Doom: TNT: Evilution", + @"Final Doom: Plutonia Experiment", + @"Chex Quest" +}; + +static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] = +{ + @"doom.wad", + @"doom2.wad", + @"tnt.wad", + @"plutonia.wad", + @"chex.wad", + @"undefined" +}; + +@implementation IWADController + +- (void) getIWADList: (IWADLocation **) iwadList +{ + iwadList[IWAD_DOOM1] = self->doom1; + iwadList[IWAD_DOOM2] = self->doom2; + iwadList[IWAD_TNT] = self->tnt; + iwadList[IWAD_PLUTONIA] = self->plutonia; + iwadList[IWAD_CHEX] = self->chex; +} + +- (IWAD) getSelectedIWAD +{ + unsigned int i; + + for (i=0; iiwadSelector titleOfSelectedItem] == IWADLabels[i]) + { + return i; + } + } + + return NUM_IWAD_TYPES; +} + +// Get the location of the selected IWAD. + +- (NSString *) getIWADLocation +{ + IWAD selectedIWAD; + IWADLocation *iwadList[NUM_IWAD_TYPES]; + + selectedIWAD = [self getSelectedIWAD]; + + if (selectedIWAD == NUM_IWAD_TYPES) + { + return nil; + } + else + { + [self getIWADList: iwadList]; + + return [iwadList[selectedIWAD] getLocation]; + } +} + +- (void) setIWADConfig +{ + IWADLocation *iwadList[NUM_IWAD_TYPES]; + NSUserDefaults *defaults; + NSString *key; + NSString *value; + unsigned int i; + + [self getIWADList: iwadList]; + + // Load IWAD filename paths + + defaults = [NSUserDefaults standardUserDefaults]; + + for (i=0; iiwadSelector selectItemWithTitle:IWADLabels[i]]; + break; + } + } +} + +// Set the dropdown list to include an entry for each IWAD that has +// been configured. Returns true if at least one IWAD is configured. + +- (BOOL) setDropdownList +{ + IWADLocation *iwadList[NUM_IWAD_TYPES]; + BOOL have_wads; + id location; + unsigned int i; + unsigned int enabled_wads; + + // Build the new list. + + [self getIWADList: iwadList]; + [self->iwadSelector removeAllItems]; + + enabled_wads = 0; + + for (i=0; i 0) + { + [self->iwadSelector addItemWithTitle: IWADLabels[i]]; + ++enabled_wads; + } + } + + // Enable/disable the dropdown depending on whether there + // were any configured IWADs. + + have_wads = enabled_wads > 0; + [self->iwadSelector setEnabled: have_wads]; + + // Restore the old selection. + + [self setDropdownSelection]; + + return have_wads; +} + +- (void) saveConfig +{ + IWADLocation *iwadList[NUM_IWAD_TYPES]; + IWAD selectedIWAD; + NSUserDefaults *defaults; + NSString *key; + NSString *value; + unsigned int i; + + [self getIWADList: iwadList]; + + // Store all IWAD locations to user defaults. + + defaults = [NSUserDefaults standardUserDefaults]; + + for (i=0; iconfigWindow isVisible]) + { + [self->configWindow makeKeyAndOrderFront: sender]; + } +} + +// Callback method invoked when the close button is clicked. + +- (void) closeConfigWindow: (id)sender +{ + [self->configWindow orderOut: sender]; + [self saveConfig]; + [self setDropdownList]; +} + +- (void) awakeFromNib +{ + // Set configuration for all IWADs from configuration file. + + [self setIWADConfig]; + + // Populate the dropdown IWAD list, and open the configuration + // dialog if not yet configured. + + if ([self setDropdownList]) + { + [self setDropdownSelection]; + } + else + { + [self openConfigWindow: nil]; + } +} + +// Set the DOOMWADPATH environment variable to contain the path to each +// of the configured IWAD files. + +- (void) setEnvironment +{ + IWADLocation *iwadList[NUM_IWAD_TYPES]; + NSString *location; + unsigned int i; + unsigned int len; + BOOL first; + char *env; + + [self getIWADList: iwadList]; + + // Calculate length of environment string. + + len = 30; + + for (i=0; i 0) + { + len += [location length] + 1; + } + } + + // Build string. + + env = malloc(len); + strcpy(env, "DOOMWADPATH="); + + first = YES; + + for (i=0; i 0) + { + if (!first) + { + strcat(env, ":"); + } + + strcat(env, [location UTF8String]); + first = NO; + } + } + + // Load into environment: + + putenv(env); + + //free(env); +} + +@end + diff --git a/pkg/osx/IWADLocation.h b/pkg/osx/IWADLocation.h new file mode 100644 index 00000000..4ddfebc2 --- /dev/null +++ b/pkg/osx/IWADLocation.h @@ -0,0 +1,44 @@ +/* ... */ +//----------------------------------------------------------------------------- +// +// Copyright(C) 2009 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- + +#ifndef LAUNCHER_IWADLOCATION_H +#define LAUNCHER_IWADLOCATION_H + +#include + +#include "IWADController.h" + +@interface IWADLocation : NSObject +{ + IWADController *iwadController; + + id locationConfigBox; +} + +- (void) setButtonClicked: (id)sender; +- (NSString *) getLocation; +- (void) setLocation: (NSString *) value; + +@end + +#endif /* #ifndef LAUNCHER_IWADLOCATION_H */ + diff --git a/pkg/osx/IWADLocation.m b/pkg/osx/IWADLocation.m new file mode 100644 index 00000000..3f2ac188 --- /dev/null +++ b/pkg/osx/IWADLocation.m @@ -0,0 +1,74 @@ +/* ... */ +//----------------------------------------------------------------------------- +// +// Copyright(C) 2009 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- + +#include +#include "IWADLocation.h" + +static id WAD_TYPES[] = +{ + @"wad", @"WAD" +}; + +@implementation IWADLocation + +- (void) setButtonClicked: (id)sender +{ + NSArray *wadTypes = [NSArray arrayWithObjects: WAD_TYPES count: 2]; + NSOpenPanel *openPanel; + NSArray *filenames; + int result; + + [wadTypes retain]; + + // Open a file selector for the new file. + + openPanel = [NSOpenPanel openPanel]; + [openPanel setTitle: @"Add IWAD file"]; + [openPanel setCanChooseFiles: YES]; + [openPanel setCanChooseDirectories: NO]; + + result = [openPanel runModalForTypes: wadTypes]; + + // If the "OK" button was clicked, add the new IWAD file to the list. + + if (result == NSOKButton) + { + filenames = [openPanel filenames]; + [self setLocation: [filenames lastObject]]; + + [self->iwadController saveConfig]; + [self->iwadController setDropdownList]; + } +} + +- (NSString *) getLocation +{ + return [self->locationConfigBox stringValue]; +} + +- (void) setLocation: (NSString *) filename +{ + [self->locationConfigBox setStringValue: filename]; +} + +@end + diff --git a/pkg/osx/Info.plist b/pkg/osx/Info.plist new file mode 100755 index 00000000..fb2afc15 --- /dev/null +++ b/pkg/osx/Info.plist @@ -0,0 +1,32 @@ + + + + + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + Cocoa Doom + CFBundleExecutable + launcher + CFBundleGetInfoString + Cocoa Doom 1.2.1 + CFBundleIconFile + app.icns + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Cocoa Doom + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.2.1 + CFBundleVersion + 1.2.1 + NSPrincipalClass + NSApplication + NSMainNibFile + launcher + + diff --git a/pkg/osx/Info.plist.in b/pkg/osx/Info.plist.in new file mode 100755 index 00000000..a7a33b84 --- /dev/null +++ b/pkg/osx/Info.plist.in @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + @PACKAGE_NAME@ + CFBundleExecutable + launcher + CFBundleGetInfoString + @PACKAGE_STRING@ + CFBundleIconFile + app.icns + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + @PACKAGE_NAME@ + CFBundlePackageType + APPL + CFBundleShortVersionString + @PACKAGE_VERSION@ + CFBundleVersion + @PACKAGE_VERSION@ + NSPrincipalClass + NSApplication + NSMainNibFile + launcher + + diff --git a/pkg/osx/LauncherManager.h b/pkg/osx/LauncherManager.h new file mode 100644 index 00000000..11852dcf --- /dev/null +++ b/pkg/osx/LauncherManager.h @@ -0,0 +1,47 @@ +/* ... */ +//----------------------------------------------------------------------------- +// +// Copyright(C) 2009 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- + +#ifndef LAUNCHER_LAUNCHERMANAGER_H +#define LAUNCHER_LAUNCHERMANAGER_H + +#include +#include +#include "IWADController.h" + +@interface LauncherManager : NSObject +{ + IWADController *iwadController; + + id launcherWindow; + + id commandLineArguments; + id packageLabel; +} + +- (void) launch: (id)sender; +- (void) runSetup: (id)sender; +- (void) awakeFromNib; + +@end + +#endif /* #ifndef LAUNCHER_LAUNCHERMANAGER_H */ + diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m new file mode 100644 index 00000000..cda7b3e7 --- /dev/null +++ b/pkg/osx/LauncherManager.m @@ -0,0 +1,98 @@ +/* ... */ +//----------------------------------------------------------------------------- +// +// Copyright(C) 2009 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- + +#include +#include "Execute.h" +#include "LauncherManager.h" +#include "config.h" + +@implementation LauncherManager + +// Save configuration. Invoked when we launch the game or quit. + +- (void) saveConfig +{ + NSUserDefaults *defaults; + + // Save IWAD configuration and selected IWAD. + + [self->iwadController saveConfig]; + + // Save command line arguments. + + defaults = [NSUserDefaults standardUserDefaults]; + [defaults setObject:[self->commandLineArguments stringValue] + forKey:@"command_line_args"]; +} + +// Load configuration, invoked on startup. + +- (void) setConfig +{ + NSUserDefaults *defaults; + NSString *args; + + defaults = [NSUserDefaults standardUserDefaults]; + + args = [defaults stringForKey:@"command_line_args"]; + + if (args != nil) + { + [self->commandLineArguments setStringValue:args]; + } +} + +- (void) launch: (id)sender +{ + NSString *iwad; + NSString *args; + + [self saveConfig]; + + iwad = [self->iwadController getIWADLocation]; + args = [self->commandLineArguments stringValue]; + + if (iwad != nil) + { + ExecuteProgram(PACKAGE_TARNAME, [iwad UTF8String], + [args UTF8String]); + [NSApp terminate:sender]; + } +} + +- (void) runSetup: (id)sender +{ + [self saveConfig]; + + [self->iwadController setEnvironment]; + ExecuteProgram("chocolate-setup", NULL, NULL); +} + +- (void) awakeFromNib +{ + [self->packageLabel setStringValue: @PACKAGE_STRING]; + [self->launcherWindow setTitle: @PACKAGE_NAME " Launcher"]; + [self setConfig]; +} + +@end + diff --git a/pkg/osx/app-skeleton/Contents/PkgInfo b/pkg/osx/app-skeleton/Contents/PkgInfo new file mode 100644 index 00000000..6f749b0f --- /dev/null +++ b/pkg/osx/app-skeleton/Contents/PkgInfo @@ -0,0 +1 @@ +APPL???? diff --git a/pkg/osx/app-skeleton/Contents/Resources/128x128.png b/pkg/osx/app-skeleton/Contents/Resources/128x128.png new file mode 100644 index 00000000..0ef1fe9c Binary files /dev/null and b/pkg/osx/app-skeleton/Contents/Resources/128x128.png differ diff --git a/pkg/osx/app-skeleton/Contents/Resources/app.icns b/pkg/osx/app-skeleton/Contents/Resources/app.icns new file mode 100644 index 00000000..9b535a25 Binary files /dev/null and b/pkg/osx/app-skeleton/Contents/Resources/app.icns differ diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib new file mode 100644 index 00000000..9092e44b --- /dev/null +++ b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib @@ -0,0 +1,40 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {closeConfigWindow = id; openConfigWindow = id; }; + CLASS = IWADController; + LANGUAGE = ObjC; + OUTLETS = { + chex = id; + configWindow = id; + doom1 = id; + doom2 = id; + iwadSelector = id; + plutonia = id; + tnt = id; + }; + SUPERCLASS = NSObject; + }, + { + ACTIONS = {setButtonClicked = id; }; + CLASS = IWADLocation; + LANGUAGE = ObjC; + OUTLETS = {locationConfigBox = id; }; + SUPERCLASS = NSObject; + }, + { + ACTIONS = {launch = id; runSetup = id; }; + CLASS = LauncherManager; + LANGUAGE = ObjC; + OUTLETS = { + commandLineArguments = id; + iwadController = id; + launcherWindow = id; + packageLabel = id; + }; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib new file mode 100644 index 00000000..63067b23 --- /dev/null +++ b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib @@ -0,0 +1,23 @@ + + + + + IBDocumentLocation + 172 70 612 260 0 0 1440 878 + IBEditorPositions + + 29 + 108 337 163 44 0 0 1440 878 + + IBFramework Version + 446.1 + IBOpenObjects + + 29 + 227 + 21 + + IBSystem Version + 8S2167 + + diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib new file mode 100644 index 00000000..85980d2d Binary files /dev/null and b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib differ diff --git a/pkg/osx/config.h b/pkg/osx/config.h new file mode 100644 index 00000000..77fbac58 --- /dev/null +++ b/pkg/osx/config.h @@ -0,0 +1,27 @@ +// Dummy config.h for developing launcher. Eventually, the launcher +// will include the top-level config.h for the program. + +/* Name of package */ +#define PACKAGE "cocoa-doom" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "fraggle@gmail.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "Cocoa Doom" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "Cocoa Doom 1.2.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "cocoa-doom" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.2.1" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "1.2.1" + diff --git a/pkg/osx/config.make b/pkg/osx/config.make new file mode 100644 index 00000000..49905c84 --- /dev/null +++ b/pkg/osx/config.make @@ -0,0 +1,10 @@ +# File included by the main makefile that contains details +# about the package name. This will eventuall be generated +# by configure. + +PACKAGE = cocoa-doom +PACKAGE_NAME = Cocoa Doom +PACKAGE_STRING = Cocoa Doom 1.2.1 +PACKAGE_TARNAME = cocoa-doom +PACKAGE_VERSION = 1.2.1 + diff --git a/pkg/osx/config.make.in b/pkg/osx/config.make.in new file mode 100644 index 00000000..67f1c968 --- /dev/null +++ b/pkg/osx/config.make.in @@ -0,0 +1,9 @@ +# File included by the main makefile that contains details +# about the package name, generated by configure. + +PACKAGE = @PACKAGE@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ + diff --git a/pkg/osx/main.m b/pkg/osx/main.m new file mode 100644 index 00000000..e3c70dc1 --- /dev/null +++ b/pkg/osx/main.m @@ -0,0 +1,32 @@ +/* ... */ +//----------------------------------------------------------------------------- +// +// Copyright(C) 2009 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +//----------------------------------------------------------------------------- + +#include +#include "Execute.h" + +int main(int argc, const char *argv[]) +{ + SetProgramLocation(argv[0]); + + return NSApplicationMain (argc, argv); +} + -- cgit v1.2.3 From afb95216afb043a56122a3f57292bf0ded5d7775 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 4 Jan 2010 22:11:11 +0000 Subject: Generate Info.plist and config.make in configure and remove temporary versions. Include config.h from top level. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1785 --- pkg/osx/GNUmakefile | 2 +- pkg/osx/Info.plist | 32 -------------------------------- pkg/osx/Info.plist.in | 0 pkg/osx/config.h | 27 --------------------------- pkg/osx/config.make | 10 ---------- 5 files changed, 1 insertion(+), 70 deletions(-) delete mode 100755 pkg/osx/Info.plist mode change 100755 => 100644 pkg/osx/Info.plist.in delete mode 100644 pkg/osx/config.h delete mode 100644 pkg/osx/config.make (limited to 'pkg') diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile index 8d89ef50..cf9d1ffb 100644 --- a/pkg/osx/GNUmakefile +++ b/pkg/osx/GNUmakefile @@ -30,7 +30,7 @@ $(STAGING_DIR): launcher # Launcher build: -CFLAGS=-Wall +CFLAGS=-Wall -I../.. LDFLAGS=-framework Cocoa LAUNCHER_OBJS= \ diff --git a/pkg/osx/Info.plist b/pkg/osx/Info.plist deleted file mode 100755 index fb2afc15..00000000 --- a/pkg/osx/Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - CFBundleDevelopmentRegion - English - CFBundleDisplayName - Cocoa Doom - CFBundleExecutable - launcher - CFBundleGetInfoString - Cocoa Doom 1.2.1 - CFBundleIconFile - app.icns - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Cocoa Doom - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.2.1 - CFBundleVersion - 1.2.1 - NSPrincipalClass - NSApplication - NSMainNibFile - launcher - - diff --git a/pkg/osx/Info.plist.in b/pkg/osx/Info.plist.in old mode 100755 new mode 100644 diff --git a/pkg/osx/config.h b/pkg/osx/config.h deleted file mode 100644 index 77fbac58..00000000 --- a/pkg/osx/config.h +++ /dev/null @@ -1,27 +0,0 @@ -// Dummy config.h for developing launcher. Eventually, the launcher -// will include the top-level config.h for the program. - -/* Name of package */ -#define PACKAGE "cocoa-doom" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "fraggle@gmail.com" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "Cocoa Doom" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Cocoa Doom 1.2.1" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "cocoa-doom" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "1.2.1" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "1.2.1" - diff --git a/pkg/osx/config.make b/pkg/osx/config.make deleted file mode 100644 index 49905c84..00000000 --- a/pkg/osx/config.make +++ /dev/null @@ -1,10 +0,0 @@ -# File included by the main makefile that contains details -# about the package name. This will eventuall be generated -# by configure. - -PACKAGE = cocoa-doom -PACKAGE_NAME = Cocoa Doom -PACKAGE_STRING = Cocoa Doom 1.2.1 -PACKAGE_TARNAME = cocoa-doom -PACKAGE_VERSION = 1.2.1 - -- cgit v1.2.3 From c94870783a025514286df1d8bb43cf616b865547 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 4 Jan 2010 22:19:53 +0000 Subject: Fix GNUstep build. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1786 --- pkg/osx/GNUmakefile | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile index cf9d1ffb..67f0fed8 100644 --- a/pkg/osx/GNUmakefile +++ b/pkg/osx/GNUmakefile @@ -4,15 +4,15 @@ include config.make STAGING_DIR=staging DMG=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).dmg +ifndef GNUSTEP_MAKEFILES + # DMG file containing package: $(DMG) : $(STAGING_DIR) rm -f $@ hdiutil create -volname "$(PACKAGE_STRING)" -srcdir $(STAGING_DIR) $@ -clean : launcher_clean - rm -f $(DMG) - rm -rf $(STAGING_DIR) +endif # Staging dir build for package: @@ -26,12 +26,24 @@ $(STAGING_DIR): launcher cp launcher "$(APP_DIR)/Contents/MacOS/" # TODO: copy Doom and setup binaries into app dir # TODO: copy other documentation into staging dir - find $(STAGING_DIR) -name .svn -delete -exec rm -rf {} \; + find $(STAGING_DIR) -name .svn -delete -exec rm -rf {} \; || true + +clean : launcher_clean + rm -f $(DMG) + rm -rf $(STAGING_DIR) # Launcher build: -CFLAGS=-Wall -I../.. -LDFLAGS=-framework Cocoa +CFLAGS = -Wall -I../.. + +# Are we building using gs_make? + +ifdef GNUSTEP_MAKEFILES +CFLAGS += $(shell gnustep-config --objc-flags) +LDFLAGS = $(shell gnustep-config --gui-libs) +else +LDFLAGS = -framework Cocoa +endif LAUNCHER_OBJS= \ AppController.o \ -- cgit v1.2.3 From dfff86ebefb6044183022016da67c7cae691b973 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 4 Jan 2010 22:24:48 +0000 Subject: Include documentation files in package. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1787 --- pkg/osx/GNUmakefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile index 67f0fed8..82c353fe 100644 --- a/pkg/osx/GNUmakefile +++ b/pkg/osx/GNUmakefile @@ -3,6 +3,14 @@ include config.make STAGING_DIR=staging DMG=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).dmg +DOC_FILES=\ + README \ + COPYING \ + ChangeLog \ + NEWS \ + BUGS \ + CMDLINE \ + TODO ifndef GNUSTEP_MAKEFILES @@ -25,7 +33,7 @@ $(STAGING_DIR): launcher cp Info.plist "$(APP_DIR)/Contents/" cp launcher "$(APP_DIR)/Contents/MacOS/" # TODO: copy Doom and setup binaries into app dir - # TODO: copy other documentation into staging dir + for d in $(DOC_FILES); do cp ../../$$d $(STAGING_DIR)/; done find $(STAGING_DIR) -name .svn -delete -exec rm -rf {} \; || true clean : launcher_clean -- cgit v1.2.3 From c401e515b0bbe734fc39517a4d25c96ce487bef4 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 4 Jan 2010 22:45:45 +0000 Subject: Copy binaries into app dir along with libraries. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1788 --- pkg/osx/GNUmakefile | 15 +++++++++++++-- pkg/osx/cp-with-libs | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100755 pkg/osx/cp-with-libs (limited to 'pkg') diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile index 82c353fe..b060f483 100644 --- a/pkg/osx/GNUmakefile +++ b/pkg/osx/GNUmakefile @@ -1,6 +1,9 @@ include config.make +CC=gcc +STRIP=strip + STAGING_DIR=staging DMG=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).dmg DOC_FILES=\ @@ -25,15 +28,23 @@ endif # Staging dir build for package: APP_DIR=$(STAGING_DIR)/$(PACKAGE_NAME).app +APP_BIN_DIR=$(APP_DIR)/Contents/MacOS/ $(STAGING_DIR): launcher rm -rf $(STAGING_DIR) mkdir $(STAGING_DIR) + cp -R app-skeleton "$(APP_DIR)" cp Info.plist "$(APP_DIR)/Contents/" - cp launcher "$(APP_DIR)/Contents/MacOS/" - # TODO: copy Doom and setup binaries into app dir + cp launcher "$(APP_BIN_DIR)/" + + ./cp-with-libs ../../src/chocolate-doom "$(APP_BIN_DIR)" + $(STRIP) "$(APP_BIN_DIR)/chocolate-doom" + ./cp-with-libs ../../setup/chocolate-setup "$(APP_BIN_DIR)" + $(STRIP) "$(APP_BIN_DIR)/chocolate-setup" + for d in $(DOC_FILES); do cp ../../$$d $(STAGING_DIR)/; done + find $(STAGING_DIR) -name .svn -delete -exec rm -rf {} \; || true clean : launcher_clean diff --git a/pkg/osx/cp-with-libs b/pkg/osx/cp-with-libs new file mode 100755 index 00000000..902ae079 --- /dev/null +++ b/pkg/osx/cp-with-libs @@ -0,0 +1,16 @@ +#!/bin/sh +# +# Copy a program to the specified destination, along +# with SDL libraries it depends upon. + +BINARY=$1 +DEST=$2 + +cp "$BINARY" "$DEST" + +# Copy libraries; only those with libSDL in the name + +otool -L "$BINARY" | grep libSDL | sed 's/^.//; s/(.*//' | while read; do + cp "$REPLY" "$DEST" +done + -- cgit v1.2.3 From 37325bbfc1f71111715cf2f4ef2918b6cc5c0ff1 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 4 Jan 2010 22:53:44 +0000 Subject: Fix single space error when listing libraries. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1789 --- pkg/osx/cp-with-libs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/osx/cp-with-libs b/pkg/osx/cp-with-libs index 902ae079..bb4fa001 100755 --- a/pkg/osx/cp-with-libs +++ b/pkg/osx/cp-with-libs @@ -10,7 +10,7 @@ cp "$BINARY" "$DEST" # Copy libraries; only those with libSDL in the name -otool -L "$BINARY" | grep libSDL | sed 's/^.//; s/(.*//' | while read; do +otool -L "$BINARY" | grep libSDL | sed 's/^.//; s/ (.*//' | while read; do cp "$REPLY" "$DEST" done -- cgit v1.2.3 From 860a17497bdc189f78f5a0bca000a0451d5ae624 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 5 Jan 2010 15:52:12 +0000 Subject: Move config.make up to pkg/ directory. Use static makefiles to generate all packages, rather than dynamically generated makefiles. Add pkg/osx to dist. Make OS X staging directory depend on top level documentation files. Generate CMDLINE as part of standard build if it is not already present. Set svn:ignore properties. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1790 --- pkg/.gitignore | 3 +++ pkg/Makefile.am | 28 +++++++++++++++++++++++++++- pkg/config.make.in | 19 +++++++++++++++++++ pkg/osx/.gitignore | 5 +++++ pkg/osx/GNUmakefile | 24 ++++++++++-------------- pkg/osx/config.make.in | 9 --------- pkg/win32/GNUmakefile | 26 ++++++++++++++++++++++++++ pkg/win32/GNUmakefile.am | 35 ----------------------------------- pkg/wince/GNUmakefile | 10 ++++++++++ pkg/wince/GNUmakefile.am | 12 ------------ 10 files changed, 100 insertions(+), 71 deletions(-) create mode 100644 pkg/.gitignore create mode 100644 pkg/config.make.in create mode 100644 pkg/osx/.gitignore delete mode 100644 pkg/osx/config.make.in create mode 100644 pkg/win32/GNUmakefile delete mode 100644 pkg/win32/GNUmakefile.am create mode 100644 pkg/wince/GNUmakefile delete mode 100644 pkg/wince/GNUmakefile.am (limited to 'pkg') diff --git a/pkg/.gitignore b/pkg/.gitignore new file mode 100644 index 00000000..a1dd1cde --- /dev/null +++ b/pkg/.gitignore @@ -0,0 +1,3 @@ +Makefile +Makefile.in +config.make diff --git a/pkg/Makefile.am b/pkg/Makefile.am index 66cb9ba0..9a607ee8 100644 --- a/pkg/Makefile.am +++ b/pkg/Makefile.am @@ -1,3 +1,29 @@ -DIST_SUBDIRS=wince win32 +OSX_FILES= \ +osx/app-skeleton/Contents/PkgInfo \ +osx/app-skeleton/Contents/Resources/128x128.png \ +osx/app-skeleton/Contents/Resources/app.icns \ +osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib \ +osx/app-skeleton/Contents/Resources/launcher.nib/info.nib \ +osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib \ +osx/GNUmakefile \ +osx/Info.plist.in \ +osx/cp-with-libs \ +osx/main.m \ +osx/AppController.m osx/AppController.h \ +osx/Execute.m osx/Execute.h \ +osx/IWADController.m osx/IWADController.h \ +osx/IWADLocation.m osx/IWADLocation.h \ +osx/LauncherManager.m osx/LauncherManager.h + +WINCE_FILES= \ +wince/GNUmakefile \ +wince/wince-cab.cfg \ +wince/wince-cabgen + +WIN32_FILES= \ +win32/GNUmakefile \ +win32/README + +EXTRA_DIST=$(OSX_FILES) $(WINCE_FILES) $(WIN32_FILES) diff --git a/pkg/config.make.in b/pkg/config.make.in new file mode 100644 index 00000000..caedab23 --- /dev/null +++ b/pkg/config.make.in @@ -0,0 +1,19 @@ +# File included by package makefiles that contains details +# about the package name, generated by configure. + +PACKAGE = @PACKAGE@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ + +# Documentation files to distribute with packages. + +DOC_FILES=README \ + COPYING \ + ChangeLog \ + NEWS \ + BUGS \ + CMDLINE \ + TODO + diff --git a/pkg/osx/.gitignore b/pkg/osx/.gitignore new file mode 100644 index 00000000..5b7a16ef --- /dev/null +++ b/pkg/osx/.gitignore @@ -0,0 +1,5 @@ +Info.plist +launcher +*.o +*.d +staging diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile index b060f483..92fc5b0f 100644 --- a/pkg/osx/GNUmakefile +++ b/pkg/osx/GNUmakefile @@ -1,19 +1,14 @@ -include config.make +include ../config.make CC=gcc STRIP=strip STAGING_DIR=staging DMG=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).dmg -DOC_FILES=\ - README \ - COPYING \ - ChangeLog \ - NEWS \ - BUGS \ - CMDLINE \ - TODO + +TOPLEVEL=../.. +TOPLEVEL_DOCS=$(patsubst %,../../%,$(DOC_FILES)) ifndef GNUSTEP_MAKEFILES @@ -30,20 +25,21 @@ endif APP_DIR=$(STAGING_DIR)/$(PACKAGE_NAME).app APP_BIN_DIR=$(APP_DIR)/Contents/MacOS/ -$(STAGING_DIR): launcher +$(STAGING_DIR): launcher $(TOPLEVEL_DOCS) rm -rf $(STAGING_DIR) mkdir $(STAGING_DIR) cp -R app-skeleton "$(APP_DIR)" + mkdir "$(APP_BIN_DIR)" cp Info.plist "$(APP_DIR)/Contents/" cp launcher "$(APP_BIN_DIR)/" - ./cp-with-libs ../../src/chocolate-doom "$(APP_BIN_DIR)" + ./cp-with-libs $(TOPLEVEL)/src/chocolate-doom "$(APP_BIN_DIR)" $(STRIP) "$(APP_BIN_DIR)/chocolate-doom" - ./cp-with-libs ../../setup/chocolate-setup "$(APP_BIN_DIR)" + ./cp-with-libs $(TOPLEVEL)/setup/chocolate-setup "$(APP_BIN_DIR)" $(STRIP) "$(APP_BIN_DIR)/chocolate-setup" - for d in $(DOC_FILES); do cp ../../$$d $(STAGING_DIR)/; done + for d in $(DOC_FILES); do cp $(TOPLEVEL)/$$d $(STAGING_DIR)/; done find $(STAGING_DIR) -name .svn -delete -exec rm -rf {} \; || true @@ -53,7 +49,7 @@ clean : launcher_clean # Launcher build: -CFLAGS = -Wall -I../.. +CFLAGS = -Wall -I$(TOPLEVEL) # Are we building using gs_make? diff --git a/pkg/osx/config.make.in b/pkg/osx/config.make.in deleted file mode 100644 index 67f1c968..00000000 --- a/pkg/osx/config.make.in +++ /dev/null @@ -1,9 +0,0 @@ -# File included by the main makefile that contains details -# about the package name, generated by configure. - -PACKAGE = @PACKAGE@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ - diff --git a/pkg/win32/GNUmakefile b/pkg/win32/GNUmakefile new file mode 100644 index 00000000..93c6abe1 --- /dev/null +++ b/pkg/win32/GNUmakefile @@ -0,0 +1,26 @@ + +include ../config.make + +TOPLEVEL=../.. + +EXE_FILES=$(TOPLEVEL)/src/$(PACKAGE_TARNAME).exe \ + $(TOPLEVEL)/src/chocolate-server.exe \ + $(TOPLEVEL)/setup/chocolate-setup.exe + +DLL_FILES=$(TOPLEVEL)/src/SDL.dll \ + $(TOPLEVEL)/src/SDL_mixer.dll \ + $(TOPLEVEL)/src/SDL_net.dll + +$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-win32.zip : staging + zip -j -r $@ staging/ + +staging: $(EXE_FILES) $(DLL_FILES) $(patsubst %,../../%,$(DOC_FILES)) + rm -rf staging + mkdir staging + cp $(EXE_FILES) $(DLL_FILES) staging/ + $(STRIP) staging/*.exe + for f in $(DOC_FILES); do \ + cp $(TOPLEVEL)/$$f staging/$$f.txt; \ + unix2dos staging/$$f.txt; \ + done + diff --git a/pkg/win32/GNUmakefile.am b/pkg/win32/GNUmakefile.am deleted file mode 100644 index ed86d2cc..00000000 --- a/pkg/win32/GNUmakefile.am +++ /dev/null @@ -1,35 +0,0 @@ - -TOPLEVEL=../.. - -EXE_FILES=$(TOPLEVEL)/src/@PACKAGE_TARNAME@.exe \ - $(TOPLEVEL)/src/chocolate-server.exe \ - $(TOPLEVEL)/setup/chocolate-setup.exe - -DLL_FILES=$(TOPLEVEL)/src/SDL.dll \ - $(TOPLEVEL)/src/SDL_mixer.dll \ - $(TOPLEVEL)/src/SDL_net.dll - -DOC_FILES=README \ - COPYING \ - ChangeLog \ - NEWS \ - BUGS \ - CMDLINE \ - TODO - -EXTRA_DIST=README -noinst_DATA=@PACKAGE_TARNAME@-@PACKAGE_VERSION@-win32.zip - -@PACKAGE_TARNAME@-@PACKAGE_VERSION@-win32.zip : staging - zip -j -r $@ staging/ - -staging: $(EXE_FILES) $(DLL_FILES) $(patsubst %,../../%,$(DOC_FILES)) - rm -rf staging - mkdir staging - cp $(EXE_FILES) $(DLL_FILES) staging/ - $(STRIP) staging/*.exe - for f in $(DOC_FILES); do \ - cp $(TOPLEVEL)/$$f staging/$$f.txt; \ - unix2dos staging/$$f.txt; \ - done - diff --git a/pkg/wince/GNUmakefile b/pkg/wince/GNUmakefile new file mode 100644 index 00000000..073346d7 --- /dev/null +++ b/pkg/wince/GNUmakefile @@ -0,0 +1,10 @@ + +include ../config.make + +DEPS=$(shell ./wince-cabgen -d $(CONFIG_FILE)) +CONFIG_FILE=wince-cab.cfg +OUTPUT_FILE=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).cab + +$(OUTPUT_FILE) : $(CONFIG_FILE) $(DEPS) + ./wince-cabgen $< $@ + diff --git a/pkg/wince/GNUmakefile.am b/pkg/wince/GNUmakefile.am deleted file mode 100644 index e710e679..00000000 --- a/pkg/wince/GNUmakefile.am +++ /dev/null @@ -1,12 +0,0 @@ - -DEPS=$(shell ./wince-cabgen -d $(CONFIG_FILE)) -CONFIG_FILE=wince-cab.cfg -OUTPUT_FILE=@PACKAGE_TARNAME@-@PACKAGE_VERSION@.cab - -EXTRA_DIST=wince-cabgen $(CONFIG_FILE) - -noinst_DATA = $(OUTPUT_FILE) - -$(OUTPUT_FILE) : $(CONFIG_FILE) $(DEPS) - ./wince-cabgen $< $@ - -- cgit v1.2.3 From 6fb7afc47cb78584d19ccb10284dd20243b06540 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 5 Jan 2010 17:20:58 +0000 Subject: Add "clean" target to package makefiles. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1791 --- pkg/win32/GNUmakefile | 8 +++++++- pkg/wince/GNUmakefile | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/win32/GNUmakefile b/pkg/win32/GNUmakefile index 93c6abe1..626f1845 100644 --- a/pkg/win32/GNUmakefile +++ b/pkg/win32/GNUmakefile @@ -11,7 +11,9 @@ DLL_FILES=$(TOPLEVEL)/src/SDL.dll \ $(TOPLEVEL)/src/SDL_mixer.dll \ $(TOPLEVEL)/src/SDL_net.dll -$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-win32.zip : staging +ZIP=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-win32.zip + +$(ZIP) : staging zip -j -r $@ staging/ staging: $(EXE_FILES) $(DLL_FILES) $(patsubst %,../../%,$(DOC_FILES)) @@ -24,3 +26,7 @@ staging: $(EXE_FILES) $(DLL_FILES) $(patsubst %,../../%,$(DOC_FILES)) unix2dos staging/$$f.txt; \ done +clean: + rm -f $(ZIP) + rm -rf staging + diff --git a/pkg/wince/GNUmakefile b/pkg/wince/GNUmakefile index 073346d7..c237922e 100644 --- a/pkg/wince/GNUmakefile +++ b/pkg/wince/GNUmakefile @@ -8,3 +8,6 @@ OUTPUT_FILE=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).cab $(OUTPUT_FILE) : $(CONFIG_FILE) $(DEPS) ./wince-cabgen $< $@ +clean: + rm -f $(OUTPUT_FILE) + -- cgit v1.2.3 From d109ab268f7c7d140bf76d30b4526ef836e070fe Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 9 Jan 2010 18:38:48 +0000 Subject: Hook in AppController as delegate for application, add file associations to property list file. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1792 --- pkg/osx/AppController.m | 1 + pkg/osx/Info.plist.in | 30 +++++++++++++++++++++ .../Contents/Resources/launcher.nib/classes.nib | 6 +++++ .../Contents/Resources/launcher.nib/info.nib | 4 +-- .../Resources/launcher.nib/keyedobjects.nib | Bin 17192 -> 17360 bytes 5 files changed, 39 insertions(+), 2 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/AppController.m b/pkg/osx/AppController.m index 81dc56a9..bf72af63 100644 --- a/pkg/osx/AppController.m +++ b/pkg/osx/AppController.m @@ -76,6 +76,7 @@ - (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName { + printf("File selected to open: '%s'\n", [fileName UTF8String]); return NO; } diff --git a/pkg/osx/Info.plist.in b/pkg/osx/Info.plist.in index a7a33b84..8b19777f 100644 --- a/pkg/osx/Info.plist.in +++ b/pkg/osx/Info.plist.in @@ -26,5 +26,35 @@ NSApplication NSMainNibFile launcher + + + + CFBundleDocumentTypes + + + CFBundleTypeName + Doom WAD file + CFBundleTypeIconFile + app.icns + CFBundleTypeRole + Viewer + CFBundleTypeExtensions + + wad + + + + CFBundleTypeName + Dehacked patch + CFBundleTypeIconFile + app.icns + CFBundleTypeRole + Viewer + CFBundleTypeExtensions + + deh + + + diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib index 9092e44b..3ff47e71 100644 --- a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib +++ b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib @@ -1,5 +1,11 @@ { IBClasses = ( + { + CLASS = AppController; + LANGUAGE = ObjC; + OUTLETS = {launcherManager = id; }; + SUPERCLASS = NSObject; + }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = {closeConfigWindow = id; openConfigWindow = id; }; diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib index 63067b23..aecf812a 100644 --- a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib +++ b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib @@ -3,7 +3,7 @@ IBDocumentLocation - 172 70 612 260 0 0 1440 878 + 170 140 612 260 0 0 1440 878 IBEditorPositions 29 @@ -13,9 +13,9 @@ 446.1 IBOpenObjects + 21 29 227 - 21 IBSystem Version 8S2167 diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib index 85980d2d..345ce976 100644 Binary files a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib and b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib differ -- cgit v1.2.3 From c2f2fa12a68626a3d2a25231d0aa1c6146d555c3 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 9 Jan 2010 18:54:04 +0000 Subject: Initial code to identify file type by extension and add file to command line. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1793 --- pkg/osx/AppController.h | 5 +++-- pkg/osx/AppController.m | 25 ++++++++++++++++++++++--- pkg/osx/LauncherManager.h | 3 +++ pkg/osx/LauncherManager.m | 6 ++++++ 4 files changed, 34 insertions(+), 5 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/AppController.h b/pkg/osx/AppController.h index 80f9a461..6714eb2f 100644 --- a/pkg/osx/AppController.h +++ b/pkg/osx/AppController.h @@ -24,11 +24,12 @@ #define LAUNCHER_APPCONTROLLER_H #include -// Uncomment if your application is Renaissance-based -//#include + +#include "LauncherManager.h" @interface AppController : NSObject { + LauncherManager *launcherManager; } + (void)initialize; diff --git a/pkg/osx/AppController.m b/pkg/osx/AppController.m index bf72af63..03a5965b 100644 --- a/pkg/osx/AppController.m +++ b/pkg/osx/AppController.m @@ -74,10 +74,29 @@ { } -- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName +- (BOOL) application:(NSApplication *) application + openFile:(NSString *) fileName { - printf("File selected to open: '%s'\n", [fileName UTF8String]); - return NO; + NSString *extension; + + extension = [fileName pathExtension]; + + if (![extension caseInsensitiveCompare: @"wad"]) + { + [self->launcherManager addFileToCommandLine: fileName + forArgument: @"-merge"]; + } + else if (![extension caseInsensitiveCompare: @"deh"]) + { + [self->launcherManager addFileToCommandLine: fileName + forArgument: @"-deh"]; + } + else + { + return NO; + } + + return YES; } - (void)showPrefPanel:(id)sender diff --git a/pkg/osx/LauncherManager.h b/pkg/osx/LauncherManager.h index 11852dcf..de95265a 100644 --- a/pkg/osx/LauncherManager.h +++ b/pkg/osx/LauncherManager.h @@ -40,6 +40,9 @@ - (void) launch: (id)sender; - (void) runSetup: (id)sender; - (void) awakeFromNib; +- (void) addFileToCommandLine: (NSString *) fileName + forArgument: (NSString *) args; + @end diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m index cda7b3e7..ff90b987 100644 --- a/pkg/osx/LauncherManager.m +++ b/pkg/osx/LauncherManager.m @@ -61,6 +61,12 @@ } } +- (void) addFileToCommandLine: (NSString *) fileName + forArgument: (NSString *) args +{ + // TODO +} + - (void) launch: (id)sender { NSString *iwad; -- cgit v1.2.3 From 45f543dbe6800827907fd78649d30480a6d0bd31 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 9 Jan 2010 20:42:30 +0000 Subject: Add file to command line when opened; add link from AppController to LauncherManager. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1794 --- pkg/osx/LauncherManager.m | 12 +++++++++++- .../Contents/Resources/launcher.nib/info.nib | 4 ++-- .../Resources/launcher.nib/keyedobjects.nib | Bin 17360 -> 17451 bytes 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m index ff90b987..52ce7f82 100644 --- a/pkg/osx/LauncherManager.m +++ b/pkg/osx/LauncherManager.m @@ -64,7 +64,17 @@ - (void) addFileToCommandLine: (NSString *) fileName forArgument: (NSString *) args { - // TODO + NSString *newCommandLine; +printf("Add file: %s %s\n", [args UTF8String], [fileName UTF8String]); + + newCommandLine = [self->commandLineArguments stringValue]; + newCommandLine = [newCommandLine stringByAppendingString: @" "]; + newCommandLine = [newCommandLine stringByAppendingString: args]; + newCommandLine = [newCommandLine stringByAppendingString: @" \""]; + newCommandLine = [newCommandLine stringByAppendingString: fileName]; + newCommandLine = [newCommandLine stringByAppendingString: @"\""]; + + [self->commandLineArguments setStringValue: newCommandLine]; } - (void) launch: (id)sender diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib index aecf812a..21e3bb1d 100644 --- a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib +++ b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib @@ -13,9 +13,9 @@ 446.1 IBOpenObjects - 21 - 29 227 + 29 + 21 IBSystem Version 8S2167 diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib index 345ce976..680eaff7 100644 Binary files a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib and b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib differ -- cgit v1.2.3 From a4f038a36435b5d4dd726c2f9e3f6a34e0269ec6 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 9 Jan 2010 21:06:31 +0000 Subject: Clear existing arguments when adding a file. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1795 --- pkg/osx/LauncherManager.m | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m index 52ce7f82..bef0520e 100644 --- a/pkg/osx/LauncherManager.m +++ b/pkg/osx/LauncherManager.m @@ -62,15 +62,11 @@ } - (void) addFileToCommandLine: (NSString *) fileName - forArgument: (NSString *) args + forArgument: (NSString *) arg { NSString *newCommandLine; -printf("Add file: %s %s\n", [args UTF8String], [fileName UTF8String]); - newCommandLine = [self->commandLineArguments stringValue]; - newCommandLine = [newCommandLine stringByAppendingString: @" "]; - newCommandLine = [newCommandLine stringByAppendingString: args]; - newCommandLine = [newCommandLine stringByAppendingString: @" \""]; + newCommandLine = [arg stringByAppendingString: @" \""]; newCommandLine = [newCommandLine stringByAppendingString: fileName]; newCommandLine = [newCommandLine stringByAppendingString: @"\""]; -- cgit v1.2.3 From da950e23214018c7dc80dff0cb5566ad46bf30cf Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 10 Jan 2010 18:42:35 +0000 Subject: Recursively copy library dependencies into destination package. Identify libraries to be installed based on the path in which they are located, rather than whether there is "libSDL" in the name. Use install_name_tool to change the search path so that the system looks for libraries in @executable_path@ rather than their location on the machine upon which the program was built. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1796 --- pkg/osx/cp-with-libs | 102 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 93 insertions(+), 9 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/cp-with-libs b/pkg/osx/cp-with-libs index bb4fa001..18274172 100755 --- a/pkg/osx/cp-with-libs +++ b/pkg/osx/cp-with-libs @@ -1,16 +1,100 @@ -#!/bin/sh +#!/bin/bash # # Copy a program to the specified destination, along -# with SDL libraries it depends upon. +# with libraries it depends upon. -BINARY=$1 -DEST=$2 +src_bin=$1 +dest_dir=$2 -cp "$BINARY" "$DEST" +# Returns true if the specified file is a dylib. -# Copy libraries; only those with libSDL in the name +is_dylib() { + case "$1" in + *.dylib) + true + ;; + *) + false + ;; + esac +} -otool -L "$BINARY" | grep libSDL | sed 's/^.//; s/ (.*//' | while read; do - cp "$REPLY" "$DEST" -done +# Returns true if the specified file is in a system location +# (/System or /usr): + +is_sys_lib() { + case "$1" in + /System/*) + true + ;; + /usr/*) + true + ;; + *) + false + ;; + esac +} + +# Install the specified file to the location in dest_dir, along with +# any libraries it depends upon (recursively): + +install_with_deps() { + local src_file + local bin_name + local dest_file + local lib_name + + src_file=$1 + bin_name=$(basename "$src_file") + dest_file="$dest_dir/$bin_name" + + # Already copied into the package? Don't copy again. + # Prevents endless recursion. + + if [ -e "$dest_file" ]; then + return + fi + + echo "Installing $bin_name..." + + # Copy file into package. + + cp "$src_file" "$dest_file" + + # Copy libraries that this file depends on: + + otool -L "$src_file" | tail -n +2 | sed 's/^.//; s/ (.*//' | while read; do + + # Don't copy system libraries + + if is_sys_lib "$REPLY"; then + continue + fi + + #echo " - $bin_name depends on $REPLY" + + # Copy this library into the package, and: + # recursively install any libraries that _this_ library depends on: + + install_with_deps "$REPLY" + + # Change destination binary to depend on the + # copy inside the package: + + lib_name=$(basename "$REPLY") + install_name_tool -change "$REPLY" "@executable_path@/$lib_name" \ + "$dest_file" + done + + # If this is a library that we have installed, change its id: + + if is_dylib "$dest_file"; then + install_name_tool -id "@executable_path@/$bin_name" "$dest_file" + fi +} + +# Install the file, and recursively install any libraries: + +install_with_deps "$src_bin" -- cgit v1.2.3 From 7b07b99fa23b112986a6eb54fbec218f7069ef71 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 10 Jan 2010 18:48:21 +0000 Subject: Install docs with a single cp, rather than using a for loop. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1797 --- pkg/osx/GNUmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile index 92fc5b0f..3cab6bf7 100644 --- a/pkg/osx/GNUmakefile +++ b/pkg/osx/GNUmakefile @@ -39,7 +39,7 @@ $(STAGING_DIR): launcher $(TOPLEVEL_DOCS) ./cp-with-libs $(TOPLEVEL)/setup/chocolate-setup "$(APP_BIN_DIR)" $(STRIP) "$(APP_BIN_DIR)/chocolate-setup" - for d in $(DOC_FILES); do cp $(TOPLEVEL)/$$d $(STAGING_DIR)/; done + cp $(TOPLEVEL_DOCS) "$(STAGING_DIR)" find $(STAGING_DIR) -name .svn -delete -exec rm -rf {} \; || true -- cgit v1.2.3 From 213b88ef3557f680233c6165b5dc6f2185c0f482 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 10 Jan 2010 20:46:15 +0000 Subject: Change "@executable_path@" to "@executable_path" Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1799 --- pkg/osx/cp-with-libs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/cp-with-libs b/pkg/osx/cp-with-libs index 18274172..04fb5bc6 100755 --- a/pkg/osx/cp-with-libs +++ b/pkg/osx/cp-with-libs @@ -83,14 +83,14 @@ install_with_deps() { # copy inside the package: lib_name=$(basename "$REPLY") - install_name_tool -change "$REPLY" "@executable_path@/$lib_name" \ + install_name_tool -change "$REPLY" "@executable_path/$lib_name" \ "$dest_file" done # If this is a library that we have installed, change its id: if is_dylib "$dest_file"; then - install_name_tool -id "@executable_path@/$bin_name" "$dest_file" + install_name_tool -id "@executable_path/$bin_name" "$dest_file" fi } -- cgit v1.2.3 From 550b95f79cf8022acc5b335f6ef948b32cd2c615 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 11 Jan 2010 01:35:04 +0000 Subject: When launching a file from the finder, add the new file into the command line at the appropriate position in the command line string. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1802 --- pkg/osx/LauncherManager.m | 178 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 173 insertions(+), 5 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m index bef0520e..a67e5cc9 100644 --- a/pkg/osx/LauncherManager.m +++ b/pkg/osx/LauncherManager.m @@ -61,16 +61,184 @@ } } +// Get the next command line argument from the command line. +// The position counter used to iterate over arguments is in 'pos'. +// The index of the argument that was found is saved in arg_pos. + +static NSString *GetNextArgument(NSString *commandLine, int *pos, int *arg_pos) +{ + NSRange arg_range; + + // Skip past any whitespace + + while (*pos < [commandLine length] + && isspace([commandLine characterAtIndex: *pos])) + { + ++*pos; + } + + if (*pos >= [commandLine length]) + { + return nil; + } + + // We are at the start of the argument. This may be a quoted + // string argument, or a "normal" one. + + if ([commandLine characterAtIndex: *pos] == '\"') + { + // Quoted string, skip past first quote + + ++*pos; + + // Save start position: + + *arg_pos = *pos; + + while (*pos < [commandLine length] + && [commandLine characterAtIndex: *pos] != '\"') + { + ++*pos; + } + + // Unexpected end of string? + + if (*pos >= [commandLine length]) + { + return nil; + } + + arg_range = NSMakeRange(*arg_pos, *pos - *arg_pos); + + // Skip past last quote + + ++*pos; + } + else + { + // Normal argument + + // Save position: + + *arg_pos = *pos; + + // Read until end: + + while (*pos < [commandLine length] + && !isspace([commandLine characterAtIndex: *pos])) + { + ++*pos; + } + + arg_range = NSMakeRange(*arg_pos, *pos - *arg_pos); + } + + return [commandLine substringWithRange: arg_range]; +} + +// Given the specified command line argument, find the index +// to insert the new file within the command line. Returns -1 if the +// argument is not already within the arguments string. + +static int GetFileInsertIndex(NSString *commandLine, NSString *needle) +{ + NSString *arg; + int arg_pos; + int pos; + + pos = 0; + + // Find the command line parameter we are searching + // for (-merge, -deh, etc) + + for (;;) + { + arg = GetNextArgument(commandLine, &pos, &arg_pos); + + // Searched to end of string and never found? + + if (arg == nil) + { + return -1; + } + + if (![arg caseInsensitiveCompare: needle]) + { + break; + } + } + + // Now skip over existing files. For example, if we + // have -file foo.wad bar.wad, the new file should be appended + // to the end of the list. + + for (;;) + { + arg = GetNextArgument(commandLine, &pos, &arg_pos); + + // If we search to the end of the string now, it is fine; + // the new string should be added to the end of the command + // line. Otherwise, if we find an argument that begins + // with '-', it is a new command line parameter and the end + // of the list. + + if (arg == nil || [arg characterAtIndex: 0] == '-') + { + break; + } + } + + // arg_pos should now contain the offset to insert the new filename. + + return arg_pos; +} + - (void) addFileToCommandLine: (NSString *) fileName forArgument: (NSString *) arg { - NSString *newCommandLine; + NSString *commandLine; + int insert_pos; + + // Get the current command line + + commandLine = [self->commandLineArguments stringValue]; + + // Find the location to insert the new filename: + + insert_pos = GetFileInsertIndex(commandLine, arg); + + // If position < 0, we should add the new argument and filename + // to the end. Otherwise, append the new filename to the existing + // list of files. + + if (insert_pos < 0) + { + commandLine = [commandLine stringByAppendingString: @" "]; + commandLine = [commandLine stringByAppendingString: arg]; + + commandLine = [commandLine stringByAppendingString: @" \""]; + commandLine = [commandLine stringByAppendingString: fileName]; + commandLine = [commandLine stringByAppendingString: @"\""]; + } + else + { + NSString *start; + NSString *end; - newCommandLine = [arg stringByAppendingString: @" \""]; - newCommandLine = [newCommandLine stringByAppendingString: fileName]; - newCommandLine = [newCommandLine stringByAppendingString: @"\""]; + // Divide existing command line in half: + + start = [commandLine substringToIndex: insert_pos]; + end = [commandLine substringFromIndex: insert_pos]; + + // Construct new command line: + + commandLine = [start stringByAppendingString: @" \""]; + commandLine = [commandLine stringByAppendingString: fileName]; + commandLine = [commandLine stringByAppendingString: @"\" "]; + commandLine = [commandLine stringByAppendingString: end]; + } - [self->commandLineArguments setStringValue: newCommandLine]; + [self->commandLineArguments setStringValue: commandLine]; } - (void) launch: (id)sender -- cgit v1.2.3 From 160ff32f2fb8ba7112938790044684c61a0b07b1 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 11 Jan 2010 19:10:42 +0000 Subject: Insert new files into the command line at the correct location, allowing multiple files to be opened at once. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1803 --- pkg/osx/AppController.h | 1 + pkg/osx/AppController.m | 15 +++++++++++++++ pkg/osx/LauncherManager.h | 1 + pkg/osx/LauncherManager.m | 47 ++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 57 insertions(+), 7 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/AppController.h b/pkg/osx/AppController.h index 6714eb2f..88b59043 100644 --- a/pkg/osx/AppController.h +++ b/pkg/osx/AppController.h @@ -30,6 +30,7 @@ @interface AppController : NSObject { LauncherManager *launcherManager; + BOOL filesAdded; } + (void)initialize; diff --git a/pkg/osx/AppController.m b/pkg/osx/AppController.m index 03a5965b..32afd9c4 100644 --- a/pkg/osx/AppController.m +++ b/pkg/osx/AppController.m @@ -46,6 +46,8 @@ { } + self->filesAdded = NO; + return self; } @@ -79,6 +81,17 @@ { NSString *extension; + // If this is the first file added, clear out the existing + // command line. This allows us to select multiple files + // in the finder and open them all together (for TCs, etc). + + if (!self->filesAdded) + { + [self->launcherManager clearCommandLine]; + } + + // Add file with appropriate command line option based on extension: + extension = [fileName pathExtension]; if (![extension caseInsensitiveCompare: @"wad"]) @@ -96,6 +109,8 @@ return NO; } + self->filesAdded = YES; + return YES; } diff --git a/pkg/osx/LauncherManager.h b/pkg/osx/LauncherManager.h index de95265a..eac4cfba 100644 --- a/pkg/osx/LauncherManager.h +++ b/pkg/osx/LauncherManager.h @@ -40,6 +40,7 @@ - (void) launch: (id)sender; - (void) runSetup: (id)sender; - (void) awakeFromNib; +- (void) clearCommandLine; - (void) addFileToCommandLine: (NSString *) fileName forArgument: (NSString *) args; diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m index a67e5cc9..0cde9f6e 100644 --- a/pkg/osx/LauncherManager.m +++ b/pkg/osx/LauncherManager.m @@ -79,6 +79,7 @@ static NSString *GetNextArgument(NSString *commandLine, int *pos, int *arg_pos) if (*pos >= [commandLine length]) { + *arg_pos = *pos; return nil; } @@ -193,6 +194,42 @@ static int GetFileInsertIndex(NSString *commandLine, NSString *needle) return arg_pos; } +// Given the specified string, append a filename, quoted if necessary. + +static NSString *AppendQuotedFilename(NSString *str, NSString *fileName) +{ + int i; + + // Search the filename for spaces, and quote if necessary. + + for (i=0; i<[fileName length]; ++i) + { + if (isspace([fileName characterAtIndex: i])) + { + str = [str stringByAppendingString: @" \""]; + str = [str stringByAppendingString: fileName]; + str = [str stringByAppendingString: @"\" "]; + + return str; + } + } + + str = [str stringByAppendingString: @" "]; + str = [str stringByAppendingString: fileName]; + + return str; +} + +// Clear out the existing command line options. +// Invoked before the first file is added. + +- (void) clearCommandLine +{ + [self->commandLineArguments setStringValue: @""]; +} + +// Add a file to the command line to load with the game. + - (void) addFileToCommandLine: (NSString *) fileName forArgument: (NSString *) arg { @@ -215,10 +252,7 @@ static int GetFileInsertIndex(NSString *commandLine, NSString *needle) { commandLine = [commandLine stringByAppendingString: @" "]; commandLine = [commandLine stringByAppendingString: arg]; - - commandLine = [commandLine stringByAppendingString: @" \""]; - commandLine = [commandLine stringByAppendingString: fileName]; - commandLine = [commandLine stringByAppendingString: @"\""]; + commandLine = AppendQuotedFilename(commandLine, fileName); } else { @@ -232,9 +266,8 @@ static int GetFileInsertIndex(NSString *commandLine, NSString *needle) // Construct new command line: - commandLine = [start stringByAppendingString: @" \""]; - commandLine = [commandLine stringByAppendingString: fileName]; - commandLine = [commandLine stringByAppendingString: @"\" "]; + commandLine = AppendQuotedFilename(start, fileName); + commandLine = [commandLine stringByAppendingString: @" "]; commandLine = [commandLine stringByAppendingString: end]; } -- cgit v1.2.3 From 96fc229a12f020a3c51cca8ea1c88887200a2621 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 12 Jan 2010 01:20:48 +0000 Subject: Add document icon file and use for file associations. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1804 --- pkg/Makefile.am | 1 + pkg/osx/Info.plist.in | 4 ++-- pkg/osx/app-skeleton/Contents/Resources/wadfile.icns | Bin 0 -> 44092 bytes 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 pkg/osx/app-skeleton/Contents/Resources/wadfile.icns (limited to 'pkg') diff --git a/pkg/Makefile.am b/pkg/Makefile.am index 9a607ee8..b898e728 100644 --- a/pkg/Makefile.am +++ b/pkg/Makefile.am @@ -3,6 +3,7 @@ OSX_FILES= \ osx/app-skeleton/Contents/PkgInfo \ osx/app-skeleton/Contents/Resources/128x128.png \ osx/app-skeleton/Contents/Resources/app.icns \ +osx/app-skeleton/Contents/Resources/wadfile.icns \ osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib \ osx/app-skeleton/Contents/Resources/launcher.nib/info.nib \ osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib \ diff --git a/pkg/osx/Info.plist.in b/pkg/osx/Info.plist.in index 8b19777f..8b8436f7 100644 --- a/pkg/osx/Info.plist.in +++ b/pkg/osx/Info.plist.in @@ -35,7 +35,7 @@ CFBundleTypeName Doom WAD file CFBundleTypeIconFile - app.icns + wadfile.icns CFBundleTypeRole Viewer CFBundleTypeExtensions @@ -47,7 +47,7 @@ CFBundleTypeName Dehacked patch CFBundleTypeIconFile - app.icns + wadfile.icns CFBundleTypeRole Viewer CFBundleTypeExtensions diff --git a/pkg/osx/app-skeleton/Contents/Resources/wadfile.icns b/pkg/osx/app-skeleton/Contents/Resources/wadfile.icns new file mode 100644 index 00000000..13502a55 Binary files /dev/null and b/pkg/osx/app-skeleton/Contents/Resources/wadfile.icns differ -- cgit v1.2.3 From a33a26c2c46282d2afdfe543d88bd2ba4373319e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 12 Jan 2010 01:32:24 +0000 Subject: Add missing connection for plutonia.wad set button. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1805 --- .../Contents/Resources/launcher.nib/info.nib | 4 ++-- .../Resources/launcher.nib/keyedobjects.nib | Bin 17451 -> 17541 bytes 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib index 21e3bb1d..aecf812a 100644 --- a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib +++ b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib @@ -13,9 +13,9 @@ 446.1 IBOpenObjects - 227 - 29 21 + 29 + 227 IBSystem Version 8S2167 diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib index 680eaff7..12cf6aa5 100644 Binary files a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib and b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib differ -- cgit v1.2.3 From d1b0870951eaba66da1e11716898b65cbc96302a Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 12 Jan 2010 20:09:54 +0000 Subject: Set main menu title based on package name, not fixed string. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1807 --- pkg/osx/AppController.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/osx/AppController.m b/pkg/osx/AppController.m index 32afd9c4..a26a7c9e 100644 --- a/pkg/osx/AppController.m +++ b/pkg/osx/AppController.m @@ -22,6 +22,8 @@ #include "AppController.h" +#include "config.h" + @implementation AppController + (void)initialize @@ -58,7 +60,7 @@ - (void)awakeFromNib { - [[NSApp mainMenu] setTitle:@"ChocolateDoom"]; + [[NSApp mainMenu] setTitle:@PACKAGE_NAME]; } - (void)applicationDidFinishLaunching:(NSNotification *)aNotif -- cgit v1.2.3 From 869447ff69c4832dfe0a14c382f67d5dea867def Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 12 Jan 2010 20:12:56 +0000 Subject: Move Makefile definitions for CC and STRIP into config.make, use versions from autoconf. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1808 --- pkg/config.make.in | 27 ++++++++++++++++++--------- pkg/osx/GNUmakefile | 9 ++++----- 2 files changed, 22 insertions(+), 14 deletions(-) (limited to 'pkg') diff --git a/pkg/config.make.in b/pkg/config.make.in index caedab23..d8d72c60 100644 --- a/pkg/config.make.in +++ b/pkg/config.make.in @@ -1,5 +1,14 @@ -# File included by package makefiles that contains details -# about the package name, generated by configure. +# Shared file included by the makefiles used to build packages. +# This contains various information needed by the makefiles, +# and is autogenerated by configure to include various +# necessary details. + +# Tools needed: + +CC = @CC@ +STRIP = @STRIP@ + +# Package name and version number: PACKAGE = @PACKAGE@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -9,11 +18,11 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ # Documentation files to distribute with packages. -DOC_FILES=README \ - COPYING \ - ChangeLog \ - NEWS \ - BUGS \ - CMDLINE \ - TODO +DOC_FILES = README \ + COPYING \ + ChangeLog \ + NEWS \ + BUGS \ + CMDLINE \ + TODO diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile index 3cab6bf7..de2c535a 100644 --- a/pkg/osx/GNUmakefile +++ b/pkg/osx/GNUmakefile @@ -1,9 +1,6 @@ include ../config.make -CC=gcc -STRIP=strip - STAGING_DIR=staging DMG=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).dmg @@ -32,10 +29,12 @@ $(STAGING_DIR): launcher $(TOPLEVEL_DOCS) cp -R app-skeleton "$(APP_DIR)" mkdir "$(APP_BIN_DIR)" cp Info.plist "$(APP_DIR)/Contents/" + cp launcher "$(APP_BIN_DIR)/" + $(STRIP) "$(APP_BIN_DIR)/launcher" - ./cp-with-libs $(TOPLEVEL)/src/chocolate-doom "$(APP_BIN_DIR)" - $(STRIP) "$(APP_BIN_DIR)/chocolate-doom" + ./cp-with-libs $(TOPLEVEL)/src/$(PACKAGE_TARNAME) "$(APP_BIN_DIR)" + $(STRIP) "$(APP_BIN_DIR)/$(PACKAGE_TARNAME)" ./cp-with-libs $(TOPLEVEL)/setup/chocolate-setup "$(APP_BIN_DIR)" $(STRIP) "$(APP_BIN_DIR)/chocolate-setup" -- cgit v1.2.3 From b6810a29407df69f57cc3fb00922347fbaeb8550 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 12 Jan 2010 20:15:34 +0000 Subject: Strip executables when building Windows CE packages. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1810 --- pkg/wince/GNUmakefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pkg') diff --git a/pkg/wince/GNUmakefile b/pkg/wince/GNUmakefile index c237922e..b6acc3b8 100644 --- a/pkg/wince/GNUmakefile +++ b/pkg/wince/GNUmakefile @@ -2,10 +2,12 @@ include ../config.make DEPS=$(shell ./wince-cabgen -d $(CONFIG_FILE)) +EXECUTABLES=$(filter %.exe, $(DEPS)) CONFIG_FILE=wince-cab.cfg OUTPUT_FILE=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).cab $(OUTPUT_FILE) : $(CONFIG_FILE) $(DEPS) + $(STRIP) $(EXECUTABLES) ./wince-cabgen $< $@ clean: -- cgit v1.2.3 From f176ac404ad709e6c1254f8685f8d9fe7b995115 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 15 Jan 2010 18:13:05 +0000 Subject: Extend osx makefile to allow building of a working GNUstep application, for testing purposes. Add GNUstep version of Info.plist, remove app-skeleton directory and move contents up. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1813 --- pkg/Makefile.am | 17 ++++---- pkg/osx/GNUmakefile | 37 +++++++++++++---- pkg/osx/Info-GNUstep.plist.in | 31 ++++++++++++++ pkg/osx/PkgInfo | 1 + pkg/osx/Resources/128x128.png | Bin 0 -> 23029 bytes pkg/osx/Resources/app.icns | Bin 0 -> 51625 bytes pkg/osx/Resources/app.png | Bin 0 -> 4597 bytes pkg/osx/Resources/launcher.nib/classes.nib | 46 +++++++++++++++++++++ pkg/osx/Resources/launcher.nib/info.nib | 23 +++++++++++ pkg/osx/Resources/launcher.nib/keyedobjects.nib | Bin 0 -> 17541 bytes pkg/osx/Resources/wadfile.icns | Bin 0 -> 44092 bytes pkg/osx/app-skeleton/Contents/PkgInfo | 1 - .../app-skeleton/Contents/Resources/128x128.png | Bin 23029 -> 0 bytes pkg/osx/app-skeleton/Contents/Resources/app.icns | Bin 51625 -> 0 bytes .../Contents/Resources/launcher.nib/classes.nib | 46 --------------------- .../Contents/Resources/launcher.nib/info.nib | 23 ----------- .../Resources/launcher.nib/keyedobjects.nib | Bin 17541 -> 0 bytes .../app-skeleton/Contents/Resources/wadfile.icns | Bin 44092 -> 0 bytes 18 files changed, 140 insertions(+), 85 deletions(-) create mode 100644 pkg/osx/Info-GNUstep.plist.in create mode 100644 pkg/osx/PkgInfo create mode 100644 pkg/osx/Resources/128x128.png create mode 100644 pkg/osx/Resources/app.icns create mode 100644 pkg/osx/Resources/app.png create mode 100644 pkg/osx/Resources/launcher.nib/classes.nib create mode 100644 pkg/osx/Resources/launcher.nib/info.nib create mode 100644 pkg/osx/Resources/launcher.nib/keyedobjects.nib create mode 100644 pkg/osx/Resources/wadfile.icns delete mode 100644 pkg/osx/app-skeleton/Contents/PkgInfo delete mode 100644 pkg/osx/app-skeleton/Contents/Resources/128x128.png delete mode 100644 pkg/osx/app-skeleton/Contents/Resources/app.icns delete mode 100644 pkg/osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib delete mode 100644 pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib delete mode 100644 pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib delete mode 100644 pkg/osx/app-skeleton/Contents/Resources/wadfile.icns (limited to 'pkg') diff --git a/pkg/Makefile.am b/pkg/Makefile.am index b898e728..6a3b38ff 100644 --- a/pkg/Makefile.am +++ b/pkg/Makefile.am @@ -1,14 +1,15 @@ OSX_FILES= \ -osx/app-skeleton/Contents/PkgInfo \ -osx/app-skeleton/Contents/Resources/128x128.png \ -osx/app-skeleton/Contents/Resources/app.icns \ -osx/app-skeleton/Contents/Resources/wadfile.icns \ -osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib \ -osx/app-skeleton/Contents/Resources/launcher.nib/info.nib \ -osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib \ +osx/Resources/128x128.png \ +osx/Resources/app.icns \ +osx/Resources/app.png \ +osx/Resources/wadfile.icns \ +osx/Resources/launcher.nib/classes.nib \ +osx/Resources/launcher.nib/info.nib \ +osx/Resources/launcher.nib/keyedobjects.nib \ osx/GNUmakefile \ -osx/Info.plist.in \ +osx/Info.plist.in osx/Info-GNUstep.plist.in \ +osx/PkgInfo \ osx/cp-with-libs \ osx/main.m \ osx/AppController.m osx/AppController.h \ diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile index de2c535a..d1894bef 100644 --- a/pkg/osx/GNUmakefile +++ b/pkg/osx/GNUmakefile @@ -1,4 +1,9 @@ +# Makefile for building the OS X launcher program and DMG package. +# It is also possible to build and run the launcher under Unix +# systems using GNUstep, although this is only here for development +# and debugging purposes. + include ../config.make STAGING_DIR=staging @@ -20,17 +25,37 @@ endif # Staging dir build for package: APP_DIR=$(STAGING_DIR)/$(PACKAGE_NAME).app -APP_BIN_DIR=$(APP_DIR)/Contents/MacOS/ + +# OS X and GNUstep apps have a slightly different internal structure: +# OS X apps have their files within a containing "Contents" directory +# that does not exist in GNUstep apps. Similarly, the binaries are +# installed at the top level, rather than in a "MacOS" directory. +# Finally, we must install a different Info.plist file. + +ifdef GNUSTEP_MAKEFILES +APP_TOP_DIR=$(APP_DIR) +APP_BIN_DIR=$(APP_DIR) +SRC_INFO_PLIST=Info-GNUstep.plist +else +APP_TOP_DIR=$(APP_DIR)/Contents +APP_BIN_DIR=$(APP_DIR)/Contents/MacOS +SRC_INFO_PLIST=Info.plist +endif $(STAGING_DIR): launcher $(TOPLEVEL_DOCS) rm -rf $(STAGING_DIR) mkdir $(STAGING_DIR) - cp -R app-skeleton "$(APP_DIR)" - mkdir "$(APP_BIN_DIR)" - cp Info.plist "$(APP_DIR)/Contents/" + cp $(TOPLEVEL_DOCS) "$(STAGING_DIR)" + + mkdir -p "$(APP_TOP_DIR)" + cp -R Resources "$(APP_TOP_DIR)" + cp PkgInfo "$(APP_TOP_DIR)" + cp $(SRC_INFO_PLIST) "$(APP_TOP_DIR)/Info.plist" + + mkdir -p "$(APP_BIN_DIR)" - cp launcher "$(APP_BIN_DIR)/" + cp launcher "$(APP_BIN_DIR)" $(STRIP) "$(APP_BIN_DIR)/launcher" ./cp-with-libs $(TOPLEVEL)/src/$(PACKAGE_TARNAME) "$(APP_BIN_DIR)" @@ -38,8 +63,6 @@ $(STAGING_DIR): launcher $(TOPLEVEL_DOCS) ./cp-with-libs $(TOPLEVEL)/setup/chocolate-setup "$(APP_BIN_DIR)" $(STRIP) "$(APP_BIN_DIR)/chocolate-setup" - cp $(TOPLEVEL_DOCS) "$(STAGING_DIR)" - find $(STAGING_DIR) -name .svn -delete -exec rm -rf {} \; || true clean : launcher_clean diff --git a/pkg/osx/Info-GNUstep.plist.in b/pkg/osx/Info-GNUstep.plist.in new file mode 100644 index 00000000..ac6511e2 --- /dev/null +++ b/pkg/osx/Info-GNUstep.plist.in @@ -0,0 +1,31 @@ +{ + ApplicationDescription = "@PACKAGE_NAME@"; + ApplicationIcon = app.png; + ApplicationName = "@PACKAGE_NAME@"; + ApplicationRelease = @PACKAGE_VERSION@; + Copyright = "Copyright (C) 2009-2010"; + CopyrightDescription = "GNU General Public License, version 2"; + FullVersionID = @PACKAGE_VERSION@; + GSMainMarkupFile = ""; + NSExecutable = "launcher"; + NSIcon = app.png; + NSMainNibFile = launcher.nib; + NSPrincipalClass = NSApplication; + NSRole = Application; + NSTypes = ( + { + NSHumanReadableName = "Doom WAD file"; + NSUnixExtensions = ( wad ); + NSRole = Viewer; + NSMimeTypes = ( + "application/x-doom" + ); + }, + { + NSHumanReadableName = "Dehacked patch"; + NSUnixExtensions = ( deh ); + NSRole = Viewer; + NSIcon = "wadfile.png"; + } + ); +} diff --git a/pkg/osx/PkgInfo b/pkg/osx/PkgInfo new file mode 100644 index 00000000..6f749b0f --- /dev/null +++ b/pkg/osx/PkgInfo @@ -0,0 +1 @@ +APPL???? diff --git a/pkg/osx/Resources/128x128.png b/pkg/osx/Resources/128x128.png new file mode 100644 index 00000000..0ef1fe9c Binary files /dev/null and b/pkg/osx/Resources/128x128.png differ diff --git a/pkg/osx/Resources/app.icns b/pkg/osx/Resources/app.icns new file mode 100644 index 00000000..9b535a25 Binary files /dev/null and b/pkg/osx/Resources/app.icns differ diff --git a/pkg/osx/Resources/app.png b/pkg/osx/Resources/app.png new file mode 100644 index 00000000..5b932e8c Binary files /dev/null and b/pkg/osx/Resources/app.png differ diff --git a/pkg/osx/Resources/launcher.nib/classes.nib b/pkg/osx/Resources/launcher.nib/classes.nib new file mode 100644 index 00000000..3ff47e71 --- /dev/null +++ b/pkg/osx/Resources/launcher.nib/classes.nib @@ -0,0 +1,46 @@ +{ + IBClasses = ( + { + CLASS = AppController; + LANGUAGE = ObjC; + OUTLETS = {launcherManager = id; }; + SUPERCLASS = NSObject; + }, + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {closeConfigWindow = id; openConfigWindow = id; }; + CLASS = IWADController; + LANGUAGE = ObjC; + OUTLETS = { + chex = id; + configWindow = id; + doom1 = id; + doom2 = id; + iwadSelector = id; + plutonia = id; + tnt = id; + }; + SUPERCLASS = NSObject; + }, + { + ACTIONS = {setButtonClicked = id; }; + CLASS = IWADLocation; + LANGUAGE = ObjC; + OUTLETS = {locationConfigBox = id; }; + SUPERCLASS = NSObject; + }, + { + ACTIONS = {launch = id; runSetup = id; }; + CLASS = LauncherManager; + LANGUAGE = ObjC; + OUTLETS = { + commandLineArguments = id; + iwadController = id; + launcherWindow = id; + packageLabel = id; + }; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/pkg/osx/Resources/launcher.nib/info.nib b/pkg/osx/Resources/launcher.nib/info.nib new file mode 100644 index 00000000..aecf812a --- /dev/null +++ b/pkg/osx/Resources/launcher.nib/info.nib @@ -0,0 +1,23 @@ + + + + + IBDocumentLocation + 170 140 612 260 0 0 1440 878 + IBEditorPositions + + 29 + 108 337 163 44 0 0 1440 878 + + IBFramework Version + 446.1 + IBOpenObjects + + 21 + 29 + 227 + + IBSystem Version + 8S2167 + + diff --git a/pkg/osx/Resources/launcher.nib/keyedobjects.nib b/pkg/osx/Resources/launcher.nib/keyedobjects.nib new file mode 100644 index 00000000..12cf6aa5 Binary files /dev/null and b/pkg/osx/Resources/launcher.nib/keyedobjects.nib differ diff --git a/pkg/osx/Resources/wadfile.icns b/pkg/osx/Resources/wadfile.icns new file mode 100644 index 00000000..13502a55 Binary files /dev/null and b/pkg/osx/Resources/wadfile.icns differ diff --git a/pkg/osx/app-skeleton/Contents/PkgInfo b/pkg/osx/app-skeleton/Contents/PkgInfo deleted file mode 100644 index 6f749b0f..00000000 --- a/pkg/osx/app-skeleton/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPL???? diff --git a/pkg/osx/app-skeleton/Contents/Resources/128x128.png b/pkg/osx/app-skeleton/Contents/Resources/128x128.png deleted file mode 100644 index 0ef1fe9c..00000000 Binary files a/pkg/osx/app-skeleton/Contents/Resources/128x128.png and /dev/null differ diff --git a/pkg/osx/app-skeleton/Contents/Resources/app.icns b/pkg/osx/app-skeleton/Contents/Resources/app.icns deleted file mode 100644 index 9b535a25..00000000 Binary files a/pkg/osx/app-skeleton/Contents/Resources/app.icns and /dev/null differ diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib deleted file mode 100644 index 3ff47e71..00000000 --- a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/classes.nib +++ /dev/null @@ -1,46 +0,0 @@ -{ - IBClasses = ( - { - CLASS = AppController; - LANGUAGE = ObjC; - OUTLETS = {launcherManager = id; }; - SUPERCLASS = NSObject; - }, - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - { - ACTIONS = {closeConfigWindow = id; openConfigWindow = id; }; - CLASS = IWADController; - LANGUAGE = ObjC; - OUTLETS = { - chex = id; - configWindow = id; - doom1 = id; - doom2 = id; - iwadSelector = id; - plutonia = id; - tnt = id; - }; - SUPERCLASS = NSObject; - }, - { - ACTIONS = {setButtonClicked = id; }; - CLASS = IWADLocation; - LANGUAGE = ObjC; - OUTLETS = {locationConfigBox = id; }; - SUPERCLASS = NSObject; - }, - { - ACTIONS = {launch = id; runSetup = id; }; - CLASS = LauncherManager; - LANGUAGE = ObjC; - OUTLETS = { - commandLineArguments = id; - iwadController = id; - launcherWindow = id; - packageLabel = id; - }; - SUPERCLASS = NSObject; - } - ); - IBVersion = 1; -} \ No newline at end of file diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib deleted file mode 100644 index aecf812a..00000000 --- a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/info.nib +++ /dev/null @@ -1,23 +0,0 @@ - - - - - IBDocumentLocation - 170 140 612 260 0 0 1440 878 - IBEditorPositions - - 29 - 108 337 163 44 0 0 1440 878 - - IBFramework Version - 446.1 - IBOpenObjects - - 21 - 29 - 227 - - IBSystem Version - 8S2167 - - diff --git a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib b/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib deleted file mode 100644 index 12cf6aa5..00000000 Binary files a/pkg/osx/app-skeleton/Contents/Resources/launcher.nib/keyedobjects.nib and /dev/null differ diff --git a/pkg/osx/app-skeleton/Contents/Resources/wadfile.icns b/pkg/osx/app-skeleton/Contents/Resources/wadfile.icns deleted file mode 100644 index 13502a55..00000000 Binary files a/pkg/osx/app-skeleton/Contents/Resources/wadfile.icns and /dev/null differ -- cgit v1.2.3 From 571b9c32f5e054f131abb9c1d0d68eb4c784a764 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 15 Jan 2010 18:40:37 +0000 Subject: Add wadfile.png for GNUstep build. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1814 --- pkg/Makefile.am | 1 + pkg/osx/Info-GNUstep.plist.in | 1 + pkg/osx/Resources/wadfile.png | Bin 0 -> 2249 bytes 3 files changed, 2 insertions(+) create mode 100644 pkg/osx/Resources/wadfile.png (limited to 'pkg') diff --git a/pkg/Makefile.am b/pkg/Makefile.am index 6a3b38ff..75520fbd 100644 --- a/pkg/Makefile.am +++ b/pkg/Makefile.am @@ -4,6 +4,7 @@ osx/Resources/128x128.png \ osx/Resources/app.icns \ osx/Resources/app.png \ osx/Resources/wadfile.icns \ +osx/Resources/wadfile.png \ osx/Resources/launcher.nib/classes.nib \ osx/Resources/launcher.nib/info.nib \ osx/Resources/launcher.nib/keyedobjects.nib \ diff --git a/pkg/osx/Info-GNUstep.plist.in b/pkg/osx/Info-GNUstep.plist.in index ac6511e2..743816ef 100644 --- a/pkg/osx/Info-GNUstep.plist.in +++ b/pkg/osx/Info-GNUstep.plist.in @@ -20,6 +20,7 @@ NSMimeTypes = ( "application/x-doom" ); + NSIcon = "wadfile.png"; }, { NSHumanReadableName = "Dehacked patch"; diff --git a/pkg/osx/Resources/wadfile.png b/pkg/osx/Resources/wadfile.png new file mode 100644 index 00000000..394a3e33 Binary files /dev/null and b/pkg/osx/Resources/wadfile.png differ -- cgit v1.2.3 From cd8cf5f1c8c0e6a86ddc3322f33acc29698009f5 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 15 Jan 2010 18:51:35 +0000 Subject: Center the launcher window and config window on startup. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1815 --- pkg/osx/IWADController.m | 2 ++ pkg/osx/LauncherManager.m | 1 + 2 files changed, 3 insertions(+) (limited to 'pkg') diff --git a/pkg/osx/IWADController.m b/pkg/osx/IWADController.m index f1860301..783ee38f 100644 --- a/pkg/osx/IWADController.m +++ b/pkg/osx/IWADController.m @@ -250,6 +250,8 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] = - (void) awakeFromNib { + [self->configWindow center]; + // Set configuration for all IWADs from configuration file. [self setIWADConfig]; diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m index 0cde9f6e..26684811 100644 --- a/pkg/osx/LauncherManager.m +++ b/pkg/osx/LauncherManager.m @@ -304,6 +304,7 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName) { [self->packageLabel setStringValue: @PACKAGE_STRING]; [self->launcherWindow setTitle: @PACKAGE_NAME " Launcher"]; + [self->launcherWindow center]; [self setConfig]; } -- cgit v1.2.3 From 893c8dbe922b5ee6ac14c3df3b5020817b6797b3 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 15 Jan 2010 19:14:02 +0000 Subject: Fix GNUstep info panel. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1816 --- pkg/Makefile.am | 2 +- pkg/osx/GNUmakefile | 4 ++-- pkg/osx/Info-GNUstep.plist.in | 32 -------------------------------- pkg/osx/Info-gnustep.plist.in | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 pkg/osx/Info-GNUstep.plist.in create mode 100644 pkg/osx/Info-gnustep.plist.in (limited to 'pkg') diff --git a/pkg/Makefile.am b/pkg/Makefile.am index 75520fbd..9775fa77 100644 --- a/pkg/Makefile.am +++ b/pkg/Makefile.am @@ -9,7 +9,7 @@ osx/Resources/launcher.nib/classes.nib \ osx/Resources/launcher.nib/info.nib \ osx/Resources/launcher.nib/keyedobjects.nib \ osx/GNUmakefile \ -osx/Info.plist.in osx/Info-GNUstep.plist.in \ +osx/Info.plist.in osx/Info-gnustep.plist.in \ osx/PkgInfo \ osx/cp-with-libs \ osx/main.m \ diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile index d1894bef..d119efa1 100644 --- a/pkg/osx/GNUmakefile +++ b/pkg/osx/GNUmakefile @@ -35,7 +35,7 @@ APP_DIR=$(STAGING_DIR)/$(PACKAGE_NAME).app ifdef GNUSTEP_MAKEFILES APP_TOP_DIR=$(APP_DIR) APP_BIN_DIR=$(APP_DIR) -SRC_INFO_PLIST=Info-GNUstep.plist +SRC_INFO_PLIST=Info-gnustep.plist else APP_TOP_DIR=$(APP_DIR)/Contents APP_BIN_DIR=$(APP_DIR)/Contents/MacOS @@ -51,7 +51,7 @@ $(STAGING_DIR): launcher $(TOPLEVEL_DOCS) mkdir -p "$(APP_TOP_DIR)" cp -R Resources "$(APP_TOP_DIR)" cp PkgInfo "$(APP_TOP_DIR)" - cp $(SRC_INFO_PLIST) "$(APP_TOP_DIR)/Info.plist" + cp $(SRC_INFO_PLIST) "$(APP_TOP_DIR)" mkdir -p "$(APP_BIN_DIR)" diff --git a/pkg/osx/Info-GNUstep.plist.in b/pkg/osx/Info-GNUstep.plist.in deleted file mode 100644 index 743816ef..00000000 --- a/pkg/osx/Info-GNUstep.plist.in +++ /dev/null @@ -1,32 +0,0 @@ -{ - ApplicationDescription = "@PACKAGE_NAME@"; - ApplicationIcon = app.png; - ApplicationName = "@PACKAGE_NAME@"; - ApplicationRelease = @PACKAGE_VERSION@; - Copyright = "Copyright (C) 2009-2010"; - CopyrightDescription = "GNU General Public License, version 2"; - FullVersionID = @PACKAGE_VERSION@; - GSMainMarkupFile = ""; - NSExecutable = "launcher"; - NSIcon = app.png; - NSMainNibFile = launcher.nib; - NSPrincipalClass = NSApplication; - NSRole = Application; - NSTypes = ( - { - NSHumanReadableName = "Doom WAD file"; - NSUnixExtensions = ( wad ); - NSRole = Viewer; - NSMimeTypes = ( - "application/x-doom" - ); - NSIcon = "wadfile.png"; - }, - { - NSHumanReadableName = "Dehacked patch"; - NSUnixExtensions = ( deh ); - NSRole = Viewer; - NSIcon = "wadfile.png"; - } - ); -} diff --git a/pkg/osx/Info-gnustep.plist.in b/pkg/osx/Info-gnustep.plist.in new file mode 100644 index 00000000..e7436df2 --- /dev/null +++ b/pkg/osx/Info-gnustep.plist.in @@ -0,0 +1,32 @@ +{ + ApplicationName = "@PACKAGE_NAME@"; + ApplicationDescription = "Doom source port"; + ApplicationIcon = app.png; + ApplicationRelease = @PACKAGE_VERSION@; + Copyright = "Copyright (C) 2009-2010"; + CopyrightDescription = "GNU General Public License, version 2"; + FullVersionID = @PACKAGE_VERSION@; + GSMainMarkupFile = ""; + NSExecutable = "launcher"; + NSIcon = app.png; + NSMainNibFile = launcher.nib; + NSPrincipalClass = NSApplication; + NSRole = Application; + NSTypes = ( + { + NSHumanReadableName = "Doom WAD file"; + NSUnixExtensions = ( wad ); + NSRole = Viewer; + NSMimeTypes = ( + "application/x-doom" + ); + NSIcon = "wadfile.png"; + }, + { + NSHumanReadableName = "Dehacked patch"; + NSUnixExtensions = ( deh ); + NSRole = Viewer; + NSIcon = "wadfile.png"; + } + ); +} -- cgit v1.2.3 From 6e0df0d01676cec59caaafa2cea3910c5a9b51e0 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 15 Jan 2010 19:29:28 +0000 Subject: Don't open the configuration window when the launcher is first run; display an error message if the user tries to launch the game without an IWAD selected. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1817 --- pkg/osx/IWADController.m | 7 +------ pkg/osx/LauncherManager.m | 15 +++++++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/IWADController.m b/pkg/osx/IWADController.m index 783ee38f..a7730cc7 100644 --- a/pkg/osx/IWADController.m +++ b/pkg/osx/IWADController.m @@ -256,17 +256,12 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] = [self setIWADConfig]; - // Populate the dropdown IWAD list, and open the configuration - // dialog if not yet configured. + // Populate the dropdown IWAD list. if ([self setDropdownList]) { [self setDropdownSelection]; } - else - { - [self openConfigWindow: nil]; - } } // Set the DOOMWADPATH environment variable to contain the path to each diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m index 26684811..0d0ab4ea 100644 --- a/pkg/osx/LauncherManager.m +++ b/pkg/osx/LauncherManager.m @@ -284,12 +284,19 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName) iwad = [self->iwadController getIWADLocation]; args = [self->commandLineArguments stringValue]; - if (iwad != nil) + if (iwad == nil) { - ExecuteProgram(PACKAGE_TARNAME, [iwad UTF8String], - [args UTF8String]); - [NSApp terminate:sender]; + NSRunAlertPanel(@"No IWAD selected", + @"You have not selected an IWAD (game) file.\n\n" + "You must configure and select a valid IWAD file " + "in order to launch the game.", + @"OK", nil, nil); + return; } + + ExecuteProgram(PACKAGE_TARNAME, [iwad UTF8String], + [args UTF8String]); + [NSApp terminate:sender]; } - (void) runSetup: (id)sender -- cgit v1.2.3 From 7f7a7354a5e72f1226f06f6109c0d1bc6cc30133 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 18 Jan 2010 19:14:54 +0000 Subject: Define project short description, copyright, maintainer and URL in configure.in. Use these for the Info-gnustep.plist file. Add generated .spec file for building RPM packages. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1821 --- pkg/osx/Info-gnustep.plist.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/Info-gnustep.plist.in b/pkg/osx/Info-gnustep.plist.in index e7436df2..da6675ba 100644 --- a/pkg/osx/Info-gnustep.plist.in +++ b/pkg/osx/Info-gnustep.plist.in @@ -1,10 +1,14 @@ { ApplicationName = "@PACKAGE_NAME@"; - ApplicationDescription = "Doom source port"; + ApplicationDescription = "@PACKAGE_SHORTDESC@"; ApplicationIcon = app.png; ApplicationRelease = @PACKAGE_VERSION@; - Copyright = "Copyright (C) 2009-2010"; - CopyrightDescription = "GNU General Public License, version 2"; + ApplicationURL = "@PACKAGE_URL@"; + Authors = ( + "@PACKAGE_MAINTAINER@ <@PACKAGE_BUGREPORT@>" + ); + Copyright = "@PACKAGE_COPYRIGHT@"; + CopyrightDescription = "@PACKAGE_LICENSE@"; FullVersionID = @PACKAGE_VERSION@; GSMainMarkupFile = ""; NSExecutable = "launcher"; -- cgit v1.2.3 From bf8974e63b988ae1b5d2fdb0492dfe0bb3613680 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 23 Jan 2010 23:06:45 +0000 Subject: Add menu item to launcher to open a terminal window that can be used to start the game. Add missing 'edit' menu. Set svn:ignore property for osx directory. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1824 --- pkg/osx/.gitignore | 2 + pkg/osx/Execute.h | 1 + pkg/osx/Execute.m | 86 ++++++++++++++++++++++++ pkg/osx/IWADController.h | 1 + pkg/osx/IWADController.m | 31 +++++++-- pkg/osx/LauncherManager.h | 2 +- pkg/osx/LauncherManager.m | 18 +++++ pkg/osx/Resources/launcher.nib/classes.nib | 2 +- pkg/osx/Resources/launcher.nib/info.nib | 6 +- pkg/osx/Resources/launcher.nib/keyedobjects.nib | Bin 17541 -> 19494 bytes 10 files changed, 139 insertions(+), 10 deletions(-) (limited to 'pkg') diff --git a/pkg/osx/.gitignore b/pkg/osx/.gitignore index 5b7a16ef..ca1a7908 100644 --- a/pkg/osx/.gitignore +++ b/pkg/osx/.gitignore @@ -1,5 +1,7 @@ Info.plist +Info-gnustep.plist launcher *.o *.d +*.dmg staging diff --git a/pkg/osx/Execute.h b/pkg/osx/Execute.h index e92d3a11..2098be8a 100644 --- a/pkg/osx/Execute.h +++ b/pkg/osx/Execute.h @@ -25,6 +25,7 @@ void SetProgramLocation(const char *path); void ExecuteProgram(const char *executable, const char *iwad, const char *args); +void OpenTerminalWindow(const char *doomwadpath); #endif /* #ifndef LAUNCHER_EXECUTE_H */ diff --git a/pkg/osx/Execute.m b/pkg/osx/Execute.m index 1afcab1f..bb4eed45 100644 --- a/pkg/osx/Execute.m +++ b/pkg/osx/Execute.m @@ -24,10 +24,16 @@ #include #include #include +#include #include #include +#include + +#include "config.h" + #define RESPONSE_FILE "/tmp/launcher.rsp" +#define TEMP_SCRIPT "/tmp/tempscript.sh" static char *executable_path; @@ -109,3 +115,83 @@ void ExecuteProgram(const char *executable, const char *iwad, const char *args) } } +// Write a sequence of commands that will display the specified message +// via shell commands. + +static void WriteMessage(FILE *script, char *msg) +{ + char *p; + + fprintf(script, "echo \""); + + for (p=msg; *p != '\0'; ++p) + { + // Start new line? + + if (*p == '\n') + { + fprintf(script, "\"\necho \""); + continue; + } + + // Escaped character? + + if (*p == '\\' || *p == '\"') + { + fprintf(script, "\\"); + } + + fprintf(script, "%c", *p); + } + + fprintf(script, "\"\n"); +} + +// Open a terminal window with the PATH set appropriately, and DOOMWADPATH +// set to the specified value. + +void OpenTerminalWindow(const char *doomwadpath) +{ + FILE *stream; + + // Generate a shell script that sets the PATH to include the location + // where the Doom binaries are, and DOOMWADPATH to include the + // IWAD files that have been configured in the launcher interface. + // The script then deletes itself and starts a shell. + + stream = fopen(TEMP_SCRIPT, "w"); + + fprintf(stream, "#!/bin/sh\n"); + //fprintf(stream, "set -x\n"); + fprintf(stream, "PATH=\"%s:$PATH\"\n", executable_path); + fprintf(stream, "DOOMWADPATH=\"%s\"\n", doomwadpath); + fprintf(stream, "export DOOMWADPATH\n"); + fprintf(stream, "rm -f \"%s\"\n", TEMP_SCRIPT); + + // Display a useful message: + + fprintf(stream, "clear\n"); + WriteMessage(stream, + "\n" + "This command line has the PATH variable configured so that you may\n" + "launch the game with whatever parameters you desire.\n" + "\n" + "For example:\n" + "\n" + " " PACKAGE_TARNAME " -iwad doom2.wad -file sid.wad -warp 1\n" + "\n" + "Type 'exit' to exit.\n"); + + fprintf(stream, "exec $SHELL\n"); + fprintf(stream, "\n"); + + fclose(stream); + + chmod(TEMP_SCRIPT, 0755); + + // Tell the terminal to open a window to run the script. + + [[NSWorkspace sharedWorkspace] openFile: @TEMP_SCRIPT + withApplication: @"Terminal"]; +} + diff --git a/pkg/osx/IWADController.h b/pkg/osx/IWADController.h index 8bdd0d55..90f44667 100644 --- a/pkg/osx/IWADController.h +++ b/pkg/osx/IWADController.h @@ -45,6 +45,7 @@ - (BOOL) setDropdownList; - (void) setDropdownSelection; - (void) saveConfig; +- (char *) doomWadPath; - (void) setEnvironment; @end diff --git a/pkg/osx/IWADController.m b/pkg/osx/IWADController.m index a7730cc7..3c596850 100644 --- a/pkg/osx/IWADController.m +++ b/pkg/osx/IWADController.m @@ -264,10 +264,10 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] = } } -// Set the DOOMWADPATH environment variable to contain the path to each -// of the configured IWAD files. +// Generate a value to set for the DOOMWADPATH environment variable +// that contains each of the configured IWAD files. -- (void) setEnvironment +- (char *) doomWadPath { IWADLocation *iwadList[NUM_IWAD_TYPES]; NSString *location; @@ -280,7 +280,7 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] = // Calculate length of environment string. - len = 30; + len = 0; for (i=0; iiwadController doomWadPath]; + + OpenTerminalWindow(doomwadpath); + + free(doomwadpath); +} + - (void) awakeFromNib { [self->packageLabel setStringValue: @PACKAGE_STRING]; diff --git a/pkg/osx/Resources/launcher.nib/classes.nib b/pkg/osx/Resources/launcher.nib/classes.nib index 3ff47e71..236f6b67 100644 --- a/pkg/osx/Resources/launcher.nib/classes.nib +++ b/pkg/osx/Resources/launcher.nib/classes.nib @@ -30,7 +30,7 @@ SUPERCLASS = NSObject; }, { - ACTIONS = {launch = id; runSetup = id; }; + ACTIONS = {launch = id; openTerminal = id; runSetup = id; }; CLASS = LauncherManager; LANGUAGE = ObjC; OUTLETS = { diff --git a/pkg/osx/Resources/launcher.nib/info.nib b/pkg/osx/Resources/launcher.nib/info.nib index aecf812a..32b331f5 100644 --- a/pkg/osx/Resources/launcher.nib/info.nib +++ b/pkg/osx/Resources/launcher.nib/info.nib @@ -3,18 +3,18 @@ IBDocumentLocation - 170 140 612 260 0 0 1440 878 + 484 105 612 260 0 0 1440 878 IBEditorPositions 29 - 108 337 163 44 0 0 1440 878 + 221 322 205 44 0 0 1440 878 IBFramework Version 446.1 IBOpenObjects - 21 29 + 21 227 IBSystem Version diff --git a/pkg/osx/Resources/launcher.nib/keyedobjects.nib b/pkg/osx/Resources/launcher.nib/keyedobjects.nib index 12cf6aa5..4f078d7c 100644 Binary files a/pkg/osx/Resources/launcher.nib/keyedobjects.nib and b/pkg/osx/Resources/launcher.nib/keyedobjects.nib differ -- cgit v1.2.3 From a054475997a14499a9bce528a64efb22ce2fe2b0 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 30 Jan 2010 16:04:24 +0000 Subject: Set launch button as default button, so that it is possible to launch the game by pressing return. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1834 --- pkg/osx/LauncherManager.h | 1 + pkg/osx/LauncherManager.m | 1 + pkg/osx/Resources/launcher.nib/classes.nib | 1 + pkg/osx/Resources/launcher.nib/info.nib | 2 +- pkg/osx/Resources/launcher.nib/keyedobjects.nib | Bin 19494 -> 19616 bytes 5 files changed, 4 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/osx/LauncherManager.h b/pkg/osx/LauncherManager.h index 76c74624..e454ab4f 100644 --- a/pkg/osx/LauncherManager.h +++ b/pkg/osx/LauncherManager.h @@ -32,6 +32,7 @@ IWADController *iwadController; id launcherWindow; + id launchButton; id commandLineArguments; id packageLabel; diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m index ee7ed3dc..ae91ef4d 100644 --- a/pkg/osx/LauncherManager.m +++ b/pkg/osx/LauncherManager.m @@ -330,6 +330,7 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName) [self->packageLabel setStringValue: @PACKAGE_STRING]; [self->launcherWindow setTitle: @PACKAGE_NAME " Launcher"]; [self->launcherWindow center]; + [self->launcherWindow setDefaultButtonCell: [self->launchButton cell]]; [self setConfig]; } diff --git a/pkg/osx/Resources/launcher.nib/classes.nib b/pkg/osx/Resources/launcher.nib/classes.nib index 236f6b67..7efc837a 100644 --- a/pkg/osx/Resources/launcher.nib/classes.nib +++ b/pkg/osx/Resources/launcher.nib/classes.nib @@ -36,6 +36,7 @@ OUTLETS = { commandLineArguments = id; iwadController = id; + launchButton = id; launcherWindow = id; packageLabel = id; }; diff --git a/pkg/osx/Resources/launcher.nib/info.nib b/pkg/osx/Resources/launcher.nib/info.nib index 32b331f5..512ee6dd 100644 --- a/pkg/osx/Resources/launcher.nib/info.nib +++ b/pkg/osx/Resources/launcher.nib/info.nib @@ -3,7 +3,7 @@ IBDocumentLocation - 484 105 612 260 0 0 1440 878 + 325 73 612 260 0 0 1440 878 IBEditorPositions 29 diff --git a/pkg/osx/Resources/launcher.nib/keyedobjects.nib b/pkg/osx/Resources/launcher.nib/keyedobjects.nib index 4f078d7c..cc763056 100644 Binary files a/pkg/osx/Resources/launcher.nib/keyedobjects.nib and b/pkg/osx/Resources/launcher.nib/keyedobjects.nib differ -- cgit v1.2.3 From fdcd8dda0935403185ba307304028d3a682297a9 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 30 Jan 2010 16:14:04 +0000 Subject: Change directory to home directory before launching the game, so that recorded demos go somewhere sensible. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1835 --- pkg/osx/Execute.m | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'pkg') diff --git a/pkg/osx/Execute.m b/pkg/osx/Execute.m index bb4eed45..608443e2 100644 --- a/pkg/osx/Execute.m +++ b/pkg/osx/Execute.m @@ -100,6 +100,7 @@ static void DoExec(const char *executable, const char *iwad, const char *args) void ExecuteProgram(const char *executable, const char *iwad, const char *args) { pid_t childpid; + char *homedir; childpid = fork(); @@ -107,6 +108,16 @@ void ExecuteProgram(const char *executable, const char *iwad, const char *args) { signal(SIGCHLD, SIG_DFL); + // Change directory to home dir before launch, so that any demos + // are saved somewhere sensible. + + homedir = getenv("HOME"); + + if (homedir != NULL) + { + chdir(homedir); + } + DoExec(executable, iwad, args); } else -- cgit v1.2.3