Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch metang to python implementation as temp-fix for native Windows builds #349

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 94 additions & 55 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,33 @@
# Installation Instructions

<!--toc:start-->
- [Installation Instructions](#installation-instructions)
- [0. Preliminaries](#0-preliminaries)
- [1. Setting Up Your Development Environment](#1-setting-up-your-development-environment)
- [Windows with MSYS2](#windows-with-msys2)
- [Windows Subsystem for Linux](#windows-subsystem-for-linux)
- [New Installs](#new-installs)
- [Existing Installs](#existing-installs)
- [Install Build Dependencies](#install-build-dependencies)
- [MacOS](#macos)
- [Linux](#linux)
- [Ubuntu (and other Debian derivatives)](#ubuntu-and-other-debian-derivatives)
- [Arch Linux (and derivatives)](#arch-linux-and-derivatives)
- [Fedora (and derivatives)](#fedora-and-derivatives)
- [Docker](#docker)
- [2. Downloading the Repository](#2-downloading-the-repository)
- [3. Specifying a Compiler License](#3-specifying-a-compiler-license)
- [Windows (including WSL 1)](#windows-including-wsl-1)
- [Unix Systems](#unix-systems)
- [4. Building the Repository](#4-building-the-repository)
- [5. Debugger Support](#5-debugger-support)
- [Troubleshooting FAQ](#troubleshooting-faq)
- [My Build is Failing After Merging from Main](#my-build-is-failing-after-merging-from-main)
<!--toc:end-->

This document details the steps necessary to build a copy of Pokémon Platinum
(EN-US) using this repository.

## 0. Preliminaries
## Table of Contents

- [1. Setting Up Your Development Environment](#1-setting-up-your-development-environment)
- [Windows Subsystem for Linux](#windows-subsystem-for-linux)
- [New Installs](#new-installs)
- [Existing Installs](#existing-installs)
- [Install Build Dependencies](#install-build-dependencies)
- [Windows with MSYS2](#windows-with-msys2)
- [MacOS](#macos)
- [Linux](#linux)
- [Ubuntu (and other Debian derivatives)](#ubuntu-and-other-debian-derivatives)
- [Arch Linux (and derivatives)](#arch-linux-and-derivatives)
- [Fedora (and derivatives)](#fedora-and-derivatives)
- [Docker](#docker)
- [2. Downloading the Repository](#2-downloading-the-repository)
- [3. Specifying a Compiler License](#3-specifying-a-compiler-license)
- [Windows (including WSL 1)](#windows-including-wsl-1)
- [Unix Systems](#unix-systems)
- [4. Building the Repository](#4-building-the-repository)
- [5. Debugger Support](#5-debugger-support)
- [Troubleshooting FAQ](#troubleshooting-faq)
- [My Build is Failing After Merging from Main](#my-build-is-failing-after-merging-from-main)

## 1. Setting Up Your Development Environment

### Windows with MSYS2

1. Download the MSYS2 installer from [the official website](https://www.msys2.org/)
and install it on your system.

2. Once the installation is complete, a terminal should automatically pop up.
To update your package registry, enter the following command:

```bash
pacman -Syu
```

Press 'Y' when prompted to confirm the update. This process may take a few
minutes. Once completed, the terminal will automatically close.

3. Re-open an MSYS terminal (the pink icon) from your Start Menu, then enter
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}
```

Press 'Y' when prompted to confirm the installation.

4. [Download the repository](#2-downloading-the-repository).

### Windows Subsystem for Linux

> [!IMPORTANT]
Expand Down Expand Up @@ -175,6 +143,42 @@ with the path reported by `pip` above:
3. [Download the repository](#2-downloading-the-repository).
### Windows with MSYS2
> [!CAUTION]
> `MSYS2 is known to currently produce a non-matching ROM; proceed at your own
> risk, and heavily prefer to build using Windows Subsystem for Linux, if at all
> possible.
If you are unable to run Windows Subsystem for Linux due to performance reasons
or lacking virtualization requirements, then MSYS2 may be an option for you.
1. Download the MSYS2 installer from [the official website](https://www.msys2.org/)
and install it on your system.
2. Once the installation is complete, a terminal should automatically pop up.
To update your package registry, enter the following command:
```bash
pacman -Syu
```
Press 'Y' when prompted to confirm the update. This process may take a few
minutes. Once completed, the terminal will automatically close.
3. Re-open an MSYS terminal (the pink icon) from your Start Menu, then enter
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}
```
Press 'Y' when prompted to confirm the installation.
4. [Download the repository](#2-downloading-the-repository).
### MacOS
1. Apple bundles a number of the requisite utilities into Xcode Command Line Tools;
Expand Down Expand Up @@ -209,7 +213,7 @@ 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.5.0` or higher. If the version of
> `meson` provided by your package manager is out of date, then follow
Expand Down Expand Up @@ -261,6 +265,11 @@ sudo yum install git flex bison gcc make arm-none-eabi-bintuils-cs arm-none-eabi
### Docker
> [!CAUTION]
> The Docker build method is currently unmaintained and unsupported. Proceed at
> your own risk, and know that you may not receive much support from repository
> maintainers.
A `Dockerfile` is provided with the repository should you choose to build the
project as a container. If you do not have `docker` installed on your machine
and wish to make use of this feature, follow the instructions [here](https://docs.docker.com/desktop/).
Expand Down Expand Up @@ -375,3 +384,33 @@ make update
```
And then try rebuilding.
### Meson Replies With `ERROR: Unknown compiler(s)`
Example error message:
```
meson.build:1:0: ERROR: Unknown compiler(s): [['/mnt/c/pokeplatinum/tools/cw/mwrap', 'mwccarm']]
```
Meson provides some basic logging for its configuration process in
`build/meson-logs/meson-log.txt`. In that file, you should see some entries that
begin with `Detecting compiler via: ...`, which will give some insight into the
root of the error. For example:
```
Detecting compiler via: `/mnt/c/pokeplatinum/tools/cw/mwrap mwccarm --version` -> 1
stderr:
wine: '/home/<USER>/.wine' is a 64-bit installation, it cannot be used with a 32-bit wineserver.
-----------
meson.build:1:0: ERROR: Unknown compiler(s): [['/mnt/c/pokeplatinum/tools/cw/mwrap', 'mwccarm']]
```
In this instance, the user has installed 64-bit `wine`. Ensure that you have
installed 32-bit `wine`, then rebuild _after_ removing the prefix directory
using the following command:
```
rm -rf ~/.wine
```
2 changes: 2 additions & 0 deletions generated/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

# This must be declared here instead of in tools/meson.build, as some tools depend
# on metang-generated constants.
subproject('metang')

metang_exe = find_program('metang', native: true)

enum_generators = {
Expand Down
2 changes: 1 addition & 1 deletion subprojects/metang.wrap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[wrap-git]
url = https://github.com/lhearachel/metang.git
revision = main
revision = python
depth = 1

[provide]
Expand Down