From 4d363621a8341db2de4018d97d7b464bf2e0a85e Mon Sep 17 00:00:00 2001 From: TerminalCursor <49042904+TerminalCursor@users.noreply.github.com> Date: Thu, 2 Feb 2023 10:47:37 -0800 Subject: [PATCH 1/3] Add files via upload --- shell.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 shell.nix diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..31006cd6 --- /dev/null +++ b/shell.nix @@ -0,0 +1,19 @@ +with (import {}); + +let + nixgl = import (builtins.fetchTarball https://github.com/guibou/nixGL/archive/main.tar.gz) {}; + my-py-pkgs = py-pkgs: with py-pkgs; [ + pillow + pyyaml + ]; + py-packaged = python3.withPackages my-py-pkgs; +in +mkShell { + buildInputs = [ + py-packaged + SDL2 + SDL2.dev + clang + nixgl.auto.nixGLDefault + ]; +} From d7c088d432e0fbdeebe7b96d687d8a5591c540fb Mon Sep 17 00:00:00 2001 From: TerminalCursor <49042904+TerminalCursor@users.noreply.github.com> Date: Thu, 2 Feb 2023 10:53:54 -0800 Subject: [PATCH 2/3] Add Nix Shell build and running instructions --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index fee61e3d..c8503cdf 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,38 @@ Same Steps 1-7 above
10. Choose "build > build Zelda3" in the menu to create `zelda3.exe` in the "/bin/release" subfolder
11. Configure with `zelda3.ini` in the main dir
+## Compiling on Linux with Nix +1. Open a terminal +2. Clone the repo and `cd` into it +```sh +git clone https://github.com/snesrev/zelda3 +cd zelda3 +``` +3. Place your US ROM file named `zelda3.sfc` in `zelda3/tables` +4. Enter the nix shell environment +```sh +nix-shell +``` +5. Compile +```sh +make +``` +6. Running the executable with the proper graphics driver +```sh +nixGL ./zelda3 +``` +
+ +Advanced make usage ... + + +```sh +make -j$(nproc) # run on all core +make clean all # clear gen+obj and rebuild +CC=clang make # specify compiler +``` +
+ ## Installing libraries on Linux/MacOS 1. Open a terminal 2. Install pip if not already installed From 4cd0da19174bc7e67a0ad92627b124b44415168c Mon Sep 17 00:00:00 2001 From: TerminalCursor <49042904+TerminalCursor@users.noreply.github.com> Date: Thu, 2 Feb 2023 20:25:07 -0800 Subject: [PATCH 3/3] Explicit Packaging --- shell.nix | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/shell.nix b/shell.nix index 31006cd6..a6fa91e1 100644 --- a/shell.nix +++ b/shell.nix @@ -7,13 +7,41 @@ let pyyaml ]; py-packaged = python3.withPackages my-py-pkgs; + libPath = with pkgs; lib.makeLibraryPath [ + libGL + xorg.libX11 + xorg.libX11.dev + xorg.libXcursor + xorg.libXrender + xorg.libXfixes + xorg.libXi + xorg.libxcb + xorg.libXScrnSaver + xorg.libpthreadstubs + xorg.libXext + xorg.libXrandr + xorg.libXau + xorg.libXdmcp + libxkbcommon + ]; in mkShell { buildInputs = [ py-packaged SDL2 SDL2.dev - clang + xorg.libX11 + xorg.libX11.dev + xorg.libXcursor + xorg.libXScrnSaver + xorg.libXi + xorg.libXrandr + xorg.libxcb + libxkbcommon + libGL + gcc nixgl.auto.nixGLDefault ]; + LD_LIBRARY_PATH = libPath; + LDFLAGS = "-lpthread -lrt"; }