Skip to content

Add Objective-C language support (compiled_lang) #39

Description

@darkn3rd

Add Objective-C, using the GNUstep libobjc2 runtime (https://github.com/gnustep/libobjc2) rather than GCC's older bundled objc runtime, as a new language in lessons/compiled_lang/, alongside the existing C++/C#/Go/Java/Rust. See also https://askubuntu.com/questions/328343/how-to-compile-build-and-run-objective-c-program-in-ubuntu-using-terminal.

Based on cpp/ as the reference (same compile-then-link make model, via clang $(gnustep-config --objc-flags) $(gnustep-config --objc-libs) -lgnustep-base instead of a plain g++/gcc invocation).

This one has meaningfully more platform variance than the other compiled_lang additions - worth reading through before starting:

  • macOS: fully native, no new packages needed - Apple's own Xcode CLI tools (already installed by macos_xcode_cli_tools) ship Objective-C support and libobjc.dylib out of the box.

  • MSYS2: fully covered via pacman - mingw-w64-x86_64-libobjc2, mingw-w64-x86_64-gnustep-base, mingw-w64-x86_64-gnustep-make (and -gnustep-gui if a GUI-capable runtime is ever wanted) are all real, current packages.

  • Ubuntu: apt install gobjc gets you gcc's own compiler frontend (cc1obj) and its older bundled objc runtime, but the modern libobjc2 runtime this issue is actually about (ARC, blocks, GCD) is confirmed not packaged for apt and needs building from source. Worth deciding whether the older gcc runtime is an acceptable substitute for the lesson content, or whether a from-source build step belongs in an ubuntu22_*-style custom script, matching how this project already handles non-packaged installs elsewhere.

  • Windows: no Chocolatey package found, and no simple native-Windows install path exists - GNUstep's own Windows toolchain is either the MSYS2-based approach (i.e. not a separate native-Windows thing at all) or a much heavier MSVC-based toolchain (gnustep/tools-windows-msvc). Worth deciding whether Windows-native (choco:) Objective-C support is in scope at all, or whether this language is MSYS2-only on the Windows side.

  • Cygwin: not confirmed either way in a first pass - needs checking directly against Cygwin's own package list.

  • Resolve the open platform questions above (Ubuntu's gcc-vs-source-build tradeoff; Windows scope decision; confirm Cygwin) before or as part of implementation

  • New lessons/compiled_lang/objc/ directory: Makefile(.win) (adapted from cpp/Makefile, using clang + gnustep-config flags instead of g++), Rakefile (imports shared testbox.rake), psakefile.ps1, src/ with one .m file per lesson (~60 files mirroring cpp/src's set), bin//target/ output dirs

  • Add Objective-C's confirmed packages to lessons/compiled_lang/{Brewfile,choco.config,cygwin_pkgs.txt,msys2_pkgs.txt} per platform (macOS needs none beyond existing Xcode CLI tools; MSYS2 needs the three pacman packages above; Ubuntu/Windows pending the open questions)

  • Add an Objective-C entry to the Compiled Languages area in scriptbox/scripts/verify_commands.rb's AREAS

  • lessons/compiled_lang/README.md update

This is a full new-language port (~60 lesson files) with real platform-support open questions on top, so likely worth resolving the open questions and doing this in smaller PRs rather than one large one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions