fontforge: fix compilation without 10.7 SDK

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 #17909.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Kevin Ballard authored and Mike McQuaid committed 2013-02-23 08:26:25 +00:00
1 parent 9f95fff3e4
commit 67ed3bcfe7
1 file changed
+10 -19
+10 -19
View File
@@ -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"]
@@ -62,6 +52,10 @@ class Fontforge < Formula
# 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"
@@ -79,16 +73,13 @@ class Fontforge < Formula
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"