File project.diff of Package cross-gcc48

--- change_spec.orig
+++ change_spec
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-do_icecream=1
+do_icecream=0
 do_cross_static=0
 do_cross_shared=1
 do_optional_compiler_languages=0
@@ -122,26 +122,19 @@ add_cross() {
   test -f gcc$base_ver.changes && ln -f gcc$base_ver.changes $pkgname.changes
 }
 
-# We now support "proper" cross-compilers to suse targets via a
-# cross-glibc package, enable that via for example
-#
-# add_cross cross-aarch64-gcc$base_ver aarch64 aarch64-suse-linux
-#
-# For now keep the old way of doing things
-if test "$do_icecream" = 1 ; then
-add_cross cross-aarch64-gcc$base_ver-icecream-backend aarch64 aarch64-suse-linux %define gcc_icecream 1
-add_cross cross-armv6hl-gcc$base_ver-icecream-backend armv6hl armv6hl-suse-linux-gnueabi %define gcc_icecream 1
-add_cross cross-armv7hl-gcc$base_ver-icecream-backend armv7hl armv7hl-suse-linux-gnueabi %define gcc_icecream 1
-#add_cross cross-hppa-gcc$base_ver-icecream-backend hppa hppa-suse-linux %define gcc_icecream 1
-add_cross cross-i386-gcc$base_ver-icecream-backend i386 i586-suse-linux %define gcc_icecream 1
-add_cross cross-x86_64-gcc$base_ver-icecream-backend x86_64 x86_64-suse-linux %define gcc_icecream 1
-add_cross cross-s390-gcc$base_ver-icecream-backend s390 s390-suse-linux %define gcc_icecream 1
-add_cross cross-s390x-gcc$base_ver-icecream-backend s390x s390x-suse-linux %define gcc_icecream 1
-add_cross cross-ppc-gcc$base_ver-icecream-backend ppc powerpc64-suse-linux %define gcc_icecream 1
-add_cross cross-ppc64-gcc$base_ver-icecream-backend ppc64 powerpc64-suse-linux %define gcc_icecream 1
-add_cross cross-ppc64le-gcc$base_ver-icecream-backend ppc64le powerpc64le-suse-linux %define gcc_icecream 1
-add_cross cross-ia64-gcc$base_ver-icecream-backend ia64 ia64-suse-linux %define gcc_icecream 1
-fi
+# We now support "proper" cross-compilers to suse targets
+add_cross cross-aarch64-gcc$base_ver aarch64 aarch64-suse-linux
+#add_cross cross-armv6hl-gcc$base_ver armv6hl armv6hl-suse-linux-gnueabi
+add_cross cross-armv7hl-gcc$base_ver armv7hl armv7hl-suse-linux-gnueabi
+#add_cross cross-hppa-gcc$base_ver-icecream-backend hppa hppa-suse-linux
+#add_cross cross-i386-gcc$base_ver-icecream-backend i386 i586-suse-linux
+add_cross cross-x86_64-gcc$base_ver x86_64 x86_64-suse-linux
+#add_cross cross-s390-gcc$base_ver-icecream-backend s390 s390-suse-linux
+add_cross cross-s390x-gcc$base_ver s390x s390x-suse-linux
+#add_cross cross-ppc-gcc$base_ver ppc powerpc64-suse-linux
+add_cross cross-ppc64-gcc$base_ver ppc64 powerpc64-suse-linux
+add_cross cross-ppc64le-gcc$base_ver ppc64le powerpc64le-suse-linux
+add_cross cross-ia64-gcc$base_ver ia64 ia64-suse-linux
 
 for f in *.spec; do
   sed -i -e '/^# .*-\(BEGIN\|END\)$/d' $f
--- cross.spec.in.orig
+++ cross.spec.in
@@ -34,9 +34,7 @@
 %define canonical_target_abi -gnueabi
 %endif
 
-%if 0%{?gcc_icecream:1}
 %define build_sysroot /
-%endif
 
 
 Name:         %{pkgname}
@@ -66,30 +64,17 @@ BuildRequires: isl-devel
 %ifarch ia64
 BuildRequires: libunwind-devel
 %endif
-%if 0%{!?gcc_icecream:1}
-BuildRequires: cross-%cross_arch-glibc-devel
-%endif
 ExclusiveArch: ppc64 x86_64 ia64 s390x aarch64
 %define _binary_payload w.ufdio
+BuildRequires:  update-alternatives
+Requires(post): update-alternatives
+Requires(preun): update-alternatives
+
 
 # COMMON-BEGIN
 # COMMON-END
 
-%if 0%{!?gcc_icecream:1}
-make %{?jobs:-j%jobs}
-%else
 make %{?jobs:-j%jobs} all-host
-%endif
-
-
-%if 0%{!?gcc_icecream:1}
-%package -n cross-%cross_arch-gcc@base_ver@-icecream-backend
-Summary: Icecream backend for the GNU C Compiler
-Group:	Development/Languages/C and C++
-
-%description -n cross-%cross_arch-gcc@base_ver@-icecream-backend
-This package contains the icecream environment for the GNU C Compiler
-%endif
 
 
 %define targetlibsubdir %{_libdir}/gcc/%{gcc_target_arch}/%{gcc_dir_version}
@@ -99,9 +84,6 @@ cd obj-%{GCCDIST}
 
 # install and fixup host parts
 make DESTDIR=$RPM_BUILD_ROOT install-host
-# binsuffix is not applied consistently for cross builds, get rid of
-# the remains
-rm -f $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-gcc%{binsuffix}
 # with the present setup fixincludes are for the build includes which
 # is wrong - get rid of them
 rm -rf $RPM_BUILD_ROOT/%{targetlibsubdir}/include-fixed
@@ -122,72 +104,73 @@ rm -rf $RPM_BUILD_ROOT%{_infodir}
 #make DESTDIR=$RPM_BUILD_ROOT/%{_prefix}/%{gcc_target_arch} install-target
 #%endif
 
-
-# Build an icecream environment
-# The assembler comes from the cross-binutils, and hence is _not_
-# named funnily, not even on ppc, so there we need the original target
-install -s -D %{_prefix}/bin/%{canonical_target}-suse-linux%{?canonical_target_abi:%canonical_target_abi}-as \
-	$RPM_BUILD_ROOT/env/usr/bin/as
-install -s $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-g++ \
-	$RPM_BUILD_ROOT/env/usr/bin/g++
-install -s $RPM_BUILD_ROOT/%{_prefix}/bin/%{gcc_target_arch}-gcc \
-	$RPM_BUILD_ROOT/env/usr/bin/gcc
-
-for back in cc1 cc1plus; do 
-	install -s -D $RPM_BUILD_ROOT/%{targetlibsubdir}/$back \
-		$RPM_BUILD_ROOT/env%{targetlibsubdir}/$back
+# we provide update-alternatives for selecting a compiler version for
+# crosses
+mkdir -p %{buildroot}%{_sysconfdir}/alternatives
+for ex in gcc cpp \
+%if %{build_cp}
+          c++ g++ \
+%endif
+          gcc-ar gcc-nm gcc-ranlib gcov; do
+  ln -s %{_sysconfdir}/alternatives/%{gcc_target_arch}-$ex \
+	%{buildroot}%{_bindir}/%{gcc_target_arch}-$ex
 done
-if test -f $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.so; then
-  install -s -D $RPM_BUILD_ROOT/%{targetlibsubdir}/liblto_plugin.so \
-		$RPM_BUILD_ROOT/env%{targetlibsubdir}/liblto_plugin.so
-fi
 
-# Make sure to also pull in all shared library requirements for the
-# binaries we put into the environment which is operated by chrooting
-# into it and execing the compiler
-libs=`for bin in $RPM_BUILD_ROOT/env/usr/bin/* $RPM_BUILD_ROOT/env%{targetlibsubdir}/*; do \
-  ldd $bin | sed -n '\,^[^/]*\(/[^ ]*\).*,{ s//\1/; p; }'  ;\
-done | sort -u `
-for lib in $libs; do
-  # Check wether the same library also exists in the parent directory,
-  # and prefer that on the assumption that it is a more generic one.
-  baselib=`echo "$lib" | sed 's,/[^/]*\(/[^/]*\)$,\1,'`
-  test -f "$baselib" && lib=$baselib
-  install -s -D $lib $RPM_BUILD_ROOT/env$lib
+# create symlinks to build-time binutils
+for f in /usr/%{canonical_target}-suse-linux%{?canonical_target_abi}/bin/*; do
+  ln -s $(realpath $f) %{buildroot}%{targetlibsubdir}/$(basename $f)
 done
 
-cd $RPM_BUILD_ROOT/env
-tar cvzf ../%{name}_%{_arch}.tar.gz *
-cd ..
-mkdir -p usr/share/icecream-envs
-mv %{name}_%{_arch}.tar.gz usr/share/icecream-envs
-rpm -q --changelog glibc >  usr/share/icecream-envs/%{name}_%{_arch}.glibc
-rpm -q --changelog binutils >  usr/share/icecream-envs/%{name}_%{_arch}.binutils
-rm -r env
-
-%if 0%{?gcc_icecream:1}
-rm -rf $RPM_BUILD_ROOT/%{_prefix}/bin
-rm -rf $RPM_BUILD_ROOT/%{_libdir}
-%endif
-
+%post
+prio=@base_ver@
+prio=${prio::1}
+%{_sbindir}/update-alternatives \
+  --install %{_bindir}/%{gcc_target_arch}-gcc %{gcc_target_arch}-gcc %{_bindir}/%{gcc_target_arch}-gcc%{binsuffix} $prio \
+  --slave %{_bindir}/%{gcc_target_arch}-cpp %{gcc_target_arch}-cpp %{_bindir}/%{gcc_target_arch}-cpp%{binsuffix} \
+%if %{build_cp}
+  --slave %{_bindir}/%{gcc_target_arch}-c++ %{gcc_target_arch}-c++ %{_bindir}/%{gcc_target_arch}-c++%{binsuffix} \
+  --slave %{_bindir}/%{gcc_target_arch}-g++ %{gcc_target_arch}-g++ %{_bindir}/%{gcc_target_arch}-g++%{binsuffix} \
+%endif
+  --slave %{_bindir}/%{gcc_target_arch}-gcc-ar %{gcc_target_arch}-gcc-ar %{_bindir}/%{gcc_target_arch}-gcc-ar%{binsuffix} \
+  --slave %{_bindir}/%{gcc_target_arch}-gcc-nm %{gcc_target_arch}-gcc-nm %{_bindir}/%{gcc_target_arch}-gcc-nm%{binsuffix} \
+  --slave %{_bindir}/%{gcc_target_arch}-gcc-ranlib %{gcc_target_arch}-gcc-ranlib %{_bindir}/%{gcc_target_arch}-gcc-ranlib%{binsuffix} \
+  --slave %{_bindir}/%{gcc_target_arch}-gcov %{gcc_target_arch}-gcov %{_bindir}/%{gcc_target_arch}-gcov%{binsuffix}
+
+%postun
+if [ ! -f %{_bindir}/%{gcc_target_arch}-gcc ] ; then
+  %{_sbindir}/update-alternatives --remove %{gcc_target_arch}-gcc %{_bindir}/%{gcc_target_arch}-gcc%{binsuffix}
+fi
 
-%if 0%{!?gcc_icecream:1}
 %files
 %defattr(-,root,root)
-%{_prefix}/bin
+%{_prefix}/bin/%{gcc_target_arch}-gcc%{binsuffix}
+%{_prefix}/bin/%{gcc_target_arch}-cpp%{binsuffix}
+%{_prefix}/bin/%{gcc_target_arch}-gcc-ar%{binsuffix}
+%{_prefix}/bin/%{gcc_target_arch}-gcc-nm%{binsuffix}
+%{_prefix}/bin/%{gcc_target_arch}-gcc-ranlib%{binsuffix}
+%{_prefix}/bin/%{gcc_target_arch}-gcov%{binsuffix}
+%{_prefix}/bin/%{gcc_target_arch}-gcc
+%{_prefix}/bin/%{gcc_target_arch}-cpp
+%{_prefix}/bin/%{gcc_target_arch}-gcc-ar
+%{_prefix}/bin/%{gcc_target_arch}-gcc-nm
+%{_prefix}/bin/%{gcc_target_arch}-gcc-ranlib
+%{_prefix}/bin/%{gcc_target_arch}-gcov
+%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc
+%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-cpp
+%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc-ar
+%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc-nm
+%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcc-ranlib
+%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-gcov
+%if %{build_cp}
+%{_prefix}/bin/%{gcc_target_arch}-c++%{binsuffix}
+%{_prefix}/bin/%{gcc_target_arch}-g++%{binsuffix}
+%{_prefix}/bin/%{gcc_target_arch}-c++
+%{_prefix}/bin/%{gcc_target_arch}-g++
+%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-c++
+%ghost %{_sysconfdir}/alternatives/%{gcc_target_arch}-g++
+%endif
 %dir %{targetlibsubdir}
 %dir %{_libdir}/gcc/%{gcc_target_arch}
 %{targetlibsubdir}
-%else
-%files
-%defattr(-,root,root)
-/usr/share/icecream-envs
-%endif
-
-%if 0%{!?gcc_icecream:1}
-%files -n cross-%cross_arch-gcc@base_ver@-icecream-backend
-%defattr(-,root,root)
-/usr/share/icecream-envs
-%endif
 
 %changelog -n cross-%{pkgname}-gcc@base_ver@
--- gcc.spec.in.orig
+++ gcc.spec.in
@@ -336,6 +336,9 @@ Patch103:       gcc48-build-sle15.diff
 Patch104:       gcc48-update-ucontext.diff
 Patch105:       gcc48-flive-patching.patch
 Patch106:       gcc48-ipa-clones-dump.patch
+# Patches for kbuild
+Patch200:       gcc48-keep-gcc-binary-with-ext.patch
+Patch201:       gcc48-x_spill_indirect_levels-type.patch
 
 #testpatch end
 
@@ -1107,6 +1110,8 @@ Results from running the gcc and target
 %patch104 -p1
 %patch105 -p1
 %patch106 -p1
+%patch200 -p1
+%patch201 -p1
 
 #test patching end
 
@@ -1278,8 +1283,8 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_
         --disable-initfini-array \
 %endif
 	--enable-linux-futex \
-%if 0%{!?gcc_target_arch:1}
 	--program-suffix=%{binsuffix} \
+%if 0%{!?gcc_target_arch:1}
 %ifarch ia64
 	--with-system-libunwind \
 %else
@@ -1287,6 +1292,7 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_
 %endif
 %endif
 %if 0%{?gcc_target_arch:1}
+	--program-prefix=%{gcc_target_arch}- \
 	--target=%{gcc_target_arch} \
 	--disable-nls \
 %if 0%{?sysroot:1}
--- gcc48-testresults.spec.orig
+++ gcc48-testresults.spec
@@ -350,6 +350,9 @@ Patch103:       gcc48-build-sle15.diff
 Patch104:       gcc48-update-ucontext.diff
 Patch105:       gcc48-flive-patching.patch
 Patch106:       gcc48-ipa-clones-dump.patch
+# Patches for kbuild
+Patch200:       gcc48-keep-gcc-binary-with-ext.patch
+Patch201:       gcc48-x_spill_indirect_levels-type.patch
 
 #testpatch end
 
@@ -520,6 +523,8 @@ Results from running the gcc and target
 %patch104 -p1
 %patch105 -p1
 %patch106 -p1
+%patch200 -p1
+%patch201 -p1
 
 #test patching end
 
@@ -691,8 +696,8 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_
         --disable-initfini-array \
 %endif
 	--enable-linux-futex \
-%if 0%{!?gcc_target_arch:1}
 	--program-suffix=%{binsuffix} \
+%if 0%{!?gcc_target_arch:1}
 %ifarch ia64
 	--with-system-libunwind \
 %else
@@ -700,6 +705,7 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_
 %endif
 %endif
 %if 0%{?gcc_target_arch:1}
+	--program-prefix=%{gcc_target_arch}- \
 	--target=%{gcc_target_arch} \
 	--disable-nls \
 %if 0%{?sysroot:1}
--- gcc48.spec.orig
+++ gcc48.spec
@@ -329,6 +329,9 @@ Patch103:       gcc48-build-sle15.diff
 Patch104:       gcc48-update-ucontext.diff
 Patch105:       gcc48-flive-patching.patch
 Patch106:       gcc48-ipa-clones-dump.patch
+# Patches for kbuild
+Patch200:       gcc48-keep-gcc-binary-with-ext.patch
+Patch201:       gcc48-x_spill_indirect_levels-type.patch
 
 #testpatch end
 
@@ -1613,6 +1616,8 @@ Results from running the gcc and target
 %patch104 -p1
 %patch105 -p1
 %patch106 -p1
+%patch200 -p1
+%patch201 -p1
 
 #test patching end
 
@@ -1784,8 +1789,8 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_
         --disable-initfini-array \
 %endif
 	--enable-linux-futex \
-%if 0%{!?gcc_target_arch:1}
 	--program-suffix=%{binsuffix} \
+%if 0%{!?gcc_target_arch:1}
 %ifarch ia64
 	--with-system-libunwind \
 %else
@@ -1793,6 +1798,7 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_
 %endif
 %endif
 %if 0%{?gcc_target_arch:1}
+	--program-prefix=%{gcc_target_arch}- \
 	--target=%{gcc_target_arch} \
 	--disable-nls \
 %if 0%{?sysroot:1}
--- libffi48.spec.orig
+++ libffi48.spec
@@ -349,6 +349,9 @@ Patch103:       gcc48-build-sle15.diff
 Patch104:       gcc48-update-ucontext.diff
 Patch105:       gcc48-flive-patching.patch
 Patch106:       gcc48-ipa-clones-dump.patch
+# Patches for kbuild
+Patch200:       gcc48-keep-gcc-binary-with-ext.patch
+Patch201:       gcc48-x_spill_indirect_levels-type.patch
 
 #testpatch end
 
@@ -613,6 +616,8 @@ Results from running the gcc and target
 %patch104 -p1
 %patch105 -p1
 %patch106 -p1
+%patch200 -p1
+%patch201 -p1
 
 #test patching end
 
@@ -784,8 +789,8 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_
         --disable-initfini-array \
 %endif
 	--enable-linux-futex \
-%if 0%{!?gcc_target_arch:1}
 	--program-suffix=%{binsuffix} \
+%if 0%{!?gcc_target_arch:1}
 %ifarch ia64
 	--with-system-libunwind \
 %else
@@ -793,6 +798,7 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_
 %endif
 %endif
 %if 0%{?gcc_target_arch:1}
+	--program-prefix=%{gcc_target_arch}- \
 	--target=%{gcc_target_arch} \
 	--disable-nls \
 %if 0%{?sysroot:1}
--- libgcj48.spec.orig
+++ libgcj48.spec
@@ -349,6 +349,9 @@ Patch103:       gcc48-build-sle15.diff
 Patch104:       gcc48-update-ucontext.diff
 Patch105:       gcc48-flive-patching.patch
 Patch106:       gcc48-ipa-clones-dump.patch
+# Patches for kbuild
+Patch200:       gcc48-keep-gcc-binary-with-ext.patch
+Patch201:       gcc48-x_spill_indirect_levels-type.patch
 
 #testpatch end
 
@@ -704,6 +707,8 @@ Results from running the gcc and target
 %patch104 -p1
 %patch105 -p1
 %patch106 -p1
+%patch200 -p1
+%patch201 -p1
 
 #test patching end
 
@@ -875,8 +880,8 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_
         --disable-initfini-array \
 %endif
 	--enable-linux-futex \
-%if 0%{!?gcc_target_arch:1}
 	--program-suffix=%{binsuffix} \
+%if 0%{!?gcc_target_arch:1}
 %ifarch ia64
 	--with-system-libunwind \
 %else
@@ -884,6 +889,7 @@ TCFLAGS="$RPM_OPT_FLAGS" GCJFLAGS="$RPM_
 %endif
 %endif
 %if 0%{?gcc_target_arch:1}
+	--program-prefix=%{gcc_target_arch}- \
 	--target=%{gcc_target_arch} \
 	--disable-nls \
 %if 0%{?sysroot:1}
--- pre_checkin.sh.orig
+++ pre_checkin.sh
@@ -12,19 +12,21 @@ case $0 in
     here=$PWD
     ;;
 esac
-case ${here##*/} in
+pkg=${here##*/}
+pkg=${pkg#cross-}
+case ${pkg} in
   gcc*.*)
     # Handle maintainance projects with .$REPO suffix
-    suffix=${here##*/}
+    suffix=${pkg}
     suffix=${suffix%%\.*}
     set ${suffix#gcc}
     ;;
   gcc-*)
-    suffix=${here##*/}
+    suffix=${pkg}
     set ${suffix#*-}-
     ;;
   gcc[0-9]*)
-    suffix=${here##*/}
+    suffix=${pkg}
     set ${suffix#gcc}
     ;;
 esac
openSUSE Build Service is sponsored by