Skip to content

Commit

Permalink
fontforge: fix compilation without 10.7 SDK
Browse files Browse the repository at this point in the history
FontForge uses the FlatCarbon headers, which are gone in Mountain
Lion. To fix this, the formula was adjusted to use the 10.7 SDK.
However, this prevents compiling FontForge on a system without the
10.7 SDK. Fix this by replacing the FlatCarbon imports with the
correct imports to the non-flat headers.

Closes Homebrew/legacy-homebrew#17909.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
  • Loading branch information
lilyball authored and MikeMcQuaid committed Feb 23, 2013
1 parent 94e68c2 commit 7a2bda9
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions Formula/fontforge.rb
Expand Up @@ -31,16 +31,6 @@ class Fontforge < Formula
end

def install
# Reason: Designed for the 10.7 SDK because it uses FlatCarbon.
# MACOSX_DEPLOYMENT_TARGET fixes ensuing Python 10.7 vs 10.8 clash.
# Discussed: https://github.com/mxcl/homebrew/pull/14097
# Reported: Not yet.
if MacOS.version >= :mountain_lion
ENV.macosxsdk("10.7")
ENV.append "CFLAGS", "-isysroot #{MacOS.sdk_path(10.7)}"
ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.8"
end

args = ["--prefix=#{prefix}",
"--enable-double",
"--without-freetype-bytecode"]
Expand All @@ -62,6 +52,10 @@ def install
# Reset ARCHFLAGS to match how we build
ENV["ARCHFLAGS"] = MacOS.prefer_64_bit? ? "-arch x86_64" : "-arch i386"

# Set up framework paths so FlatCarbon replacement paths work (see below)
ENV.append "CFLAGS", "-F/System/Library/Frameworks/CoreServices.framework/Frameworks"
ENV.append "CFLAGS", "-F/System/Library/Frameworks/Carbon.framework/Frameworks"

args << "--without-cairo" unless build.with? "cairo"
args << "--without-pango" unless build.with? "pango"

Expand All @@ -79,16 +73,13 @@ def install
s.gsub! "python setup.py install --prefix=$(prefix) --root=$(DESTDIR)", "python setup.py install --prefix=$(prefix)"
end

# Fix hard-coded include file paths. Reported usptream:
# http://sourceforge.net/mailarchive/forum.php?thread_name=C1A32103-A62D-468B-AD8A-A8E0E7126AA5%40smparkes.net&forum_name=fontforge-devel
# https://trac.macports.org/ticket/33284
if MacOS::Xcode.version >= '4.4'
header_prefix = "#{MacOS.sdk_path(10.7)}/Developer"
else
header_prefix = MacOS::Xcode.prefix
end
# Replace FlatCarbon headers with the real paths
# Fixes building on 10.8
inreplace %w(fontforge/macbinary.c fontforge/startui.c gutils/giomime.c) do |s|
s.gsub! "/Developer", header_prefix
s.gsub! "/Developer/Headers/FlatCarbon/Files.h", "CarbonCore/Files.h"
end
inreplace %w(fontforge/startui.c) do |s|
s.gsub! "/Developer/Headers/FlatCarbon/CarbonEvents.h", "HIToolbox/CarbonEvents.h"
end

system "make"
Expand Down

0 comments on commit 7a2bda9

Please sign in to comment.