Skip to content

Commit 0574125

Browse files
committed
plutobook 0.3.0 (new formula)
1 parent 8140de9 commit 0574125

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Formula/p/plutobook.rb

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
uses_from_macos "expat"
18+
19+
def install
20+
system "meson", "setup", "build", *std_meson_args
21+
system "meson", "compile", "-C", "build", "--verbose"
22+
system "meson", "install", "-C", "build"
23+
end
24+
25+
test do
26+
(testpath/"test.cpp").write <<~EOS
27+
#include <plutobook/plutobook.hpp>
28+
29+
static const char kHTMLContent[] = R"HTML(
30+
<!DOCTYPE html>
31+
<html>
32+
<body>Hello!</body>
33+
</html>
34+
)HTML";
35+
36+
int main() {
37+
plutobook::Book book(plutobook::PageSize::A4, plutobook::PageMargins::Narrow);
38+
book.loadHtml(kHTMLContent);
39+
book.writeToPdf("test.pdf");
40+
return 0;
41+
}
42+
EOS
43+
system ENV.cxx, "test.cpp", "-std=c++17", "-I#{include}/plutobook", "-L#{lib}", "-lplutobook", "-o", "test"
44+
system "./test"
45+
assert_path_exists testpath/"test.pdf"
46+
end
47+
end

0 commit comments

Comments
 (0)