Skip to content

Commit 9f6fce1

Browse files
committed
plutobook 0.3.0 (new formula)
1 parent 739d637 commit 9f6fce1

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

Formula/p/plutobook.rb

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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_ventura do
21+
depends_on "llvm" => :build
22+
end
23+
24+
fails_with :clang do
25+
build 1499
26+
cause "Requires C++20 support"
27+
end
28+
29+
def install
30+
ENV.llvm_clang if OS.mac? && MacOS.version == :ventura
31+
32+
system "meson", "setup", "build", *std_meson_args
33+
system "meson", "compile", "-C", "build", "--verbose"
34+
system "meson", "install", "-C", "build"
35+
end
36+
37+
test do
38+
(testpath/"test.cpp").write <<~EOS
39+
#include <plutobook/plutobook.hpp>
40+
41+
static const char kHTMLContent[] = R"HTML(
42+
<!DOCTYPE html>
43+
<html>
44+
<body>Hello!</body>
45+
</html>
46+
)HTML";
47+
48+
int main() {
49+
plutobook::Book book(plutobook::PageSize::A4, plutobook::PageMargins::Narrow);
50+
book.loadHtml(kHTMLContent);
51+
book.writeToPdf("test.pdf");
52+
return 0;
53+
}
54+
EOS
55+
system ENV.cxx, "test.cpp", "-std=c++17", "-I#{include}", "-L#{lib}", "-lplutobook", "-o", "test"
56+
system "./test"
57+
assert_path_exists testpath/"test.pdf"
58+
end
59+
end

0 commit comments

Comments
 (0)