Created
February 6, 2026 19:58
-
-
Save mengstr/c07205517541e83840e8408821bdad56 to your computer and use it in GitHub Desktop.
Steps for building UniPCemu from sources on Apple Silicon macOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| # UniPCemu unattended build script for Apple Silicon macOS (Homebrew) | |
| # Step 1: Install required build dependencies (SDL2 + autotools + GNU sed) | |
| brew install sdl2 pkg-config autoconf automake libtool gnu-sed | |
| # Step 2: Shallow-clone UniPCemu including all required submodules | |
| git clone --depth 1 --recurse-submodules --shallow-submodules \ | |
| https://bitbucket.org/superfury/unipcemu.git | |
| cd unipcemu | |
| # Step 3: Use GNU sed (gsed) instead of BSD sed to avoid makefile sed incompatibilities | |
| perl -pi -e 's/\bsed\b/gsed/g' commonemuframework/Makefile.linux | |
| # Step 4: Use pkg-config instead of sdl2-config for SDL2 flags on Homebrew macOS | |
| perl -pi -e 's/\bsdl2-config --cflags\b/pkg-config --cflags sdl2/g' commonemuframework/Makefile.linux | |
| perl -pi -e 's/\bsdl2-config --libs\b/pkg-config --libs sdl2/g' commonemuframework/Makefile.linux | |
| perl -pi -e 's/\bsdl2-config --static-libs\b/pkg-config --static --libs sdl2/g' commonemuframework/Makefile.linux | |
| # Step 5: Remove GCC-only compiler flag that clang does not understand | |
| perl -pi -e 's/\s*-enable-core-inline\b//g' commonemuframework/Makefile.linux | |
| # Step 6: Replace Linux-only malloc.h include with stdlib.h for macOS | |
| perl -pi -e 's@^\s*#include\s*<malloc\.h>.*$@#include <stdlib.h>@' commonemuframework/support/zalloc.c | |
| # Step 7: Generate configure script and configure UniPCemu (do NOT run commonemuframework/autogen.sh) | |
| cd UniPCemu | |
| autoreconf -fi | |
| ./configure | |
| # Step 8: Build using the linux make target; silence warnings via CC wrapper (do not override CFLAGS) | |
| make linux rebuild SDL2 CC="clang -w" | |
| # Step 9: Print the built binary path and run it (comment out exec if you only want to build) | |
| BIN="../../projects_build/UniPCemu/linux/UniPCemu" | |
| echo "Built: ${BIN}" | |
| exec "${BIN}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment