88 lines
3.3 KiB
Ruby
88 lines
3.3 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: "4156"
|
|
version "10.86.25"
|
|
license "GPL-3.0-or-later"
|
|
version_scheme 1
|
|
head "https://svn.code.sf.net/p/netpbm/code/trunk"
|
|
|
|
livecheck do
|
|
url "https://sourceforge.net/p/netpbm/code/HEAD/tree/stable/"
|
|
strategy :page_match
|
|
regex(/Release v?(\d+(?:\.\d+)+)/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "c8ece85fb0c78ef1ae3282f8c92446f10bb01bdf3ad40a558b6702397e46979b"
|
|
sha256 cellar: :any, arm64_big_sur: "e79a279c0297fa7dec50b94e507b1c6a9ca1897f4227e21ed191d20b07066514"
|
|
sha256 cellar: :any, monterey: "e209ccde19aea51b6a1c517ea72978d44417ad53632af5522488f382b866afda"
|
|
sha256 cellar: :any, big_sur: "3d97e71c8f9dfca480d84aae7c48cf78c41b9d0c0900714eb77a19ea85b4d7d3"
|
|
sha256 cellar: :any, catalina: "a7222d95a418067c509245a96723c847a627f931904e843067454f91d95a4e6c"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "7ef7fc652aa8157e601a56fd3c49077b58d24603ef771288f26f7122ec4cf03c"
|
|
end
|
|
|
|
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"
|
|
|
|
conflicts_with "jbigkit", because: "both install `pbm.5` and `pgm.5` files"
|
|
|
|
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
|
|
|
|
cp "config.mk.in", "config.mk"
|
|
|
|
inreplace "config.mk" do |s|
|
|
s.remove_make_var! "CC"
|
|
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"
|
|
|
|
if OS.mac?
|
|
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)"
|
|
else
|
|
s.change_make_var! "CFLAGS_SHLIB", "-fPIC"
|
|
end
|
|
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/#{shared_library("*")}"]
|
|
(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
|