homebrew-core/Formula/netpbm.rb

73 lines
2.5 KiB
Ruby

class Netpbm < Formula
desc "Image manipulation"
homepage "https://netpbm.sourceforge.io/"
# Maintainers: Look at https://sourceforge.net/p/netpbm/code/HEAD/tree/
# for stable versions and matching revisions.
url "https://svn.code.sf.net/p/netpbm/code/stable", :revision => 3870
version "10.86.15"
version_scheme 1
head "https://svn.code.sf.net/p/netpbm/code/trunk"
bottle do
cellar :any
sha256 "37a97b0de551ec64acca8e1c9506e332fa6d89c9e1aabf0a17da0f6eda8209bf" => :catalina
sha256 "c41c2506bf6902e2c20ca671b146b7f61b7280f70e592a1c577dc6e6258af8bf" => :mojave
sha256 "cd6bde5ae0be1518e7413f5304433635ab6cc30179565b6ed58182081408cf94" => :high_sierra
end
depends_on "subversion" => :build, :since => :catalina
depends_on "jasper"
depends_on "jpeg"
depends_on "libpng"
depends_on "libtiff"
uses_from_macos "flex" => :build
uses_from_macos "libxml2"
uses_from_macos "zlib"
def install
# Fix file not found errors for /usr/lib/system/libsystem_symptoms.dylib and
# /usr/lib/system/libsystem_darwin.dylib on 10.11 and 10.12, respectively
ENV["SDKROOT"] = MacOS.sdk_path if MacOS.version == :sierra || MacOS.version == :el_capitan
cp "config.mk.in", "config.mk"
inreplace "config.mk" do |s|
s.remove_make_var! "CC"
s.change_make_var! "CFLAGS_SHLIB", "-fno-common"
s.change_make_var! "NETPBMLIBTYPE", "dylib"
s.change_make_var! "NETPBMLIBSUFFIX", "dylib"
s.change_make_var! "LDSHLIB", "--shared -o $(SONAME)"
s.change_make_var! "TIFFLIB", "-ltiff"
s.change_make_var! "JPEGLIB", "-ljpeg"
s.change_make_var! "PNGLIB", "-lpng"
s.change_make_var! "ZLIB", "-lz"
s.change_make_var! "JASPERLIB", "-ljasper"
s.change_make_var! "JASPERHDR_DIR", "#{Formula["jasper"].opt_include}/jasper"
end
ENV.deparallelize
system "make"
system "make", "package", "pkgdir=#{buildpath}/stage"
cd "stage" do
inreplace "pkgconfig_template" do |s|
s.gsub! "@VERSION@", File.read("VERSION").sub("Netpbm ", "").chomp
s.gsub! "@LINKDIR@", lib
s.gsub! "@INCLUDEDIR@", include
end
prefix.install %w[bin include lib misc]
lib.install Dir["staticlink/*.a"], Dir["sharedlink/*.dylib"]
(lib/"pkgconfig").install "pkgconfig_template" => "netpbm.pc"
end
end
test do
fwrite = shell_output("#{bin}/pngtopam #{test_fixtures("test.png")} -alphapam")
(testpath/"test.pam").write fwrite
system "#{bin}/pamdice", "test.pam", "-outstem", testpath/"testing"
assert_predicate testpath/"testing_0_0.", :exist?
end
end