Skip to content

Add spec aarch64-apple-darwin9 (Apple Silicon)#28

Open
iamFIREcracker wants to merge 2 commits into
Failproofshark:masterfrom
iamFIREcracker:aarch64-apple-darwin9
Open

Add spec aarch64-apple-darwin9 (Apple Silicon)#28
iamFIREcracker wants to merge 2 commits into
Failproofshark:masterfrom
iamFIREcracker:aarch64-apple-darwin9

Conversation

@iamFIREcracker
Copy link
Copy Markdown

This PR adds specs for Apple Silicon, finally making it possible to run Sketch on newer macs (see related links below). Also, tested on a MacBook Air M2 and it all seems to be working just fine.

Steps to regenerate the specs (I used nix)

First off, force quicklisp to use a version of cl-sdl2 which supports Apple Silicon (e.g., you can clone my fork into ~/quicklisp/local-projects, or wherever your quicklisp installation lives). Note: you won't need this step anymore once changes are merged upstream (see: lispgames/cl-sdl2#167).

Next, drop the following lines in a file named shell.nix at the root of the repository, and then, in the same directory, run nix-shell (this will take care of installing SDL2_ttf and c2ffi).

shell.nix
let
  pkgs =
    import (
      fetchTarball {
        name = "nixos-23.05_2023-09-18";
        url =
          "https://github.com/NixOS/nixpkgs/archive/f81112bbb0f357b80333300c4702ff7538096156.tar.gz";
        sha256 = "0pxhiggxl5drnpva9287w136rrykcd7xk1nyh655wgf6sb38a82k";
      }
    )
    {};
in
  pkgs.mkShell {
    packages = [
      pkgs.SDL2
      pkgs.SDL2_ttf
      pkgs.c2ffi
    ];
    LD_LIBRARY_PATH = "${pkgs.SDL2}/lib:${pkgs.SDL2_ttf}/lib";
    /* libffi-types__gtove.c has an include for ffi/ffi.h; installing libffi
    would not work because ${pkgs.libffe.dev}/include contains "ffi.h" and
    not "ffi/ffi.h"; so the solution, for now, is to rely on MacOS default
    includes */
    C_INCLUDE_PATH = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/:${pkgs.SDL2_ttf}/include";
  }

Remove the already existing specs (autowrap will try to generate the spec files only if missing):

$ rm -f src/spec/SDL_ttf.*.spec

Load :SDL2-TTF (this will get autowrap to generate the various spec files:

$ sbcl \
	--load "sdl2-ttf.asd" \
	--eval "(ql:quickload '(:sdl2-ttf))" \
	--eval "(uiop:quit)"

Related issues

PS. autowrap file seems to refer to the header file by its wrong name, so I went on and renamed that to match what was used. Let me know if you instead preferred me to create a separate PR for that.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant