Skip to content

Commit

Permalink
Fixes Linux builds
Browse files Browse the repository at this point in the history
Since Homebrew 4.4.0 dropped `MacOS` var when using Linuxbrew, which in turn means this formula is broken on
Linux. The patch is simply adding a conditional check before attempting to use `MacOS` as well extending test
matrix to include Linux.
  • Loading branch information
mishok13 authored and d12frosted committed Nov 19, 2024
1 parent b963aae commit d6a78b9
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 14 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/emacs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,19 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12]
os:
- macos-12
- ubuntu-latest
build_opts:
- ""
- "--build-from-source"
- "--with-spacemacs-icon"
include:
- os: macos-12
logs: "~/Library/Logs/Homebrew"
- os: ubuntu-latest
logs: "~/.cache/Homebrew/Logs"
extra_opts: "--without-cocoa"

env:
HOMEBREW_GITHUB_REF: ${{ github.head_ref || github.ref }}
Expand All @@ -35,8 +43,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master
if: matrix.os == 'ubuntu-latest'

- name: Build emacs-plus ${{ matrix.build_opts }}
run: brew install Aliases/$(readlink Aliases/emacs-plus) ${{ matrix.build_opts }} --verbose
run: brew install Aliases/$(readlink Aliases/emacs-plus) ${{ matrix.build_opts }} ${{ matrix.extra_opts }} --verbose

- name: Test installation
run: $(brew --prefix)/bin/emacs --batch --eval='(print (+ 2 2))'
Expand All @@ -48,7 +60,7 @@ jobs:
echo "build_opts=$BUILD_OPTS" >> "$GITHUB_ENV"
RUNNER_OS=$(echo "${{ matrix.os }}" | sed 's/ //')
echo "runner_os=$RUNNER_OS" >> "$GITHUB_ENV"
tar -C ~/Library/Logs/Homebrew/emacs-plus@29/ -czvf ~/Library/Logs/Homebrew/emacs-plus-$RUNNER_OS$BUILD_OPTS.tar.gz .
tar -C ${{ matrix.logs}}/emacs-plus@29/ -czvf emacs-plus@29-$RUNNER_OS$BUILD_OPTS.tar.gz .
- name: Upload logs
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def install
system "./configure", *args

# Disable aligned_alloc on Mojave. See issue: https://github.com/daviderestivo/homebrew-emacs-head/issues/15
if MacOS.version <= :mojave
if OS.mac? && MacOS.version <= :mojave
ohai "Force disabling of aligned_alloc on macOS <= Mojave"
configure_h_filtered = File.read("src/config.h")
.gsub("#define HAVE_ALIGNED_ALLOC 1", "#undef HAVE_ALIGNED_ALLOC")
Expand Down
4 changes: 2 additions & 2 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def install
system "./configure", *args

# Disable aligned_alloc on Mojave. See issue: https://github.com/daviderestivo/homebrew-emacs-head/issues/15
if MacOS.version <= :mojave
if OS.mac? && MacOS.version <= :mojave
ohai "Force disabling of aligned_alloc on macOS <= Mojave"
configure_h_filtered = File.read("src/config.h")
.gsub("#define HAVE_ALIGNED_ALLOC 1", "#undef HAVE_ALIGNED_ALLOC")
Expand Down Expand Up @@ -183,7 +183,7 @@ def install
system "./configure", *args

# Disable aligned_alloc on Mojave. See issue: https://github.com/daviderestivo/homebrew-emacs-head/issues/15
if MacOS.version <= :mojave
if OS.mac? && MacOS.version <= :mojave
ohai "Force disabling of aligned_alloc on macOS <= Mojave"
configure_h_filtered = File.read("src/config.h")
.gsub("#define HAVE_ALIGNED_ALLOC 1", "#undef HAVE_ALIGNED_ALLOC")
Expand Down
4 changes: 2 additions & 2 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def install
system "./configure", *args

# Disable aligned_alloc on Mojave. See issue: https://github.com/daviderestivo/homebrew-emacs-head/issues/15
if MacOS.version <= :mojave
if OS.mac? && MacOS.version <= :mojave
ohai "Force disabling of aligned_alloc on macOS <= Mojave"
configure_h_filtered = File.read("src/config.h")
.gsub("#define HAVE_ALIGNED_ALLOC 1", "#undef HAVE_ALIGNED_ALLOC")
Expand Down Expand Up @@ -228,7 +228,7 @@ def install
system "./configure", *args

# Disable aligned_alloc on Mojave. See issue: https://github.com/daviderestivo/homebrew-emacs-head/issues/15
if MacOS.version <= :mojave
if OS.mac? && MacOS.version <= :mojave
ohai "Force disabling of aligned_alloc on macOS <= Mojave"
configure_h_filtered = File.read("src/config.h")
.gsub("#define HAVE_ALIGNED_ALLOC 1", "#undef HAVE_ALIGNED_ALLOC")
Expand Down
4 changes: 2 additions & 2 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def install
system "./configure", *args

# Disable aligned_alloc on Mojave. See issue: https://github.com/daviderestivo/homebrew-emacs-head/issues/15
if MacOS.version <= :mojave
if OS.mac? && MacOS.version <= :mojave
ohai "Force disabling of aligned_alloc on macOS <= Mojave"
configure_h_filtered = File.read("src/config.h")
.gsub("#define HAVE_ALIGNED_ALLOC 1", "#undef HAVE_ALIGNED_ALLOC")
Expand Down Expand Up @@ -228,7 +228,7 @@ def install
system "./configure", *args

# Disable aligned_alloc on Mojave. See issue: https://github.com/daviderestivo/homebrew-emacs-head/issues/15
if MacOS.version <= :mojave
if OS.mac? && MacOS.version <= :mojave
ohai "Force disabling of aligned_alloc on macOS <= Mojave"
configure_h_filtered = File.read("src/config.h")
.gsub("#define HAVE_ALIGNED_ALLOC 1", "#undef HAVE_ALIGNED_ALLOC")
Expand Down
4 changes: 2 additions & 2 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def install
system "./configure", *args

# Disable aligned_alloc on Mojave. See issue: https://github.com/daviderestivo/homebrew-emacs-head/issues/15
if MacOS.version <= :mojave
if OS.mac? && MacOS.version <= :mojave
ohai "Force disabling of aligned_alloc on macOS <= Mojave"
configure_h_filtered = File.read("src/config.h")
.gsub("#define HAVE_ALIGNED_ALLOC 1", "#undef HAVE_ALIGNED_ALLOC")
Expand Down Expand Up @@ -242,7 +242,7 @@ def install
system "./configure", *args

# Disable aligned_alloc on Mojave. See issue: https://github.com/daviderestivo/homebrew-emacs-head/issues/15
if MacOS.version <= :mojave
if OS.mac? && MacOS.version <= :mojave
ohai "Force disabling of aligned_alloc on macOS <= Mojave"
configure_h_filtered = File.read("src/config.h")
.gsub("#define HAVE_ALIGNED_ALLOC 1", "#undef HAVE_ALIGNED_ALLOC")
Expand Down
4 changes: 2 additions & 2 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def install
system "./configure", *args

# Disable aligned_alloc on Mojave. See issue: https://github.com/daviderestivo/homebrew-emacs-head/issues/15
if MacOS.version <= :mojave
if OS.mac? && MacOS.version <= :mojave
ohai "Force disabling of aligned_alloc on macOS <= Mojave"
configure_h_filtered = File.read("src/config.h")
.gsub("#define HAVE_ALIGNED_ALLOC 1", "#undef HAVE_ALIGNED_ALLOC")
Expand Down Expand Up @@ -234,7 +234,7 @@ def install
system "./configure", *args

# Disable aligned_alloc on Mojave. See issue: https://github.com/daviderestivo/homebrew-emacs-head/issues/15
if MacOS.version <= :mojave
if OS.mac? && MacOS.version <= :mojave
ohai "Force disabling of aligned_alloc on macOS <= Mojave"
configure_h_filtered = File.read("src/config.h")
.gsub("#define HAVE_ALIGNED_ALLOC 1", "#undef HAVE_ALIGNED_ALLOC")
Expand Down

0 comments on commit d6a78b9

Please sign in to comment.