I completed the CurrencyConverter example using Xcode 2.5 on Mac OS X Tiger 10.4.11, which I called CurrencyConverter2 since it was my second attempt. Since I've read that GNUstep is compatible with the Mac OS X Tiger version of Cocoa, I wanted to try building this Xcode project in GNUstep, which I am interested in learning.
I was able to install GNUstep on a VM running FreeBSD 12.0. I created a Makefile called GNUmakefile. Here are the contents of GNUmakefile:
include $(GNUSTEP_MAKEFILES)/common.make
APP_NAME = CurrencyConverter2
CurrencyConverter2_OBJC_FILES = main.m ConverterController.m Converter.m
CurrencyConverter2_RESOURCE_FILES = Info.plist English.lproj/MainMenu.nib
include $(GNUSTEP_MAKEFILES)/application.make
When building the program using gmake, it appears that everything was built correctly:
This is gnustep-make 2.7.0. Type 'gmake print-gnustep-make-help' for help.
Running in gnustep-make version 2 strict mode.
Making all for app CurrencyConverter2...
Creating CurrencyConverter2.app/....
gmake[3]: Warning: File 'main.m' has modification time 21869 s in the future
Compiling file main.m ...
Compiling file ConverterController.m ...
Compiling file Converter.m ...
Linking app CurrencyConverter2 ...
gmake[3]: warning: Clock skew detected. Your build may be incomplete.
Creating CurrencyConverter2.app/Resources...
Creating stamp file...
Creating CurrencyConverter2.app/Resources/Info-gnustep.plist...
Creating CurrencyConverter2.app/Resources/CurrencyConverter2.desktop...
Copying resources into the app wrapper...
However, when I try to open CurrencyConverter2.app, the main window does not show up at all.
My hunch is that for some reason my Makefile is not recognizing English.lproj/MainMenu.nib.
I also tried using a tool called buildtool that is able to build Xcode projects using GNUstep, but it complained that it couldn't find English.lproj even though it is in the directory that I ran buildtool.
When converting a Mac app to GNUstep, you need to make a GNUstep-specific Info-plist template that roughly mirrors Info.plist (which is Mac-only).
At build time, the Info-plist template is used to generate two files: Info-gnustep.plist, and the app's .desktop (freedesktop.org desktop entry) file.
Info-gnustep.plist contains Info entries used at loadtime/runtime, such as the name of the principal class, the main-menu nibfile to load, etc.
The app's .desktop file contains Info entries used for registering the app with the desktop-environment/file-browser, such as the app's desktop-menu category, the executable path, supported MIME types, etc. (Note: 'make install' currently doesn't register a GNUstep app with the desktop environment; In order for an installed GNUStep app to appear in the desktop menus, its .desktop file - found in its Resources folder - must be manually registered using the 'desktop-file-install' command-line tool.)
The Info-plist template should be named, "{APP_NAME}Info.plist", and can contain a standard XML-format plist, or a simple text-list format:
{
{KEY1} = {VALUE1};
{KEY2} = {VALUE2};
...
}
For CurrencyConverter2, create a textfile named "CurrencyConverter2Info.plist" in the same directory as the Makefile, with the contents:
{
ApplicationName = CurrencyConverter2;
FreeDesktopCategories = ("Utility", "X-GNUstep");
NSExecutable = "CurrencyConverter2";
NSMainNibFile = "MainMenu.nib";
NSPrincipalClass = NSApplication;
NSRole = Application;
}
GNUstep-make will automatically find CurrencyConverter2Info.plist, so it doesn't need an entry in the Makefile.
Unrelated to the Info-plist template issue, you can also make these changes to your Makefile:
MainMenu.nib can be specified as a localized resource (so it no longer needs English.lproj in its pathname) by removing it from CurrencyConverter2_RESOURCE_FILES and adding these two lines to your Makefile:
CurrencyConverter2_LOCALIZED_RESOURCE_FILES = MainMenu.nib CurrencyConverter2_LANGUAGES = English