From bdb24c711dd52246701d366179169bae5ebec873 Mon Sep 17 00:00:00 2001 From: marius david Date: Tue, 29 Aug 2023 13:44:34 +0200 Subject: [PATCH] Better installation instruction/script --- .github/workflows/build.yml | 12 ++++---- .gitignore | 1 + INSTALL.md | 8 +++-- Makefile | 15 +++++++++- flake.lock | 59 +++++++++++++++++++++++++++++++++++++ flake.nix | 28 ++++++++++++++++++ 6 files changed, 114 insertions(+), 9 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c33b6b4..f1bb917b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,14 +42,14 @@ jobs: mkdir -p ~/download cd ~/download wget https://cdn.discordapp.com/attachments/698589325620936736/845499146982129684/mwccarm.zip - wget https://cdn.discordapp.com/attachments/698589325620936736/722822401963851797/NitroSDK-3_2-060901.7z + wget https://cdn.discordapp.com/attachments/855279572651868170/875195363261292604/NitroSDK-4_2-071210-jp.7z unzip mwccarm.zip mv mwccarm $GITHUB_WORKSPACE/tools - 7z x NitroSDK-3_2-060901.7z - mv NitroSDK-3_2-060901/tools/bin $GITHUB_WORKSPACE/tools - mv NitroSDK-3_2-060901/include/nitro/specfiles/ARM7-TS.lcf.template $GITHUB_WORKSPACE/sub/ - mv NitroSDK-3_2-060901/include/nitro/specfiles/ARM9-TS.lcf.template $GITHUB_WORKSPACE/ - mv NitroSDK-3_2-060901/include/nitro/specfiles/mwldarm.response.template $GITHUB_WORKSPACE/ + 7z x NitroSDK-4_2-071210-jp.7z + mv NitroSDK-4_2-071210-jp/tools/bin $GITHUB_WORKSPACE/tools + mv NitroSDK-4_2-071210-jp/include/nitro/specfiles/ARM7-TS.lcf.template $GITHUB_WORKSPACE/sub/ + mv NitroSDK-4_2-071210-jp/include/nitro/specfiles/ARM9-TS.lcf.template $GITHUB_WORKSPACE/ + mv NitroSDK-4_2-071210-jp/include/nitro/specfiles/mwldarm.response.template $GITHUB_WORKSPACE/ working-directory: ~ - name: Build diff --git a/.gitignore b/.gitignore index 0c930433..4970f369 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ tools/bin/** # Build folder build/** sub/build/** +toolchain_tmp/ # Icon build files *.nbfp diff --git a/INSTALL.md b/INSTALL.md index 94f51995..1f4efc85 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -6,18 +6,22 @@ Using a terminal or Git client, clone this repository to your local device. All ## 1. Install MWCC compiler -The build system requires the use of the Metrowerks C Compiler versions 2.0/sp2p2 to compile matching files. We cannot distribute the correct compiler here, so join the PRET Discord, download the pinned `mwccarm.zip` zip in `#pokediamond`, and extract it to `tools/`. At the end of this operation, you should have the file `tools/mwccarm/2.0/sp2p2/mwccarm.exe`. Run each of the executables so they ask for a `license.dat`, and provide the one in the zip (it may also ask for it when compiling). This only needs to be done once. +Step 1 and 2 can also be executed automatically by running `make install_toolchain` + +The build system requires the use of the Metrowerks C Compiler versions 2.0/sp2p2 to compile matching files. We cannot distribute the correct compiler here, so join the PRET Discord, download the pinned `mwccarm.zip` zip in `#pokediamond`, and extract it to `tools/`. At the end of this operation, you should have the file `tools/mwccarm/2.0/sp2p2/mwccarm.exe`. In the future, a GCC option will be available so MWCC is not required to build; however, it is required for a matching ROM. ## 2. Install Nitro SDK -As with the compiler, the Nitro SDK is proprietary and cannot be distributed here. Download the `NitroSDK-4_2-071210-jp.7z` file pinned in the PRET Discord. Extract and copy the folder `tools/bin` from the Nitro SDK into the folder `tools` in your `pmd-sky` clone. At the end of this operation, you should have the file `tools/bin/makelcf.exe` inside your `pmd-sky` clone. Finally, copy `include/nitro/specfiles/ARM7-TS.lcf.template` into the subdirectory `sub`, and `include/nitro/specfiles/ARM9-TS.lcf.template` and `include/nitro/specfiles/mwldarm.response.template` into the project root. +As with the compiler, the Nitro SDK is proprietary and cannot be distributed here. Download the `NitroSDK-4_2-071210-jp.7z` file pinned in the PRET Discord in `#pokeheartgold`. Extract and copy the folder `tools/bin` from the Nitro SDK into the folder `tools` in your `pmd-sky` clone. At the end of this operation, you should have the file `tools/bin/makelcf.exe` inside your `pmd-sky` clone. Finally, copy `include/nitro/specfiles/ARM7-TS.lcf.template` into the subdirectory `sub`, and `include/nitro/specfiles/ARM9-TS.lcf.template` and `include/nitro/specfiles/mwldarm.response.template` into the project root. ## 3. Dependencies ### Linux +If you have Nix with flake support enabled, you can also use `nix develop` to start an environment with the tools present. + Building the ROM requires the following packages. If you cannot find one or more of these using your package distribution, it may be under a different name. * make diff --git a/Makefile b/Makefile index 509ffc09..4fec1c36 100644 --- a/Makefile +++ b/Makefile @@ -66,4 +66,17 @@ $(BANNER): $(BANNER_SPEC) $(ICON_PNG:%.png=%.nbfp) $(ICON_PNG:%.png=%.nbfc) compare: @$(MAKE) COMPARE=1 -.PHONY: compare +install_toolchain: + rm -rf toolchain_tmp + mkdir -p toolchain_tmp + wget https://cdn.discordapp.com/attachments/698589325620936736/845499146982129684/mwccarm.zip -O toolchain_tmp/mwccarm.zip + wget https://cdn.discordapp.com/attachments/855279572651868170/875195363261292604/NitroSDK-4_2-071210-jp.7z -O toolchain_tmp/NitroSDK-4_2-071210-jp.7z + unzip -o toolchain_tmp/mwccarm.zip -d tools + 7z x toolchain_tmp/NitroSDK-4_2-071210-jp.7z -otoolchain_tmp/nitro_sdk -y + mv toolchain_tmp/nitro_sdk/tools/bin/* tools/bin + mv toolchain_tmp/nitro_sdk/include/nitro/specfiles/ARM7-TS.lcf.template sub/ + mv toolchain_tmp/nitro_sdk/include/nitro/specfiles/ARM9-TS.lcf.template . + mv toolchain_tmp/nitro_sdk/include/nitro/specfiles/mwldarm.response.template . + rm -r toolchain_tmp + +.PHONY: compare install_toolchain diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..3f5c2671 --- /dev/null +++ b/flake.lock @@ -0,0 +1,59 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1692799911, + "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1693145325, + "narHash": "sha256-Gat9xskErH1zOcLjYMhSDBo0JTBZKfGS0xJlIRnj6Rc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "cddebdb60de376c1bdb7a4e6ee3d98355453fe56", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..688472d8 --- /dev/null +++ b/flake.nix @@ -0,0 +1,28 @@ +{ + description = "PMD-SKY decomp nix development shell"; + + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.simpleFlake rec { + inherit self nixpkgs; + name = "pmd-sky-shell"; + # Native shell instead of an arm-cross shell so utilities are properly compiled for host + shell = { pkgs }: pkgs.mkShell { + inherit name; + + nativeBuildInputs = [ + pkgs.git + pkgs.wineWowPackages.base # wine with both 32 and 64 bits support + pkgs.python3 + pkgs.pkg-config + pkgs.pkgsCross.arm-embedded.stdenv.cc.bintools # binutils + ]; + + buildInputs = [ + pkgs.libpng + pkgs.pugixml + ]; + }; + }; +} \ No newline at end of file