Skip to content

Commit

Permalink
wip(deps): attempt to explicitly link in missing macOS frameworks
Browse files Browse the repository at this point in the history
  • Loading branch information
jimeh committed Nov 16, 2024
1 parent 9c02069 commit 9e25cf0
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions build-emacs-for-macos
Original file line number Diff line number Diff line change
Expand Up @@ -489,17 +489,7 @@ class Build
def env_CFLAGS
return @env_CFLAGS if @env_CFLAGS

env = []

env << '-O2'

if options[:native_comp]
env += [
"-I#{File.join(gcc_info.root_dir, 'include')}",
"-I#{File.join(gcc_info.libgccjit_root_dir, 'include')}"
]
end

env = ['-O2']
env << '-march=native' if options[:native_march]

if options[:fd_setsize].respond_to?(:>=) && options[:fd_setsize] >= 1024
Expand All @@ -509,6 +499,15 @@ class Build
]
end

# Ensure we can use native-comp with the correct headers and libraries. Not
# needed when using Nix, as relevant paths are in `NIX_CFLAGS_COMPILE`.
if options[:native_comp] && !use_nix?
env += [
"-I#{File.join(gcc_info.root_dir, 'include')}",
"-I#{File.join(gcc_info.libgccjit_root_dir, 'include')}"
]
end

if use_nix? && ENV['NIX_CFLAGS_COMPILE']
env += ENV['NIX_CFLAGS_COMPILE'].split
end
Expand All @@ -534,7 +533,16 @@ class Build
]
end

env += ENV['NIX_LDFLAGS'].split if use_nix? && ENV['NIX_LDFLAGS']
if use_nix?
env += ENV['NIX_LDFLAGS'].split if ENV['NIX_LDFLAGS']
env += [
'-framework CoreFoundation',
'-framework CoreGraphics',
'-framework CoreServices',
'-framework CoreText',
'-framework Foundation'
]
end

@env_LDFLAGS = env
end
Expand Down

0 comments on commit 9e25cf0

Please sign in to comment.