Skip to content

Commit 7838769

Browse files
committed
initial commit of the existing broken pdf2htmlex homebrew formula
1 parent 70574c1 commit 7838769

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed

building/Readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ instance:
1313

1414
https://cloud-images.ubuntu.com/locator/ec2/
1515

16+
OR alternatively the Debian choosers:
17+
18+
https://wiki.debian.org/Cloud/AmazonEC2Image
19+
https://wiki.debian.org/Cloud/AmazonEC2Image/Buster
20+
https://wiki.debian.org/Cloud/AmazonEC2Image/Stretch
21+
1622
THEN edit the file `hostEnvs` to ensure the aws0, aws1, and/or aws2 are
1723
associated with the correct *public* ip address
1824

homebrew/Readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Homebrew files
2+
3+
This directory contains files used to build a homebrew version of pdf2htmlEX
4+
5+
(at sometime in the future these files and/or the formula should migrate to
6+
[homebrew-core](https://github.com/Homebrew/homebrew-core))

homebrew/pdf2htmlex.rb

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
class Pdf2htmlex < Formula
2+
desc "PDF to HTML converter"
3+
homepage "https://coolwanglu.github.io/pdf2htmlEX/"
4+
url "https://github.com/coolwanglu/pdf2htmlEX/archive/v0.14.6.tar.gz"
5+
sha256 "320ac2e1c2ea4a2972970f52809d90073ee00a6c42ef6d9833fb48436222f0e5"
6+
revision 22
7+
head "https://github.com/coolwanglu/pdf2htmlEX.git"
8+
9+
bottle do
10+
sha256 "a668d32544101f61f3ca1c4c76f7b2342c91827c63615e129f07781a3aef00d6" => :mojave
11+
sha256 "41ef0b1e152aa0e15a3934a9f3143818c05b5a46ceb44196f9425c398ab877e2" => :high_sierra
12+
sha256 "194a3c710b1408a83ab49a8aea30fb7e1189502766c3d4804f4737fcace2d957" => :sierra
13+
end
14+
15+
depends_on "autoconf" => :build # for fontforge
16+
depends_on "automake" => :build # for fontforge
17+
depends_on "cmake" => :build
18+
depends_on "pkg-config" => :build
19+
depends_on "cairo" # for fontforge
20+
depends_on "freetype" # for fontforge
21+
depends_on "gettext" # for fontforge
22+
depends_on "giflib" # for fontforge
23+
depends_on "glib" # for fontforge
24+
depends_on "gnu-getopt"
25+
depends_on "jpeg" # for fontforge
26+
depends_on "libpng" # for fontforge
27+
depends_on "libtiff" # for fontforge
28+
depends_on "libtool" # for fontforge
29+
30+
depends_on "openjpeg" # for poppler
31+
depends_on "pango" # for fontforge
32+
depends_on "ttfautohint"
33+
34+
# Pdf2htmlex use an outdated, customised Fontforge installation.
35+
# See https://github.com/coolwanglu/pdf2htmlEX/wiki/Building
36+
resource "fontforge" do
37+
url "https://github.com/coolwanglu/fontforge.git", :branch => "pdf2htmlEX"
38+
end
39+
40+
# Upstream issue "poppler 0.59.0 incompatibility"
41+
# Reported 4 Sep 2017 https://github.com/coolwanglu/pdf2htmlEX/issues/733
42+
resource "poppler" do
43+
url "https://poppler.freedesktop.org/poppler-0.57.0.tar.xz"
44+
sha256 "0ea37de71b7db78212ebc79df59f99b66409a29c2eac4d882dae9f2397fe44d8"
45+
end
46+
47+
resource "poppler-data" do
48+
url "https://poppler.freedesktop.org/poppler-data-0.4.8.tar.gz"
49+
sha256 "1096a18161f263cccdc6d8a2eb5548c41ff8fcf9a3609243f1b6296abdf72872"
50+
end
51+
52+
def install
53+
resource("fontforge").stage do
54+
# Fix for incomplete giflib 5 support, see
55+
# https://github.com/coolwanglu/pdf2htmlEX/issues/713
56+
inreplace "gutils/gimagereadgif.c", "DGifCloseFile(gif)", "DGifCloseFile(gif, NULL)"
57+
58+
# Fix linker error; see: https://trac.macports.org/ticket/25012
59+
ENV.append "LDFLAGS", "-lintl"
60+
61+
# Reset ARCHFLAGS to match how we build
62+
ENV["ARCHFLAGS"] = "-arch #{MacOS.preferred_arch}"
63+
64+
system "./autogen.sh"
65+
system "./configure", "--prefix=#{libexec}/fontforge",
66+
"--without-libzmq",
67+
"--without-x",
68+
"--without-iconv",
69+
"--without-libspiro",
70+
"--without-libuninameslist",
71+
"--disable-python-scripting",
72+
"--disable-python-extension"
73+
system "make"
74+
system "make", "install"
75+
end
76+
77+
ENV.prepend_path "PKG_CONFIG_PATH", "#{libexec}/fontforge/lib/pkgconfig"
78+
ENV.prepend_path "PATH", "#{libexec}/fontforge/bin"
79+
80+
resource("poppler").stage do
81+
inreplace "poppler.pc.in", "Cflags: -I${includedir}/poppler",
82+
"Cflags: -I${includedir}/poppler -I${includedir}"
83+
84+
system "./configure", "--disable-dependency-tracking",
85+
"--prefix=#{libexec}/poppler",
86+
"--enable-xpdf-headers",
87+
"--enable-poppler-glib",
88+
"--disable-gtk-test",
89+
"--enable-introspection=no",
90+
"--disable-poppler-qt4"
91+
system "make", "install"
92+
resource("poppler-data").stage do
93+
system "make", "install", "prefix=#{libexec}/poppler"
94+
end
95+
end
96+
97+
ENV.prepend_path "PKG_CONFIG_PATH", "#{libexec}/poppler/lib/pkgconfig"
98+
ENV.prepend_path "PATH", "#{libexec}/poppler/bin"
99+
100+
system "cmake", ".", *std_cmake_args
101+
system "make"
102+
system "make", "install"
103+
end
104+
105+
test do
106+
system "#{bin}/pdf2htmlEX", test_fixtures("test.pdf")
107+
end
108+
end

0 commit comments

Comments
 (0)