Bugs in imlib.spec



There are a few bugs in the "high-performance config" build script in
imlib.spec (this from yesterday's Jim Pick snapshot).

First, the initial grep for pentium doesn't work right.

Then, the test to check for egcs and pgcc don't work right:

>     if [ -z "${CC}" -a ! -z `which pgcc` ]; then

This sort of thing is no good, because which isn't guaranteed to return
an empty string if it fails. In fact, my /usr/bin/which (which is the
which that gets called in the script instead of the bash builtin)
returns this:

/usr/bin/which: no pgcc in
(/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/opt/egcs/bin:/opt/kde/bin::/home/tmoore/bin)
(I just noticed that KDE in there. Don't lynch me, my distro put in in
there!)

In both cases, it's better to check the actual return value like this:

if echo -n ${RPM_OPT_FLAGS} | grep pentium >/dev/null; then

and this:

if [ -z "${CC}" ] && which egcs >/dev/null; then

There's a patch for it attached.

Tim
--- imlib.spec.orig	Sat Sep 26 15:36:44 1998
+++ imlib.spec	Sat Sep 26 15:37:00 1998
@@ -54,42 +54,42 @@
 ##### Boring normal rpm build method
 # old method of building - does not auto-detect for options in OPT_FLAGS
 ###########################################################################
-CFLAGS="${RPM_OPT_FLAGS}" ./configure --prefix=%prefix
-make
+#CFLAGS="${RPM_OPT_FLAGS}" ./configure --prefix=%prefix
+#make
 ###########################################################################
 
 ##### High-perfromance auto-detect
 # Needed for snapshot releases.
 # Optimize that damned code all the way
 ###########################################################################
-#if [ ! -z "echo -n ${RPM_OPT_FLAGS} | grep pentium" ]; then
-#  if [ -z "${CC}" -a ! -z "`which egcs`" ]; then
-#    CC="egcs"
-#    export CC
-#  else
-#    if [ -z "${CC}" -a ! -z "`which pgcc`" ]; then
-#      CC="pgcc"
-#      export CC
-#    fi
-#  fi
-#  CFLAGS="${RPM_OPT_FLAGS}"
-#else
-#  CFLAGS="${RPM_OPT_FLAGS}"
-#fi
-#export CFLAGS
-#
-#if [ ! -f configure ]; then
-#  ./autogen.sh --prefix=%prefix
-#else
-#  ./configure --prefix=%prefix
-#fi
-#
-#if [ "$SMP" != "" ]; then
-#  (make "MAKE=make -k -j $SMP"; exit 0)
-#  make
-#else
-#  make
-#fi
+if echo -n ${RPM_OPT_FLAGS} | grep pentium >/dev/null; then
+  if [ -z "${CC}" ] && which egcs >/dev/null; then
+    CC="egcs"
+    export CC
+  else
+    if [ -z "${CC}" ] && which pgcc >/dev/null; then
+      CC="pgcc"
+      export CC
+    fi
+  fi
+  CFLAGS="${RPM_OPT_FLAGS}"
+else
+  CFLAGS="${RPM_OPT_FLAGS}"
+fi
+export CFLAGS
+
+if [ ! -f configure ]; then
+  ./autogen.sh --prefix=%prefix
+else
+  ./configure --prefix=%prefix
+fi
+
+if [ "$SMP" != "" ]; then
+  (make "MAKE=make -k -j $SMP"; exit 0)
+  make
+else
+  make
+fi
 ###########################################################################
 
 %install
@@ -122,6 +122,9 @@
 %{prefix}/share/aclocal/*
 
 %changelog
+* Sat Sep 26 1998 Tim Moore <tmoore@tembel.org>
+- Fixed some bugs in the build script
+
 * Wed Sep 23 1998 Carsten Haitzler <raster@redhat.com>
 - up to 1.8.1
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]