Compare commits

...

8 Commits
0.4.6 ... 0.4.9

Author SHA1 Message Date
f1fc68c8f5 chore(release): 0.4.9 2021-04-08 12:03:41 +01:00
e19a6a7bc2 fix(cli): default to "master" if no git ref is given
Fixes #35
2021-04-08 12:02:45 +01:00
1000999eb2 fix(native_comp): skip symlink creation for recent builds which do not need symlinks
Recent builds places the native-lisp cache folder within
Contents/Resources on macOS, and correctly deals with finding them. This
means the Contents/lisp and Contents/native-lisp symlinks are no longer
needed.

Hence we skip their creation altogether if we find any
Contents/Resources/native-lisp/**/*.eln files.
2021-04-08 11:54:01 +01:00
a75047fb3a chore(release): 0.4.8 2021-02-27 23:09:58 +00:00
a1641946e4 chore(native_comp): don't set full AOT env vars if not using native-comp 2021-02-27 23:08:15 +00:00
581594da3c fix(native_comp): add support for new --with-native-compilation flag 2021-02-27 23:07:22 +00:00
bdad382e7f chore(release): 0.4.7 2021-02-21 15:24:31 +00:00
e25ceaa7e2 fix(native_comp): add libgccjit include dir during build stage
Also used existing `CFLAGS` and `LDFLAGS` environment variable values,
so a user can easily set these when running the build script to add more
paths. Previously they were set to explicit values ignoring any existing
value.

This might help resolve issues where libgccjit.h is not found as
reported in issue #20. Though I have not been able to reproduce this
myself, it seems adding the libgccjit's include dir has solved the issue
for some.
2021-02-21 15:22:07 +00:00
2 changed files with 69 additions and 34 deletions

View File

@@ -2,6 +2,28 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.4.9](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.8...0.4.9) (2021-04-08)
### Bug Fixes
* **cli:** default to "master" if no git ref is given ([e19a6a7](https://github.com/jimeh/build-emacs-for-macos/commit/e19a6a7bc24379292ee06ae4c805b8c5365f2d97)), closes [#35](https://github.com/jimeh/build-emacs-for-macos/issues/35)
* **native_comp:** skip symlink creation for recent builds which do not need symlinks ([1000999](https://github.com/jimeh/build-emacs-for-macos/commit/1000999eb2673dc207a390ff3f902b9987b99173))
### [0.4.8](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.7...0.4.8) (2021-02-27)
### Bug Fixes
* **native_comp:** add support for new --with-native-compilation flag ([581594d](https://github.com/jimeh/build-emacs-for-macos/commit/581594da3cfbf1dd2fa28e91710b767e21ff75d2))
### [0.4.7](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.6...0.4.7) (2021-02-21)
### Bug Fixes
* **native_comp:** add libgccjit include dir during build stage ([e25ceaa](https://github.com/jimeh/build-emacs-for-macos/commit/e25ceaa7e25b0e1b9947401597845b5ba43e6cd1)), closes [#20](https://github.com/jimeh/build-emacs-for-macos/issues/20)
### [0.4.6](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.5...0.4.6) (2021-02-15) ### [0.4.6](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.5...0.4.6) (2021-02-15)

View File

@@ -180,14 +180,20 @@ class Build
@configure_help @configure_help
end end
def supports_native_comp?
@supports_native_comp ||= !!configure_help.match(/\s+--with-nativecomp\s+/)
end
def supports_xwidgets? def supports_xwidgets?
@supports_xwidgets ||= !!configure_help.match(/\s+--with-xwidgets\s+/) @supports_xwidgets ||= !!configure_help.match(/\s+--with-xwidgets\s+/)
end end
def supports_native_comp?
@supports_native_comp ||= !native_comp_configure_flag.nil?
end
def native_comp_configure_flag
@native_comp_configure_flag ||= configure_help.match(
/\s+(--with-native(?:comp|-compilation))\s+/
)&.[](1)
end
def detect_native_comp def detect_native_comp
info 'Detecting native-comp support: ', newline: false info 'Detecting native-comp support: ', newline: false
options[:native_comp] = supports_native_comp? options[:native_comp] = supports_native_comp?
@@ -200,14 +206,6 @@ class Build
err 'This emacs source tree does not support native-comp' err 'This emacs source tree does not support native-comp'
end end
def gcc_library_paths
@gcc_library_paths ||= [
gcc_info.lib_dir,
gcc_info.darwin_lib_dir,
gcc_info.libgccjit_lib_dir
]
end
def autogen def autogen
FileUtils.cd(source_dir) do FileUtils.cd(source_dir) do
if File.exist?('autogen/copy_autogen') if File.exist?('autogen/copy_autogen')
@@ -219,10 +217,10 @@ class Build
end end
def compile_source(source) def compile_source(source)
target = "#{source}/nextstep" target = File.join(source, 'nextstep')
emacs_app = "#{target}/Emacs.app" emacs_app = File.join(target, 'Emacs.app')
if File.exist?("#{target}/Emacs.app") if File.exist?(emacs_app)
info 'Emacs.app already exists in ' \ info 'Emacs.app already exists in ' \
"\"#{target.gsub(root_dir + '/', '')}\", attempting to use." "\"#{target.gsub(root_dir + '/', '')}\", attempting to use."
return emacs_app return emacs_app
@@ -240,20 +238,27 @@ class Build
ENV['CFLAGS'] = [ ENV['CFLAGS'] = [
"-I#{File.join(gcc_info.root_dir, 'include')}", "-I#{File.join(gcc_info.root_dir, 'include')}",
"-I#{File.join(gcc_info.libgccjit_root_dir, 'include')}",
'-O2', '-O2',
'-march=native' '-march=native',
ENV['CFLAGS']
].compact.join(' ') ].compact.join(' ')
ENV['LDFLAGS'] = [ ENV['LDFLAGS'] = [
gcc_library_paths.map { |path| "-L#{path}" }, "-L#{gcc_info.lib_dir}",
"-L#{gcc_info.darwin_lib_dir}",
"-L#{gcc_info.libgccjit_lib_dir}",
"-I#{File.join(gcc_info.root_dir, 'include')}", "-I#{File.join(gcc_info.root_dir, 'include')}",
"-I#{File.join(gcc_info.libgccjit_root_dir, 'include')}" "-I#{File.join(gcc_info.libgccjit_root_dir, 'include')}",
].flatten.compact.join(' ') ENV['LDFLAGS']
].compact.join(' ')
ENV['LIBRARY_PATH'] = [ ENV['LIBRARY_PATH'] = [
gcc_library_paths, gcc_info.lib_dir,
gcc_info.darwin_lib_dir,
gcc_info.libgccjit_lib_dir,
ENV['LIBRARY_PATH'] ENV['LIBRARY_PATH']
].flatten.compact.join(':') ].compact.join(':')
end end
ENV['CC'] = 'clang' ENV['CC'] = 'clang'
@@ -293,7 +298,7 @@ class Build
if options[:xwidgets] && supports_xwidgets? if options[:xwidgets] && supports_xwidgets?
configure_flags << '--with-xwidgets' configure_flags << '--with-xwidgets'
end end
configure_flags << '--with-nativecomp' if options[:native_comp] configure_flags << native_comp_configure_flag if options[:native_comp]
configure_flags << '--without-rsvg' unless options[:rsvg] configure_flags << '--without-rsvg' unless options[:rsvg]
run_cmd './configure', *configure_flags run_cmd './configure', *configure_flags
@@ -309,17 +314,17 @@ class Build
make_flags = [] make_flags = []
make_flags += ['-j', options[:parallel].to_s] if options[:parallel] make_flags += ['-j', options[:parallel].to_s] if options[:parallel]
if options[:native_full_aot]
info 'Using NATIVE_FULL_AOT=1'
make_flags << 'NATIVE_FULL_AOT=1'
ENV.delete('NATIVE_FAST_BOOT')
else
ENV.delete('NATIVE_FULL_AOT')
ENV['NATIVE_FAST_BOOT'] = '1'
end
if options[:native_comp] if options[:native_comp]
make_flags << "BYTE_COMPILE_EXTRA_FLAGS=--eval '(setq comp-speed 2)'" make_flags << "BYTE_COMPILE_EXTRA_FLAGS=--eval '(setq comp-speed 2)'"
if options[:native_full_aot]
info 'Using NATIVE_FULL_AOT=1'
make_flags << 'NATIVE_FULL_AOT=1'
ENV.delete('NATIVE_FAST_BOOT')
else
ENV.delete('NATIVE_FULL_AOT')
ENV['NATIVE_FAST_BOOT'] = '1'
end
end end
run_cmd 'make', *make_flags run_cmd 'make', *make_flags
@@ -334,13 +339,20 @@ class Build
def symlink_internals(app) def symlink_internals(app)
return unless options[:native_comp] return unless options[:native_comp]
info 'Creating symlinks within Emacs.app needed for native-comp'
FileUtils.cd(File.join(app, 'Contents')) do FileUtils.cd(File.join(app, 'Contents')) do
# Skip creation of symlinks if *.eln files are located under
# Resources/native-lisp. Emacs is capable of finding lisp sources and
# *.eln cache files without symlinks.
return if Dir['Resources/native-lisp/**/*.eln'].any?
info 'Creating symlinks within Emacs.app needed for native-comp'
FileUtils.ln_s('Resources/lisp', 'lisp') unless File.exist?('lisp') FileUtils.ln_s('Resources/lisp', 'lisp') unless File.exist?('lisp')
source = Dir['MacOS/libexec/emacs/**/eln-cache', source = Dir['MacOS/libexec/emacs/**/eln-cache',
'MacOS/lib/emacs/**/native-lisp'].first 'MacOS/lib/emacs/**/native-lisp'].first
err 'Failed to find native-lisp cache directory for symlink creation.'
target = File.basename(source) target = File.basename(source)
FileUtils.ln_s(source, target) unless File.exist?(target) FileUtils.ln_s(source, target) unless File.exist?(target)
end end
@@ -390,7 +402,8 @@ class Build
def meta def meta
return @meta if @meta return @meta if @meta
ref_sha = options[:git_sha] || ref ref_sha = options[:git_sha] || ref || 'master'
info "Fetching info for git ref: #{ref_sha}"
url = format(LATEST_URL, ref_sha) url = format(LATEST_URL, ref_sha)
commit_json = http_get(url) commit_json = http_get(url)
err "Failed to get commit info about: #{ref_sha}" if commit_json.nil? err "Failed to get commit info about: #{ref_sha}" if commit_json.nil?