homebrew-core/Formula/libgxps.rb

83 lines
2.5 KiB
Ruby

class Libgxps < Formula
desc "GObject based library for handling and rendering XPS documents"
homepage "https://wiki.gnome.org/Projects/libgxps"
url "https://download.gnome.org/sources/libgxps/0.3/libgxps-0.3.1.tar.xz"
sha256 "1a939fc8fcea9471b7eca46b1ac90cff89a30d26f65c7c9a375a4bf91223fa94"
license "LGPL-2.1-or-later"
revision 1
livecheck do
url :stable
regex(/libgxps[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
cellar :any
sha256 "2b3f7d48efd67aae795cbe831c3f6016ef3935927bc277e605525a9a29d38e45" => :big_sur
sha256 "dd6c63cf7f8af07a9ea8bbe4ee902d55a834652f4100780affab11dd38a3deb0" => :catalina
sha256 "a71f1a595fe620805393786fe14dedc8fe3fb6f75a812536ba5acc00e9ec9c07" => :mojave
sha256 "ed21a1e2b30b473883f54fa09c7a1707eb6ae2a78946ecbb1d1d11f5f340154a" => :high_sierra
end
head do
url "https://gitlab.gnome.org/GNOME/libgxps.git"
end
depends_on "gobject-introspection" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "glib"
depends_on "gtk+3"
depends_on "libarchive"
depends_on "little-cms2"
def install
mkdir "build" do
system "meson", *std_meson_args, ".."
system "ninja", "-v"
system "ninja", "install", "-v"
end
end
test do
mkdir_p [
(testpath/"Documents/1/Pages/_rels/"),
(testpath/"_rels/"),
]
(testpath/"FixedDocumentSequence.fdseq").write <<~EOS
<FixedDocumentSequence>
<DocumentReference Source="/Documents/1/FixedDocument.fdoc"/>
</FixedDocumentSequence>
EOS
(testpath/"Documents/1/FixedDocument.fdoc").write <<~EOS
<FixedDocument>
<PageContent Source="/Documents/1/Pages/1.fpage"/>
</FixedDocument>
EOS
(testpath/"Documents/1/Pages/1.fpage").write <<~EOS
<FixedPage Width="1" Height="1" xml:lang="und" />
EOS
(testpath/"_rels/.rels").write <<~EOS
<Relationships>
<Relationship Target="/FixedDocumentSequence.fdseq" Type="http://schemas.microsoft.com/xps/2005/06/fixedrepresentation"/>
</Relationships>
EOS
[
"_rels/FixedDocumentSequence.fdseq.rels",
"Documents/1/_rels/FixedDocument.fdoc.rels",
"Documents/1/Pages/_rels/1.fpage.rels",
].each do |f|
(testpath/f).write <<~EOS
<Relationships />
EOS
end
Dir.chdir(testpath) do
system "/usr/bin/zip", "-qr", (testpath/"test.xps"), "_rels", "Documents", "FixedDocumentSequence.fdseq"
end
system "#{bin}/xpstopdf", (testpath/"test.xps")
end
end