2011-09-28 04:46:15 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2012-04-17 18:38:24 +00:00
|
|
|
class NeedsSnowLeopard < Requirement
|
|
|
|
def satisfied?
|
|
|
|
MACOS_VERSION >= 10.6
|
|
|
|
end
|
|
|
|
|
2012-05-24 19:32:43 +00:00
|
|
|
def fatal?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2012-04-17 18:38:24 +00:00
|
|
|
def message; <<-EOS.undent
|
|
|
|
The version of Freetype that comes with Leopard is too old to build MuPDF
|
|
|
|
against. It is possible to get MuPDF working on Leopard using the Freetype
|
|
|
|
formula from Homebrew-Dupes and some tweaks to the Makefile.
|
|
|
|
|
|
|
|
Doing so is left as an exercise for the reader.
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-09-28 04:46:15 +00:00
|
|
|
class Mupdf < Formula
|
|
|
|
homepage 'http://mupdf.com'
|
2012-05-24 19:32:43 +00:00
|
|
|
url 'http://mupdf.googlecode.com/files/mupdf-1.0-source.tar.gz'
|
|
|
|
md5 'd986ab98e2b035b7abd61afc474562b3'
|
2011-09-28 04:46:15 +00:00
|
|
|
|
2012-04-17 18:38:24 +00:00
|
|
|
depends_on NeedsSnowLeopard.new
|
|
|
|
|
2011-09-28 04:46:15 +00:00
|
|
|
depends_on 'jpeg'
|
|
|
|
depends_on 'openjpeg'
|
|
|
|
depends_on 'jbig2dec'
|
2012-06-07 01:35:12 +00:00
|
|
|
depends_on :x11 # libpng, freetype
|
2011-09-28 04:46:15 +00:00
|
|
|
|
|
|
|
def patches
|
2012-01-04 06:05:05 +00:00
|
|
|
# Fix up the Makefile so it doesn't mess with our CFLAGS.
|
2011-09-28 04:46:15 +00:00
|
|
|
DATA
|
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
2012-05-15 18:31:21 +00:00
|
|
|
system "make", "install", "prefix=#{prefix}"
|
2012-04-17 18:38:24 +00:00
|
|
|
end
|
2011-09-28 04:46:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
__END__
|
|
|
|
|
|
|
|
Remove some Makefile rules that Homebrew takes care of through CFLAGS and
|
|
|
|
LDFLAGS. MuPDF doesn't look at CPPFLAGS, so we piggyback it onto CFLAGS.
|
|
|
|
|
|
|
|
diff --git a/Makerules b/Makerules
|
2012-05-24 19:32:43 +00:00
|
|
|
index 26eab3c..46e8dc9 100644
|
2011-09-28 04:46:15 +00:00
|
|
|
--- a/Makerules
|
|
|
|
+++ b/Makerules
|
2012-05-24 19:32:43 +00:00
|
|
|
@@ -5,21 +5,6 @@ OS := $(OS:MINGW%=MINGW)
|
2011-09-28 04:46:15 +00:00
|
|
|
|
|
|
|
CFLAGS += -Wall
|
|
|
|
|
|
|
|
-ifeq "$(build)" "debug"
|
2012-05-24 19:32:43 +00:00
|
|
|
-CFLAGS += -pipe -g -DDEBUG
|
2011-09-28 04:46:15 +00:00
|
|
|
-else ifeq "$(build)" "profile"
|
|
|
|
-CFLAGS += -pipe -O2 -DNDEBUG -pg
|
|
|
|
-LDFLAGS += -pg
|
|
|
|
-else ifeq "$(build)" "release"
|
|
|
|
-CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
|
|
|
|
-else ifeq "$(build)" "native"
|
|
|
|
-CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer -march=native -mfpmath=sse
|
2012-05-24 19:32:43 +00:00
|
|
|
-else ifeq "$(build)" "memento"
|
|
|
|
-CFLAGS += -pipe -g -DMEMENTO -DDEBUG
|
2011-09-28 04:46:15 +00:00
|
|
|
-else
|
|
|
|
-$(error unknown build setting: '$(build)')
|
|
|
|
-endif
|
|
|
|
-
|
|
|
|
ifeq "$(OS)" "Linux"
|
|
|
|
SYS_FREETYPE_INC := `pkg-config --cflags freetype2`
|
|
|
|
X11_LIBS := -lX11 -lXext
|
2012-05-24 19:32:43 +00:00
|
|
|
@@ -34,17 +19,9 @@ endif
|
2011-09-28 04:46:15 +00:00
|
|
|
# Mac OS X build depends on some thirdparty libs
|
|
|
|
ifeq "$(OS)" "Darwin"
|
|
|
|
SYS_FREETYPE_INC := -I/usr/X11R6/include/freetype2
|
|
|
|
-CFLAGS += -I/usr/X11R6/include
|
|
|
|
-LDFLAGS += -L/usr/X11R6/lib
|
|
|
|
+CFLAGS += $(CPPFLAGS)
|
2012-05-24 19:32:43 +00:00
|
|
|
RANLIB_CMD = ranlib $@
|
2011-09-28 04:46:15 +00:00
|
|
|
X11_LIBS := -lX11 -lXext
|
|
|
|
-ifeq "$(arch)" "amd64"
|
|
|
|
-CFLAGS += -m64
|
|
|
|
-LDFLAGS += -m64
|
|
|
|
-else
|
|
|
|
-CFLAGS += -m32
|
|
|
|
-LDFLAGS += -m32
|
|
|
|
-endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# The following section is an example of how to simply do cross-compilation
|