The attached patch to the Release 2.5 version of pdflib fixes a
problem building on SuSE Linux Enterprise 10 in which the build
was failing saying it didn't know how to build ``-lpng''.

It turns out that the included piece for the Makefile uses the
variables PNGLIBLINK and JPEGLIBLINK in dependencies so requires
file names here, not loader options.  I put in a couple of loops
through the l_ldflags macro to test for the libraries since on
the 64 bit machines this may need to check multiple directories.

It also required adding ``-lpng -ljpeg'' to LDFLAGS to get things
to load properly.

Looking at the pdflib.spec file in the CURRENT version of pdflib,
it appears that it should have the same patch applied.

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Systems, Inc.
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``No matter how much I may exaggerate it, it must have a certain amount of
truth...Now rumor travels fast but it don't stay put as long as truth''
    Will Rogers
--- pdflib.spec.orig    2006-10-09 16:37:28.000000000 -0700
+++ pdflib.spec 2006-10-09 16:25:39.915957000 -0700
@@ -37,7 +37,7 @@
 Group:        Graphics
 License:      PDFlib
 Version:      %{V_long}
-Release:      2.5.0
+Release:      20061009
 
 #   list of sources
 Source0:      
http://www.pdflib.com/products/pdflib/download/%{V_comp}src/PDFlib-Lite-%{V_long}.tar.gz
@@ -78,17 +78,35 @@
         configure
 
 %build
+    # The next two loops kludge around strange Makefile rules
+    # which fail when handed loader options, -lpng and -ljpeg
+    for libdir in %{l_ldflags}; do #{
+        libdir=`echo $libdir | sed -e 's/-L//'`
+        lib=$libdir/libpng.a
+        test -s $lib && {
+            PNGLIBLINK=$lib
+            break
+        }
+    done #}
+    for libdir in %{l_ldflags}; do #{
+        libdir=`echo $libdir | sed -e 's/-L//'`
+        lib=$libdir/libjpeg.a
+        test -s $lib && {
+            JPEGLIBLINK=$lib
+            break
+        }
+    done #}
     ECHO="%{l_prefix}/bin/gecho" \
     CC="%{l_cc}" \
     CFLAGS="%{l_cflags -O}" \
     INSTALL="%{l_shtool} install -c" \
     PNGLIBINC="%{l_cppflags libpng .}" \
-    PNGLIBLINK="-lpng" \
+    PNGLIBLINK="$PNGLIBLINK" \
     JPEGLIBINC="%{l_cppflags}" \
-    JPEGLIBLINK="-ljpeg" \
+    JPEGLIBLINK="$JPEGLIBLINK" \
     FLATELIBINC="%{l_cppflags}" \
     FLATELIBLINK="-lz" \
-    LDFLAGS="%{l_ldflags}" \
+    LDFLAGS="%{l_ldflags} -lpng -ljpeg" \
     ./configure \
         --prefix=%{l_prefix} \
         --disable-shared
@@ -127,4 +145,3 @@
 %clean
     rm -rf $RPM_BUILD_ROOT
 
-

Reply via email to