26 ms·
Is there a guide somewhere on how to write software for GNUStep in a way it's also compatible with macOS?
by rbanffy 3y ago
Is there a guide somewhere on how to write software for GNUStep in a way it's also compatible with macOS?
- koito17 3y agoThese are called "Renaissance apps" by GNUstep users. They are apps designed such that you can run them on both GNUstep and Cocoa. There used to be a tutorial out there, but the site is gone now. Here is an archive link to it: https://web.archive.org/web/20180125122828/http://www.gnustep.it/nicola/Tutorials/Renaissance/index.html https://web.archive.org/web/20180125122828/http://www.gnuste...
- asveikau 3y agoI haven't followed gnustep in a long time, but I thought renaissance was a library that was an alternative to NIB files, with an XML format. Back when I wrote some small apps, it was very easy to target Mac with the GNUstep makefile package. That could build on Mac without any extra work on the build side. I would sprinkle a lot with #ifdef __APPLE__ when the APIs differ, on a case by case basis. A lot of things (most?) work on both without modification, it just depends how new the API is.
- jhatemyjob 3y agoI 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.
- bandrami 3y agoThey're source-compatible, so if you write it for GNUStep you should also get a functioning macOS application if you build it with that target (you just won't get whatever they call Carbon and Cocoa nowadays).
- kelnos 3y agoCarbon is more or less dead (certainly for new apps, anyway), and GNUStep does indeed implement Cocoa. GNUStep doesn't implement a lot of other macOS frameworks, though.
- tedge 3y agoI'm the developer of PikoPixel, a cross-platform Mac/Linux/BSD pixel-art editor. PikoPixel was initially written for Mac, and GNUstep saved me a huge amount of work from having to completely rewrite it for Linux/BSD. However, it was still a significant effort: * GNUstep's an implementation of the Cocoa framework only, it doesn't include any other macOS frameworks. * The same source-code & UI resources can produce different behaviors & visuals between the different platforms. This is due to different Cocoa implementations, some missing functionality on GNUstep, different system fonts, different window managers & desktop environments (Linux/BSD have many of them, each with their own quirks), etc. A cross-platform Mac/GNUstep app is definitely doable - PikoPixel is now available in many Linux distro repositories (Ubuntu Studio even preinstalls it as a default graphics app) - but expect to spend significant effort correcting platform differences (depending on the app). I'd suggest getting started by spinning up a VM, installing a GNUstep dev environment on it, then downloading some GNUstep app sources & building them. PikoPixel's homepage links some build scripts for Debian & Fedora that will install both a GNUstep dev environment and PikoPixel: https://twilightedge.com/mac/pikopixel/ https://twilightedge.com/mac/pikopixel/ You can also browse PikoPixel's sources online at the Debian GNUstep team's mirror repository: https://salsa.debian.org/gnustep-team/pikopixel.app https://salsa.debian.org/gnustep-team/pikopixel.app (Note: PikoPixel's fixes & workarounds for the platform differences on GNUstep are found in the various source files that begin with PPGNUstepGlue*).
- rbanffy 3y ago> (Note: PikoPixel's fixes & workarounds for the platform differences on GNUstep are found in the various source files that begin with PPGNUstepGlue*). This alone would be a nice standalone open source project that one could extend to offer more coverage.