2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
Dependency resolution
Specify dependencies in your formula's deps function. You can return an Array,
String or Hash, eg:
def deps
{ :optional => 'libogg', :required => %w[flac sdl], :recommended => 'cmake' }
end
Note currently the Hash is flattened and qualifications are ignored. If you
only return an Array or String, the qualification is assumed to be :required.
Other packaging systems have problems when it comes to packages requiring a
specific version of a package, or some patches that may not work well with
other software. With Homebrew we have some options:
1. If the formula is vanilla but an older version we can cherry-pick the old
version and install it in the Cellar in parallel, but just not symlink it
into /usr/local while forcing the formula that depends on it to link to
that one and not any other versions of it.
2. If the dependency requires patches then we shouldn't install this for use
by any other tools, (I guess this needs to be decided on a per-situation
basis). It can be installed into the parent formula's prefix, and not
symlinked into /usr/local. In this case the dependency's Formula
derivation should be saved in the parent formula's file (check git or
flac for an example of this).
Both the above can be done currently with hacks, so I'll flesh out a proper
way sometime this week.
2009-09-07 00:06:08 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class GhostscriptFonts < Formula
|
2009-09-29 15:57:12 +00:00
|
|
|
url 'http://downloads.sourceforge.net/project/gs-fonts/gs-fonts/8.11%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-8.11.tar.gz'
|
|
|
|
homepage 'http://sourceforge.net/projects/gs-fonts/'
|
|
|
|
md5 '6865682b095f8c4500c54b285ff05ef6'
|
Dependency resolution
Specify dependencies in your formula's deps function. You can return an Array,
String or Hash, eg:
def deps
{ :optional => 'libogg', :required => %w[flac sdl], :recommended => 'cmake' }
end
Note currently the Hash is flattened and qualifications are ignored. If you
only return an Array or String, the qualification is assumed to be :required.
Other packaging systems have problems when it comes to packages requiring a
specific version of a package, or some patches that may not work well with
other software. With Homebrew we have some options:
1. If the formula is vanilla but an older version we can cherry-pick the old
version and install it in the Cellar in parallel, but just not symlink it
into /usr/local while forcing the formula that depends on it to link to
that one and not any other versions of it.
2. If the dependency requires patches then we shouldn't install this for use
by any other tools, (I guess this needs to be decided on a per-situation
basis). It can be installed into the parent formula's prefix, and not
symlinked into /usr/local. In this case the dependency's Formula
derivation should be saved in the parent formula's file (check git or
flac for an example of this).
Both the above can be done currently with hacks, so I'll flesh out a proper
way sometime this week.
2009-09-07 00:06:08 +00:00
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Ghostscript < Formula
|
2011-04-14 07:14:49 +00:00
|
|
|
url 'http://downloads.ghostscript.com/public/ghostscript-9.02.tar.bz2'
|
2009-09-29 15:57:12 +00:00
|
|
|
homepage 'http://www.ghostscript.com/'
|
2011-04-14 07:14:49 +00:00
|
|
|
md5 'f67151444bd56a7904579fc75a083dd6'
|
2009-09-29 15:57:12 +00:00
|
|
|
|
2010-09-19 17:21:57 +00:00
|
|
|
depends_on 'pkg-config' => :build
|
2009-09-29 15:57:12 +00:00
|
|
|
depends_on 'jpeg'
|
2010-07-02 20:03:43 +00:00
|
|
|
depends_on 'libtiff'
|
2011-07-22 20:01:57 +00:00
|
|
|
depends_on 'jasper'
|
|
|
|
|
|
|
|
# The patches fix compilation against libpng 1.5, provided by Lion.
|
|
|
|
# Patch by @CharlieRoot
|
|
|
|
def patches
|
|
|
|
DATA
|
|
|
|
end
|
2009-09-29 15:57:12 +00:00
|
|
|
|
2009-11-15 03:18:12 +00:00
|
|
|
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
|
2011-07-22 20:01:57 +00:00
|
|
|
renames = [ "jpeg", "libpng", "zlib", "jasper", "expat", "tiff" ]
|
|
|
|
renames << "freetype" if 10.7 <= MACOS_VERSION
|
|
|
|
renames.each do |lib|
|
2010-05-13 05:43:42 +00:00
|
|
|
mv lib, "#{lib}_local"
|
2009-11-15 03:18:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
Dependency resolution
Specify dependencies in your formula's deps function. You can return an Array,
String or Hash, eg:
def deps
{ :optional => 'libogg', :required => %w[flac sdl], :recommended => 'cmake' }
end
Note currently the Hash is flattened and qualifications are ignored. If you
only return an Array or String, the qualification is assumed to be :required.
Other packaging systems have problems when it comes to packages requiring a
specific version of a package, or some patches that may not work well with
other software. With Homebrew we have some options:
1. If the formula is vanilla but an older version we can cherry-pick the old
version and install it in the Cellar in parallel, but just not symlink it
into /usr/local while forcing the formula that depends on it to link to
that one and not any other versions of it.
2. If the dependency requires patches then we shouldn't install this for use
by any other tools, (I guess this needs to be decided on a per-situation
basis). It can be installed into the parent formula's prefix, and not
symlinked into /usr/local. In this case the dependency's Formula
derivation should be saved in the parent formula's file (check git or
flac for an example of this).
Both the above can be done currently with hacks, so I'll flesh out a proper
way sometime this week.
2009-09-07 00:06:08 +00:00
|
|
|
def install
|
2009-11-15 03:18:12 +00:00
|
|
|
ENV.libpng
|
|
|
|
ENV.deparallelize
|
2009-09-29 15:57:12 +00:00
|
|
|
# O4 takes an ungodly amount of time
|
2009-09-28 15:09:25 +00:00
|
|
|
ENV.O3
|
Dependency resolution
Specify dependencies in your formula's deps function. You can return an Array,
String or Hash, eg:
def deps
{ :optional => 'libogg', :required => %w[flac sdl], :recommended => 'cmake' }
end
Note currently the Hash is flattened and qualifications are ignored. If you
only return an Array or String, the qualification is assumed to be :required.
Other packaging systems have problems when it comes to packages requiring a
specific version of a package, or some patches that may not work well with
other software. With Homebrew we have some options:
1. If the formula is vanilla but an older version we can cherry-pick the old
version and install it in the Cellar in parallel, but just not symlink it
into /usr/local while forcing the formula that depends on it to link to
that one and not any other versions of it.
2. If the dependency requires patches then we shouldn't install this for use
by any other tools, (I guess this needs to be decided on a per-situation
basis). It can be installed into the parent formula's prefix, and not
symlinked into /usr/local. In this case the dependency's Formula
derivation should be saved in the parent formula's file (check git or
flac for an example of this).
Both the above can be done currently with hacks, so I'll flesh out a proper
way sometime this week.
2009-09-07 00:06:08 +00:00
|
|
|
# ghostscript configure ignores LDFLAGs apparently
|
|
|
|
ENV['LIBS']="-L/usr/X11/lib"
|
2009-09-28 15:09:25 +00:00
|
|
|
|
2009-11-15 03:18:12 +00:00
|
|
|
move_included_source_copies
|
2009-09-29 15:57:12 +00:00
|
|
|
|
|
|
|
system "./configure", "--prefix=#{prefix}", "--disable-debug",
|
Dependency resolution
Specify dependencies in your formula's deps function. You can return an Array,
String or Hash, eg:
def deps
{ :optional => 'libogg', :required => %w[flac sdl], :recommended => 'cmake' }
end
Note currently the Hash is flattened and qualifications are ignored. If you
only return an Array or String, the qualification is assumed to be :required.
Other packaging systems have problems when it comes to packages requiring a
specific version of a package, or some patches that may not work well with
other software. With Homebrew we have some options:
1. If the formula is vanilla but an older version we can cherry-pick the old
version and install it in the Cellar in parallel, but just not symlink it
into /usr/local while forcing the formula that depends on it to link to
that one and not any other versions of it.
2. If the dependency requires patches then we shouldn't install this for use
by any other tools, (I guess this needs to be decided on a per-situation
basis). It can be installed into the parent formula's prefix, and not
symlinked into /usr/local. In this case the dependency's Formula
derivation should be saved in the parent formula's file (check git or
flac for an example of this).
Both the above can be done currently with hacks, so I'll flesh out a proper
way sometime this week.
2009-09-07 00:06:08 +00:00
|
|
|
# the cups component adamantly installs to /usr so fuck it
|
2009-11-15 03:18:12 +00:00
|
|
|
"--disable-cups",
|
|
|
|
"--disable-compile-inits",
|
|
|
|
"--disable-gtk"
|
|
|
|
|
Dependency resolution
Specify dependencies in your formula's deps function. You can return an Array,
String or Hash, eg:
def deps
{ :optional => 'libogg', :required => %w[flac sdl], :recommended => 'cmake' }
end
Note currently the Hash is flattened and qualifications are ignored. If you
only return an Array or String, the qualification is assumed to be :required.
Other packaging systems have problems when it comes to packages requiring a
specific version of a package, or some patches that may not work well with
other software. With Homebrew we have some options:
1. If the formula is vanilla but an older version we can cherry-pick the old
version and install it in the Cellar in parallel, but just not symlink it
into /usr/local while forcing the formula that depends on it to link to
that one and not any other versions of it.
2. If the dependency requires patches then we shouldn't install this for use
by any other tools, (I guess this needs to be decided on a per-situation
basis). It can be installed into the parent formula's prefix, and not
symlinked into /usr/local. In this case the dependency's Formula
derivation should be saved in the parent formula's file (check git or
flac for an example of this).
Both the above can be done currently with hacks, so I'll flesh out a proper
way sometime this week.
2009-09-07 00:06:08 +00:00
|
|
|
# versioned stuff in main tree is pointless for us
|
|
|
|
inreplace 'Makefile', '/$(GS_DOT_VERSION)', ''
|
|
|
|
system "make install"
|
|
|
|
|
|
|
|
GhostscriptFonts.new.brew do
|
|
|
|
Dir.chdir '..'
|
2010-08-08 17:20:15 +00:00
|
|
|
(share+'ghostscript').install 'fonts'
|
Dependency resolution
Specify dependencies in your formula's deps function. You can return an Array,
String or Hash, eg:
def deps
{ :optional => 'libogg', :required => %w[flac sdl], :recommended => 'cmake' }
end
Note currently the Hash is flattened and qualifications are ignored. If you
only return an Array or String, the qualification is assumed to be :required.
Other packaging systems have problems when it comes to packages requiring a
specific version of a package, or some patches that may not work well with
other software. With Homebrew we have some options:
1. If the formula is vanilla but an older version we can cherry-pick the old
version and install it in the Cellar in parallel, but just not symlink it
into /usr/local while forcing the formula that depends on it to link to
that one and not any other versions of it.
2. If the dependency requires patches then we shouldn't install this for use
by any other tools, (I guess this needs to be decided on a per-situation
basis). It can be installed into the parent formula's prefix, and not
symlinked into /usr/local. In this case the dependency's Formula
derivation should be saved in the parent formula's file (check git or
flac for an example of this).
Both the above can be done currently with hacks, so I'll flesh out a proper
way sometime this week.
2009-09-07 00:06:08 +00:00
|
|
|
end
|
2010-07-02 20:03:43 +00:00
|
|
|
|
Dependency resolution
Specify dependencies in your formula's deps function. You can return an Array,
String or Hash, eg:
def deps
{ :optional => 'libogg', :required => %w[flac sdl], :recommended => 'cmake' }
end
Note currently the Hash is flattened and qualifications are ignored. If you
only return an Array or String, the qualification is assumed to be :required.
Other packaging systems have problems when it comes to packages requiring a
specific version of a package, or some patches that may not work well with
other software. With Homebrew we have some options:
1. If the formula is vanilla but an older version we can cherry-pick the old
version and install it in the Cellar in parallel, but just not symlink it
into /usr/local while forcing the formula that depends on it to link to
that one and not any other versions of it.
2. If the dependency requires patches then we shouldn't install this for use
by any other tools, (I guess this needs to be decided on a per-situation
basis). It can be installed into the parent formula's prefix, and not
symlinked into /usr/local. In this case the dependency's Formula
derivation should be saved in the parent formula's file (check git or
flac for an example of this).
Both the above can be done currently with hacks, so I'll flesh out a proper
way sometime this week.
2009-09-07 00:06:08 +00:00
|
|
|
(man+'de').rmtree
|
|
|
|
end
|
|
|
|
end
|
2011-07-22 20:01:57 +00:00
|
|
|
|
|
|
|
__END__
|
|
|
|
diff --git a/base/gdevpng.c b/base/gdevpng.c
|
|
|
|
index f58c4eb..3477fe3 100644
|
|
|
|
--- a/base/gdevpng.c
|
|
|
|
+++ b/base/gdevpng.c
|
|
|
|
@@ -274,13 +274,30 @@ png_print_page(gx_device_printer * pdev, FILE * file)
|
|
|
|
char software_key[80];
|
|
|
|
char software_text[256];
|
|
|
|
png_text text_png;
|
|
|
|
+#if PNG_LIBPNG_VER >= 10500
|
|
|
|
+ int color_type = 0;
|
|
|
|
+ png_color* palette = NULL;
|
|
|
|
+#define PNG_SET_IHDR(bit, color) \
|
|
|
|
+ png_set_IHDR(png_ptr, info_ptr, pdev->width, pdev->height, (bit), (color_type = (color)), \
|
|
|
|
+ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
|
|
|
|
+#define COLOR_TYPE color_type
|
|
|
|
+#define PALETTE palette
|
|
|
|
+#define PNG_JMPBUF png_jmpbuf(png_ptr)
|
|
|
|
+#else
|
|
|
|
+#define PNG_SET_IHDR(bit, color) \
|
|
|
|
+ info_ptr->bit_depth = (bit); \
|
|
|
|
+ info_ptr->color_type = (color);
|
|
|
|
+#define COLOR_TYPE info_ptr->color_type
|
|
|
|
+#define PALETTE info_ptr->palette
|
|
|
|
+#define PNG_JMPBUF png_ptr->jmpbuf
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
if (row == 0 || png_ptr == 0 || info_ptr == 0) {
|
|
|
|
code = gs_note_error(gs_error_VMerror);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
/* set error handling */
|
|
|
|
- if (setjmp(png_ptr->jmpbuf)) {
|
|
|
|
+ if (setjmp(PNG_JMPBUF)) {
|
|
|
|
/* If we get here, we had a problem reading the file */
|
|
|
|
code = gs_note_error(gs_error_VMerror);
|
|
|
|
goto done;
|
|
|
|
@@ -289,6 +306,12 @@ png_print_page(gx_device_printer * pdev, FILE * file)
|
|
|
|
/* set up the output control */
|
|
|
|
png_init_io(png_ptr, file);
|
|
|
|
|
|
|
|
+#if PNG_LIBPNG_VER >= 10500
|
|
|
|
+ png_set_pHYs(png_ptr, info_ptr,
|
|
|
|
+ (png_uint_32) (pdev->HWResolution[0] * (100.0 / 2.54)),
|
|
|
|
+ (png_uint_32) (pdev->HWResolution[1] * (100.0 / 2.54)),
|
|
|
|
+ PNG_RESOLUTION_METER);
|
|
|
|
+#else
|
|
|
|
/* set the file information here */
|
|
|
|
info_ptr->width = pdev->width;
|
|
|
|
info_ptr->height = pdev->height;
|
|
|
|
@@ -299,10 +322,10 @@ png_print_page(gx_device_printer * pdev, FILE * file)
|
|
|
|
(png_uint_32) (pdev->HWResolution[1] * (100.0 / 2.54));
|
|
|
|
info_ptr->phys_unit_type = PNG_RESOLUTION_METER;
|
|
|
|
info_ptr->valid |= PNG_INFO_pHYs;
|
|
|
|
+#endif
|
|
|
|
switch (depth) {
|
|
|
|
case 32:
|
|
|
|
- info_ptr->bit_depth = 8;
|
|
|
|
- info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
|
|
|
+ PNG_SET_IHDR(8, PNG_COLOR_TYPE_RGB_ALPHA);
|
|
|
|
png_set_invert_alpha(png_ptr);
|
|
|
|
{ gx_device_pngalpha *ppdev = (gx_device_pngalpha *)pdev;
|
|
|
|
png_color_16 background;
|
|
|
|
@@ -315,75 +338,78 @@ png_print_page(gx_device_printer * pdev, FILE * file)
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 48:
|
|
|
|
- info_ptr->bit_depth = 16;
|
|
|
|
- info_ptr->color_type = PNG_COLOR_TYPE_RGB;
|
|
|
|
+ PNG_SET_IHDR(16, PNG_COLOR_TYPE_RGB);
|
|
|
|
#if defined(ARCH_IS_BIG_ENDIAN) && (!ARCH_IS_BIG_ENDIAN)
|
|
|
|
png_set_swap(png_ptr);
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case 24:
|
|
|
|
- info_ptr->bit_depth = 8;
|
|
|
|
- info_ptr->color_type = PNG_COLOR_TYPE_RGB;
|
|
|
|
+ PNG_SET_IHDR(8, PNG_COLOR_TYPE_RGB);
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
- info_ptr->bit_depth = 8;
|
|
|
|
- if (gx_device_has_color(pdev))
|
|
|
|
- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
|
|
|
|
- else
|
|
|
|
- info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
|
|
|
|
+ PNG_SET_IHDR(8, (gx_device_has_color(pdev) ? PNG_COLOR_TYPE_PALETTE : PNG_COLOR_TYPE_GRAY));
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
- info_ptr->bit_depth = 4;
|
|
|
|
- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
|
|
|
|
+ PNG_SET_IHDR(4, PNG_COLOR_TYPE_PALETTE);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
- info_ptr->bit_depth = 1;
|
|
|
|
- info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
|
|
|
|
+ PNG_SET_IHDR(1, PNG_COLOR_TYPE_GRAY);
|
|
|
|
/* invert monocrome pixels */
|
|
|
|
png_set_invert_mono(png_ptr);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set the palette if there is one */
|
|
|
|
- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
|
|
|
|
+ if (COLOR_TYPE == PNG_COLOR_TYPE_PALETTE) {
|
|
|
|
int i;
|
|
|
|
int num_colors = 1 << depth;
|
|
|
|
gx_color_value rgb[3];
|
|
|
|
|
|
|
|
- info_ptr->palette =
|
|
|
|
+ PALETTE =
|
|
|
|
(void *)gs_alloc_bytes(mem, 256 * sizeof(png_color),
|
|
|
|
"png palette");
|
|
|
|
- if (info_ptr->palette == 0) {
|
|
|
|
+ if (PALETTE == 0) {
|
|
|
|
code = gs_note_error(gs_error_VMerror);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
+#if PNG_LIBPNG_VER < 10500
|
|
|
|
info_ptr->num_palette = num_colors;
|
|
|
|
info_ptr->valid |= PNG_INFO_PLTE;
|
|
|
|
+#endif
|
|
|
|
for (i = 0; i < num_colors; i++) {
|
|
|
|
(*dev_proc(pdev, map_color_rgb)) ((gx_device *) pdev,
|
|
|
|
(gx_color_index) i, rgb);
|
|
|
|
- info_ptr->palette[i].red = gx_color_value_to_byte(rgb[0]);
|
|
|
|
- info_ptr->palette[i].green = gx_color_value_to_byte(rgb[1]);
|
|
|
|
- info_ptr->palette[i].blue = gx_color_value_to_byte(rgb[2]);
|
|
|
|
+ PALETTE[i].red = gx_color_value_to_byte(rgb[0]);
|
|
|
|
+ PALETTE[i].green = gx_color_value_to_byte(rgb[1]);
|
|
|
|
+ PALETTE[i].blue = gx_color_value_to_byte(rgb[2]);
|
|
|
|
}
|
|
|
|
+#if PNG_LIBPNG_VER >= 10500
|
|
|
|
+ png_set_PLTE(png_ptr, info_ptr, PALETTE, num_colors);
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
/* add comment */
|
|
|
|
strncpy(software_key, "Software", sizeof(software_key));
|
|
|
|
sprintf(software_text, "%s %d.%02d", gs_product,
|
|
|
|
(int)(gs_revision / 100), (int)(gs_revision % 100));
|
|
|
|
- text_png.compression = -1; /* uncompressed */
|
|
|
|
+ text_png.compression = PNG_TEXT_COMPRESSION_NONE; /* uncompressed */
|
|
|
|
text_png.key = software_key;
|
|
|
|
text_png.text = software_text;
|
|
|
|
text_png.text_length = strlen(software_text);
|
|
|
|
+#if PNG_LIBPNG_VER >= 10500
|
|
|
|
+ png_set_text(png_ptr, info_ptr, &text_png, 1);
|
|
|
|
+#else
|
|
|
|
info_ptr->text = &text_png;
|
|
|
|
info_ptr->num_text = 1;
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/* write the file information */
|
|
|
|
png_write_info(png_ptr, info_ptr);
|
|
|
|
|
|
|
|
+#if PNG_LIBPNG_VER < 10500
|
|
|
|
/* don't write the comments twice */
|
|
|
|
info_ptr->num_text = 0;
|
|
|
|
info_ptr->text = NULL;
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/* Write the contents of the image. */
|
|
|
|
for (y = 0; y < height; y++) {
|
|
|
|
@@ -395,7 +421,7 @@ png_print_page(gx_device_printer * pdev, FILE * file)
|
|
|
|
png_write_end(png_ptr, info_ptr);
|
|
|
|
|
|
|
|
/* if you alloced the palette, free it here */
|
|
|
|
- gs_free_object(mem, info_ptr->palette, "png palette");
|
|
|
|
+ gs_free_object(mem, PALETTE, "png palette");
|
|
|
|
|
|
|
|
done:
|
|
|
|
/* free the structures */
|
|
|
|
diff --git a/base/Makefile.in b/base/Makefile.in
|
|
|
|
index 5b7847d..85e1a32 100644
|
|
|
|
--- a/base/Makefile.in
|
|
|
|
+++ b/base/Makefile.in
|
|
|
|
@@ -362,7 +362,7 @@ LDFLAGS=@LDFLAGS@ $(XLDFLAGS)
|
|
|
|
# Solaris may need -lnsl -lsocket -lposix4.
|
|
|
|
# (Libraries required by individual drivers are handled automatically.)
|
|
|
|
|
|
|
|
-EXTRALIBS=@LIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@
|
|
|
|
+EXTRALIBS=@LIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@
|
|
|
|
|
|
|
|
# Define the standard libraries to search at the end of linking.
|
|
|
|
# Most platforms require -lpthread for the POSIX threads library;
|
|
|
|
|