--- /dev/null
+--- texlive-20080816-source/texk/web2c/luatexdir/image/image.h.orig 2008-04-28 10:45:24.000000000 +0200
++++ texlive-20080816-source/texk/web2c/luatexdir/image/image.h 2016-07-23 18:18:25.545919882 +0200
+@@ -22,7 +22,7 @@
+ #ifndef IMAGE_H
+ # define IMAGE_H
+
+-# include <../libpng/png.h>
++# include <png.h>
+
+ # define JPG_UINT16 unsigned int
+ # define JPG_UINT32 unsigned long
+--- texlive-20080816-source/texk/web2c/luatexdir/image/writepng.c.orig 2008-04-28 10:45:24.000000000 +0200
++++ texlive-20080816-source/texk/web2c/luatexdir/image/writepng.c 2016-07-24 08:43:25.776117469 +0200
+@@ -59,7 +59,7 @@
+ if ((info_p = png_create_info_struct(png_p)) == NULL)
+ pdftex_fail("libpng: png_create_info_struct() failed");
+ img_png_info_ptr(idict) = info_p;
+- if (setjmp(png_p->jmpbuf))
++ if (png_jmpbuf(png_p))
+ pdftex_fail("libpng: internal error");
+ png_init_io(png_p, img_file(idict));
+ png_read_info(png_p, info_p);
+@@ -68,12 +68,12 @@
+ png_set_tRNS_to_alpha(png_p);
+ }
+ /* alpha channel support */
+- if (fixed_pdf_minor_version < 4 && png_p->color_type | PNG_COLOR_MASK_ALPHA)
++ if (fixed_pdf_minor_version < 4 && png_get_color_type(png_p, info_p) & PNG_COLOR_MASK_ALPHA)
+ png_set_strip_alpha(png_p);
+ /* 16bit depth support */
+ if (fixed_pdf_minor_version < 5)
+ fixed_image_hicolor = 0;
+- if (info_p->bit_depth == 16 && !fixed_image_hicolor)
++ if (png_get_bit_depth(png_p, info_p) == 16 && !fixed_image_hicolor)
+ png_set_strip_16(png_p);
+ /* gamma support */
+ if (fixed_image_apply_gamma) {
+@@ -86,15 +86,15 @@
+ /* reset structure */
+ png_read_update_info(png_p, info_p);
+ /* resolution support */
+- img_xsize(idict) = info_p->width;
+- img_ysize(idict) = info_p->height;
+- if (info_p->valid & PNG_INFO_pHYs) {
++ img_xsize(idict) = png_get_image_width(png_p, info_p);
++ img_ysize(idict) = png_get_image_height(png_p, info_p);
++ if (png_get_valid(png_p, info_p, PNG_INFO_pHYs)) {
+ img_xres(idict) =
+ round(0.0254 * png_get_x_pixels_per_meter(png_p, info_p));
+ img_yres(idict) =
+ round(0.0254 * png_get_y_pixels_per_meter(png_p, info_p));
+ }
+- switch (info_p->color_type) {
++ switch (png_get_color_type(png_p, info_p)) {
+ case PNG_COLOR_TYPE_PALETTE:
+ img_color(idict) = IMAGE_COLOR_C | IMAGE_COLOR_I;
+ break;
+@@ -107,9 +107,9 @@
+ img_color(idict) = IMAGE_COLOR_C;
+ break;
+ default:
+- pdftex_fail("unsupported type of color_type <%i>", info_p->color_type);
++ pdftex_fail("unsupported type of color_type <%i>", png_get_color_type(png_p, info_p));
+ }
+- img_colordepth(idict) = info_p->bit_depth;
++ img_colordepth(idict) = png_get_bit_depth(png_p, info_p);
+ if (readtype == IMG_CLOSEINBETWEEN)
+ close_and_cleanup_png(idict);
+ }
+@@ -134,10 +134,10 @@
+ #define write_simple_pixel(r) pdf_buf[pdf_ptr++] = *r++
+
+ #define write_noninterlaced(outmac) \
+- for (i = 0; (unsigned) i < (int)info_p->height; i++) { \
++ for (i = 0; (unsigned) i < (int)height; i++) { \
+ png_read_row(png_p, row, NULL); \
+ r = row; \
+- k = info_p->rowbytes; \
++ k = rowbytes; \
+ while(k > 0) { \
+ l = (k > pdf_buf_size)? pdf_buf_size : k; \
+ pdfroom(l); \
+@@ -149,9 +149,9 @@
+ }
+
+ #define write_interlaced(outmac) \
+- for (i = 0; (unsigned) i < (int)info_p->height; i++) { \
++ for (i = 0; (unsigned) i < (int)height; i++) { \
+ row = rows[i]; \
+- k = info_p->rowbytes; \
++ k = rowbytes; \
+ while(k > 0) { \
+ l = (k > pdf_buf_size)? pdf_buf_size : k;\
+ pdfroom(l); \
+@@ -173,36 +173,46 @@
+ if (img_colorspace(idict) != 0) {
+ pdf_printf("%i 0 R\n", (int) img_colorspace(idict));
+ } else {
++ png_colorp palette;
++ int num_palette;
+ pdf_create_obj(0, 0);
+ palette_objnum = obj_ptr;
++ png_get_PLTE(png_p, info_p, &palette, &num_palette);
+ pdf_printf("[/Indexed /DeviceRGB %i %i 0 R]\n",
+- (int) (info_p->num_palette - 1), (int) palette_objnum);
++ (int) (num_palette - 1), (int) palette_objnum);
+ }
+ pdf_begin_stream();
+- if (info_p->interlace_type == PNG_INTERLACE_NONE) {
+- row = xtalloc(info_p->rowbytes, png_byte);
++ if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE) {
++ png_uint_32 height = png_get_image_height(png_p, info_p);
++ png_size_t rowbytes = png_get_rowbytes(png_p, info_p);
++ row = xtalloc(rowbytes, png_byte);
+ write_noninterlaced(write_simple_pixel(r));
+ xfree(row);
+ } else {
+- if (info_p->height * info_p->rowbytes >= 10240000L)
++ png_uint_32 height = png_get_image_height(png_p, info_p);
++ png_size_t rowbytes = png_get_rowbytes(png_p, info_p);
++ if (height * rowbytes >= 10240000L)
+ pdftex_warn
+ ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)");
+- rows = xtalloc(info_p->height, png_bytep);
+- for (i = 0; (unsigned) i < info_p->height; i++)
+- rows[i] = xtalloc(info_p->rowbytes, png_byte);
++ rows = xtalloc(height, png_bytep);
++ for (i = 0; (unsigned) i < height; i++)
++ rows[i] = xtalloc(rowbytes, png_byte);
+ png_read_image(png_p, rows);
+ write_interlaced(write_simple_pixel(row));
+ xfree(rows);
+ }
+ pdf_end_stream();
+ if (palette_objnum > 0) {
++ png_colorp palette;
++ int num_palette;
++ png_get_PLTE(png_p, info_p, &palette, &num_palette);
+ pdf_begin_dict(palette_objnum, 0);
+ pdf_begin_stream();
+- for (i = 0; (unsigned) i < info_p->num_palette; i++) {
++ for (i = 0; (unsigned) i < num_palette; i++) {
+ pdfroom(3);
+- pdf_buf[pdf_ptr++] = info_p->palette[i].red;
+- pdf_buf[pdf_ptr++] = info_p->palette[i].green;
+- pdf_buf[pdf_ptr++] = info_p->palette[i].blue;
++ pdf_buf[pdf_ptr++] = palette[i].red;
++ pdf_buf[pdf_ptr++] = palette[i].green;
++ pdf_buf[pdf_ptr++] = palette[i].blue;
+ }
+ pdf_end_stream();
+ }
+@@ -220,17 +230,21 @@
+ pdf_puts("/DeviceGray\n");
+ }
+ pdf_begin_stream();
+- if (info_p->interlace_type == PNG_INTERLACE_NONE) {
+- row = xtalloc(info_p->rowbytes, png_byte);
++ if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE) {
++ png_uint_32 height = png_get_image_height(png_p, info_p);
++ png_size_t rowbytes = png_get_rowbytes(png_p, info_p);
++ row = xtalloc(rowbytes, png_byte);
+ write_noninterlaced(write_simple_pixel(r));
+ xfree(row);
+ } else {
+- if (info_p->height * info_p->rowbytes >= 10240000L)
++ png_uint_32 height = png_get_image_height(png_p, info_p);
++ png_size_t rowbytes = png_get_rowbytes(png_p, info_p);
++ if (height * rowbytes >= 10240000L)
+ pdftex_warn
+ ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)");
+- rows = xtalloc(info_p->height, png_bytep);
+- for (i = 0; (unsigned) i < info_p->height; i++)
+- rows[i] = xtalloc(info_p->rowbytes, png_byte);
++ rows = xtalloc(height, png_bytep);
++ for (i = 0; (unsigned) i < height; i++)
++ rows[i] = xtalloc(rowbytes, png_byte);
+ png_read_image(png_p, rows);
+ write_interlaced(write_simple_pixel(row));
+ xfree(rows);
+@@ -257,26 +271,30 @@
+ pdf_create_obj(0, 0);
+ smask_objnum = obj_ptr;
+ pdf_printf("/SMask %i 0 R\n", (int) smask_objnum);
+- smask_size = (info_p->rowbytes / 2) * info_p->height;
++ smask_size = (png_get_rowbytes(png_p, info_p) / 2) * png_get_image_height(png_p, info_p);
+ smask = xtalloc(smask_size, png_byte);
+ pdf_begin_stream();
+- if (info_p->interlace_type == PNG_INTERLACE_NONE) {
+- row = xtalloc(info_p->rowbytes, png_byte);
+- if ((info_p->bit_depth == 16) && fixed_image_hicolor) {
++ if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE) {
++ png_uint_32 height = png_get_image_height(png_p, info_p);
++ png_size_t rowbytes = png_get_rowbytes(png_p, info_p);
++ row = xtalloc(rowbytes, png_byte);
++ if ((png_get_bit_depth(png_p, info_p) == 16) && fixed_image_hicolor) {
+ write_noninterlaced(write_gray_pixel_16(r));
+ } else {
+ write_noninterlaced(write_gray_pixel_8(r));
+ }
+ xfree(row);
+ } else {
+- if (info_p->height * info_p->rowbytes >= 10240000L)
++ png_uint_32 height = png_get_image_height(png_p, info_p);
++ png_size_t rowbytes = png_get_rowbytes(png_p, info_p);
++ if (height * rowbytes >= 10240000L)
+ pdftex_warn
+ ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)");
+- rows = xtalloc(info_p->height, png_bytep);
+- for (i = 0; (unsigned) i < info_p->height; i++)
+- rows[i] = xtalloc(info_p->rowbytes, png_byte);
++ rows = xtalloc(height, png_bytep);
++ for (i = 0; (unsigned) i < height; i++)
++ rows[i] = xtalloc(rowbytes, png_byte);
+ png_read_image(png_p, rows);
+- if ((info_p->bit_depth == 16) && fixed_image_hicolor) {
++ if ((png_get_bit_depth(png_p, info_p) == 16) && fixed_image_hicolor) {
+ write_interlaced(write_gray_pixel_16(row));
+ } else {
+ write_interlaced(write_gray_pixel_8(row));
+@@ -286,14 +304,14 @@
+ pdf_end_stream();
+ pdf_flush();
+ /* now write the Smask object */
+- bitdepth = (int) info_p->bit_depth;
++ bitdepth = (int) png_get_bit_depth(png_p, info_p);
+ pdf_begin_dict(smask_objnum, 0);
+ pdf_puts("/Type /XObject\n/Subtype /Image\n");
+ if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0)
+ pdf_printf("%s\n", img_attr(idict));
+ pdf_printf("/Width %i\n/Height %i\n/BitsPerComponent %i\n",
+- (int) info_p->width,
+- (int) info_p->height, (bitdepth == 16 ? 8 : bitdepth));
++ (int) png_get_image_width(png_p, info_p),
++ (int) png_get_image_height(png_p, info_p), (bitdepth == 16 ? 8 : bitdepth));
+ pdf_puts("/ColorSpace /DeviceGray\n");
+ pdf_begin_stream();
+ for (i = 0; i < smask_size; i++) {
+@@ -319,17 +337,21 @@
+ pdf_puts("/DeviceRGB\n");
+ }
+ pdf_begin_stream();
+- if (info_p->interlace_type == PNG_INTERLACE_NONE) {
+- row = xtalloc(info_p->rowbytes, png_byte);
++ if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE) {
++ png_uint_32 height = png_get_image_height(png_p, info_p);
++ png_size_t rowbytes = png_get_rowbytes(png_p, info_p);
++ row = xtalloc(rowbytes, png_byte);
+ write_noninterlaced(write_simple_pixel(r));
+ xfree(row);
+ } else {
+- if (info_p->height * info_p->rowbytes >= 10240000L)
++ png_uint_32 height = png_get_image_height(png_p, info_p);
++ png_size_t rowbytes = png_get_rowbytes(png_p, info_p);
++ if (height * rowbytes >= 10240000L)
+ pdftex_warn
+ ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)");
+- rows = xtalloc(info_p->height, png_bytep);
+- for (i = 0; (unsigned) i < info_p->height; i++)
+- rows[i] = xtalloc(info_p->rowbytes, png_byte);
++ rows = xtalloc(height, png_bytep);
++ for (i = 0; (unsigned) i < height; i++)
++ rows[i] = xtalloc(rowbytes, png_byte);
+ png_read_image(png_p, rows);
+ write_interlaced(write_simple_pixel(row));
+ xfree(rows);
+@@ -356,26 +378,30 @@
+ pdf_create_obj(0, 0);
+ smask_objnum = obj_ptr;
+ pdf_printf("/SMask %i 0 R\n", (int) smask_objnum);
+- smask_size = (info_p->rowbytes / 2) * info_p->height;
++ smask_size = (png_get_rowbytes(png_p, info_p) / 2) * png_get_image_height(png_p, info_p);
+ smask = xtalloc(smask_size, png_byte);
+ pdf_begin_stream();
+- if (info_p->interlace_type == PNG_INTERLACE_NONE) {
+- row = xtalloc(info_p->rowbytes, png_byte);
+- if ((info_p->bit_depth == 16) && fixed_image_hicolor) {
++ if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE) {
++ png_uint_32 height = png_get_image_height(png_p, info_p);
++ png_size_t rowbytes = png_get_rowbytes(png_p, info_p);
++ row = xtalloc(rowbytes, png_byte);
++ if ((png_get_bit_depth(png_p, info_p) == 16) && fixed_image_hicolor) {
+ write_noninterlaced(write_rgb_pixel_16(r));
+ } else {
+ write_noninterlaced(write_rgb_pixel_8(r));
+ }
+ xfree(row);
+ } else {
+- if (info_p->height * info_p->rowbytes >= 10240000L)
++ png_uint_32 height = png_get_image_height(png_p, info_p);
++ png_size_t rowbytes = png_get_rowbytes(png_p, info_p);
++ if (height * rowbytes >= 10240000L)
+ pdftex_warn
+ ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)");
+- rows = xtalloc(info_p->height, png_bytep);
+- for (i = 0; (unsigned) i < info_p->height; i++)
+- rows[i] = xtalloc(info_p->rowbytes, png_byte);
++ rows = xtalloc(height, png_bytep);
++ for (i = 0; (unsigned) i < height; i++)
++ rows[i] = xtalloc(rowbytes, png_byte);
+ png_read_image(png_p, rows);
+- if ((info_p->bit_depth == 16) && fixed_image_hicolor) {
++ if ((png_get_bit_depth(png_p, info_p) == 16) && fixed_image_hicolor) {
+ write_interlaced(write_rgb_pixel_16(row));
+ } else {
+ write_interlaced(write_rgb_pixel_8(row));
+@@ -386,14 +412,14 @@
+ pdf_flush();
+ /* now write the Smask object */
+ if (smask_objnum > 0) {
+- bitdepth = (int) info_p->bit_depth;
++ bitdepth = (int) png_get_bit_depth(png_p, info_p);
+ pdf_begin_dict(smask_objnum, 0);
+ pdf_puts("/Type /XObject\n/Subtype /Image\n");
+ if (img_attr(idict) != NULL)
+ pdf_printf("%s\n", img_attr(idict));
+ pdf_printf("/Width %i\n/Height %i\n/BitsPerComponent %i\n",
+- (int) info_p->width,
+- (int) info_p->height, (bitdepth == 16 ? 8 : bitdepth));
++ (int) png_get_image_width(png_p, info_p),
++ (int) png_get_image_height(png_p, info_p), (bitdepth == 16 ? 8 : bitdepth));
+ pdf_puts("/ColorSpace /DeviceGray\n");
+ pdf_begin_stream();
+ for (i = 0; i < smask_size; i++) {
+@@ -442,7 +468,7 @@
+ assert(idict != NULL);
+ png_p = img_png_png_ptr(idict);
+ info_p = img_png_info_ptr(idict);
+- fp = (FILE *) png_p->io_ptr;
++ fp = (FILE *) png_get_io_ptr(png_p);
+ /* 1st pass to find overall stream /Length */
+ if (fseek(fp, 8, SEEK_SET) != 0)
+ pdftex_fail("writepng: fseek in PNG file failed");
+@@ -463,9 +489,9 @@
+ pdf_printf("/Length %d\n", streamlength);
+ pdf_printf("/Filter /FlateDecode\n");
+ pdf_printf("/DecodeParms << ");
+- pdf_printf("/Colors %d ", info_p->color_type == 2 ? 3 : 1);
+- pdf_printf("/Columns %d ", (int) info_p->width);
+- pdf_printf("/BitsPerComponent %i ", (int) info_p->bit_depth);
++ pdf_printf("/Colors %d ", png_get_color_type(png_p, info_p) == PNG_COLOR_TYPE_RGB ? 3 : 1);
++ pdf_printf("/Columns %d ", (int) png_get_image_width(png_p, info_p));
++ pdf_printf("/BitsPerComponent %i ", (int) png_get_bit_depth(png_p, info_p));
+ pdf_printf("/Predictor %d ", 10); /* actual predictor defined on line basis */
+ pdf_printf(">>\n>>\nstream\n");
+ /* 2nd pass to copy data */
+@@ -535,8 +561,8 @@
+ if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0)
+ pdf_printf("%s\n", img_attr(idict));
+ pdf_printf("/Width %i\n/Height %i\n/BitsPerComponent %i\n",
+- (int) info_p->width,
+- (int) info_p->height, (int) info_p->bit_depth);
++ (int) png_get_image_width(png_p, info_p),
++ (int) png_get_image_height(png_p, info_p), (int) png_get_bit_depth(png_p, info_p));
+ pdf_puts("/ColorSpace ");
+ checked_gamma = 1.0;
+ if (fixed_image_apply_gamma) {
+@@ -549,22 +575,27 @@
+ }
+ /* the switching between |info_p| and |png_p| queries has been trial and error.
+ */
+- if (fixed_pdf_minor_version > 1 && info_p->interlace_type == PNG_INTERLACE_NONE && (png_p->transformations == 0 || png_p->transformations == 0x2000) /* gamma */
+- &&!(png_p->color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||
+- png_p->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+- && (fixed_image_hicolor || (png_p->bit_depth <= 8))
++ if (fixed_pdf_minor_version > 1 && png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE /* && (png_p->transformations == PNG_TRANSFORM_IDENTITY || png_p->transformations == PNG_TRANSFORM_GRAY_TO_PNG) */ /* gamma */
++ &&!(png_get_color_type(png_p, info_p) == PNG_COLOR_TYPE_GRAY_ALPHA ||
++ png_get_color_type(png_p, info_p) == PNG_COLOR_TYPE_RGB_ALPHA)
++ && (fixed_image_hicolor || (png_get_bit_depth(png_p, info_p) <= 8))
+ && (checked_gamma <= 1.01 && checked_gamma > 0.99)
+ ) {
+ if (img_colorspace(idict) != 0) {
+ pdf_printf("%i 0 R\n", (int) img_colorspace(idict));
+ } else {
+- switch (info_p->color_type) {
++ switch (png_get_color_type(png_p, info_p)) {
+ case PNG_COLOR_TYPE_PALETTE:
++ {
++ png_colorp palette;
++ int num_palette;
++ png_get_PLTE(png_p, info_p, &palette, &num_palette);
+ pdf_create_obj(0, 0);
+ palette_objnum = obj_ptr;
+ pdf_printf("[/Indexed /DeviceRGB %i %i 0 R]\n",
+- (int) (info_p->num_palette - 1),
++ (int) (num_palette - 1),
+ (int) palette_objnum);
++ }
+ break;
+ case PNG_COLOR_TYPE_GRAY:
+ pdf_puts("/DeviceGray\n");
+@@ -577,13 +608,16 @@
+ tex_printf(" (PNG copy)");
+ copy_png(idict);
+ if (palette_objnum > 0) {
++ png_colorp palette;
++ int num_palette;
++ png_get_PLTE(png_p, info_p, &palette, &num_palette);
+ pdf_begin_dict(palette_objnum, 0);
+ pdf_begin_stream();
+- for (i = 0; (unsigned) i < info_p->num_palette; i++) {
++ for (i = 0; (unsigned) i < num_palette; i++) {
+ pdfroom(3);
+- pdf_buf[pdf_ptr++] = info_p->palette[i].red;
+- pdf_buf[pdf_ptr++] = info_p->palette[i].green;
+- pdf_buf[pdf_ptr++] = info_p->palette[i].blue;
++ pdf_buf[pdf_ptr++] = palette[i].red;
++ pdf_buf[pdf_ptr++] = palette[i].green;
++ pdf_buf[pdf_ptr++] = palette[i].blue;
+ }
+ pdf_end_stream();
+ }
+@@ -593,22 +627,22 @@
+ if (fixed_image_apply_gamma &&
+ (checked_gamma > 1.01 || checked_gamma < 0.99))
+ tex_printf("gamma delta=%lf ", checked_gamma);
+- if (png_p->transformations != PNG_TRANSFORM_IDENTITY)
+- tex_printf("transform=%lu", (long) png_p->transformations);
+- if ((info_p->color_type != PNG_COLOR_TYPE_GRAY)
+- && (info_p->color_type != PNG_COLOR_TYPE_RGB)
+- && (info_p->color_type != PNG_COLOR_TYPE_PALETTE))
++ /* if (png_p->transformations != PNG_TRANSFORM_IDENTITY)
++ tex_printf("transform=%lu", (long) png_p->transformations); */
++ if ((png_get_color_type(png_p, info_p) != PNG_COLOR_TYPE_GRAY)
++ && (png_get_color_type(png_p, info_p) != PNG_COLOR_TYPE_RGB)
++ && (png_get_color_type(png_p, info_p) != PNG_COLOR_TYPE_PALETTE))
+ tex_printf("colortype ");
+ if (fixed_pdf_minor_version <= 1)
+ tex_printf("version=%d ", (int) fixed_pdf_minor_version);
+- if (info_p->interlace_type != PNG_INTERLACE_NONE)
++ if (png_get_interlace_type(png_p, info_p) != PNG_INTERLACE_NONE)
+ tex_printf("interlaced ");
+- if (info_p->bit_depth > 8)
+- tex_printf("bitdepth=%d ", info_p->bit_depth);
++ if (png_get_bit_depth(png_p, info_p) > 8)
++ tex_printf("bitdepth=%d ", png_get_bit_depth(png_p, info_p));
+ if (png_get_valid(png_p, info_p, PNG_INFO_tRNS))
+ tex_printf("simple transparancy ");
+ }
+- switch (info_p->color_type) {
++ switch (png_get_color_type(png_p, info_p)) {
+ case PNG_COLOR_TYPE_PALETTE:
+ write_png_palette(idict);
+ break;
+@@ -632,7 +666,7 @@
+ break;
+ default:
+ pdftex_fail("unsupported type of color_type <%i>",
+- info_p->color_type);
++ png_get_color_type(png_p, info_p));
+ }
+ }
+ pdf_flush();
Patch1: %{name}-20080816-kpathsea-ar.patch
Patch2: %{name}-gcc44.patch
Patch3: %{name}-getline.patch
-Patch4: %{name}-stdio.patch
Patch5: %{name}-aclocal.patch
Patch6: %{name}-libpng.patch
Patch7: %{name}-libpng15.patch
Patch9: %{name}-5yr-old.patch
Patch10: format-security.patch
Patch11: %{name}-clisp.patch
+Patch12: %{name}-system-libpng.patch
+Patch13: %{name}-system-zzip.patch
URL: http://www.tug.org/texlive/
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: xorg-lib-libXmu-devel
BuildRequires: xorg-lib-libXpm-devel
BuildRequires: zlib-devel >= 1.2.1
+BuildRequires: zziplib-devel
Requires: %{name}-dirs-fonts = %{epoch}:%{version}-%{release}
Requires: %{name}-fonts-cm = %{epoch}:%{version}-%{release}
Requires: %{name}-fonts-misc = %{epoch}:%{version}-%{release}
XMLTeX is a non-validating, namespace-aware XML parser written in TeX.
It allows TeX to directly process XML files.
+%package luatex
+Summary: Extended version of pdfTeX using Lua as an embedded scripting language
+Summary(pl.UTF-8): Rozszerzona wersja pdfTeXa wykorzystująca Lua jako wbudowany język skryptowy
+Group: Applications/Publishing/TeX
+Requires(post,postun): /usr/bin/texhash
+
+%description luatex
+LuaTeX is an extended version of pdfTeX using Lua as an embedded
+scripting language.
+
+%description luatex -l pl.UTF-8
+LuaTeX to rozszerzona wersja pdfTeXa, wykorzystująca Lua jako
+wbudowany język skryptowy.
+
%prep
%setup -q -c -T -n %{name}-%{version}-source
lzma -dc %{SOURCE0} | tar xf - -C ..
%patch1 -p1
%patch2 -p1
%patch3 -p1
-%patch4 -p1
%patch5 -p1
%patch6 -p0
%patch7 -p1
%patch8 -p1
%patch10 -p1
%patch11 -p1
-CURDIR=$(pwd)
+%patch12 -p1
+%patch13 -p1
+CURDIR=$(pwd)
cd utils/xindy/make-rules/alphabets
tar xvf %{SOURCE11}
cp $(find fonts -type f) .
for i in larm?00.tfm; do ln -s $i $(echo $i | sed "s@larm\(.\).*@larm0\100.tfm@") ; done
cd ${CURDIR}
+%build
+find . -name "config.sub" -exec cp /usr/share/automake/config.sub '{}' ';'
+%{__sed} -i 's@"extend/\(.*\)"@<\1>@' texk/ttf2pk/*.c
+%{__sed} -e 's@^TEXMFMAIN =.*@TEXMFMAIN = %{texmf}@' \
+ -e 's@^TEXMFDIST =.*@TEXMFDIST = %{texmfdist}@' \
+ -e 's@^TEXMFLOCAL =.*@TEXMFLOCAL = %{texmf}@' \
+ -e 's@^TEXMFSYSVAR =.*@TEXMFSYSVAR = %{_localstatedir}@' \
+ -e 's@^TEXMFSYSCONFIG =.*@TEXMFSYSCONFIG = %{_sysconfdir}/%{name}@' \
+ -e 's@^TEXMFVAR =.*@TEXMFVAR = %{_localstatedir}@' \
+ -e 's@^trie_size.*@trie_size = 1262000@' -i texk/kpathsea/texmf.cnf
+
cd libs/teckit
cat ax*.m4 > acinclude.m4
%{__libtoolize}
%{__aclocal}
%{__autoconf}
%{__automake}
-
-%build
-find . -name "config.sub" -exec cp /usr/share/automake/config.sub '{}' ';'
-%{__sed} -i 's@"extend/\(.*\)"@<\1>@' texk/ttf2pk/*.c
-cd texk/kpathsea
-%{__sed} -i 's@^TEXMFMAIN =.*@TEXMFMAIN = %{texmf}@' texmf.cnf
-%{__sed} -i 's@^TEXMFDIST =.*@TEXMFDIST = %{texmfdist}@' texmf.cnf
-%{__sed} -i 's@^TEXMFLOCAL =.*@TEXMFLOCAL = %{texmf}@' texmf.cnf
-%{__sed} -i 's@^TEXMFSYSVAR =.*@TEXMFSYSVAR = %{_localstatedir}@' texmf.cnf
-%{__sed} -i 's@^TEXMFSYSCONFIG =.*@TEXMFSYSCONFIG = %{_sysconfdir}/%{name}@' texmf.cnf
-%{__sed} -i 's@^TEXMFVAR =.*@TEXMFVAR = %{_localstatedir}@' texmf.cnf
-%{__sed} -i 's@^trie_size.*@trie_size = 1262000@' texmf.cnf
cd ../..
%ifarch ppc ppc64
ulimit -s unlimited
%endif
-%configure \
- --with%{!?with_xindy:out}-xindy \
- --without-luatex \
+install -d build/utils/xindy/make-rules/alphabets
+for f in utils/xindy/make-rules/alphabets/larm????.* ; do ln -sf ../../../../../$f build/$f ; done
+cd build
+../%configure \
+ --with-xindy%{!?with_xindy:=no}\
--disable-multiplatform \
--disable-static \
--enable-a4 \
LD_LIBRARY_PATH=$RPM_BUILD_ROOT%{_libdir}; export LD_LIBRARY_PATH
-%{__make} install \
+%{__make} -C build install \
prefix=$RPM_BUILD_ROOT%{_prefix} \
bindir=$RPM_BUILD_ROOT%{_bindir} \
mandir=$RPM_BUILD_ROOT%{_mandir} \
yes | tex prog_manual.tex
tex example1.tex
tex example2.tex
-rm formlett.sty
+%{__rm} formlett.sty
cd $CURDIR
%{__rm} -r $RPM_BUILD_ROOT%{texmf}/doc/man
%{__rm} -r $RPM_BUILD_ROOT%{texmfdoc}/source
-perl -pi \
+%{__perl} -pi \
-e "s|$RPM_BUILD_ROOT||g;" \
$RPM_BUILD_ROOT%{texmf}/web2c/texmf.cnf
# not included in package
rm -f $RPM_BUILD_ROOT%{_datadir}/texinfo/html/texi2html.html
rm -f $RPM_BUILD_ROOT%{_infodir}/dir*
-rm -f $RPM_BUILD_ROOT%{_infodir}/dvipng*
-rm -f $RPM_BUILD_ROOT%{_mandir}/{README.*,hu/man1/readlink.1*}
-rm -f $RPM_BUILD_ROOT%{texmf}/doc/Makefile
-rm -f $RPM_BUILD_ROOT%{texmf}/doc/fonts/oldgerman/COPYING
-rm -f $RPM_BUILD_ROOT%{texmf}/doc/help/Catalogue-upd.sh
-rm -f $RPM_BUILD_ROOT%{texmf}/doc/help/faq/uktug-faq-upd.sh
-rm -f $RPM_BUILD_ROOT%{texmf}/doc/helpfile
-rm -f $RPM_BUILD_ROOT%{texmf}/doc/helpindex.html
-rm -f $RPM_BUILD_ROOT%{texmf}/doc/index.html
-rm -f $RPM_BUILD_ROOT%{texmf}/doc/index.php
-rm -f $RPM_BUILD_ROOT%{texmf}/doc/mkhtml*
-rm -f $RPM_BUILD_ROOT%{texmf}/doc/programs/texinfo.*
-rm -f $RPM_BUILD_ROOT%{texmf}/fonts/pk/ljfour/lh/lh-lcy/*.600pk
-rm -f $RPM_BUILD_ROOT%{texmf}/generic/config/pdftex-dvi.tex
-rm -f $RPM_BUILD_ROOT%{texmf}/release-tetex-{src,texmf}.txt
-rm -f $RPM_BUILD_ROOT%{texmf}/scripts/uniqleaf/uniqleaf.pl
-rm -f $RPM_BUILD_ROOT%{texmf}/tex/generic/pdftex/glyphtounicode.tex
-rm -rf $RPM_BUILD_ROOT%{_datadir}/lcdf-typetools
-rm -rf $RPM_BUILD_ROOT%{texmfdist}/doc/generic/pdf-trans
-rm -rf $RPM_BUILD_ROOT%{texmfdist}/source/generic/hyph-utf8
-rm -rf $RPM_BUILD_ROOT%{texmfdist}/source/generic/patch
-rm -rf $RPM_BUILD_ROOT%{texmfdist}/source/plain/plgraph
-rm -rf $RPM_BUILD_ROOT%{texmfdist}/tex/generic/pdf-trans
-rm -rf $RPM_BUILD_ROOT%{texmfdist}/tex/generic/xecyr
-rm -rf $RPM_BUILD_ROOT%{texmf}/cef5conv
-rm -rf $RPM_BUILD_ROOT%{texmf}/cefsconv
-rm -rf $RPM_BUILD_ROOT%{texmf}/chktex
-rm -rf $RPM_BUILD_ROOT%{texmf}/doc/cef5conv
-rm -rf $RPM_BUILD_ROOT%{texmf}/doc/cefsconv
-rm -rf $RPM_BUILD_ROOT%{texmf}/doc/chktex
-rm -rf $RPM_BUILD_ROOT%{texmf}/doc/gzip
+%{__rm} $RPM_BUILD_ROOT%{_infodir}/dvipng*
+%{__rm} $RPM_BUILD_ROOT%{texmf}/tex/generic/pdftex/glyphtounicode.tex
+%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/lcdf-typetools
+%{__rm} -r $RPM_BUILD_ROOT%{texmfdist}/doc/generic/pdf-trans
+%{__rm} -r $RPM_BUILD_ROOT%{texmfdist}/source/generic/hyph-utf8
+%{__rm} -r $RPM_BUILD_ROOT%{texmfdist}/source/generic/patch
+%{__rm} -r $RPM_BUILD_ROOT%{texmfdist}/source/plain/plgraph
+%{__rm} -r $RPM_BUILD_ROOT%{texmfdist}/tex/generic/pdf-trans
+%{__rm} -r $RPM_BUILD_ROOT%{texmfdist}/tex/generic/xecyr
+%{__rm} -r $RPM_BUILD_ROOT%{texmf}/chktex
+%{__rm} -r $RPM_BUILD_ROOT%{texmf}/doc/cef5conv
+%{__rm} -r $RPM_BUILD_ROOT%{texmf}/doc/cefsconv
+%{__rm} -r $RPM_BUILD_ROOT%{texmf}/doc/chktex
+%{__rm} -r $RPM_BUILD_ROOT%{texmf}/doc/gzip
# move format logs to BUILD, so $RPM_BUILD_ROOT is not polluted
# and we can still analyze them
# mv -fv $RPM_BUILD_ROOT%{fmtdir}/*.log format-logs
# xindy files are in %%{texmf}
-rm -rf $RPM_BUILD_ROOT%{_datadir}/xindy
-rm -rf $RPM_BUILD_ROOT%{_docdir}
+%if %{with xindy}
+%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/xindy
+%{__rm} -r $RPM_BUILD_ROOT%{_docdir}
+%endif
# Create format files
for format in \
%if %{with bootstrap}
touch $RPM_BUILD_ROOT%{fmtdir}/xetex/xelatex.fmt
%endif
+
# We don't need the log files
-rm -f $(find $RPM_BUILD_ROOT%{fmtdir} -name "*.log")
+find $RPM_BUILD_ROOT%{fmtdir} -name "*.log" | xargs -r %{__rm}
%clean
rm -rf $RPM_BUILD_ROOT
%postun xmltex
%texhash
+%post luatex
+%texhash
+
+%postun luatex
+%texhash
+
%files
%defattr(644,root,root,755)
# There isn't doc/fonts directory
%files pdftex
%defattr(644,root,root,755)
%config(noreplace) %verify(not md5 mtime size) %{texmf}/tex/generic/config/pdftexconfig.tex
+%config(noreplace) %verify(not md5 mtime size) %{texmf}/tex/generic/config/pdftex-dvi.tex
%dir %{texmfdist}/doc/support
%dir %{texmf}/fonts/map/pdftex
%dir %{texmf}/scripts/epstopdf
%dir %{texmfdist}/fonts/map/dvips
%dir %{texmfdist}/fonts/pk/ljfour/public
%doc %{texmfdist}/doc/fonts/cm
+%{texmfdist}/fonts/afm/bluesky/ams
%{texmfdist}/fonts/afm/bluesky/cm
%{texmfdist}/fonts/map/dvips/cm
%{texmfdist}/fonts/pk/ljfour/public/cm
%{texmf}/fmtutil/format.xmltex.cnf
%{fmtdir}/pdftex/pdfxmltex.fmt
%{fmtdir}/pdftex/xmltex.fmt
+
+%files luatex
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/lualatex
+%attr(755,root,root) %{_bindir}/luatex
+%attr(755,root,root) %{_bindir}/pdflualatex
+%attr(755,root,root) %{_bindir}/pdfluatex
+%attr(755,root,root) %{_bindir}/texlua
+%attr(755,root,root) %{_bindir}/texluac
+