components/gcc49/patches/012-fixinc.in.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Tue, 13 Sep 2016 13:02:35 -0700
changeset 6896 142170914c4c
parent 5205 eaff9ab86216
permissions -rw-r--r--
Added tag s12-108.1 for changeset 71ef4536e377

# Stefan Teleman <[email protected]>
#
# On Solaris, we do NOT want to bootstrap GCC with a completely different
# set of header files than those which will be *used* by GCC to compile
# other things. And we only want two 'fixincluded' header files:
# <limts.h> and <syslimits.h>. The other header files are those found
# on the system.
# Internal patch. Solaris specific.
--- fixincludes/fixinc.in	2012-10-28 14:42:48.000000000 -0700
+++ fixincludes/fixinc.in	2015-08-02 17:32:14.598076914 -0700
@@ -36,7 +36,13 @@
   exit 1
 fi
 
-LIB=${1}
+export UNAMES="`uname -s`"
+if [ "${UNAMES}" = "SunOS" ] ; then
+  export PATH="/usr/gnu/bin:/usr/bin:/usr/sbin"
+fi
+
+
+export LIB=${1}
 shift
 
 # Make sure it exists.
@@ -475,28 +481,38 @@
 then echo 'Cleaning up unneeded directories:' ; fi
 cd $LIB
 all_dirs=`find . -type d \! -name '.' -print | sort -r`
+
 for file in $all_dirs; do
-  if rmdir $LIB/$file > /dev/null
-  then
-    test $VERBOSE -gt 3 && echo "  removed $file"
-  fi
+  rm -rf "${LIB}/${file}"
+  test $VERBOSE -gt 0 && echo "  removed $file"
 done 2> /dev/null
 
+if [ "${UNAMES}" = "SunOS" ] ; then
+  extra_files=`find . -type f -name "*.h" -print | sort -r`
+  echo "Doing additional cleanups on Solaris..."
+  for file in $extra_files; do
+    filename=`basename ${file}`
+    if [ "${filename}" != "limits.h" ] && [ "${filename}" != "syslimits.h" ] ; then
+      rm -f $LIB/$file
+      echo "removed $file"
+    fi
+  done
+fi
+
 # On systems which don't support symlinks, `find' may barf
 # if called with "-type l" predicate.  So only use that if
 # we know we should look for symlinks.
 if $LINKS; then
-  test $VERBOSE -gt 2 && echo "Removing unused symlinks"
-
+  test $VERBOSE -gt 0 && echo "Removing unused symlinks"
   all_dirs=`find . -type l -print`
   for file in $all_dirs
   do
     if test ! -d $file
     then
       rm -f $file
-      test $VERBOSE -gt 3 && echo "  removed $file"
-      rmdir `dirname $file` > /dev/null && \
-           test $VERBOSE -gt 3 && \
+      test $VERBOSE -gt 0 && echo "  removed $file"
+      rm -rf `dirname $file` && \
+        test $VERBOSE -gt 0 && \
            echo "  removed `dirname $file`"
     fi
   done 2> /dev/null