-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
/
libspiro.rb
66 lines (57 loc) 路 2.85 KB
/
libspiro.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
class Libspiro < Formula
desc "Library to simplify the drawing of curves"
homepage "https://github.com/fontforge/libspiro"
url "https://github.com/fontforge/libspiro/releases/download/20221101/libspiro-dist-20221101.tar.gz"
sha256 "5984fb5af3e4e1f927f3a74850b705a711fb86284802a5e6170b09786440e8be"
license "GPL-3.0-or-later"
version_scheme 1
bottle do
sha256 cellar: :any, arm64_sonoma: "d571e640cca9b461fd540bf4b0ee34bfe8d94e659061b0c025e95e08479d6c42"
sha256 cellar: :any, arm64_ventura: "51c8921af221ce78f184e95a55a79e81d38fc1fa84abe2dc46625a57788e6b0e"
sha256 cellar: :any, arm64_monterey: "1e90fd585fcaa84a166d7a77c2ae5aeb97fd8692c98dc5b2f6952d9d9033bf9a"
sha256 cellar: :any, arm64_big_sur: "d2d54755d2a1a15ab93350e6a74697357a7e7478f9a53e78d7c40b2c47fd9651"
sha256 cellar: :any, sonoma: "501665be51496d3b753051529c9876aef0f9fe784a8b3841d757c70c9e0987e0"
sha256 cellar: :any, ventura: "5721b7e65026b5a86e387c4f648925b6e9166825b158226fbfb6a4ce2387c2f4"
sha256 cellar: :any, monterey: "946ef3d6e92c177e4456421353ed3090128d8eebca4630bcd8f1ee1cd4bb9b49"
sha256 cellar: :any, big_sur: "f95068a1f9cb22591a2e37cb2b061199f8f624cbab15d743b1176438020fb119"
sha256 cellar: :any, catalina: "a4487593a91bce4bdd4456bee4f3a31219d03ed1c6960e6d998d551e50e186df"
sha256 cellar: :any_skip_relocation, x86_64_linux: "b4dfa30c267a3b79aa235c9569a0289ebce4cd3d8f0a570c4fc48fea840d9ff3"
end
head do
url "https://github.com/fontforge/libspiro.git", branch: "master"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
def install
if build.head?
system "autoreconf", "-i"
system "automake"
end
system "./configure", "--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <spiroentrypoints.h>
#include <bezctx.h>
void moveto(bezctx *bc, double x, double y, int open) {}
void lineto(bezctx *bc, double x, double y) {}
void quadto(bezctx *bc, double x1, double y1, double x2, double y2) {}
void curveto(bezctx *bc, double x1, double y1, double x2, double y2, double x3, double t3) {}
void markknot(bezctx *bc, int knot) {}
int main() {
int done;
bezctx bc = {moveto, lineto, quadto, curveto, markknot};
spiro_cp path[] = {
{-100, 0, SPIRO_G4}, {0, 100, SPIRO_G4},
{100, 0, SPIRO_G4}, {0, -100, SPIRO_G4}
};
SpiroCPsToBezier1(path, sizeof(path)/sizeof(spiro_cp), 1, &bc, &done);
return done == 0;
}
EOS
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lspiro", "-o", "test"
system "./test"
end
end