News for hackers. Stuff that matters.
Re:GNUStep Now Has Badges by rbanffy on Friday August 04, 2023 @01:05PM (#37002744)
Is there a guide somewhere on how to write software for GNUStep in a way it's also compatible with macOS?
Re:GNUStep Now Has Badges by koito17 on Friday August 04, 2023 @01:46PM (#37003328)
These 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.gnuste...
Re:GNUStep Now Has Badges by asveikau on Friday August 04, 2023 @03:05PM (#37004380)
I 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.

Re:GNUStep Now Has Badges by jhatemyjob on Friday August 04, 2023 @02:11PM (#37003633)
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
Re:GNUStep Now Has Badges by mpweiher on Friday August 04, 2023 @04:25PM (#37005400)
Or you use buildtool to build Xcode projects with GNUstep:

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/GN...

https://gitlab.com/mpwmo/MPWFoundation/-/blob/master/GNUmake...

https://gitlab.com/mpwmo/MPWFoundation/-/tree/master/GNUstep...

Re:GNUStep Now Has Badges by rbanffy on Saturday August 05, 2023 @08:08PM (#37017560)
This 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?

Re:GNUStep Now Has Badges by mpweiher on Tuesday August 08, 2023 @07:15AM (#37047268)
The 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.

Re:GNUStep Now Has Badges by bandrami on Friday August 04, 2023 @04:48PM (#37005681)
They'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).
Re:GNUStep Now Has Badges by kelnos on Friday August 04, 2023 @07:36PM (#37007253)
Carbon 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.
Re:GNUStep Now Has Badges by tedge on Friday August 04, 2023 @05:35PM (#37006209)

   I'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/

   You can also browse PikoPixel's sources online at the Debian GNUstep team's mirror repository:
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*).

Re:GNUStep Now Has Badges by rbanffy on Sunday August 06, 2023 @07:46PM (#37028200)
> (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.