diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8407f18ee2..e92b7b9cd1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,16 +11,14 @@ 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: | @@ -29,8 +27,7 @@ jobs: 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 --install-recommends python3-pip wine32:i386 binutils-arm-none-eabi gcc-arm-none-eabi flex bison - name: Checkout Repo uses: actions/checkout@v2 @@ -41,14 +38,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/Dockerfile b/Dockerfile index 5588ad339c..b8667b88c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ 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 pip install -r requirements.txt COPY tools/cw/license.dat /etc/mwerks/license.dat ENV LM_LICENSE_FILE=/etc/mwerks/license.dat RUN hash -r diff --git a/INSTALL.md b/INSTALL.md index 02cb8ca8ad..04d16524a4 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -53,7 +53,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 git gcc flex bison base-devel mingw-w64-x86_64-arm-none-eabi-{binutils,gcc} ``` Press 'Y' when prompted to confirm the installation. @@ -153,27 +153,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 + sudo apt install git flex bison build-essential binutils-arm-none-eabi gcc-arm-none-eabi ``` -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). ### MacOS @@ -190,7 +173,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 libpng pkg-config arm-none-eabi-binutils arm-none-eabi-gcc brew install --cask wine-stable ``` @@ -209,12 +192,6 @@ GNU `coreutils` installed to run the build scripts: > Precise packages to be installed will vary by Linux distribution and > package registry. A handful of common distributions are listed below for > convenience. -> -> [!IMPORTANT] -> This project requires `meson` version `1.3.0` or higher. If the version of -> `meson` provided by your package manager is out of date, then follow -> [these instructions](https://mesonbuild.com/Getting-meson.html) to get the -> most recent version. Once you have installed all the above dependencies, proceed to [downloading the repository](#2-downloading-the-repository). @@ -234,15 +211,7 @@ the repository](#2-downloading-the-repository). 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 + sudo apt install git flex bison build-essential binutils-arm-none-eabi gcc-arm-none-eabi pkg-config ``` #### Arch Linux (and derivatives) @@ -250,13 +219,13 @@ the repository](#2-downloading-the-repository). 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 git flex bison build-essentials arm-none-eabi-binutils arm-none-eabi-gcc pkg-config 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 yum install git flex bison gcc make arm-none-eabi-bintuils-cs arm-none-eabi-gcc-cs pkg-config wine ``` ### Docker diff --git a/Makefile b/Makefile index 8d6fed5700..6128d69c16 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all release debug check rom target format clean distclean setup_release setup_debug configure +.PHONY: all release debug check rom target format clean distclean setup_release setup_debug configure venv MESON ?= meson NINJA ?= ninja @@ -17,6 +17,14 @@ UNAME_R := $(shell uname -r) UNAME_S := $(shell uname -s) CWD := $(shell pwd) +VENV ?= .venv +VENV_ACTIVATE := $(VENV)/bin/activate +VENV_MESON := . $(VENV_ACTIVATE) ; $(MESON) +VENV_NINJA := . $(VENV_ACTIVATE) ; $(NINJA) +VENV_PIP := . $(VENV_ACTIVATE) ; pip + +PIP_REQUIREMENTS := requirements.txt + ifneq (,$(findstring Microsoft,$(UNAME_R))) ifneq (,$(filter /mnt/%,$(CWD))) WSL_ACCESSING_WINDOWS := 0 @@ -56,39 +64,47 @@ release: setup_release rom .NOTPARALLEL: debug debug: setup_debug rom - $(MESON) compile -C $(BUILD) debug.nef overlay.map + $(VENV_MESON) compile -C $(BUILD) debug.nef overlay.map check: rom - $(MESON) test -C $(BUILD) + $(VENV_MESON) test -C $(BUILD) rom: $(BUILD)/build.ninja - $(MESON) compile -C $(BUILD) pokeplatinum.us.nds + $(VENV_MESON) compile -C $(BUILD) pokeplatinum.us.nds target: $(BUILD)/build.ninja - $(MESON) compile -C $(BUILD) $(MESON_TARGET) + $(VENV_MESON) compile -C $(BUILD) $(MESON_TARGET) format: $(BUILD)/build.ninja - $(NINJA) -C $(BUILD) clang-format + $(VENV_NINJA) -C $(BUILD) clang-format clean: $(BUILD)/build.ninja - $(MESON) compile -C $(BUILD) --clean + $(VENV_MESON) compile -C $(BUILD) --clean update: $(BUILD)/build.ninja - $(MESON) subprojects update + $(VENV_PIP) install --upgrade pip + $(VENV_PIP) install --upgrade -r $(PIP_REQUIREMENTS) + $(VENV_MESON) subprojects update distclean: - rm -rf $(BUILD) $(MWRAP) + rm -rf $(BUILD) $(MWRAP) $(VENV) setup_release: $(BUILD)/build.ninja - $(MESON) configure build -Dgdb_debugging=false + $(VENV_MESON) configure build -Dgdb_debugging=false setup_debug: $(BUILD)/build.ninja - $(MESON) configure build -Dgdb_debugging=true + $(VENV_MESON) configure build -Dgdb_debugging=true configure: $(BUILD)/build.ninja -$(BUILD)/build.ninja: $(ROOT_INI) $(DOT_MWCONFIG) | $(BUILD) - MWCONFIG=$(abspath $(DOT_MWCONFIG)) $(MESON) setup \ +venv: $(VENV_ACTIVATE) + +$(VENV_ACTIVATE): + python3 -m venv $(VENV) + . $(VENV_ACTIVATE) ; pip install -r $(PIP_REQUIREMENTS) + +$(BUILD)/build.ninja: $(ROOT_INI) $(DOT_MWCONFIG) $(VENV_ACTIVATE) | $(BUILD) + . $(VENV_ACTIVATE) ; MWCONFIG=$(abspath $(DOT_MWCONFIG)) $(MESON) setup \ --wrap-mode=nopromote \ --native-file=meson/$(NATIVE) \ --native-file=$(ROOT_INI) \ @@ -124,9 +140,9 @@ endif $(BUILD): mkdir -p -- $(BUILD) -$(MWRAP): +$(MWRAP): $(VENV_ACTIVATE) rm -rf $(MWRAP) $(WRAP_BUILD) - $(MESON) setup $(WRAP_BUILD) $(WRAP) - $(MESON) compile -C $(WRAP_BUILD) + $(VENV_MESON) setup $(WRAP_BUILD) $(WRAP) + $(VENV_MESON) compile -C $(WRAP_BUILD) install -m755 $(WRAP_BUILD)/$(@F) $@ rm -rf $(WRAP_BUILD) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000..3682e6b9de --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +meson >= 1.3.0 +ninja >= 1.11.0