Streamline dependency building on macOS

This commit is contained in:
Struma 2021-01-03 00:32:58 -05:00 committed by Roza
parent cc337afb81
commit a7331517c3
5 changed files with 34 additions and 36 deletions

View file

@ -87,7 +87,7 @@ sigcxx: init_dirs $(LIBDIR)/libsigc-2.0.a
$(LIBDIR)/libsigc-2.0.a: $(DOWNLOADS)/sigcxx/Makefile
cd $(DOWNLOADS)/sigcxx; \
make; make install
$(CONFIGURE_ENV) make; $(CONFIGURE_ENV) make install
$(DOWNLOADS)/sigcxx/Makefile: $(DOWNLOADS)/sigcxx/autogen.sh
cd $(DOWNLOADS)/sigcxx; \
@ -262,11 +262,11 @@ $(DOWNLOADS)/openssl/Configure:
cd $(DOWNLOADS)/openssl; git checkout OpenSSL_1_1_1i
# Standard ruby
ruby: init_dirs $(LIBDIR)/libruby.3.0.dylib openssl
ruby: init_dirs openssl $(LIBDIR)/libruby.3.0.dylib
$(LIBDIR)/libruby.3.0.dylib: $(DOWNLOADS)/ruby/Makefile
cd $(DOWNLOADS)/ruby; \
make -j$(NPROC); make install
$(CONFIGURE_ENV) make -j$(NPROC); $(CONFIGURE_ENV) make install
# Make the dylib relative
install_name_tool -id @rpath/libruby.3.0.dylib $(LIBDIR)/libruby.3.0.dylib

21
macos/Dependencies/setup Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env ruby
HOST = `clang -dumpmachine`.strip
ARCH = HOST[/x86_64|arm64/]
def run_build(arch)
case arch
when "x86_64"
return system("make everything -f .Intel")
when "arm64"
code = system("make everything -f .AppleSilicon")
return code if !code
code = (system("arch -x86_64 make everything -f .Intel"))
return code if !code
return system("./make_macuniversal")
else
raise "Unsupported architecture"
end
end
exit(run_build(ARCH) ? 0 : 1)

View file

@ -1,34 +1,4 @@
This folder contains an experimental Xcode project that will build mkxp-z and all of its dependencies.
Currently, building the Apple Silicon and Universal schemes requires an ARM Mac on hand.
Currently, building mkxp-z for ARM requires an ARM Mac on hand.
This is primarily because libsigc++ doesn't properly cross-compile when you ask it to.
To get all dependencies, cd to the `Dependencies` folder and run:
```sh
# This will download all the required tools
# for building the dependencies
brew bundle
# Intel Macs
make everything -f .Intel
# ARM Macs
make everything -f .AppleSilicon
# Create universal libraries (For the universal build)
make everything -f .AppleSilicon
arch -x86_64 make everything -f .Intel
./make_macuniversal.command
# Use your own Ruby, and build everything else (for Intel Macs)
make custom-ruby -f .Intel RUBY_PATH="Path to Ruby" RUBY_FLAGS="extra configure arguments"
make deps-core -f .Intel
```
Afterwards, simply open the Xcode project, select the scheme you'd like to use
and hit Command+B.
If you built a version of ruby >= 2, change the MRI_VERSION build setting to match.
If you built 1.8, select the PlayerLegacy scheme.
To get all dependencies, all you need to do is run `setup.command`.
Then you can open the Xcode project and build it.

7
macos/setup.command Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
# https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR/Dependencies"
./setup