Skip to content

Commit 4a32e72

Browse files
bevanjkaycarlocab
andcommitted
plutobook 0.3.0 (new formula)
Update Formula/p/plutobook.rb Co-authored-by: Carlo Cabrera <[email protected]> Update Formula/p/plutobook.rb Co-authored-by: Carlo Cabrera <[email protected]>
1 parent dc088e4 commit 4a32e72

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

Formula/p/plutobook.rb

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
class Plutobook < Formula
2+
desc "Paged HTML Rendering Library"
3+
homepage "https://github.com/plutoprint/plutobook"
4+
url "https://github.com/plutoprint/plutobook/archive/refs/tags/v0.3.0.tar.gz"
5+
sha256 "e5c7d7fae94051ef8407d4fa9f9006bfd170d4348f562dbf7e045218121ed7e3"
6+
license "MIT"
7+
8+
depends_on "meson" => :build
9+
depends_on "ninja" => :build
10+
depends_on "pkgconf" => :build
11+
depends_on "cairo"
12+
depends_on "fontconfig"
13+
depends_on "freetype"
14+
depends_on "harfbuzz"
15+
depends_on "icu4c@77"
16+
depends_on "jpeg-turbo"
17+
depends_on "webp"
18+
uses_from_macos "expat"
19+
20+
on_macos do
21+
depends_on "llvm" if DevelopmentTools.clang_build_version <= 1500
22+
end
23+
24+
on_ventura do
25+
depends_on "llvm"
26+
end
27+
28+
fails_with :clang do
29+
build 1500
30+
cause "Requires C++20 support"
31+
end
32+
33+
def install
34+
if OS.mac? && (MacOS.version == :ventura || DevelopmentTools.clang_build_version <= 1500)
35+
ENV.llvm_clang
36+
llvm = Formula["llvm"]
37+
ENV.append "LDFLAGS", "-L#{llvm.opt_lib}/c++ -L#{llvm.opt_lib}/unwind -lunwind"
38+
end
39+
40+
system "meson", "setup", "build", *std_meson_args
41+
system "meson", "compile", "-C", "build", "--verbose"
42+
system "meson", "install", "-C", "build"
43+
end
44+
45+
test do
46+
(testpath/"test.cpp").write <<~EOS
47+
#include <plutobook/plutobook.hpp>
48+
49+
static const char kHTMLContent[] = R"HTML(
50+
<!DOCTYPE html>
51+
<html>
52+
<body>Hello!</body>
53+
</html>
54+
)HTML";
55+
56+
int main() {
57+
plutobook::Book book(plutobook::PageSize::A4, plutobook::PageMargins::Narrow);
58+
book.loadHtml(kHTMLContent);
59+
book.writeToPdf("test.pdf");
60+
return 0;
61+
}
62+
EOS
63+
system ENV.cxx, "test.cpp", "-std=c++17", "-I#{include}", "-L#{lib}", "-lplutobook", "-o", "test"
64+
system "./test"
65+
assert_path_exists testpath/"test.pdf"
66+
end
67+
end

0 commit comments

Comments
 (0)