Ghostscript: add DjVU support

Closes Homebrew/homebrew#16830.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
Joey Korkames 2013-01-01 15:29:07 -07:00 committed by Adam Vandenberg
parent a0e24d3280
commit 50c9f29867

View file

@ -6,6 +6,15 @@ class GhostscriptFonts < Formula
sha1 '2a7198e8178b2e7dba87cb5794da515200b568f5'
end
class GsDjVU < Formula
homepage 'http://djvu.sourceforge.net/gsdjvu.html'
url 'http://sourceforge.net/projects/djvu/files/GSDjVu/1.5/gsdjvu-1.5.tar.gz'
version '1.5'
sha1 'c7d0677dae5fe644cf3d714c04b3c2c343906342'
head 'git://git.code.sf.net/p/djvu/gsdjvu-git'
end
class Ghostscript < Formula
homepage 'http://www.ghostscript.com/'
url 'http://downloads.ghostscript.com/public/ghostscript-9.07.tar.gz'
@ -14,6 +23,7 @@ class Ghostscript < Formula
head 'git://git.ghostscript.com/ghostpdl.git'
option 'with-x11', 'Install with X11 support'
option 'with-djvu', 'Build drivers for DjVU file format'
if build.head?
depends_on :automake
@ -26,6 +36,7 @@ class Ghostscript < Formula
depends_on 'jbig2dec'
depends_on :libpng
depends_on :x11 => '2.7.2' if build.include? 'with-x11'
depends_on 'djvulibre' if build.include? 'with-djvu'
# Fix dylib names, per installation instructions
def patches
@ -48,6 +59,16 @@ class Ghostscript < Formula
src_dir = build.head? ? "gs" : "."
if build.include? 'with-djvu'
GsDjVU.new.brew do
inreplace 'gdevdjvu.c', /#include "gserror.h"/, ''
(buildpath+'base').install 'gdevdjvu.c'
(buildpath+'lib').install 'ps2utf8.ps'
ENV['EXTRA_INIT_FILES'] = 'ps2utf8.ps'
File.open((buildpath+'base/contrib.mak'),'a'){|f|f.write(IO.read('gsdjvu.mak'))} #cat
end
end
cd src_dir do
move_included_source_copies
args = %W[
@ -68,9 +89,13 @@ class Ghostscript < Formula
# 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')
end if build.include? 'with-djvu'
# Install binaries and libraries
system "make install"
system "make install-so"
system 'make install'
system 'make install-so'
end
GhostscriptFonts.new.brew do