Skip to content

Commit b582523

Browse files
committed
fix(emacs-28): patch configure.ac to support latest libgccjit
When building Emacs 28.x the build script will attempt to patch configure.ac if needed to support the latest version of libgccjit which renamed libgccjit.so to libgccjit.dylib. Fixes jimeh#72
1 parent 4f1e748 commit b582523

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

build-emacs-for-macos

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,17 @@ class Build
671671
end
672672
end
673673

674+
if effective_version == 'emacs-28'
675+
p << {
676+
replace: [
677+
'configure.ac',
678+
'grep libgccjit.so\$))"',
679+
'grep -E \'libgccjit\.(so|dylib)$\'))"'
680+
],
681+
allow_failure: true
682+
}
683+
end
684+
674685
if effective_version == 'emacs-27'
675686
p << {
676687
url: 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
@@ -720,17 +731,34 @@ class Build
720731
err 'Patch replace input error' unless patch[:replace].size == 3
721732

722733
file, before, after = patch[:replace]
734+
info "Applying patch to #{file}..."
723735
filepath = File.join(target, file)
724736

725-
err "\"#{file}\" does not exist in #{target}" unless File.exist?(filepath)
737+
unless File.exist?(filepath)
738+
if patch[:allow_failure]
739+
info "File #{filepath} does not exist, skipping patch."
740+
return
741+
end
742+
743+
err "\"#{file}\" does not exist in #{target}"
744+
end
726745

727746
f = File.open(filepath, 'rb')
728747
s = f.read
729748
sub = s.gsub!(before, after)
730-
err "Replacement filed in #{file}" if sub.nil?
749+
750+
if sub.nil?
751+
if patch[:allow_failure]
752+
info 'Patch did not apply, skipping.'
753+
return
754+
end
755+
756+
err "Replacement failed in #{file}"
757+
end
731758

732759
f.reopen(filepath, 'wb').write(s)
733760
f.close
761+
info "#{file} patched."
734762
end
735763
end
736764

0 commit comments

Comments
 (0)