2011-03-10 05:11:03 +00:00
|
|
|
class Devil < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Cross-platform image library"
|
2015-11-12 02:36:09 +00:00
|
|
|
homepage "https://sourceforge.net/projects/openil/"
|
2016-05-18 15:22:22 +00:00
|
|
|
revision 3
|
2010-10-07 03:14:58 +00:00
|
|
|
|
2016-03-18 21:52:12 +00:00
|
|
|
stable do
|
|
|
|
url "https://downloads.sourceforge.net/project/openil/DevIL/1.7.8/DevIL-1.7.8.tar.gz"
|
|
|
|
sha256 "682ffa3fc894686156337b8ce473c954bf3f4fb0f3ecac159c73db632d28a8fd"
|
|
|
|
|
|
|
|
# fix compilation issue for ilur.c
|
|
|
|
patch do
|
2016-05-27 19:54:59 +00:00
|
|
|
url "https://raw.githubusercontent.com/Homebrew/formula-patches/3db2f9727cea4a51fbcfae742518c614020fb8f2/devil/patch-src-ILU-ilur-ilur.c.diff"
|
2016-03-18 21:52:12 +00:00
|
|
|
sha256 "ce96bc4aad940b80bc918180d6948595ee72624ae925886b1b770f2a7be8a2f9"
|
|
|
|
end
|
|
|
|
end
|
2016-05-04 17:43:28 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2016-06-06 01:38:50 +00:00
|
|
|
sha256 "1953824a6ba55112277ba40ee9604c58b4c93d3b61950583323113fd64ed5ae3" => :el_capitan
|
|
|
|
sha256 "bd23907c8dd2202835e8cfb5e03b879aa304a2bdf74481a3d148231b869ae230" => :yosemite
|
|
|
|
sha256 "5d77a3dcfed8123738dbfa1d77ea6dd2459688b0acbc35a0fd5dfe4b2cf0fead" => :mavericks
|
2016-05-04 17:43:28 +00:00
|
|
|
end
|
|
|
|
|
2016-03-18 21:52:12 +00:00
|
|
|
head do
|
|
|
|
url "https://github.com/DentonW/DevIL.git"
|
|
|
|
|
|
|
|
option "with-ilut", "Also build the ILUT library"
|
|
|
|
|
|
|
|
depends_on "libtool" => :build
|
|
|
|
depends_on "autoconf" => :build
|
|
|
|
depends_on "automake" => :build
|
|
|
|
depends_on "homebrew/x11/freeglut" if build.with? "ilut"
|
|
|
|
|
|
|
|
# fix compilation issue for ilur.c
|
|
|
|
patch do
|
2016-05-27 19:54:59 +00:00
|
|
|
url "https://raw.githubusercontent.com/Homebrew/formula-patches/3db2f9727cea4a51fbcfae742518c614020fb8f2/devil/patch-DevIL-src-ILU-ilur-ilur.c.diff"
|
2016-03-18 21:52:12 +00:00
|
|
|
sha256 "8021ffcd5c9ea151b991c7cd29b49ecea14afdfe07cb04fa9d25ab07d836f7d0"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-12-19 06:59:33 +00:00
|
|
|
option :universal
|
|
|
|
|
2016-05-04 17:32:53 +00:00
|
|
|
depends_on "gcc"
|
2015-08-03 12:55:31 +00:00
|
|
|
depends_on "jpeg"
|
2016-05-04 17:32:53 +00:00
|
|
|
depends_on "libpng"
|
|
|
|
depends_on "libtiff" => :recommended
|
2010-09-26 18:31:41 +00:00
|
|
|
|
2016-03-18 21:52:12 +00:00
|
|
|
# most compilation issues with clang are fixed in the following pull request
|
|
|
|
# see https://github.com/DentonW/DevIL/pull/30
|
2015-11-12 02:36:09 +00:00
|
|
|
# see https://sourceforge.net/p/openil/bugs/204/
|
2012-05-21 23:03:34 +00:00
|
|
|
# also, even with -std=gnu99 removed from the configure script,
|
|
|
|
# devil fails to build with clang++ while compiling il_exr.cpp
|
|
|
|
fails_with :clang do
|
|
|
|
cause "invalid -std=gnu99 flag while building C++"
|
|
|
|
end
|
|
|
|
|
2009-10-18 19:05:19 +00:00
|
|
|
def install
|
2014-01-17 20:59:54 +00:00
|
|
|
ENV.universal_binary if build.universal?
|
|
|
|
|
2016-03-18 21:52:12 +00:00
|
|
|
if build.head?
|
2016-05-04 17:32:53 +00:00
|
|
|
cd "DevIL"
|
2016-03-18 21:52:12 +00:00
|
|
|
system "./autogen.sh"
|
|
|
|
end
|
|
|
|
|
2016-05-04 17:32:53 +00:00
|
|
|
# GCC 5 build failure: https://github.com/Homebrew/legacy-homebrew/issues/40442
|
|
|
|
# Reported 4th May 2016: https://github.com/DentonW/DevIL/issues/31
|
|
|
|
# Fix is from NetBSD: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/devel/devIL/patches/patch-include_IL_il.h
|
|
|
|
inreplace "include/IL/il.h",
|
|
|
|
"#ifdef RESTRICT_KEYWORD",
|
|
|
|
"#if defined(RESTRICT_KEYWORD) && !defined(__cplusplus)"
|
|
|
|
|
2016-03-18 21:52:12 +00:00
|
|
|
args = %W[
|
|
|
|
--disable-debug
|
|
|
|
--disable-dependency-tracking
|
|
|
|
--prefix=#{prefix}
|
|
|
|
--enable-ILU
|
|
|
|
]
|
|
|
|
args << "--enable-ILUT" if build.stable? || build.with?("ilut")
|
2016-05-04 17:32:53 +00:00
|
|
|
args << "--disable-tiff" if build.without? "libtiff"
|
|
|
|
|
|
|
|
# "fatal error: 'IL/ilut.h' file not found"
|
|
|
|
# Reported 4th May 2016: https://github.com/DentonW/DevIL/issues/32
|
|
|
|
# Fixes the test for HEAD builds that have ILUT disabled
|
|
|
|
if build.without? "ilut"
|
|
|
|
inreplace "include/IL/devil_cpp_wrapper.hpp",
|
|
|
|
"<IL/ilut.h>", "\"ilu.h\""
|
|
|
|
end
|
2016-03-18 21:52:12 +00:00
|
|
|
|
|
|
|
system "./configure", *args
|
2015-08-03 12:55:31 +00:00
|
|
|
system "make", "install"
|
2009-10-18 19:05:19 +00:00
|
|
|
end
|
2010-10-07 03:14:58 +00:00
|
|
|
|
2016-03-18 21:52:12 +00:00
|
|
|
test do
|
|
|
|
(testpath/"test.cpp").write <<-EOS.undent
|
|
|
|
#include <IL/devil_cpp_wrapper.hpp>
|
|
|
|
int main() {
|
|
|
|
ilImage image;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOS
|
2010-09-26 18:31:41 +00:00
|
|
|
|
2016-03-18 21:52:12 +00:00
|
|
|
system ENV.cxx, "test.cpp", "-L#{lib}", "-lIL", "-lILU", "-o", "test"
|
|
|
|
system "./test"
|
|
|
|
end
|
|
|
|
end
|