LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File change_spec of Package gcc48 (Project devel:gcc)

#!/bin/bash

do_icecream=1
do_cross_static=0
do_cross_shared=1
do_optional_compiler_languages=0
rm -f libgcj*.spec libgcj*.changes libffi*.spec libffi*.changes gcc*-testresults.spec gcc*-testresults.changes gcc*.spec cross*.spec cross*.changes

# Default is to generate the normal gcc package
# unless a parameter is given.  In case that it is '-*',
# that parameter will be used as suffix for the package name
# and as suffix for the install path (/opt/gccSUFFIX)
# In case that it is '[0-9]*', that parameter will be used
# as a suffix for a versioned package name.

if [ $# -lt 1 ]; then
	outfile=gcc.spec
else
	case $1 in
	[0-9]*)
	  base_ver=$1
	  outfile=gcc$1.spec
	;;
	*)
	  exit 1
	;;
	esac
fi

	: > $outfile
	if test "$do_optional_compiler_languages" = "1"; then
	    echo '%define run_tests 1' >> $outfile
	    echo '%define build_optional_compiler_languages 1' >> $outfile
	fi
	sed -e 's%@base_ver@%'$base_ver'%g' \
	    gcc.spec.in \
	| sed -n -e '{
/^# PACKAGE-BEGIN/h
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/H
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/!p
/^# PACKAGE-END/{g
s/@variant@//g
p
g
s/@variant@/-32bit/g
p
g
s/@variant@/-64bit/g
p
}
}' >> $outfile
	if test "$do_optional_compiler_languages" = "0"; then
	echo '%define building_libjava 1' > libgcj$base_ver.spec
	sed -e '/^# LIBJAVA-DELETE-BEGIN/,/^# LIBJAVA-DELETE-END/d;s/-n libgcj@base_ver@$//g;s/^Name:[[:space:]]*gcc/Name: libgcj/g' \
	    gcc.spec.in \
	| sed -e 's%@base_ver@%'$base_ver'%g' \
	| sed -n -e '{
/^# PACKAGE-BEGIN/h
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/H
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/!p
/^# PACKAGE-END/{g
s/@variant@//g
p
g
s/@variant@/-32bit/g
p
g
s/@variant@/-64bit/g
p
}
}' >> libgcj$base_ver.spec
	echo '%define building_testsuite 1' > gcc$base_ver-testresults.spec
	echo '%define run_tests 1' >> gcc$base_ver-testresults.spec
	sed -e '/^# GCC-TESTSUITE-DELETE-BEGIN/,/^# GCC-TESTSUITE-DELETE-END/d;s/-n gcc@base_ver@-testresults$//g;s/^Name:[[:space:]]*gcc@base_ver@/Name: gcc@base_ver@-testresults/g' \
	    gcc.spec.in \
	| sed -e 's%@base_ver@%'$base_ver'%g' \
>> gcc$base_ver-testresults.spec
	echo '%define building_libffi 1' > libffi$base_ver.spec
	sed -e '/^# LIBFFI-DELETE-BEGIN/,/^# LIBFFI-DELETE-END/d;s/^Name:[[:space:]]*gcc/Name: libffi/g' \
	    gcc.spec.in \
	| sed -e 's%@base_ver@%'$base_ver'%g' \
	| sed -n -e '{
/^# PACKAGE-BEGIN/h
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/H
/^# PACKAGE-BEGIN/,/^# PACKAGE-END/!p
/^# PACKAGE-END/{g
s/@variant@//g
p
g
s/@variant@/-32bit/g
p
g
s/@variant@/-64bit/g
p
}
}' \
>> libffi$base_ver.spec

  test -f gcc$base_ver.changes \
    && ( ln -f gcc$base_ver.changes libgcj$base_ver.changes; \
	 ln -f gcc$base_ver.changes libffi$base_ver.changes; \
	 ln -f gcc$base_ver.changes gcc$base_ver-testresults.changes; )
    fi



add_cross() {
  local pkgname="$1"; shift
  local rpmtarget="$1"; shift
  local triplet="$1"; shift

  exclarch=`echo $rpmtarget | sed -e 's/ppc$/ppc64/'`
  echo "%define pkgname $pkgname" > $pkgname.spec
  echo "%define cross_arch $rpmtarget" >> $pkgname.spec
  echo "%define gcc_target_arch $triplet" >> $pkgname.spec
  echo "$@" >> $pkgname.spec
  { sed -n -e '1,/COMMON-BEGIN/p' cross.spec.in
    sed -n -e '/COMMON-BEGIN/,/COMMON-END/p' $outfile
    sed -n -e '/COMMON-END/,$p' cross.spec.in; } |
    sed -e "s#@base_ver@#$base_ver#" \
	-e "s/^\(ExclusiveArch.*\) $exclarch /\1 /" \
      >> $pkgname.spec
  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

for f in *.spec; do
  sed -i -e '/^# .*-\(BEGIN\|END\)$/d' $f
done

osc service localrun format_spec_file

exit 0