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" bottle do sha256 "74f4662c40830e4697255a05447171637c749ce28a6aa7262ab29cbfca32d642" => :catalina sha256 "f2a0b5d1e9d85ad84ab041381c3c0bdd8f6f98d2be8586cdf48958e4a85aab27" => :mojave sha256 "ef0b670a2dcbbbc2e42e6dd9ada96353fad1d039c42d8a41ef5271b8370bdd25" => :high_sierra sha256 "949980a659fa2c301992af86c54a91e47a9721e372348bb1e5b49891d55b5285" => :sierra end head do url "https://gitlab.gnome.org/GNOME/libgxps.git" end depends_on "gobject-introspection" => :build depends_on "meson-internal" => :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", "--prefix=#{prefix}", ".." 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 EOS (testpath/"Documents/1/FixedDocument.fdoc").write <<~EOS EOS (testpath/"Documents/1/Pages/1.fpage").write <<~EOS EOS (testpath/"_rels/.rels").write <<~EOS 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 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