diff --git a/.github/workflows/gen_macos.yml b/.github/workflows/gen_macos.yml index 30b39ec69..6ee315760 100644 --- a/.github/workflows/gen_macos.yml +++ b/.github/workflows/gen_macos.yml @@ -14,7 +14,7 @@ jobs: build: strategy: fail-fast: false - runs-on: "macos-latest" + runs-on: "macos-11.0" steps: - name: "checkout repo" @@ -44,6 +44,13 @@ jobs: components: "rustfmt" env: ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" + - name: "Install Rust (ARM)" + shell: bash + run: | + export MACOSX_DEPLOYMENT_TARGET=10.9 + rustup target add aarch64-apple-darwin + + - name: "Install System Deps" shell: bash run: | @@ -58,18 +65,25 @@ jobs: cargo fmt --all -- --check - - name: "Build (Release mode)" + - name: "Build (Release mode Intel)" shell: bash run: | export MACOSX_DEPLOYMENT_TARGET=10.9 - cargo build --all --release + cargo build --target x86_64-apple-darwin --all --release + + + - name: "Build (Release mode ARM)" + shell: bash + run: | + export MACOSX_DEPLOYMENT_TARGET=10.9 + cargo build --target aarch64-apple-darwin --all --release - name: "Test (Release mode)" shell: bash run: | export MACOSX_DEPLOYMENT_TARGET=10.9 - cargo test --all --release + cargo test --target x86_64-apple-darwin --all --release - name: "Package" diff --git a/.github/workflows/gen_macos_continuous.yml b/.github/workflows/gen_macos_continuous.yml index 0f887574e..35e51bf2e 100644 --- a/.github/workflows/gen_macos_continuous.yml +++ b/.github/workflows/gen_macos_continuous.yml @@ -10,7 +10,7 @@ jobs: build: strategy: fail-fast: false - runs-on: "macos-latest" + runs-on: "macos-11.0" steps: - name: "checkout repo" @@ -44,6 +44,15 @@ jobs: components: "rustfmt" env: ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" + - name: "Install Rust (ARM)" + shell: bash + run: | + export BUILD_REASON=Schedule + export MACOSX_DEPLOYMENT_TARGET=10.9 + rustup target add aarch64-apple-darwin + + + - name: "Install System Deps" shell: bash run: | @@ -53,12 +62,21 @@ jobs: - - name: "Build (Release mode)" + - name: "Build (Release mode Intel)" shell: bash run: | export BUILD_REASON=Schedule export MACOSX_DEPLOYMENT_TARGET=10.9 - cargo build --all --release + cargo build --target x86_64-apple-darwin --all --release + + + + - name: "Build (Release mode ARM)" + shell: bash + run: | + export BUILD_REASON=Schedule + export MACOSX_DEPLOYMENT_TARGET=10.9 + cargo build --target aarch64-apple-darwin --all --release @@ -67,7 +85,7 @@ jobs: run: | export BUILD_REASON=Schedule export MACOSX_DEPLOYMENT_TARGET=10.9 - cargo test --all --release + cargo test --target x86_64-apple-darwin --all --release diff --git a/.github/workflows/gen_macos_tag.yml b/.github/workflows/gen_macos_tag.yml index df3900ab7..ec344fa44 100644 --- a/.github/workflows/gen_macos_tag.yml +++ b/.github/workflows/gen_macos_tag.yml @@ -11,7 +11,7 @@ jobs: build: strategy: fail-fast: false - runs-on: "macos-latest" + runs-on: "macos-11.0" steps: - name: "checkout repo" @@ -41,6 +41,13 @@ jobs: components: "rustfmt" env: ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" + - name: "Install Rust (ARM)" + shell: bash + run: | + export MACOSX_DEPLOYMENT_TARGET=10.9 + rustup target add aarch64-apple-darwin + + - name: "Install System Deps" shell: bash run: | @@ -48,18 +55,25 @@ jobs: ./get-deps - - name: "Build (Release mode)" + - name: "Build (Release mode Intel)" shell: bash run: | export MACOSX_DEPLOYMENT_TARGET=10.9 - cargo build --all --release + cargo build --target x86_64-apple-darwin --all --release + + + - name: "Build (Release mode ARM)" + shell: bash + run: | + export MACOSX_DEPLOYMENT_TARGET=10.9 + cargo build --target aarch64-apple-darwin --all --release - name: "Test (Release mode)" shell: bash run: | export MACOSX_DEPLOYMENT_TARGET=10.9 - cargo test --all --release + cargo test --target x86_64-apple-darwin --all --release - name: "Package" diff --git a/Cargo.lock b/Cargo.lock index f9f156fc7..6407b07ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2073,8 +2073,7 @@ dependencies = [ [[package]] name = "mlua" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12dc3300f9cb6d319059a5e94f9fcde2ee8dd803f225b92bed17b0c6fb15154" +source = "git+https://github.com/wez/mlua.git?branch=cross#24d9099ef70619c08099157b63812b33af16426d" dependencies = [ "bstr 0.2.14", "cc", diff --git a/Cargo.toml b/Cargo.toml index 77c5acc3a..aabefef46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,3 +4,7 @@ members = ["wezterm-mux-server", "wezterm", "wezterm-gui", "strip-ansi-escapes"] [profile.release] opt-level = 3 # debug = 1 + +[patch.crates-io] +# See: https://github.com/khvzak/mlua/pull/26 +mlua = { git = "https://github.com/wez/mlua.git", branch="cross" } diff --git a/ci/deploy.sh b/ci/deploy.sh index cc23253b5..85284bd65 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -24,10 +24,21 @@ case $OSTYPE in # and on M1/Big Sur, CGL is implemented in terms of Metal anyway rm $zipdir/WezTerm.app/*.dylib cp -r assets/shell-integration/* $zipdir/WezTerm.app - cp $TARGET_DIR/release/wezterm $zipdir/WezTerm.app - cp $TARGET_DIR/release/wezterm-mux-server $zipdir/WezTerm.app - cp $TARGET_DIR/release/wezterm-gui $zipdir/WezTerm.app - cp $TARGET_DIR/release/strip-ansi-escapes $zipdir/WezTerm.app + + for bin in wezterm wezterm-mux-server wezterm-gui strip-ansi-escapes ; do + # If the user ran a simple `cargo build --release`, then we want to allow + # a single-arch package to be built + if [[ -f target/release/$bin ]] ; then + cp target/release/$bin $zipdir/WezTerm.app/$bin + else + # The CI runs `cargo build --target XXX --release` which means that + # the binaries will be deployed in `target/XXX/release` instead of + # the plain path above. + # In that situation, we have two architectures to assemble into a + # Universal ("fat") binary, so we use the `lipo` tool for that. + lipo target/*/release/$bin -output $zipdir/WezTerm.app/$bin -create + fi + done zip -r $zipname $zipdir SHA256=$(shasum -a 256 $zipname | cut -d' ' -f1) diff --git a/ci/generate-workflows.py b/ci/generate-workflows.py index dc0a1bf45..2b88f45e6 100755 --- a/ci/generate-workflows.py +++ b/ci/generate-workflows.py @@ -214,11 +214,16 @@ ln -s /usr/local/git/bin/git /usr/local/bin/git env={"ACTIONS_ALLOW_UNSECURE_COMMANDS": "true"}, ), ] + if "macos" in self.name: + steps += [ + RunStep(name="Install Rust (ARM)", run="rustup target add aarch64-apple-darwin") + ] if cache: + cache_paths = ["~/.cargo/registry", "~/.cargo/git", "target"] steps += [ CacheStep( name="Cache cargo", - path="~/.cargo/registry\n~/.cargo/git\ntarget", + path="\n".join(cache_paths), key=f"{key_prefix}-cargo", ), ] @@ -244,9 +249,20 @@ PATH C:\\Strawberry\\perl\\bin;%PATH% cargo build --all --release""", ) ] + if "macos" in self.name: + return [ + RunStep( + name="Build (Release mode Intel)", + run="cargo build --target x86_64-apple-darwin --all --release"), + RunStep( + name="Build (Release mode ARM)", + run="cargo build --target aarch64-apple-darwin --all --release"), + ] return [RunStep(name="Build (Release mode)", run="cargo build --all --release")] def test_all_release(self): + if "macos" in self.name: + return [RunStep(name="Test (Release mode)", run="cargo test --target x86_64-apple-darwin --all --release")] return [RunStep(name="Test (Release mode)", run="cargo test --all --release")] def package(self): @@ -516,7 +532,7 @@ TARGETS = [ # Target(container="debian:8.11", continuous_only=True, bootstrap_git=True), Target(container="debian:9.12", continuous_only=True, bootstrap_git=True), Target(container="debian:10.3", continuous_only=True), - Target(name="macos", os="macos-latest"), + Target(name="macos", os="macos-11.0"), Target(container="fedora:31"), Target(container="fedora:32"), Target(container="fedora:33"), diff --git a/docs/changelog.markdown b/docs/changelog.markdown index 0af8d4d25..3d1f93ce7 100644 --- a/docs/changelog.markdown +++ b/docs/changelog.markdown @@ -39,6 +39,7 @@ brief notes about them may accumulate here. * Added `selection_word_boundary` option to control double-click word selection boundaries. The default is ` \t\n{[}]()\"'\``. [#405](https://github.com/wez/wezterm/issues/405) * Added support for Curly, Dotted and Dashed underlines. Vim users can set `let &t_Cs = "\e[4:3m"` in their `.vimrc` to enable undercurl support in wezterm. See [#415](https://github.com/wez/wezterm/issues/415) for more details on the escape sequences and configuration for this. * Fixed an issue where wezterm would spawn processes with `umask 077` on unix systems, rather than the more commonly expected `umask 022`. [#416](https://github.com/wez/wezterm/issues/416) +* macOS: We now ship a Universal binary containing both Intel and "Apple Silicon" architectures ### 20201101-103216-403d002d diff --git a/docs/install/macos.markdown b/docs/install/macos.markdown index dfec5ad5e..23f06e568 100644 --- a/docs/install/macos.markdown +++ b/docs/install/macos.markdown @@ -3,6 +3,10 @@ The CI system builds the package on macOS Mojave (10.14). It may run on earlier versions of macOS, but that has not been tested. +If you have an M1-based mac then it is recommended that you download the +Nightly build which is a Universal binary with support for both Apple Silicon +and Intel hardware. + Download for macOS Nightly for macOS 1. Download Release