3 ms·
I assume you meant to ask "how to build" and not "how to write", since writing the Objective-C code is trivial since it's all just AppKit and there's documentat
by jhatemyjob 3y ago
I assume you meant to ask "how to build" and not "how to write", since writing the Objective-C code is trivial since it's all just AppKit and there's documentation on Apple's website for that.
Building for both GNUstep and macOS is difficult. The problem is, macOS wants you to use Xcode and GNUstep wants you to use their weird build system. In order to build software that is compatible with both GNUstep and macOS you will either need need to have two parallel build systems (one GNUmakefile and one Xcode project) or use a custom build system.
Personally I think GNUstep's build system is stupid, and I don't like using Xcode, so I lean more towards a custom build system. Sounds insane I know but it really isn't that bad. Compiling and running a Cocoa application on macOS pretty much boils down to this:
clang main.m -framework Cocoa
./a.out
I don't remember how to do it for GNUstep. It's been a few years. Their GNUmakefile thing is REALLY weird, they have all these Makefile macros you need to import and they try to abstract all of this stuff away. Using Makefile macros. It's horrible. I asked ChatGPT and it generated this:
include $(GNUSTEP_MAKEFILES)/common.make
APP_NAME = YourAppName
YourAppName_OBJC_FILES = main.m YourAppClass.m
YourAppName_RESOURCE_FILES = Info-gnustep.plist
include $(GNUSTEP_MAKEFILES)/application.make
I would make a basic GNUmakefile, then run it with `V=1` (or `VERBOSE=1`? i forgot the name of the environment variable) to get the actual terminal commands its running, extract those, put those in your one-liner custom build script and be done with it
- mpweiher 3y agoOr you use buildtool to build Xcode projects with GNUstep: https://github.com/gnustep/libs-xcode https://github.com/gnustep/libs-xcode MPWFoundation, Objective-S and related all build on both macOS and GNUstep without buildtool. Once you have the GNUmakefiles they are not that hard to keep in sync. https://gitlab.com/mpwmo/ObjectiveSmalltalk/-/blob/master/GNUmakefile?ref_type=heads https://gitlab.com/mpwmo/ObjectiveSmalltalk/-/blob/master/GN... https://gitlab.com/mpwmo/MPWFoundation/-/blob/master/GNUmakefile?ref_type=heads https://gitlab.com/mpwmo/MPWFoundation/-/blob/master/GNUmake... https://gitlab.com/mpwmo/MPWFoundation/-/tree/master/GNUstep?ref_type=heads https://gitlab.com/mpwmo/MPWFoundation/-/tree/master/GNUstep...
- rbanffy 3y agoThis sounds like a great option. But I was looking for both things. Is there a tool to warn against partial or not implemented functionality that needs to be avoided?
- mpweiher 3y agoThe easiest "tool" is to build as early as possible against both GNUstep and macOS (iOS etc.), preferably with a good suite of unit tests. Works perfectly fine, and I don't see how some external tool attempting to give a guess at this would be easier, never mind as accurate.