Skip to content

Commit a7755ad

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 84a8e3c commit a7755ad

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

Formula/p/plutobook.rb

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

0 commit comments

Comments
 (0)