Blob Blame History Raw
commit 18a892b62c50fcbdaed3d92645d9457466d623a3
Author: James Antill <james@and.org>
Date:   Wed Mar 5 22:01:58 2008 -0500

    Fixup ustr-import in multilib. ... again

diff --git a/Makefile b/Makefile
index d025d25..3a245ec 100644
--- a/Makefile
+++ b/Makefile
@@ -410,7 +410,7 @@ install: all-shared ustr.pc ustr-debug.pc
 		install -pm 644 -t $(DESTDIR)$(libdir)/pkgconfig ustr.pc ustr-debug.pc
 
 ustr-import-multilib: ustr-import-multilib.in
-		sed -e 's,@MBINDIR@,$(MBINDIR),g' < $< > $@
+		sed -e 's,@INCLUDEDIR@,$(includedir),g' -e 's,@MBINDIR@,$(MBINDIR),g' < $< > $@
 
 install-multilib-linux: install autoconf_64b ustr-import-multilib
 		install -d $(DESTDIR)$(MBINDIR)
@@ -429,7 +429,7 @@ install-multilib-linux: install autoconf_64b ustr-import-multilib
 		$(HIDE)mv -f $(DESTDIR)$(bindir)/ustr-import-multilib $(DESTDIR)$(bindir)/ustr-import
 		$(HIDE)touch --reference ustr-conf-multilib-linux.h $(DESTDIR)$(includedir)/ustr-conf.h
 		$(HIDE)touch --reference ustr-conf-debug-multilib-linux.h $(DESTDIR)$(includedir)/ustr-conf-debug.h
-		$(HIDE)touch --reference ustr-import-multilib $(DESTDIR)$(bindir)/ustr-import
+		$(HIDE)touch --reference ustr-import-multilib.in $(DESTDIR)$(bindir)/ustr-import
 
 
 clean:
diff --git a/ustr-import-multilib.in b/ustr-import-multilib.in
index b1f9994..0656b2a 100644
--- a/ustr-import-multilib.in
+++ b/ustr-import-multilib.in
@@ -3,30 +3,59 @@
 INCDIR=@INCLUDEDIR@
 MBINDIR=@MBINDIR@
 
+NOT_DONE=1
 inst32()
 {
+  foo=no
+  if [ "x$1" = "xeither" ]; then
+    foo=either
+    shift
+  fi
   if [ -f "$MBINDIR/ustr-import-32" ]; then
     "$MBINDIR/ustr-import-32" "$@"
-  
+    RETVAL=$?
+  fi
+
+  if [ "x$foo" = "xeither" ]; then
     # This assume an installed multilib ustr-conf.h
-    [ $RETVAL -eq 0 ] && mv ustr-conf.h ustr-conf-32.h
-    [ $RETVAL -eq 0 ] && cp "$INCDIR/ustr-conf.h" .
-    [ $RETVAL -eq 0 ] && mv ustr-conf-debug.h ustr-conf-debug-32.h
-    [ $RETVAL -eq 0 ] && cp "$INCDIR/ustr-conf-debug.h" .
+    if [ $RETVAL -eq 0 ] && [ -f ustr-conf.h ]; then
+        mv ustr-conf.h ustr-conf-32.h
+        cp "$INCDIR/ustr-conf.h" .
+    fi
+    if [ $RETVAL -eq 0 ] && [ -f ustr-conf-debug.h ]; then
+        mv ustr-conf-debug.h ustr-conf-debug-32.h
+        cp "$INCDIR/ustr-conf-debug.h" .
+    fi
+    NOT_DONE=0
+  else
     exit $RETVAL
   fi
 }
 
 inst64()
 {
+  foo=no
+  if [ "x$1" = "xeither" ]; then
+    foo=either
+    shift
+  fi
   if [ -f "$MBINDIR/ustr-import-64" ]; then
     "$MBINDIR/ustr-import-64" "$@"
     RETVAL=$?
+  fi
+
+  if [ "x$foo" = "xeither" ]; then
     # This assume an installed multilib ustr-conf.h
-    [ $RETVAL -eq 0 ] && mv ustr-conf.h ustr-conf-64.h
-    [ $RETVAL -eq 0 ] && cp "$INCDIR/ustr-conf.h" .
-    [ $RETVAL -eq 0 ] && mv ustr-conf-debug.h ustr-conf-debug-64.h
-    [ $RETVAL -eq 0 ] && cp "$INCDIR/ustr-conf-debug.h" .
+    if [ $RETVAL -eq 0 ] && [ -f ustr-conf.h ]; then
+        mv ustr-conf.h ustr-conf-64.h
+        cp "$INCDIR/ustr-conf.h" .
+    fi
+    if [ $RETVAL -eq 0 ] && [ -f ustr-conf-debug.h ]; then
+        mv ustr-conf-debug.h ustr-conf-debug-64.h
+        cp "$INCDIR/ustr-conf-debug.h" .
+    fi
+    NOT_DONE=0
+  else
     exit $RETVAL
   fi
 }
@@ -41,7 +70,7 @@ if [ "x$1" = "x--64" ]; then
   inst64 $@
 fi
 
-inst64 $@
-inst32 $@
+inst64 either $@
+inst32 either $@
 
-exit 1
+exit $NOT_DONE