Update build scripts for MacOS Monterey; Use pkg-config on all platforms; MacOS no longer needs static libc++fs; Use gsed on MacOS

This commit is contained in:
shinyquagsire23 2021-11-05 19:58:55 -07:00
parent 1b75688d9a
commit ba7202457f
8 changed files with 24 additions and 17 deletions

View File

@ -19,7 +19,7 @@ jobs:
run: |
sudo apt update
sudo ACCEPT_EULA=Y apt -y --fix-missing --allow-downgrades upgrade
sudo apt -y --allow-downgrades install g++-8-multilib linux-libc-dev binutils-arm-none-eabi p7zip-full
sudo apt -y --allow-downgrades install g++-8-multilib linux-libc-dev binutils-arm-none-eabi p7zip-full pkg-config
sudo dpkg --add-architecture i386
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo add-apt-repository ppa:cybermax-dexter/sdl2-backport

3
.gitignore vendored
View File

@ -50,3 +50,6 @@ symbols.csv
files/**/*.c
*.o
*.naix
# MacOS garbage
.DS_Store

View File

@ -21,6 +21,7 @@ Building the ROM requires the following packages:
* wine (to run the mwcc executables)
* python3 (for asm preprocessor)
* libpng-devel (libpng-dev on Ubuntu)
* pkg-config
NOTE: If you are using Arch/Manjaro or Void you will only need base-devel instead of build-essentials or make or git. You will still need wine.
@ -48,6 +49,7 @@ You will still require the following packages:
* git
* build-essentials
* libpng-devel
* pkg-config
Install them using either the Cygwin package manager or using pacman on Msys2.
@ -55,24 +57,25 @@ Install them using either the Cygwin package manager or using pacman on Msys2.
#### macOS
**macOS 10.14 Mojave or older is required**. macOS 10.15 Catalina is not supported due to missing support for 32-bit binaries (thus making wine emulation unfeasible). You will also require the following packages:
macOS 10.15 Catalina and later is supported on Intel and ARM64 hardware configurations. On ARM64, Rosetta 2 must be installed, as well as the following dependencies:
* GNU coreutils
* GNU make
* LLVM 8 clang compiler
* gcc@5 (for mwasmarm_patcher)
* GNU sed
* LLVM clang compiler
* arm-gcc-bin
* git
* libpng
* wine-stable and xquartz dependency
* pkg-config
* wine-crossover (includes wine32on64, required on Catalina and later to run 32-bit x86 EXEs)
They can be installed with the following commands:
```console
$ brew tap osx-cross/homebrew-arm
$ brew tap homebrew/cask-versions
$ brew install make llvm@8 gcc@5 arm-gcc-bin libpng git
$ brew install --cask xquartz
$ brew install --cask --no-quarantine wine-stable
$ brew tap gcenx/wine
$ brew install coreutils make gnu-sed llvm arm-gcc-bin libpng git pkg-config
$ brew install wine-crossover
```
### 4. Build ROM
@ -99,9 +102,9 @@ Note: Docker may not run at a full performance if its underlying Linux kernel is
#### macOS
To avoid issues run the build as shown below. This avoids issues with missing features (i.e. "introduced in macOS 10.15" errors) and Apple's make not following standards.
To avoid issues, you will need to run the build as shown below. This avoids issues with missing features (i.e. "introduced in macOS 10.15" errors) and Apple's `make` being an older version.
```console
$ export PATH=/usr/local/opt/llvm@8/bin:$PATH CC=clang CXX=clang++
$ export PATH=${HOMEBREW_PREFIX}/opt/llvm/bin:$PATH CC=clang CXX=clang++
$ gmake
```

View File

@ -41,7 +41,7 @@ WINE := wine
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
GREP := grep -E
SED := perl -p -e
SED := gsed -r
else
GREP := grep -P
SED := sed -r

View File

@ -8,7 +8,7 @@ else
C_SRCS :=
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LDFLAGS += -lstdc++ -lc++ -lc /usr/local/opt/llvm@8/lib/libc++fs.a
LDFLAGS += -lstdc++ -lc++ -lc -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM
else
LDFLAGS += -lstdc++fs
endif

View File

@ -2,7 +2,7 @@
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
CC := gcc-5
CC := clang
else
CC := gcc
endif

View File

@ -5,7 +5,8 @@ LDFLAGS += -lstdc++fs
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LDFLAGS += -lstdc++ -lc++ -lc /usr/local/opt/llvm@8/lib/libc++fs.a
CXXFLAGS += -D_LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM
LDFLAGS += -lstdc++ -lc++ -lc
else
LDFLAGS += -lstdc++fs
endif

View File

@ -1,8 +1,8 @@
CC = gcc
CFLAGS = -Wall -Wextra -Werror -Wno-sign-compare -std=c11 -O2 -DPNG_SKIP_SETJMP_CHECK -D_CRT_SECURE_NO_WARNINGS
CFLAGS = -Wall -Wextra -Werror -Wno-sign-compare -std=c11 -O2 -DPNG_SKIP_SETJMP_CHECK $(shell pkg-config --cflags libpng)
LIBS = -lpng -lz
LIBS = $(shell pkg-config --libs libpng)
SRCS = main.c convert_png.c gfx.c jasc_pal.c lz.c rl.c util.c font.c huff.c json.c cJSON.c