83 lines
2.6 KiB
Ruby
83 lines
2.6 KiB
Ruby
class Pdf2htmlex < Formula
|
|
desc "PDF to HTML converter"
|
|
homepage "https://coolwanglu.github.io/pdf2htmlEX/"
|
|
url "https://github.com/coolwanglu/pdf2htmlEX/archive/v0.14.6.tar.gz"
|
|
sha256 "320ac2e1c2ea4a2972970f52809d90073ee00a6c42ef6d9833fb48436222f0e5"
|
|
revision 13
|
|
|
|
head "https://github.com/coolwanglu/pdf2htmlEX.git"
|
|
|
|
bottle do
|
|
rebuild 1
|
|
sha256 "58b69126ba991752b0de9819a46759f4600bf89593708a7deb203ae658f765a3" => :sierra
|
|
sha256 "c6f0bd7d5029084e2c0f1da7b6025f8002caeec5353e92b6884c6ec0891dd74a" => :el_capitan
|
|
sha256 "2624c79321b3cf408230434d2c199b97655ce854fa46d5bc8d93867937bbfa2c" => :yosemite
|
|
end
|
|
|
|
depends_on :macos => :lion
|
|
depends_on "cmake" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "poppler"
|
|
depends_on "gnu-getopt"
|
|
depends_on "ttfautohint" => :recommended if MacOS.version > :snow_leopard
|
|
|
|
# Fontforge dependencies
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :run
|
|
depends_on "cairo"
|
|
depends_on "freetype"
|
|
depends_on "giflib"
|
|
depends_on "glib"
|
|
depends_on "pango"
|
|
depends_on "gettext"
|
|
depends_on "libpng" => :recommended
|
|
depends_on "jpeg" => :recommended
|
|
depends_on "libtiff" => :recommended
|
|
|
|
# Pdf2htmlex use an outdated, customised Fontforge installation.
|
|
# See https://github.com/coolwanglu/pdf2htmlEX/wiki/Building
|
|
resource "fontforge" do
|
|
url "https://github.com/coolwanglu/fontforge.git", :branch => "pdf2htmlEX"
|
|
end
|
|
|
|
def install
|
|
resource("fontforge").stage do
|
|
# Fix for incomplete giflib 5 support, see
|
|
# https://github.com/coolwanglu/pdf2htmlEX/issues/713
|
|
inreplace "gutils/gimagereadgif.c", "DGifCloseFile(gif)", "DGifCloseFile(gif, NULL)"
|
|
|
|
args = %W[
|
|
--prefix=#{prefix}/fontforge
|
|
--without-libzmq
|
|
--without-x
|
|
--without-iconv
|
|
--disable-python-scripting
|
|
--disable-python-extension
|
|
]
|
|
|
|
# Fix linker error; see: https://trac.macports.org/ticket/25012
|
|
ENV.append "LDFLAGS", "-lintl"
|
|
|
|
# Reset ARCHFLAGS to match how we build
|
|
ENV["ARCHFLAGS"] = "-arch #{MacOS.preferred_arch}"
|
|
|
|
system "./autogen.sh"
|
|
system "./configure", *args
|
|
|
|
system "make"
|
|
system "make", "install"
|
|
end
|
|
|
|
# Prepend the paths to always find this dep fontforge instead of another.
|
|
ENV.prepend_path "PKG_CONFIG_PATH", "#{prefix}/fontforge/lib/pkgconfig"
|
|
ENV.prepend_path "PATH", "#{prefix}/fontforge/bin"
|
|
system "cmake", ".", *std_cmake_args
|
|
system "make"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/pdf2htmlEX", test_fixtures("test.pdf")
|
|
end
|
|
end
|