netpbm/netpbm.patch

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
parent 54
f012bbb2a542
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

     1 Index: converter/other/jpeg2000/jpeg2ktopam.c
     2 --- converter/other/jpeg2000/jpeg2ktopam.c.orig	2005-05-19 17:29:47 +0200
     3 +++ converter/other/jpeg2000/jpeg2ktopam.c	2006-10-24 08:07:49 +0200
     4 @@ -9,7 +9,6 @@
     5  *****************************************************************************/
     7  #define _BSD_SOURCE 1      /* Make sure strdup() is in string.h */
     8 -#define _XOPEN_SOURCE 500  /* Make sure strdup() is in string.h */
     9  #include <string.h>
    11  #include "pam.h"
    12 Index: converter/other/jpeg2000/pamtojpeg2k.c
    13 --- converter/other/jpeg2000/pamtojpeg2k.c.orig	2005-02-21 04:56:41 +0100
    14 +++ converter/other/jpeg2000/pamtojpeg2k.c	2006-10-24 08:07:49 +0200
    15 @@ -9,7 +9,6 @@
    16  *****************************************************************************/
    18  #define _BSD_SOURCE 1    /* Make sure strdup() is in string.h */
    19 -#define _XOPEN_SOURCE 500  /* Make sure strdup() is in string.h */
    20  #include <string.h>
    22  #include "pam.h"
    23 Index: lib/libpm.c
    24 --- lib/libpm.c.orig	2004-11-20 17:55:27 +0100
    25 +++ lib/libpm.c	2006-10-24 08:07:49 +0200
    26 @@ -617,7 +617,7 @@
    27  pm_openr(const char * const name) {
    28      FILE* f;
    30 -    if (strcmp(name, "-") == 0)
    31 +    if (name == NULL || strcmp(name, "-") == 0)
    32          f = stdin;
    33      else {
    34  #ifndef VMS
    35 @@ -639,7 +639,7 @@
    36  pm_openw(const char * const name) {
    37      FILE* f;
    39 -    if (strcmp(name, "-") == 0)
    40 +    if (name == NULL || strcmp(name, "-") == 0)
    41          f = stdout;
    42      else {
    43  #ifndef VMS
    44 Index: lib/pm_gamma.h
    45 --- lib/pm_gamma.h.orig	2004-06-13 00:53:25 +0200
    46 +++ lib/pm_gamma.h	2006-10-24 08:18:26 +0200
    47 @@ -5,7 +5,7 @@
    49  #include <math.h>
    51 -static __inline__ float
    52 +static float
    53  pm_gamma709(float const intensity) {
    55      /* Here are parameters of the gamma transfer function
    56 @@ -34,7 +34,7 @@
    60 -static __inline__ float
    61 +static float
    62  pm_ungamma709(float const brightness) {
    64      /* These are the same parameters as in pm_gamma, above */
    65 Index: converter/other/Makefile
    66 --- converter/other/Makefile.orig	2005-02-05 18:48:28.000000000 +0100
    67 +++ converter/other/Makefile	2009-01-09 00:54:13.704466003 +0100
    68 @@ -111,29 +111,29 @@
    69  endif
    71  tifftopnm pnmtotiff pnmtotiffcmyk: %: %.o $(NETPBMLIB) $(LIBOPT)
    72 -	$(LD) $(LDFLAGS) -o $@ $@.o \
    73 +	$(LD) -o $@ $@.o \
    74  	  `$(LIBOPT) $(NETPBMLIB) $(LIBOPTR) $(TIFFLIB) $(TIFFLIB_EXTRALIBS)` \
    75 -	   $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
    76 +	   $(LDFLAGS) $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
    78  pngtopnm: %: %.o $(NETPBMLIB) $(LIBOPT)
    79 -	$(LD) $(LDFLAGS) -o $@ $@.o \
    80 +	$(LD) -o $@ $@.o \
    81  	  `$(LIBOPT) $(NETPBMLIB) $(LIBOPTR) $(PNGLIB) $(ZLIB)` \
    82 -	  $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
    83 +	  $(LDFLAGS) $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
    85  pnmtopng: %: %.o pngtxt.o $(NETPBMLIB) $(LIBOPT)
    86 -	$(LD) $(LDFLAGS) -o $@ $@.o pngtxt.o \
    87 +	$(LD) -o $@ $@.o pngtxt.o \
    88  	  `$(LIBOPT) $(NETPBMLIB) $(LIBOPTR) $(PNGLIB) $(ZLIB)` \
    89 -	  $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
    90 +	  $(LDFLAGS) $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
    92  jpegtopnm: %: %.o jpegdatasource.o exif.o $(NETPBMLIB) $(LIBOPT)
    93 -	$(LD) $(LDFLAGS) -o $@ $< jpegdatasource.o exif.o \
    94 +	$(LD) -o $@ $< jpegdatasource.o exif.o \
    95  	  `$(LIBOPT) $(NETPBMLIB) $(LIBOPTR) $(JPEGLIB)` \
    96 -	  $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD) 
    97 +	  $(LDFLAGS) $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD) 
    99  pnmtojpeg: %: %.o $(NETPBMLIB) $(LIBOPT)
   100 -	$(LD) $(LDFLAGS) -o $@ $@.o \
   101 +	$(LD) -o $@ $@.o \
   102  	  `$(LIBOPT) $(NETPBMLIB) $(LIBOPTR) $(JPEGLIB)` \
   103 -	  $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
   104 +	  $(LDFLAGS) $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
   106  # If URTLIB is BUNDLED_URTLIB, then we're responsible for building it, which
   107  # means it needs to be a dependency:
   108 @@ -142,13 +142,13 @@
   109  endif
   111  rletopnm pnmtorle: %: %.o $(NETPBMLIB) $(URTLIBDEP) $(LIBOPT)
   112 -	$(LD) $(LDFLAGS) -o $@ $@.o \
   113 -	  `$(LIBOPT) $(NETPBMLIB) $(URTLIB)` $(MATHLIB) $(LDLIBS) \
   114 +	$(LD) -o $@ $@.o \
   115 +	  `$(LIBOPT) $(NETPBMLIB) $(URTLIB)` $(LDFLAGS) $(MATHLIB) $(LDLIBS) \
   116  	   $(RPATH) $(LADD)
   118  pnmtorast rasttopnm: %: %.o rast.o $(NETPBMLIB) $(LIBOPT)
   119 -	$(LD) $(LDFLAGS) -o $@ $@.o rast.o \
   120 -	  `$(LIBOPT) $(NETPBMLIB)` $(MATHLIB) $(LDLIBS) \
   121 +	$(LD) -o $@ $@.o rast.o \
   122 +	  `$(LIBOPT) $(NETPBMLIB)` $(LDFLAGS) $(MATHLIB) $(LDLIBS) \
   123  	   $(RPATH) $(LADD)
   125  install.bin: install.bin.local

mercurial