homebrew-core/Formula/ghostscript.rb

142 lines
4.3 KiB
Ruby
Raw Normal View History

require 'formula'
2011-03-10 05:11:03 +00:00
class Ghostscript < Formula
homepage 'http://www.ghostscript.com/'
stable do
url 'http://downloads.ghostscript.com/public/ghostscript-9.15.tar.gz'
sha1 'f53bcc47e912c7bffc2ced62ed9311376fb18bab'
patch :DATA # Uncomment OS X-specific make vars
end
2014-02-24 15:11:24 +00:00
bottle do
2014-10-21 20:14:11 +00:00
revision 3
sha1 "64527567402bb0e06bd3cd2bd1999d3bd3ea09ad" => :yosemite
sha1 "bd885778fee5126a4f2b7bc27ea70e312668c430" => :mavericks
sha1 "41d1130888b464aa27cf46ae4266a517d17d64cb" => :mountain_lion
end
2013-09-18 20:57:52 +00:00
head do
url 'git://git.ghostscript.com/ghostpdl.git'
resource 'djvu' do
url 'git://git.code.sf.net/p/djvu/gsdjvu-git'
end
2013-09-20 15:15:54 +00:00
2014-06-02 02:38:17 +00:00
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
# Uncomment OS X-specific make vars
patch do
url "https://gist.githubusercontent.com/jacknagel/9559501/raw/9709b3234cc888d29f717838650d29e7062da917/gs.patch"
sha1 "65c99df4f0d57368a086154d34722f5c4b9c84cc"
end
2013-09-18 20:57:52 +00:00
end
option 'with-djvu', 'Build drivers for DjVU file format'
depends_on 'pkg-config' => :build
depends_on 'jpeg'
depends_on 'libtiff'
depends_on 'jbig2dec'
2013-11-11 15:52:15 +00:00
depends_on 'little-cms2'
depends_on 'libpng'
2013-06-25 15:12:14 +00:00
depends_on :x11 => ['2.7.2', :optional]
2013-09-18 20:57:52 +00:00
depends_on 'djvulibre' if build.with? 'djvu'
depends_on 'freetype'
2013-11-12 15:41:44 +00:00
conflicts_with 'gambit-scheme', :because => 'both install `gsc` binaries'
2013-08-12 04:50:17 +00:00
# http://sourceforge.net/projects/gs-fonts/
resource 'fonts' do
url 'https://downloads.sourceforge.net/project/gs-fonts/gs-fonts/8.11%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-8.11.tar.gz'
2013-08-12 04:50:17 +00:00
sha1 '2a7198e8178b2e7dba87cb5794da515200b568f5'
end
2013-09-18 20:57:52 +00:00
# http://djvu.sourceforge.net/gsdjvu.html
resource 'djvu' do
url 'https://downloads.sourceforge.net/project/djvu/GSDjVu/1.6/gsdjvu-1.6.tar.gz'
sha1 'a8c5520d698d8be558a1957b4e5108cba68822ef'
2013-09-18 20:57:52 +00:00
end
def move_included_source_copies
# If the install version of any of these doesn't match
# the version included in ghostscript, we get errors
# Taken from the MacPorts portfile - http://bit.ly/ghostscript-portfile
2014-04-18 23:53:07 +00:00
renames = %w{freetype jbig2dec jpeg libpng tiff}
2013-11-11 15:52:15 +00:00
renames.each { |lib| mv lib, "#{lib}_local" }
end
def install
src_dir = build.head? ? "gs" : "."
2013-09-18 20:57:52 +00:00
resource('djvu').stage do
inreplace 'gsdjvu.mak', '$(GL', '$(DEV'
(buildpath+'devices').install 'gdevdjvu.c'
2013-09-18 20:57:52 +00:00
(buildpath+'lib').install 'ps2utf8.ps'
ENV['EXTRA_INIT_FILES'] = 'ps2utf8.ps'
(buildpath/'devices/contrib.mak').open('a') { |f| f.write(File.read('gsdjvu.mak')) }
2013-09-18 20:57:52 +00:00
end if build.with? 'djvu'
cd src_dir do
move_included_source_copies
args = %W[
--prefix=#{prefix}
--disable-cups
--disable-compile-inits
--disable-gtk
--with-system-libtiff
]
args << '--without-x' if build.without? 'x11'
if build.head?
system './autogen.sh', *args
else
system './configure', *args
end
# versioned stuff in main tree is pointless for us
inreplace 'Makefile', '/$(GS_DOT_VERSION)', ''
inreplace 'Makefile' do |s|
s.change_make_var!('DEVICE_DEVS17','$(DD)djvumask.dev $(DD)djvusep.dev')
2013-09-18 20:57:52 +00:00
end if build.with? 'djvu'
# Install binaries and libraries
system 'make', 'install'
system 'make', 'install-so'
end
2013-08-12 04:50:17 +00:00
(share+'ghostscript/fonts').install resource('fonts')
(man+'de').rmtree
end
end
__END__
diff --git a/base/unix-dll.mak b/base/unix-dll.mak
index ae2d7d8..4f4daed 100644
--- a/base/unix-dll.mak
+++ b/base/unix-dll.mak
@@ -64,12 +64,12 @@ GS_SONAME_MAJOR_MINOR=$(GS_SONAME_BASE)$(GS_SOEXT)$(SO_LIB_VERSION_SEPARATOR)$(G
# MacOS X
-#GS_SOEXT=dylib
-#GS_SONAME=$(GS_SONAME_BASE).$(GS_SOEXT)
-#GS_SONAME_MAJOR=$(GS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_SOEXT)
-#GS_SONAME_MAJOR_MINOR=$(GS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_VERSION_MINOR).$(GS_SOEXT)
+GS_SOEXT=dylib
+GS_SONAME=$(GS_SONAME_BASE).$(GS_SOEXT)
+GS_SONAME_MAJOR=$(GS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_SOEXT)
+GS_SONAME_MAJOR_MINOR=$(GS_SONAME_BASE).$(GS_VERSION_MAJOR).$(GS_VERSION_MINOR).$(GS_SOEXT)
#LDFLAGS_SO=-dynamiclib -flat_namespace
-#LDFLAGS_SO_MAC=-dynamiclib -install_name $(GS_SONAME_MAJOR_MINOR)
+LDFLAGS_SO_MAC=-dynamiclib -install_name __PREFIX__/lib/$(GS_SONAME_MAJOR_MINOR)
#LDFLAGS_SO=-dynamiclib -install_name $(FRAMEWORK_NAME)
GS_SO=$(BINDIR)/$(GS_SONAME)