Skip to content

Commit 9dc29e1

Browse files
authored
Merge pull request #218812 from johnwhitington/camlpdfandcpdf
camlpdf 2.8.1
2 parents e9e0cb3 + cdeab19 commit 9dc29e1

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

Formula/c/camlpdf.rb

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
class Camlpdf < Formula
2+
desc "OCaml library for reading, writing and modifying PDF files"
3+
homepage "https://github.com/johnwhitington/camlpdf"
4+
url "https://github.com/johnwhitington/camlpdf/archive/refs/tags/v2.8.1.tar.gz"
5+
sha256 "148994c70016f1b02fee1f5548ff7d36ba7d0a5716e03f95011160fcc495657b"
6+
license "LGPL-2.1-only" => { with: "OCaml-LGPL-linking-exception" }
7+
8+
bottle do
9+
sha256 cellar: :any, arm64_sequoia: "34f2db85bff44fd2a7b00704e099a76106d85431dcb8f122a74ad530e585407d"
10+
sha256 cellar: :any, arm64_sonoma: "22e65fe30f42615d8711c07c4d9df5fe61942f4e315575725d274d9572b13bd3"
11+
sha256 cellar: :any, arm64_ventura: "5b4993442c060aba6405e5518b9246e72d4c6369f31dc5632d58398fa9456c44"
12+
sha256 cellar: :any, sonoma: "804e849272f9ed7d58a318a199bae0a46169b46366ed87c136d7a6142b83bad0"
13+
sha256 cellar: :any, ventura: "0f9d1b46f0389a342fa7305efe0393526860c2e6704537ae5d66e4456619adbb"
14+
sha256 cellar: :any_skip_relocation, x86_64_linux: "ae56e872f83e5c2e5087e75108baa31c90171fe2de3c14495b6fb41d6dd7feb8"
15+
end
16+
17+
depends_on "ocaml-findlib" => :build
18+
depends_on "ocaml"
19+
20+
def install
21+
# For OCamlmakefile
22+
ENV.deparallelize
23+
24+
# Work around for https://github.com/Homebrew/homebrew-test-bot/issues/805
25+
if ENV["HOMEBREW_GITHUB_ACTIONS"] && !(Formula["ocaml-findlib"].etc/"findlib.conf").exist?
26+
ENV["OCAMLFIND_CONF"] = Formula["ocaml-findlib"].opt_libexec/"findlib.conf"
27+
end
28+
29+
ENV["OCAMLFIND_DESTDIR"] = lib/"ocaml"
30+
31+
(lib/"ocaml").mkpath
32+
cp Formula["ocaml"].opt_lib/"ocaml/Makefile.config", lib/"ocaml"
33+
34+
# install in #{lib}/ocaml not #{HOMEBREW_PREFIX}/lib/ocaml
35+
inreplace lib/"ocaml/Makefile.config" do |s|
36+
s.change_make_var! "prefix", prefix
37+
end
38+
39+
system "make"
40+
(lib/"ocaml/stublibs").mkpath # `make install` assumes this directory exists
41+
system "make", "install", "STDLIBDIR=#{lib}/ocaml"
42+
43+
rm lib/"ocaml/Makefile.config" # avoid conflict with ocaml
44+
end
45+
46+
test do
47+
(testpath/"test.ml").write "Pdfutil.flprint \"camlpdf\""
48+
system Formula["ocaml"].opt_bin/"ocamlopt", "-I", lib/"ocaml/camlpdf", "-I",
49+
Formula["ocaml"].opt_lib/"ocaml", "-o", "test", "camlpdf.cmxa",
50+
"test.ml"
51+
assert_match "camlpdf", shell_output("./test")
52+
end
53+
end

0 commit comments

Comments
 (0)