From ce1493c36b82442f6db6b5a8310322b20933cdeb Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 1 Jan 2025 18:38:34 -0800 Subject: [PATCH 1/3] Clone meson instead of asking users to download it This squash also removes the calcrom webhook, which serves no purpose at this stage of the project. --- .github/workflows/build.yml | 20 ++++------------ .gitignore | 1 + Dockerfile | 22 ++++-------------- INSTALL.md | 46 ++++++++++--------------------------- Makefile | 46 ++++++++++++++++++++++++++----------- tools/cw/meson.build | 8 +++---- 6 files changed, 59 insertions(+), 84 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8407f18ee2..603a459849 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,26 +11,24 @@ on: env: LM_LICENSE_FILE: "${{ github.workspace }}/tools/cw/license.dat" - CALCROM_DISCORD_WEBHOOK_AVATAR_URL: "https://i.imgur.com/38BQHdd.png" - CALCROM_DISCORD_WEBHOOK_USERNAME: "OK" - CALCROM_WEBHOOK_URL: "${{ secrets.WEBHOOKURL }}" BUILD: /var/tmp/pokeplatinum + WINEARCH: win32 jobs: build: permissions: contents: write - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Install Software run: | + sudo dpkg --add-architecture i386 sudo mkdir -pm755 /etc/apt/keyrings sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/$(lsb_release -cs)/winehq-$(lsb_release -cs).sources - sudo dpkg --add-architecture i386 sudo apt-get update -y - sudo apt-get install -y --install-recommends python3-pip ninja-build winehq-stable binutils-arm-none-eabi gcc-arm-none-eabi flex bison - pip install --user meson pyelftools + sudo apt-get install -y bison flex g++ gcc-arm-none-eabi git make ninja-build pkg-config python3 + sudo apt-get install -y --install-recommends winehq-stable - name: Checkout Repo uses: actions/checkout@v2 @@ -41,14 +39,6 @@ jobs: - name: Build Repo run: make check - - name: Webhook - if: ${{ github.event_name == 'push' }} - env: - arm9name: ${{ vars.BUILD }} - run: | - .github/calcrom/webhook.sh "$CALCROM_WEBHOOK_URL" "$BUILD" - continue-on-error: true - - name: Checkout xMAP if: ${{ github.event_name == 'push' }} uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index 20656bb43a..a0a0500725 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ /subprojects/narc/ /subprojects/metang/ /subprojects/rapidjson-*/ +/subprojects/meson-*/ # CLion folders .idea/ diff --git a/Dockerfile b/Dockerfile index 5a7cc5235f..ab3ce89216 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,14 @@ -FROM ubuntu:jammy +FROM ubuntu:noble RUN apt-get update -y -RUN apt-get install -y \ - git \ - build-essential \ - pkg-config \ - python3 \ - python3-venv \ - python3-pip \ - python-is-python3 \ - flex \ - bison \ - binutils-arm-none-eabi \ - gcc-arm-none-eabi \ - wget +RUN apt-get install -y bison flex g++ gcc-arm-none-eabi git make ninja-build pkg-config python3 wget ninja-build + RUN dpkg --add-architecture i386 RUN mkdir -pm755 /etc/apt/keyrings RUN wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key -RUN wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources +RUN wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/noble/winehq-noble.sources RUN apt-get update -y RUN apt-get install -y --install-recommends winehq-stable -RUN python -m venv .venv -RUN . .venv/bin/activate -RUN pip install meson ninja RUN hash -r CMD [ "/bin/sh" ] diff --git a/INSTALL.md b/INSTALL.md index 699da48100..b5177ee3be 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -118,27 +118,10 @@ install to a more recent version of `Ubuntu`: registry: ```bash - sudo apt install git flex bison build-essential binutils-arm-none-eabi gcc-arm-none-eabi ninja-build + apt install bison flex g++ gcc-arm-none-eabi git make ninja-build pkg-config python3 ``` -2. Run the following to install additional dependencies via `pip`: - - ```bash - sudo apt install pip - pip install --user meson - ``` - - You may see `pip` respond with a warning saying `"The script meson is -installed in '/home//.local/bin', which is not on PATH.` To resolve -this issue, run the following commands, filling `` -with the path reported by `pip` above: - - ```bash - echo 'export PATH=":$PATH"' >> ~/.bashrc - source ~/.bashrc - ``` - -3. [Download the repository](#2-downloading-the-repository). +2. [Download the repository](#2-downloading-the-repository). ### Windows with MSYS2 @@ -169,7 +152,7 @@ the following commands to install necessary build dependencies: ```bash echo 'export PATH=${PATH}:/mingw64/bin' >> ~/.bashrc source ~/.bashrc - pacman -S git meson gcc flex bison base-devel mingw-w64-x86_64-arm-none-eabi-{binutils,gcc} + pacman -S bison flex gcc git make ninja python mingw-w64-x86_64-arm-none-eabi-gcc ``` Press 'Y' when prompted to confirm the installation. @@ -191,7 +174,7 @@ the following commands: ```zsh brew update - brew install gcc@14 meson libpng pkg-config arm-none-eabi-binutils arm-none-eabi-gcc + brew install gcc@14 ninja libpng pkg-config arm-none-eabi-gcc brew install --cask wine-stable ``` @@ -228,36 +211,31 @@ the repository](#2-downloading-the-repository). sudo dpkg --add-architecture i386 sudo mkdir -pm755 /etc/apt/keyrings sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key + sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/$(lsb_release -cs)/winehq-$(lsb_release -cs).sources sudo apt update sudo apt install --install-recommends wine-stable ``` 2. Install the following packages via `apt`: - ```bash - sudo apt install git flex bison ninja-build build-essential binutils-arm-none-eabi gcc-arm-none-eabi pkg-config - ``` - -3. Install `meson` via `pip`: - - ```bash - pip3 install --user meson - echo "export PATH=~/.local/bin:$PATH" >> ~/.bashrc - source ~/.bashrc - ``` +```bash +sudo apt install bison flex g++ gcc-arm-none-eabi git make ninja-build pkg-config python3 +``` #### Arch Linux (and derivatives) +Enable the [multilib repository](https://wiki.archlinux.org/title/Multilib). + Install dependencies via `pacman`: ```bash -sudo pacman -S git flex bison build-essentials arm-none-eabi-binutils arm-none-eabi-gcc pkg-config wine meson +sudo pacman -S arm-none-eabi-gcc bison flex gcc git make ninja python wine ``` #### Fedora (and derivatives) ```bash -sudo yum install git flex bison gcc make arm-none-eabi-bintuils-cs arm-none-eabi-gcc-cs pkg-config wine meson ninja-build +sudo dnf install arm-none-eabi-gcc-cs bison flex gcc-c++ git make ninja-build python3 wine-core.i686 wine-core.x86_64 ``` ### Docker diff --git a/Makefile b/Makefile index f1ff12f16f..8de6d60aac 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,12 @@ -.PHONY: all release debug check rom data target format clean distclean setup_release setup_debug configure +.PHONY: all release debug check rom data target format clean distclean purge update setup_release setup_debug configure meson -MESON ?= meson -NINJA ?= ninja +MESON_VER := 1.7.0 +MESON_DIR := subprojects/meson-$(MESON_VER) +MESON_SUB := $(MESON_DIR)/meson.py + +MESON ?= $(MESON_SUB) WINELOADER ?= wine +GIT ?= git BUILD ?= build ROOT_INI := $(BUILD)/root.ini @@ -60,7 +64,7 @@ release: setup_release rom .NOTPARALLEL: debug debug: setup_debug rom - $(NINJA) -C $(BUILD) debug.nef overlay.map + $(MESON) compile -C $(BUILD) debug.nef overlay.map check: rom $(MESON) test -C $(BUILD) @@ -72,26 +76,34 @@ check: rom # generate data-targets first (archives and generated headers), then proceed # with compiling the ROM code. rom: $(BUILD)/build.ninja data - $(NINJA) -C $(BUILD) pokeplatinum.us.nds + $(MESON) compile -C $(BUILD) pokeplatinum.us.nds data: $(BUILD)/build.ninja - $(NINJA) -C $(BUILD) data + $(MESON) compile -C $(BUILD) data target: $(BUILD)/build.ninja - $(NINJA) -C $(BUILD) $(MESON_TARGET) + $(MESON) compile -C $(BUILD) $(MESON_TARGET) format: $(BUILD)/build.ninja - $(NINJA) -C $(BUILD) clang-format + $(MESON) compile -C $(BUILD) clang-format clean: $(BUILD)/build.ninja $(MESON) compile -C $(BUILD) --clean -update: $(BUILD)/build.ninja - $(MESON) subprojects update - distclean: rm -rf $(BUILD) $(MWRAP) +purge: distclean +ifeq ($(MESON),$(MESON_SUB)) + ! test -f $(MESON) || $(MESON) subprojects purge --confirm + rm -rf $(dir $(MESON_SUB)) +else + $(MESON) subprojects purge --confirm +endif + +update: meson + $(MESON) subprojects update + setup_release: $(BUILD)/build.ninja $(MESON) configure build -Dgdb_debugging=false @@ -100,7 +112,7 @@ setup_debug: $(BUILD)/build.ninja configure: $(BUILD)/build.ninja -$(BUILD)/build.ninja: $(ROOT_INI) $(DOT_MWCONFIG) | $(BUILD) +$(BUILD)/build.ninja: $(ROOT_INI) $(DOT_MWCONFIG) | $(BUILD) meson MWCONFIG=$(abspath $(DOT_MWCONFIG)) $(MESON) setup \ --wrap-mode=nopromote \ --native-file=meson/$(NATIVE) \ @@ -137,9 +149,17 @@ endif $(BUILD): mkdir -p -- $(BUILD) -$(MWRAP): +$(MWRAP): | meson rm -rf $(MWRAP) $(WRAP_BUILD) $(MESON) setup $(WRAP_BUILD) $(WRAP) $(MESON) compile -C $(WRAP_BUILD) install -m755 $(WRAP_BUILD)/$(@F) $@ rm -rf $(WRAP_BUILD) + +meson: ; +ifeq ($(MESON),$(MESON_SUB)) +meson: $(MESON_SUB) +endif + +$(MESON_SUB): + $(GIT) clone --depth=1 -b $(MESON_VER) https://github.com/mesonbuild/meson $(@D) diff --git a/tools/cw/meson.build b/tools/cw/meson.build index ff392fe2e5..e86fa4ee80 100644 --- a/tools/cw/meson.build +++ b/tools/cw/meson.build @@ -1,4 +1,4 @@ -project('metrowerks', ['c', 'cpp'], +project('metrowerks', 'c', default_options : ['warning_level=2']) if host_machine.system() == 'windows' @@ -6,13 +6,13 @@ if host_machine.system() == 'windows' '-mconsole', '-municode' ] - add_project_arguments(winflags, language : ['c', 'cpp']) - add_project_link_arguments(winflags, language : ['c', 'cpp']) + add_project_arguments(winflags, language : 'c') + add_project_link_arguments(winflags, language : 'c') add_project_arguments( '-DUNICODE', '-D_UNICODE', '-D_CRT_SECURE_NO_WARNINGS', - language : ['c', 'cpp']) + language : 'c') endif executable('mwrap', 'mwrap.c') From 46c4ec5845433e630501dd4a4da79e9ff83f7e92 Mon Sep 17 00:00:00 2001 From: Rachel Date: Thu, 13 Feb 2025 10:55:31 -0800 Subject: [PATCH 2/3] Directly invoke ninja for build targets instead of going through meson --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 8de6d60aac..1def4aea50 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ MESON_DIR := subprojects/meson-$(MESON_VER) MESON_SUB := $(MESON_DIR)/meson.py MESON ?= $(MESON_SUB) +NINJA ?= ninja WINELOADER ?= wine GIT ?= git @@ -64,7 +65,7 @@ release: setup_release rom .NOTPARALLEL: debug debug: setup_debug rom - $(MESON) compile -C $(BUILD) debug.nef overlay.map + $(NINJA) -C $(BUILD) debug.nef overlay.map check: rom $(MESON) test -C $(BUILD) @@ -76,16 +77,16 @@ check: rom # generate data-targets first (archives and generated headers), then proceed # with compiling the ROM code. rom: $(BUILD)/build.ninja data - $(MESON) compile -C $(BUILD) pokeplatinum.us.nds + $(NINJA) -C $(BUILD) pokeplatinum.us.nds data: $(BUILD)/build.ninja - $(MESON) compile -C $(BUILD) data + $(NINJA) -C $(BUILD) data target: $(BUILD)/build.ninja - $(MESON) compile -C $(BUILD) $(MESON_TARGET) + $(NINJA) -C $(BUILD) $(MESON_TARGET) format: $(BUILD)/build.ninja - $(MESON) compile -C $(BUILD) clang-format + $(NINJA) -C $(BUILD) clang-format clean: $(BUILD)/build.ninja $(MESON) compile -C $(BUILD) --clean From 3820258a4e73fd2e52d55d9037ff2f4b6b98d1c6 Mon Sep 17 00:00:00 2001 From: Rachel Date: Tue, 11 Mar 2025 10:25:11 -0700 Subject: [PATCH 3/3] Update NitroWiFi subproject wrap to satisfy meson subprojects update --- subprojects/NitroWiFi.wrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/NitroWiFi.wrap b/subprojects/NitroWiFi.wrap index b6e74e37d0..16a74e6792 100644 --- a/subprojects/NitroWiFi.wrap +++ b/subprojects/NitroWiFi.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://github.com/ntrtwl/NitroWiFi.git -revision = 8f4f0a60d5ecf6f7d90bfd1f85dce252ee12e692 +revision = 0bb999007564dbe913cb8f6df8bfb27ac775221f depth = 1 directory = NitroWiFi-2.1.30003