gcc: adapt from Yocto Project recipes
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Fri, 15 Feb 2013 08:56:56 +0000 (08:56 +0000)
committerPaul Eggleton <paul.eggleton@linux.intel.com>
Fri, 15 Feb 2013 10:24:28 +0000 (10:24 +0000)
28 files changed:
meta-tizen/recipes-Development/gcc/gcc-common.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-configure-common.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-configure-cross.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-configure-runtime.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-configure-sdk.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-configure-target.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-cross-canadian.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-cross-canadian_git.bb [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-cross-initial.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-cross-initial_git.bb [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-cross.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-cross4.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-cross_git.bb [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-crosssdk-initial.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-crosssdk-initial_git.bb [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-crosssdk.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-crosssdk_git.bb [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-extraconf.inc [deleted file]
meta-tizen/recipes-Development/gcc/gcc-git.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-multilib-config.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-package-cross.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-package-runtime.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-package-sdk.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-package-target.inc [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc-runtime_git.bb [new file with mode: 0644]
meta-tizen/recipes-Development/gcc/gcc.inc [deleted file]
meta-tizen/recipes-Development/gcc/gcc_git.bb
meta-tizen/recipes-Development/gcc/libgcc_git.bb [new file with mode: 0644]

diff --git a/meta-tizen/recipes-Development/gcc/gcc-common.inc b/meta-tizen/recipes-Development/gcc/gcc-common.inc
new file mode 100644 (file)
index 0000000..ad96989
--- /dev/null
@@ -0,0 +1,123 @@
+DESCRIPTION = "The GNU cc and gcc C compilers."
+HOMEPAGE = "http://www.gnu.org/software/gcc/"
+SECTION = "devel"
+LICENSE = "GPL"
+
+NATIVEDEPS = ""
+
+inherit autotools gettext
+
+def get_gcc_fpu_setting(bb, d):
+    if d.getVar('ARMPKGSFX_EABI', True) == "hf" and d.getVar('TRANSLATED_TARGET_ARCH', True) == "arm":
+        return "--with-float=hard"
+    if d.getVar('TARGET_FPU', True) in [ 'soft' ]:
+        return "--with-float=soft"
+    if d.getVar('TARGET_FPU', True) in [ 'ppc-efd' ]:
+        return "--enable-e500_double"
+    return ""
+
+def get_gcc_mips_plt_setting(bb, d):
+    if d.getVar('TRANSLATED_TARGET_ARCH', True) in [ 'mips', 'mipsel' ] and 'mplt' in d.getVar('DISTRO_FEATURES',1).split() :
+        return "--with-mips-plt"
+    return ""
+
+def get_gcc_multiarch_setting(bb, d):
+    target_arch = d.getVar('TRANSLATED_TARGET_ARCH', True)
+    multiarch_options = {
+        "i586":    "--enable-targets=all",
+        "powerpc": "--enable-targets=powerpc64",
+        "sparc":   "--enable-targets=all",
+    }
+
+    if 'multiarch' in d.getVar('DISTRO_FEATURES', True).split() :
+        if target_arch in multiarch_options :
+            return multiarch_options[target_arch]
+    return ""
+
+# this is used by the multilib setup of gcc
+def get_tune_parameters(tune, d):
+    availtunes = d.getVar('AVAILTUNES', True)
+    if tune not in availtunes.split():
+        bb.error('The tune: %s is not one of the available tunes: %s', tune, availtunes)
+
+    localdata = bb.data.createCopy(d)
+    override = ':tune-' + tune
+    localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
+    bb.data.update_data(localdata)
+
+    retdict = {}
+    retdict['tune'] = tune
+    retdict['ccargs'] = localdata.getVar('TUNE_CCARGS', True)
+    retdict['features'] = localdata.getVar('TUNE_FEATURES', True)
+    # BASELIB is used by the multilib code to change library paths
+    retdict['baselib'] = localdata.getVar('BASE_LIB', True) or localdata.getVar('BASELIB', True)
+    retdict['arch'] = localdata.getVar('TUNE_ARCH', True)
+    retdict['abiextension'] = localdata.getVar('ABIEXTENSION', True)
+    retdict['target_fpu'] = localdata.getVar('TARGET_FPU', True)
+    retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH', True)
+    retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS', True)
+    return retdict
+
+# We really need HOST_SYS here for some packages and TARGET_SYS for others.
+# For now, libgcc is most important so we fix for that - RP.
+SHLIBSDIR = "${STAGING_DIR_TARGET}/shlibs"
+
+DEBIANNAME_${MLPREFIX}libgcc = "libgcc1"
+
+MIRRORS =+ "\
+${GNU_MIRROR}/gcc    ftp://gcc.gnu.org/pub/gcc/releases/ \n \
+${GNU_MIRROR}/gcc      ftp://gd.tuwien.ac.at/gnu/gcc/ \n \
+${GNU_MIRROR}/gcc      http://mirrors.rcn.net/pub/sourceware/gcc/releases/ \n \
+${GNU_MIRROR}/gcc   http://gcc.get-software.com/releases/ \n \
+${GNU_MIRROR}/gcc      http://gcc.get-software.com/releases/ \n \
+"
+
+#
+# Set some default values
+#
+gcclibdir = "${libdir}/gcc"
+BINV = "${PV}"
+#S = "${WORKDIR}/gcc-${PV}"
+S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
+B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
+
+# SS means Shared Stamps directory
+SS = "${TMPDIR}/stamps/work-shared/gcc-${PV}-${PR}"
+do_fetch[stamp-base] = "${SS}"
+do_unpack[stamp-base] = "${SS}"
+do_patch[stamp-base] = "${SS}"
+SSCLEAN = "${TMPDIR}/stamps/work-shared/gcc-[0-9]*-*"
+do_fetch[stamp-base-clean] = "${SSCLEAN}"
+do_unpack[stamp-base-clean] = "${SSCLEAN}"
+do_patch[stamp-base-clean] = "${SSCLEAN}"
+
+# SW means Shared Work directory
+SW = "${TMPDIR}/work-shared/gcc-${PV}-${PR}"
+WORKDIR_task-unpack = "${SW}"
+WORKDIR_task-patch = "${SW}"
+
+target_includedir ?= "${includedir}"
+target_libdir ?= "${libdir}"
+target_base_libdir ?= "${base_libdir}"
+target_prefix ?= "${prefix}"
+
+CLEANFUNCS += "workshared_clean"
+# The do_clean should be exclusive since share ${S}
+do_clean[lockfiles] = "${SW}.clean.lock"
+
+python workshared_clean () {
+       """clear the source directory"""
+       dir = d.expand("${SW}")
+       bb.note("Removing " + dir)
+       oe.path.remove(dir)
+
+       """clear the the stamps in work-shared"""
+       dir = "%s.*" % bb.data.expand(d.getVarFlag('do_fetch', 'stamp-base', True), d)
+       bb.note("Removing " + dir)
+       oe.path.remove(dir)
+}
+
+# We need to ensure that for the shared work directory, the do_patch singatures match
+# The real WORKDIR location isn't a dependency for the shared workdir.
+src_patches[vardepsexclude] = "WORKDIR"
+should_apply[vardepsexclude] += "PN"
diff --git a/meta-tizen/recipes-Development/gcc/gcc-configure-common.inc b/meta-tizen/recipes-Development/gcc/gcc-configure-common.inc
new file mode 100644 (file)
index 0000000..b87ea62
--- /dev/null
@@ -0,0 +1,132 @@
+require gcc-multilib-config.inc
+#
+# Build the list of lanaguages to build.
+#
+# These can be overridden by the version specific .inc file.
+
+# Java (gcj doesn't work on all architectures)
+JAVA ?= ",java"
+JAVA_arm ?= ""
+JAVA_armeb ?= ""
+JAVA_mipsel ?= ""
+JAVA_sh3 ?= ""
+# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
+FORTRAN ?= ",f77"
+LANGUAGES ?= "c,c++${FORTRAN}${JAVA}"
+# disable --enable-target-optspace for powerpc SPE
+# at -Os libgcc.so.1 creates references into
+# hidden symbols in libgcc.a which linker complains
+# when linking shared libraries further in the build like (gnutls)
+
+SPECIAL_ARCH_LIST = "powerpc"
+OPTSPACE = '${@base_contains("SPECIAL_ARCH_LIST", "${TARGET_ARCH}", "", "--enable-target-optspace",d)}'
+
+EXTRA_OECONF_BASE ?= ""
+EXTRA_OECONF_PATHS ?= ""
+EXTRA_OECONF_INITIAL ?= ""
+EXTRA_OECONF_INTERMEDIATE ?= ""
+
+GCCMULTILIB ?= "--disable-multilib"
+GCCTHREADS ?= "posix"
+
+EXTRA_OECONF = "${@['--enable-clocale=generic', ''][d.getVar('USE_NLS', True) != 'no']} \
+                --with-gnu-ld \
+                --enable-shared \
+                --enable-languages=${LANGUAGES} \
+                --enable-threads=${GCCTHREADS} \
+                ${GCCMULTILIB} \
+                --enable-c99 \
+                --enable-long-long \
+                --enable-symvers=gnu \
+                --enable-libstdcxx-pch \
+                --program-prefix=${TARGET_PREFIX} \
+               --without-local-prefix \
+                ${OPTSPACE} \
+                ${EXTRA_OECONF_BASE} \
+                ${EXTRA_OECONF_FPU} \
+                ${EXTRA_OECONF_PATHS} \
+                ${@get_gcc_mips_plt_setting(bb, d)} \
+                ${@get_gcc_multiarch_setting(bb, d)}"
+
+export gcc_cv_collect2_libs = 'none required'
+# We need to set gcc_cv_collect2_libs else there is cross-compilation badness
+# in the config.log files (which might not get generated until do_compile
+# hence being missed by the insane do_configure check).
+
+# Build uclibc compilers without cxa_atexit support
+EXTRA_OECONF_append_linux               = " --enable-__cxa_atexit"
+EXTRA_OECONF_append_libc-uclibc        = " --enable-__cxa_atexit"
+
+EXTRA_OECONF_append_mips64    = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
+EXTRA_OECONF_append_mips64el    = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
+
+EXTRA_OECONF_FPU = "${@get_gcc_fpu_setting(bb, d)}"
+CPPFLAGS = ""
+
+# powerpc needs this to comply with the ABI
+EXTRA_OECONF_append_powerpc = " --with-long-double-128"
+EXTRA_OECONF_append_powerpc64 = " --with-long-double-128"
+
+# Used by configure to define additional values for FLAGS_FOR_TARGET -
+# passed to all the compilers.
+ARCH_FLAGS_FOR_TARGET = "${TARGET_CC_ARCH}"
+EXTRA_OEMAKE += "ARCH_FLAGS_FOR_TARGET='${ARCH_FLAGS_FOR_TARGET}'"
+
+SYSTEMHEADERS = "${target_includedir}"
+SYSTEMLIBS = "${target_base_libdir}/"
+SYSTEMLIBS1 = "${target_libdir}/"
+
+do_configure_prepend () {
+       # teach gcc to find correct target includedir when checking libc ssp support
+       mkdir -p ${B}/gcc
+       echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
+       cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
+       cat >>${B}/gcc/defaults.h.new <<_EOF
+#ifndef STANDARD_INCLUDE_DIR
+#define STANDARD_INCLUDE_DIR "${SYSTEMHEADERS}"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX_1
+#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX_2
+#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
+#endif
+#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
+#endif /* ! GCC_DEFAULTS_H */
+_EOF
+       mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
+}
+
+do_configure () {
+       # Setup these vars for cross building only
+       # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
+       # gcc build stuff when the build is producing a cross compiler - i.e.
+       # when the 'current' target is the 'host' system, and the host is not
+       # the target (because the build is actually making a cross compiler!)
+       if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
+               export CC_FOR_TARGET="${CC}"
+               export GCC_FOR_TARGET="${CC}"
+               export CXX_FOR_TARGET="${CXX}"
+               export AS_FOR_TARGET="${HOST_PREFIX}as"
+               export LD_FOR_TARGET="${HOST_PREFIX}ld"
+               export NM_FOR_TARGET="${HOST_PREFIX}nm"
+               export AR_FOR_TARGET="${HOST_PREFIX}ar"
+               export GFORTRAN_FOR_TARGET="gfortran"
+               export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
+       fi
+       export CC_FOR_BUILD="${BUILD_CC}"
+       export CXX_FOR_BUILD="${BUILD_CXX}"
+       export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
+       export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
+       export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
+       export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
+       export ARCH_FLAGS_FOR_TARGET="${ARCH_FLAGS_FOR_TARGET}"
+       export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
+       export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
+       export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
+       export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
+       (cd ${S} && gnu-configize) || die "failure running gnu-configize"
+
+       oe_runconf
+}
+
diff --git a/meta-tizen/recipes-Development/gcc/gcc-configure-cross.inc b/meta-tizen/recipes-Development/gcc/gcc-configure-cross.inc
new file mode 100644 (file)
index 0000000..243ee55
--- /dev/null
@@ -0,0 +1,28 @@
+require gcc-configure-common.inc
+
+EXTRA_OECONF += " --enable-poison-system-directories \
+               "
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+EXTRA_OECONF_PATHS = " \
+                     --with-headers=${STAGING_DIR_TARGET}${SYSTEMHEADERS} \
+                     --with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++ \
+                      --with-sysroot=${STAGING_DIR_TARGET} \
+                      --with-build-sysroot=${STAGING_DIR_TARGET}"
+
+do_compile_prepend () {
+       export CC="${BUILD_CC}"
+       export AR_FOR_TARGET="${TARGET_SYS}-ar"
+       export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib"
+       export LD_FOR_TARGET="${TARGET_SYS}-ld"
+       export NM_FOR_TARGET="${TARGET_SYS}-nm"
+       export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
+       export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
+       export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
+       export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
+       export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
+}
+
+LIBGCCS_VAR = "-lgcc_s"
+LIBGCCS_VAR_avr32 = ""
diff --git a/meta-tizen/recipes-Development/gcc/gcc-configure-runtime.inc b/meta-tizen/recipes-Development/gcc/gcc-configure-runtime.inc
new file mode 100644 (file)
index 0000000..a9f77d9
--- /dev/null
@@ -0,0 +1,55 @@
+require gcc-configure-common.inc
+
+CXXFLAGS := "${@oe_filter_out('-fvisibility-inlines-hidden', '${CXXFLAGS}', d)}"
+
+EXTRA_OECONF_PATHS = " \
+    --with-gxx-include-dir=${includedir}/c++/ \
+    --with-sysroot=${STAGING_DIR_TARGET} \
+    --with-build-sysroot=${STAGING_DIR_TARGET}"
+
+RUNTIMETARGET = "libssp libstdc++-v3 libgomp"
+#  ?
+# libiberty
+# libmudflap
+# libgfortran
+
+do_configure () {
+       export CXX="${CXX} -nostdinc++ -nostdlib++"
+       mtarget=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-nativesdk##`
+       target=`echo ${TARGET_SYS} | sed -e s#-nativesdk##`
+       cp -fpPR ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget/* ${B}
+       for d in libgcc ${RUNTIMETARGET}; do
+               echo "Configuring $d"
+               rm -rf ${B}/$target/$d/
+               mkdir -p ${B}/$target/$d/
+               cd ${B}/$target/$d/
+               chmod a+x ${S}/$d/configure
+               ${S}/$d/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
+       done
+}
+
+do_compile () {
+       target=`echo ${TARGET_SYS} | sed -e s#-nativesdk##`
+       for d in libgcc ${RUNTIMETARGET}; do
+               cd ${B}/$target/$d/
+               oe_runmake MULTIBUILDTOP=${B}/$target/$d/
+       done
+}
+
+do_install () {
+       target=`echo ${TARGET_SYS} | sed -e s#-nativesdk##`
+       for d in ${RUNTIMETARGET}; do
+               cd ${B}/$target/$d/
+               oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/$d/ install
+       done
+       rm -rf ${D}${infodir}/libgomp.info ${D}${infodir}/dir
+       rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
+       rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
+       chown -R root:root ${D}
+}
+
+INHIBIT_DEFAULT_DEPS = "1"
+DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ libgcc"
+PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs"
+
+BBCLASSEXTEND = "nativesdk"
diff --git a/meta-tizen/recipes-Development/gcc/gcc-configure-sdk.inc b/meta-tizen/recipes-Development/gcc/gcc-configure-sdk.inc
new file mode 100644 (file)
index 0000000..51c0217
--- /dev/null
@@ -0,0 +1,47 @@
+require gcc-configure-common.inc
+
+EXTRA_OECONF_PATHS = "--with-gxx-include-dir=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}${target_includedir}/c++ \
+                      --with-build-time-tools=${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}/bin \
+                      --with-sysroot=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS} \
+                      --with-build-sysroot=${STAGING_DIR_TARGET}"
+
+#
+# gcc-cross looks and finds these in ${exec_prefix} but we're not so lucky
+# for the sdk. Hardcoding the paths ensures the build doesn't go canadian or worse.
+#
+export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
+export AS_FOR_TARGET = "${TARGET_PREFIX}as"
+export DLLTOOL_FOR_TARGET = "${TARGET_PREFIX}dlltool"
+export CC_FOR_TARGET = "${TARGET_PREFIX}gcc"
+export CXX_FOR_TARGET = "${TARGET_PREFIX}g++"
+export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
+export LIPO_FOR_TARGET = "${TARGET_PREFIX}lipo"
+export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
+export OBJDUMP_FOR_TARGET = "${TARGET_PREFIX}objdump"
+export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
+export STRIP_FOR_TARGET = "${TARGET_PREFIX}strip"
+export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
+
+#
+# We need to override this and make sure the compiler can find staging
+#
+export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
+
+do_configure () {
+       export CC_FOR_BUILD="${BUILD_CC}"
+       export CXX_FOR_BUILD="${BUILD_CXX}"
+       export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
+       export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
+       export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
+       export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
+       export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
+       export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
+       export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
+       export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
+       (cd ${S} && gnu-configize) || die "failure running gnu-configize"
+       oe_runconf
+}
+
+do_compile () {
+       oe_runmake all-host all-target-libgcc
+}
diff --git a/meta-tizen/recipes-Development/gcc/gcc-configure-target.inc b/meta-tizen/recipes-Development/gcc/gcc-configure-target.inc
new file mode 100644 (file)
index 0000000..6cc374b
--- /dev/null
@@ -0,0 +1,8 @@
+GCCMULTILIB = "--enable-multilib"
+require gcc-configure-common.inc
+
+EXTRA_OECONF_PATHS = " \
+    --with-sysroot=/ \
+    --with-build-sysroot=${STAGING_DIR_TARGET} \
+    --with-native-system-header-dir=${STAGING_DIR_TARGET}${target_includedir} \
+    --with-gxx-include-dir=${includedir}/c++/"
diff --git a/meta-tizen/recipes-Development/gcc/gcc-cross-canadian.inc b/meta-tizen/recipes-Development/gcc/gcc-cross-canadian.inc
new file mode 100644 (file)
index 0000000..10ddacf
--- /dev/null
@@ -0,0 +1,9 @@
+inherit cross-canadian
+
+DESCRIPTION = "The cross-canadian GNU cc and gcc C compilers for ${TARGET_ARCH} target."
+PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+BPN = "gcc"
+
+DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc nativesdk-gettext"
+
+GCCMULTILIB = "--enable-multilib"
diff --git a/meta-tizen/recipes-Development/gcc/gcc-cross-canadian_git.bb b/meta-tizen/recipes-Development/gcc/gcc-cross-canadian_git.bb
new file mode 100644 (file)
index 0000000..f822a0f
--- /dev/null
@@ -0,0 +1,26 @@
+inherit cross-canadian
+
+require recipes-Development/gcc/gcc-${PV}.inc
+require gcc-cross-canadian.inc
+require gcc-configure-sdk.inc
+require gcc-package-sdk.inc
+
+DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc nativesdk-elfutils"
+RDEPENDS_${PN} += "nativesdk-mpfr nativesdk-libmpc nativesdk-elfutils"
+
+SYSTEMHEADERS = "/usr/include"
+SYSTEMLIBS = "${target_base_libdir}/"
+SYSTEMLIBS1 = "${target_libdir}/"
+
+EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \
+               --disable-libgomp --disable-libmudflap \
+               --with-mpfr=${STAGING_DIR_HOST}${layout_exec_prefix} \
+               --with-mpc=${STAGING_DIR_HOST}${layout_exec_prefix}"
+
+# to find libmpfr
+# export LD_LIBRARY_PATH = "{STAGING_DIR_HOST}${layout_exec_prefix}"
+
+PARALLEL_MAKE = ""
+
+# gcc 4.7 needs -isystem
+export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}"
diff --git a/meta-tizen/recipes-Development/gcc/gcc-cross-initial.inc b/meta-tizen/recipes-Development/gcc/gcc-cross-initial.inc
new file mode 100644 (file)
index 0000000..1ac1db6
--- /dev/null
@@ -0,0 +1,79 @@
+DEPENDS = "virtual/${TARGET_PREFIX}binutils ${NATIVEDEPS}"
+PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
+PACKAGES = ""
+
+INHIBIT_AUTOTOOLS_DEPS = "1"
+INHIBIT_DEFAULT_DEPS = "1"
+
+CROSS_TARGET_SYS_DIR_append = ".${PN}"
+
+# This is intended to be a -very- basic config
+# sysroot is needed in case we use libc-initial
+EXTRA_OECONF = "--with-newlib \
+               --without-headers \
+               --disable-shared \
+               --disable-threads \
+               --disable-multilib \
+               --disable-__cxa_atexit \
+               --enable-languages=c \
+                ${OPTSPACE} \
+               --program-prefix=${TARGET_PREFIX} \
+               --with-sysroot=${STAGING_DIR_TARGET} \
+               --with-build-sysroot=${GCCCROSS_BUILDSYSROOT} \
+               ${EXTRA_OECONF_INITIAL} \
+               ${@base_contains('DISTRO_FEATURES', 'ld-is-gold', '--with-ld=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}ld.bfd', '', d)} \
+               ${EXTRA_OECONF_FPU}"
+
+GCCCROSS_BUILDSYSROOT = "${B}/tmpsysroot"
+
+do_configure_prepend () {
+       sysr=${GCCCROSS_BUILDSYSROOT}${target_includedir}
+       mkdir -p $sysr
+       for t in linux asm asm-generic; do
+               rm -f $sysr/$t
+               ln -s ${STAGING_DIR_TARGET}${target_includedir}/$t $sysr/
+       done
+}
+
+do_compile () {
+    oe_runmake all-gcc all-target-libgcc
+}
+do_install () {
+       oe_runmake 'DESTDIR=${D}' install-gcc install-target-libgcc
+
+       # We don't really need this (here shares/ contains man/, info/, locale/).
+       rm -rf ${D}${datadir}/
+
+       # We use libiberty from binutils
+       find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f
+       find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f
+
+       # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
+       # found. These need to be relative paths so they work in different locations.
+       dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
+       install -d $dest
+       for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
+               ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
+       done
+       # fixed limits.h infact includes the so called real limits.h
+       # which should come from libc but when we build libc-initial
+       # then bunch of configure tests include fixed limits.h which in turn
+       # includes real limits.h but this real limits.h is not staged yet
+       # so we overwirte the generated include-fixed/limits.h for gcc-cross-initial
+       # to get rid references to real limits.h
+       cp gcc/include-fixed/limits.h ${D}${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed/limits.h
+}
+#
+# Override the default sysroot staging copy since this won't look like a target system
+#
+sysroot_stage_all() {
+       sysroot_stage_dir ${D} ${SYSROOT_DESTDIR}
+       install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_base_libdir}/
+       install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/
+       mv ${SYSROOT_DESTDIR}${target_base_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_base_libdir}/ || true
+       mv ${SYSROOT_DESTDIR}${target_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/ || true
+}
+
+do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_HOST}/ ${SYSROOT_DESTDIR}/${STAGING_DIR_TARGET}/${target_base_libdir}/"
+do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_HOST}/ ${STAGING_DIR_TCBOOTSTRAP}/${target_base_libdir}/"
+
diff --git a/meta-tizen/recipes-Development/gcc/gcc-cross-initial_git.bb b/meta-tizen/recipes-Development/gcc/gcc-cross-initial_git.bb
new file mode 100644 (file)
index 0000000..8a0dd32
--- /dev/null
@@ -0,0 +1,2 @@
+require recipes-Development/gcc/gcc-cross_${PV}.bb
+require gcc-cross-initial.inc
diff --git a/meta-tizen/recipes-Development/gcc/gcc-cross.inc b/meta-tizen/recipes-Development/gcc/gcc-cross.inc
new file mode 100644 (file)
index 0000000..9d29f56
--- /dev/null
@@ -0,0 +1,108 @@
+inherit cross
+
+DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc ${EXTRADEPENDS} ${NATIVEDEPS}"
+PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
+
+require gcc-configure-cross.inc
+require gcc-package-cross.inc
+
+EXTRADEPENDS = ""
+python () {
+    if d.getVar("TARGET_OS", True).startswith("linux"):
+        d.setVar("EXTRADEPENDS", "linux-libc-headers")
+}
+
+do_compile () {
+       oe_runmake all-host all-target-libgcc
+       # now generate script to drive testing
+       echo "#!/usr/bin/env sh" >${B}/${TARGET_PREFIX}testgcc
+       set >> ${B}/${TARGET_PREFIX}testgcc
+       # prune out the unneeded vars
+       sed -i -e "/^BASH/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^USER/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^OPT/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^DIRSTACK/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^EUID/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^FUNCNAME/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^GROUPS/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^HOST/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^HOME/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^IFS/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^LC_ALL/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^LOGNAME/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^MACHTYPE/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^OSTYPE/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^PIPE/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^SHELL/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^'/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^UID/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^TERM/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^PATCH_GET/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^PKG_/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^POSIXLY_/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^PPID/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^PS4/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^Q/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^SHLVL/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^STAGING/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^LD_LIBRARY_PATH/d" ${B}/${TARGET_PREFIX}testgcc
+       sed -i -e "/^PSEUDO/d" ${B}/${TARGET_PREFIX}testgcc
+
+       # append execution part of the script
+cat >> ${B}/${TARGET_PREFIX}testgcc << STOP
+target="\$1"
+usage () {
+       echo "Usage:"
+       echo "\$0 user@target 'extra options to dejagnu'"
+       echo "\$0 target 'extra options to dejagnu'"
+       echo "\$0 target"
+       echo "e.g. \$0 192.168.7.2 ' dg.exp=visibility-d.c'"
+       echo "will only run visibility-d.c test case"
+       echo "e.g. \$0 192.168.7.2 '/-mthumb dg.exp=visibility-d.c'"
+       echo "will only run visibility-d.c test case in thumb mode"
+       echo "You need to have dejagnu autogen expect installed"
+       echo "on the build host"
+    }
+if [ "x\$target" = "x" ]
+then
+       echo "Please specify the target machine and remote user in form of user@target\n"
+       usage
+       exit 1;
+fi
+
+shift
+
+echo "\$target" | grep "@" 2>&1 > /dev/null
+if [ "x\$?" = "x0" ]
+then
+   user=\$(echo \$target | cut -d '@' -f 1)
+   target=\$(echo \$target | cut -d '@' -f 2)
+else
+   user=\$USER
+fi
+ssh \$user@\$target date 2>&1 > /dev/null
+if [ "x\$?" != "x0" ]
+then
+       echo "Failed connecting to \$user@\$target it could be because"
+       echo "you don't have passwordless ssh setup to access \$target"
+       echo "or sometimes host key has been changed"
+       echo "in such case do something like below on build host"
+       echo "ssh-keygen -f "~/.ssh/known_hosts" -R \$target"
+       echo "and then try ssh \$user@\$target"
+
+       usage
+       exit 1
+fi
+       echo "lappend boards_dir [pwd]/../../.." > ${B}/site.exp
+       echo "load_generic_config \"unix\"" > ${B}/${PACKAGE_ARCH}.exp
+       echo "set_board_info username \$user" >> ${B}/${PACKAGE_ARCH}.exp
+       echo "set_board_info rsh_prog ssh" >> ${B}/${PACKAGE_ARCH}.exp
+       echo "set_board_info rcp_prog scp" >> ${B}/${PACKAGE_ARCH}.exp
+       echo "set_board_info hostname \$target" >> ${B}/${PACKAGE_ARCH}.exp
+       DEJAGNU=${B}/site.exp make -k check RUNTESTFLAGS="--target_board=${PACKAGE_ARCH}\$@"
+
+STOP
+
+       chmod +x ${B}/${TARGET_PREFIX}testgcc
+
+}
diff --git a/meta-tizen/recipes-Development/gcc/gcc-cross4.inc b/meta-tizen/recipes-Development/gcc/gcc-cross4.inc
new file mode 100644 (file)
index 0000000..4a20818
--- /dev/null
@@ -0,0 +1,3 @@
+require gcc-cross.inc
+
+EXTRA_OECONF_append_sh4 = " --with-multilib-list= --enable-incomplete-targets "
diff --git a/meta-tizen/recipes-Development/gcc/gcc-cross_git.bb b/meta-tizen/recipes-Development/gcc/gcc-cross_git.bb
new file mode 100644 (file)
index 0000000..0c61d61
--- /dev/null
@@ -0,0 +1,14 @@
+require recipes-Development/gcc/gcc-${PV}.inc
+require gcc-cross4.inc
+
+EXTRA_OECONF += "--disable-libunwind-exceptions \
+                 --with-mpfr=${STAGING_DIR_NATIVE}${prefix_native} \
+                 --with-system-zlib "
+
+EXTRA_OECONF_PATHS = " \
+                      --with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++ \
+                      --with-sysroot=${STAGING_DIR_TARGET} \
+                      --with-build-sysroot=${STAGING_DIR_TARGET}"
+
+
+ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
diff --git a/meta-tizen/recipes-Development/gcc/gcc-crosssdk-initial.inc b/meta-tizen/recipes-Development/gcc/gcc-crosssdk-initial.inc
new file mode 100644 (file)
index 0000000..c6f74a6
--- /dev/null
@@ -0,0 +1,8 @@
+inherit crosssdk
+
+SYSTEMHEADERS = "${SDKPATHNATIVE}${prefix_nativesdk}/include"
+SYSTEMLIBS = "${SDKPATHNATIVE}${base_libdir_nativesdk}/"
+SYSTEMLIBS1 = "${SDKPATHNATIVE}${libdir_nativesdk}/"
+
+DEPENDS = "virtual/${TARGET_PREFIX}binutils-crosssdk gettext-native ${NATIVEDEPS}"
+PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial-crosssdk"
diff --git a/meta-tizen/recipes-Development/gcc/gcc-crosssdk-initial_git.bb b/meta-tizen/recipes-Development/gcc/gcc-crosssdk-initial_git.bb
new file mode 100644 (file)
index 0000000..9056290
--- /dev/null
@@ -0,0 +1,4 @@
+require recipes-Development/gcc/gcc-cross-initial_${PV}.bb
+require gcc-crosssdk-initial.inc
+EXTRA_OECONF += " --with-native-system-header-dir=${SYSTEMHEADERS} "
+
diff --git a/meta-tizen/recipes-Development/gcc/gcc-crosssdk.inc b/meta-tizen/recipes-Development/gcc/gcc-crosssdk.inc
new file mode 100644 (file)
index 0000000..467a3f5
--- /dev/null
@@ -0,0 +1,10 @@
+inherit crosssdk
+
+SYSTEMHEADERS = "${SDKPATHNATIVE}${prefix_nativesdk}/include"
+SYSTEMLIBS = "${SDKPATHNATIVE}${base_libdir_nativesdk}/"
+SYSTEMLIBS1 = "${SDKPATHNATIVE}${libdir_nativesdk}/"
+
+GCCMULTILIB = "--disable-multilib"
+
+DEPENDS = "virtual/${TARGET_PREFIX}binutils-crosssdk virtual/nativesdk-${TARGET_PREFIX}libc-for-gcc gettext-native"
+PROVIDES = "virtual/${TARGET_PREFIX}gcc-crosssdk virtual/${TARGET_PREFIX}g++-crosssdk"
diff --git a/meta-tizen/recipes-Development/gcc/gcc-crosssdk_git.bb b/meta-tizen/recipes-Development/gcc/gcc-crosssdk_git.bb
new file mode 100644 (file)
index 0000000..3bba271
--- /dev/null
@@ -0,0 +1,2 @@
+require recipes-Development/gcc/gcc-cross_${PV}.bb
+require gcc-crosssdk.inc
diff --git a/meta-tizen/recipes-Development/gcc/gcc-extraconf.inc b/meta-tizen/recipes-Development/gcc/gcc-extraconf.inc
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/meta-tizen/recipes-Development/gcc/gcc-git.inc b/meta-tizen/recipes-Development/gcc/gcc-git.inc
new file mode 100644 (file)
index 0000000..da4eaa7
--- /dev/null
@@ -0,0 +1,94 @@
+require gcc-common.inc
+
+# Third digit in PV should be incremented after a minor release
+# happens from this branch on gcc e.g. currently its 4.7.1
+# when 4.7.2 is releases and we bump SRCREV beyond the release
+# on branch then PV should be incremented to 4.7.2+svnr${SRCPV}
+# to reflect that change
+
+PV = "4.7.2"
+
+# BINV should be incremented after updating to a revision
+# after a minor gcc release (e.g. 4.7.1 or 4.7.2) has been made
+# the value will be minor-release+1 e.g. if current minor release was
+# 4.7.1 then the value below will have 2 which will mean 4.7.2
+# which will be next minor release and so on.
+
+BINV = "4.7.2"
+
+FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/gcc-git' ], d)}"
+
+DEPENDS =+ "mpfr gmp libmpc zlib"
+NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
+
+LICENSE="GPL-3.0-with-GCC-exception & GPLv3"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
+                   file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
+                   file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
+                   file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
+                  file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8"
+
+SRC_URI = "git://tz.otcshare.org/profile/base/glibc.git;protocol=ssh;tag=master"
+
+S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
+B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
+
+# Language Overrides
+FORTRAN = ""
+JAVA = ""
+
+EXTRA_OECONF_BASE = " --enable-lto \
+                       --enable-libssp \
+                       --disable-bootstrap \
+                       --disable-libmudflap \
+                       --with-system-zlib \
+                       --with-linker-hash-style=${LINKER_HASH_STYLE} \
+                       --enable-linker-build-id \
+                       --with-ppl=no \
+                       --with-cloog=no \
+                       --enable-checking=release \
+                       --enable-cheaders=c_global "
+
+EXTRA_OECONF_INITIAL = "--disable-libmudflap \
+                       --disable-libgomp \
+                       --disable-libssp \
+                       --disable-libquadmath \
+                       --with-system-zlib \
+                       --disable-lto \
+                       --disable-plugin \
+                       --enable-decimal-float=no"
+
+EXTRA_OECONF_INTERMEDIATE = "--disable-libmudflap \
+                               --disable-libgomp \
+                               --disable-libquadmath \
+                               --with-system-zlib \
+                               --disable-lto \
+                               --disable-plugin \
+                               --disable-libssp"
+
+EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float "
+
+EXTRA_OECONF_PATHS = " \ 
+                      --with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++ \ 
+                      --with-sysroot=${STAGING_DIR_TARGET} \ 
+                      --with-build-sysroot=${STAGING_DIR_TARGET}"
+
+do_configure_prepend () {
+        # teach gcc to find correct target includedir when checking libc ssp support
+        mkdir -p ${B}/gcc
+        echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
+        cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
+        cat >>${B}/gcc/defaults.h.new <<_EOF
+#ifndef STANDARD_STARTFILE_PREFIX_1
+#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX_2
+#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
+#endif
+#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
+#endif /* ! GCC_DEFAULTS_H */
+_EOF
+        mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
+}
+
diff --git a/meta-tizen/recipes-Development/gcc/gcc-multilib-config.inc b/meta-tizen/recipes-Development/gcc/gcc-multilib-config.inc
new file mode 100644 (file)
index 0000000..f89aa8e
--- /dev/null
@@ -0,0 +1,191 @@
+# following code modifies these definitions in the gcc config
+#    MULTILIB_OPTIONS
+#    MULTILIB_DIRNAMES
+#    MULTILIB_OSDIRNAMES
+#    GLIBC_DYNAMIC_LINKER32
+#    GLIBC_DYNAMIC_LINKER64
+#    GLIBC_DYNAMIC_LINKERX32
+#    GLIBC_DYNAMIC_LINKERN32
+#  For more information on use of these variables look at these files in the gcc source code
+#    gcc/config/i386/t-linux64
+#    gcc/config/mips/t-linux64
+#    gcc/config/rs6000/t-linux64
+#    gcc/config/i386/linux64.h
+#    gcc/config/mips/linux64.h
+#    gcc/config/rs6000/linux64.h
+
+python gcc_multilib_setup() {
+    import re
+    import shutil
+    import glob
+
+    srcdir = d.getVar('S', True)
+    builddir = d.getVar('B', True)
+    src_conf_dir = '%s/gcc/config' % srcdir
+    build_conf_dir = '%s/gcc/config' % builddir
+
+    bb.utils.remove(build_conf_dir, True)
+    ml_globs = ('%s/*/t-linux64' % src_conf_dir,
+                '%s/*/linux64.h' % src_conf_dir)
+
+    # copy the target multilib config files to ${B}
+    for ml_glob in ml_globs:
+        for fn in glob.glob(ml_glob):
+            rel_path = os.path.relpath(fn, src_conf_dir)
+            parent_dir = os.path.dirname(rel_path)
+            bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir))
+            bb.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path))
+
+    multilibs = (d.getVar('MULTILIB_VARIANTS', True) or '').split()
+    if not multilibs:
+        return
+
+    mlprefix = d.getVar('MLPREFIX', True)
+    pn = d.getVar('PN', True)
+    if ('%sgcc' % mlprefix) != pn and (not pn.startswith('gcc-cross-canadian')):
+        return
+
+
+    def write_config(root, files, options, dirnames, osdirnames):
+        for ml_conf_file in files:
+            with open(root + '/' + ml_conf_file, 'r') as f:
+                filelines = f.readlines()
+                # recreate multilib configuration variables
+                substs = [
+                    (r'^(\s*(MULTILIB_OPTIONS\s*=).*)$', r'\2 %s' % '/'.join(options)),
+                    (r'^(\s*MULTILIB_OPTIONS\s*\+=.*)$', ''),
+                    (r'^(\s*(MULTILIB_DIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(dirnames)),
+                    (r'^(\s*MULTILIB_DIRNAMES\s*\+=.*)$', ''),
+                    (r'^(\s*(MULTILIB_OSDIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(osdirnames)),
+                    (r'^(\s*MULTILIB_OSDIRNAMES\s*\+=.*)$', ''),
+                ]
+
+                for (i, line) in enumerate(filelines):
+                    for subst in substs:
+                        line = re.sub(subst[0], subst[1], line)
+                    filelines[i] = line
+
+                with open(root + '/' + ml_conf_file, 'w') as f:
+                    f.write(''.join(filelines))
+
+    def write_headers(root, files, libdir32, libdir64, libdirx32, libdirn32):
+        def wrap_libdir(libdir):
+            if libdir.find('SYSTEMLIBS_DIR') != -1:
+                return libdir
+            else:
+                return '"/%s/"' % libdir
+
+        for ml_conf_file in files:
+            with open(root + '/' + ml_conf_file, 'r') as f:
+                filelines = f.readlines()
+
+                # replace lines like
+                # #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
+                # by
+                # #define GLIBC_DYNAMIC_LINKER32 "/lib/" "ld-linux.so.2"
+                # this is needed to put the correct dynamic loader path in the generated binaries
+                substs = [
+                    (r'^(#define\s*GLIBC_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
+                        r'\1' + wrap_libdir(libdir32) + r'\3'),
+                    (r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$',
+                        r'\1' + wrap_libdir(libdir64) + r'\3'),
+                    (r'^(#define\s*GLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
+                        r'\1' + wrap_libdir(libdirx32) + r'\3'),
+                    (r'^(#define\s*GLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$',
+                        r'\1' + wrap_libdir(libdirn32) + r'\3'),
+                ]
+
+                for (i, line) in enumerate(filelines):
+                    for subst in substs:
+                        line = re.sub(subst[0], subst[1], line)
+                    filelines[i] = line
+
+                with open(root + '/' + ml_conf_file, 'w') as f:
+                    f.write(''.join(filelines))
+
+
+    gcc_target_config_files = {
+        'x86_64'    : ['gcc/config/i386/t-linux64'],
+        'i586'      : ['gcc/config/i386/t-linux64'],
+        'mips'      : ['gcc/config/mips/t-linux64'],
+        'powerpc'   : ['gcc/config/rs6000/t-linux64'],
+    }
+
+    gcc_header_config_files = {
+        'x86_64'    : ['gcc/config/i386/linux64.h'],
+        'i586'      : ['gcc/config/i386/linux64.h'],
+        'mips'      : ['gcc/config/mips/linux64.h'],
+        'powerpc'   : ['gcc/config/rs6000/linux64.h'],
+    }
+
+    target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL', True) if mlprefix
+                    else d.getVar('TARGET_ARCH', True))
+    if target_arch not in gcc_target_config_files:
+        bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch)
+        return
+
+    libdir32 = 'SYSTEMLIBS_DIR'
+    libdir64 = 'SYSTEMLIBS_DIR'
+    libdirx32 = 'SYSTEMLIBS_DIR'
+    libdirn32 = 'SYSTEMLIBS_DIR'
+
+    target_config_files = gcc_target_config_files[target_arch]
+    header_config_files = gcc_header_config_files[target_arch]
+
+    ml_list = ['DEFAULTTUNE_MULTILIB_ORIGINAL' if mlprefix else 'DEFAULTTUNE']
+    mltunes = [('DEFAULTTUNE_virtclass-multilib-%s' % ml) for ml in multilibs]
+    if mlprefix:
+        mlindex = 0
+        for ml in multilibs:
+            if mlprefix.startswith(ml):
+                break
+            mlindex += 1
+
+        ml_list.extend(mltunes[:mlindex] + ['DEFAULTTUNE'] + mltunes[(mlindex + 1):])
+    else:
+        ml_list.extend(mltunes)
+
+    options = []
+    dirnames = []
+    osdirnames = []
+
+    for ml in ml_list:
+        tune = d.getVar(ml, True)
+        if not tune:
+            bb.warn("%s doesn't have a corresponding tune. Skipping..." % ml)
+            continue
+        tune_parameters = get_tune_parameters(tune, d)
+
+        tune_baselib = tune_parameters['baselib']
+        if not tune_baselib:
+            bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
+            continue
+
+        if tune_baselib == 'lib64':
+            libdir64 = tune_baselib
+        elif tune_baselib == 'libx32':
+            libdirx32 = tune_baselib
+        elif tune_baselib == 'lib32':
+            libdirn32 = tune_baselib
+        elif tune_baselib == 'lib':
+            libdir32 = tune_baselib
+        else:
+            bb.error('Unknown libdir (%s) of the tune : %s' % (tune_baselib, tune))
+
+        # take out '-' and march='s from parameters
+        options.append(re.sub(r'march=[^ ]+ *', '',
+                            re.sub(r' +\-+', ' ',
+                                re.sub(r'^ *\-+', '', tune_parameters['ccargs']))))
+        if tune_baselib == 'lib':
+            dirnames.append('32')  # /lib => 32bit lib
+        else:
+            dirnames.append(tune_baselib.replace('lib', ''))
+        osdirnames.append('../' + tune_baselib)
+
+    write_config(builddir, target_config_files, options, dirnames, osdirnames)
+    write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32)
+}
+
+gcc_multilib_setup[cleandirs] = "${B}/gcc/config"
+
+EXTRACONFFUNCS += "gcc_multilib_setup"
diff --git a/meta-tizen/recipes-Development/gcc/gcc-package-cross.inc b/meta-tizen/recipes-Development/gcc/gcc-package-cross.inc
new file mode 100644 (file)
index 0000000..3d81677
--- /dev/null
@@ -0,0 +1,48 @@
+INHIBIT_PACKAGE_STRIP = "1"
+
+# Compute how to get from libexecdir to bindir in python (easier than shell)
+BINRELPATH = "${@oe.path.relative(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${STAGING_DIR_NATIVE}${prefix_native}/bin/${MULTIMACH_TARGET_SYS}"))}"
+
+do_install () {
+       oe_runmake 'DESTDIR=${D}' install-host
+
+       install -d ${D}${target_base_libdir}
+       install -d ${D}${target_libdir}
+    
+       # Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77
+       # gfortran is fully backwards compatible. This is a safe and practical solution. 
+       ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true
+
+       
+       # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
+       # found. These need to be relative paths so they work in different locations.
+       dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
+       install -d $dest
+       for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
+               ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
+               ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t
+       done
+
+       # Remove things we don't need but keep share/java
+       for d in info man share/doc share/locale share/man share/info; do
+               rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/$d
+       done
+
+       # We use libiberty from binutils
+       find ${D}${exec_prefix}/lib -name libiberty.a | xargs rm -f
+       find ${D}${exec_prefix}/lib -name libiberty.h | xargs rm -f
+
+       # gcc-runtime installs libgcc into a special location in staging since it breaks doing a standalone build
+       case ${PN} in
+               *gcc-cross|*gcc-crosssdk)
+                       dest=${D}/${includedir}/gcc-build-internal-${MULTIMACH_TARGET_SYS}
+                       cp -fpPR . $dest
+               ;;
+       esac
+}
+
+do_package[noexec] = "1"
+do_packagedata[noexec] = "1"
+do_package_write_ipk[noexec] = "1"
+do_package_write_rpm[noexec] = "1"
+do_package_write_deb[noexec] = "1"
diff --git a/meta-tizen/recipes-Development/gcc/gcc-package-runtime.inc b/meta-tizen/recipes-Development/gcc/gcc-package-runtime.inc
new file mode 100644 (file)
index 0000000..2e2f75a
--- /dev/null
@@ -0,0 +1,80 @@
+PACKAGES = "\
+  ${PN}-dbg \
+  libstdc++ \
+  libstdc++-precompile-dev \
+  libstdc++-dev \
+  libstdc++-staticdev \
+  libg2c \
+  libg2c-dev \
+  libssp \
+  libssp-dev \
+  libssp-staticdev \
+  libgfortran \
+  libgfortran-dev \
+  libmudflap \
+  libmudflap-dev \
+  libgomp \
+  libgomp-dev \
+  libgomp-staticdev \
+"
+# The base package doesn't exist, so we clear the recommends.
+RRECOMMENDS_${PN}-dbg = ""
+
+# include python debugging scripts
+FILES_${PN}-dbg += "\
+  ${libdir}/libstdc++.so.*-gdb.py \
+  ${datadir}/gcc-${BINV}/python/libstdcxx"
+
+FILES_libg2c = "${target_libdir}/libg2c.so.*"
+FILES_libg2c-dev = "\
+  ${libdir}/libg2c.so \
+  ${libdir}/libg2c.a \
+  ${libdir}/libfrtbegin.a"
+
+FILES_libstdc++ = "${libdir}/libstdc++.so.*"
+FILES_libstdc++-dev = "\
+  ${includedir}/c++/ \
+  ${libdir}/libstdc++.so \
+  ${libdir}/libstdc++.la \
+  ${libdir}/libsupc++.la"
+FILES_libstdc++-staticdev = "\
+  ${libdir}/libstdc++.a \
+  ${libdir}/libsupc++.a"
+
+FILES_libstdc++-precompile-dev = "${includedir}/c++/${TARGET_SYS}/bits/*.gch"
+
+FILES_libssp = "${libdir}/libssp.so.*"
+FILES_libssp-dev = " \
+  ${libdir}/libssp*.so \
+  ${libdir}/libssp*_nonshared.a \
+  ${libdir}/libssp*.la \
+  ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ssp"
+FILES_libssp-staticdev = " \
+  ${libdir}/libssp*.a"
+
+FILES_libgfortran = "${libdir}/libgfortran.so.*"
+FILES_libgfortran-dev = " \
+  ${libdir}/libgfortran.a \
+  ${libdir}/libgfortran.so \
+  ${libdir}/libgfortranbegin.a"
+
+FILES_libmudflap = "${libdir}/libmudflap*.so.*"
+FILES_libmudflap-dev = "\
+  ${libdir}/libmudflap*.so \
+  ${libdir}/libmudflap*.a \
+  ${libdir}/libmudflap*.la"
+
+FILES_libgomp = "${libdir}/libgomp*${SOLIBS}"
+FILES_libgomp-dev = "\
+  ${libdir}/libgomp*${SOLIBSDEV} \
+  ${libdir}/libgomp*.la \
+  ${libdir}/libgomp.spec \
+  ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/omp.h \
+  "
+FILES_libgomp-staticdev = "\
+  ${libdir}/libgomp*.a \
+  "
+
+do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
+do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
+do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
diff --git a/meta-tizen/recipes-Development/gcc/gcc-package-sdk.inc b/meta-tizen/recipes-Development/gcc/gcc-package-sdk.inc
new file mode 100644 (file)
index 0000000..f32e95f
--- /dev/null
@@ -0,0 +1,68 @@
+INHIBIT_PACKAGE_STRIP = "1"
+
+# Having anything auto depending on gcc-cross-sdk is a really bad idea...
+EXCLUDE_FROM_SHLIBS = "1"
+
+PACKAGES = "${PN} ${PN}-doc"
+
+FILES_${PN} = "\
+    ${bindir}/* \
+    ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/* \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/lib* \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.* \
+    ${includedir}/c++/${BINV} \
+    ${prefix}/${TARGET_SYS}/bin/* \
+    ${prefix}/${TARGET_SYS}/lib/* \
+    ${prefix}/${TARGET_SYS}/usr/include/* \
+    "
+INSANE_SKIP_${PN} += "dev-so"
+
+FILES_${PN}-doc = "\
+    ${infodir} \
+    ${mandir} \
+    ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
+    "
+
+do_install () {
+       oe_runmake 'DESTDIR=${D}' install-host
+
+       # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
+       rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
+       rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
+
+       # We care about g++ not c++
+       rm -f ${D}${bindir}/*c++
+
+       # We don't care about the gcc-<version> copies
+       rm -f ${D}${bindir}/*gcc-?.?*
+
+       # We use libiberty from binutils
+       rm -f ${D}${prefix}/${TARGET_SYS}/lib/libiberty.a
+       # Not sure where the strange paths come from
+       rm -f ${D}${libdir}/../lib/libiberty.a
+       rm -f ${D}${libdir}/libiberty.a
+
+       # Cleanup empty directories which are not shipped
+       # we use rmdir instead of 'rm -f' to ensure the non empty directories are not deleted
+       # ${D}${libdir}/../lib only seems to appear with SDKMACHINE=i686
+       local empty_dirs="${D}${libdir}/../lib ${D}${prefix}/${TARGET_SYS}/lib ${D}${prefix}/${TARGET_SYS} ${D}${includedir}"
+       for i in $empty_dirs; do
+               [ -d $i ] && rmdir --ignore-fail-on-non-empty $i
+       done
+
+       # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
+       # found.
+       dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
+       install -d $dest
+       for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
+               ln -sf ${bindir}/${TARGET_PREFIX}$t $dest$t
+       done
+
+       chown -R root:root ${D}
+}
+
diff --git a/meta-tizen/recipes-Development/gcc/gcc-package-target.inc b/meta-tizen/recipes-Development/gcc/gcc-package-target.inc
new file mode 100644 (file)
index 0000000..95a92c1
--- /dev/null
@@ -0,0 +1,142 @@
+PACKAGES = "\
+  ${PN} ${PN}-plugins ${PN}-symlinks \
+  g++ g++-symlinks \
+  cpp cpp-symlinks \
+  g77 g77-symlinks \
+  gfortran gfortran-symlinks \
+  gcov gcov-symlinks \
+  ${PN}-plugin-dev \
+  ${PN}-doc \
+  ${PN}-dev \
+  ${PN}-dbg \
+"
+
+FILES_${PN} = "\
+  ${bindir}/${TARGET_PREFIX}gcc* \
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2 \
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc* \
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \
+  ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
+  ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
+  ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
+  ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
+  ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
+"
+INSANE_SKIP_${PN} += "dev-so"
+
+FILES_${PN}-dbg += "\
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/.debug/ \
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/.debug/ \
+"
+FILES_${PN}-dev = "\
+  ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
+"
+FILES_${PN}-plugin-dev = "\
+  ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/gengtype \
+  ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.state \
+"
+FILES_${PN}-symlinks = "\
+  ${bindir}/cc \
+  ${bindir}/gcc \
+  ${bindir}/gccbug \
+"
+
+FILES_${PN}-plugins = "\
+  ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin \
+"
+ALLOW_EMPTY_${PN}-plugins = "1"
+
+FILES_g77 = "\
+  ${bindir}/${TARGET_PREFIX}g77 \
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \
+"
+FILES_g77-symlinks = "\
+  ${bindir}/g77 \
+  ${bindir}/f77 \
+"
+FILES_gfortran = "\
+  ${bindir}/${TARGET_PREFIX}gfortran \
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \
+"
+FILES_gfortran-symlinks = "\
+  ${bindir}/gfortran \
+  ${bindir}/f95"
+
+FILES_cpp = "\
+  ${bindir}/${TARGET_PREFIX}cpp \
+  ${base_libdir}/cpp \
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1"
+FILES_cpp-symlinks = "${bindir}/cpp"
+
+FILES_gcov = "${bindir}/${TARGET_PREFIX}gcov"
+FILES_gcov-symlinks = "${bindir}/gcov"
+
+FILES_g++ = "\
+  ${bindir}/${TARGET_PREFIX}g++ \
+  ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
+"
+FILES_g++-symlinks = "\
+  ${bindir}/c++ \
+  ${bindir}/g++ \
+"
+
+
+FILES_${PN}-doc = "\
+  ${infodir} \
+  ${mandir} \
+  ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
+"
+
+do_install () {
+       oe_runmake 'DESTDIR=${D}' install-host
+
+       # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
+       rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
+       rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
+       rm -rf ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/*.la
+       rmdir ${D}${includedir}
+
+       # Hack around specs file assumptions
+       test -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs && sed -i -e '/^*cross_compile:$/ { n; s/1/0/; }' ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs
+
+       # Cleanup manpages..
+       rm -rf ${D}${mandir}/man7
+
+       cd ${D}${bindir}
+
+       # We care about g++ not c++
+       rm -f *c++
+
+       # We don't care about the gcc-<version> ones for this
+       rm -f *gcc-?.?*
+
+       # We use libiberty from binutils
+       find ${D}${libdir} -name libiberty.a | xargs rm -f
+       find ${D}${libdir} -name libiberty.h | xargs rm -f
+
+       # Not sure why we end up with these but we don't want them...
+       rm -f ${TARGET_PREFIX}${TARGET_PREFIX}*
+
+       # Symlinks so we can use these trivially on the target
+       if [ -e ${TARGET_PREFIX}g77 ]; then
+               ln -sf ${TARGET_PREFIX}g77 g77 || true
+               ln -sf g77 f77 || true
+       fi
+       if [ -e ${TARGET_PREFIX}gfortran ]; then
+               ln -sf ${TARGET_PREFIX}gfortran gfortran || true
+               ln -sf gfortran f95 || true
+       fi
+       ln -sf ${TARGET_PREFIX}g++ g++
+       ln -sf ${TARGET_PREFIX}gcc gcc
+       ln -sf ${TARGET_PREFIX}cpp cpp
+       install -d ${D}${base_libdir}
+       ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp
+       ln -sf g++ c++
+       ln -sf gcc cc
+
+       chown -R root:root ${D}
+}
diff --git a/meta-tizen/recipes-Development/gcc/gcc-runtime_git.bb b/meta-tizen/recipes-Development/gcc/gcc-runtime_git.bb
new file mode 100644 (file)
index 0000000..2d74db5
--- /dev/null
@@ -0,0 +1,8 @@
+require recipes-Development/gcc/gcc-${PV}.inc
+require gcc-configure-runtime.inc
+require gcc-package-runtime.inc
+
+ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
+
+EXTRA_OECONF += "--disable-libunwind-exceptions"
+EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu"
diff --git a/meta-tizen/recipes-Development/gcc/gcc.inc b/meta-tizen/recipes-Development/gcc/gcc.inc
deleted file mode 100644 (file)
index e52ed86..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-DESCRIPTION = "The system GNU C Compiler"
-HOMEPAGE = "http://gcc.gnu.org/"
-SECTION = "Development/Languages/C and C++"
-PRIORITY = ""
-LICENSE = "GPL-3.0+"
-
-PROVIDES = ""
-#PROVIDES by gcc-gij 
-PROVIDES += "gcc-gij"
-RPROVIDES_gcc-gij += "gcc-gij"
-
-#PROVIDES by gcc-gij-32bit 
-PROVIDES += "gcc-gij-32bit"
-RPROVIDES_gcc-gij-32bit += "gcc-gij-32bit"
-
-#PROVIDES by gcc-obj-c++ 
-PROVIDES += "gcc-obj-c++"
-RPROVIDES_gcc-obj-c++ += "gcc-obj-c++"
-
-#PROVIDES by gcc-fortran-32bit 
-PROVIDES += "gcc-fortran-32bit"
-RPROVIDES_gcc-fortran-32bit += "gcc-fortran-32bit"
-
-#PROVIDES by gcc-info 
-PROVIDES += "gcc-info"
-RPROVIDES_gcc-info += "gcc-info"
-
-#PROVIDES by gcc 
-PROVIDES += "gcc"
-RPROVIDES_gcc += "gcc"
-PROVIDES += "c_compiler"
-RPROVIDES_gcc += "c_compiler"
-
-#PROVIDES by libstdc++-devel 
-PROVIDES += "libstdc++-devel"
-RPROVIDES_libstdc++-devel += "libstdc++-devel"
-
-#PROVIDES by gcc-64bit 
-PROVIDES += "gcc-64bit"
-RPROVIDES_gcc-64bit += "gcc-64bit"
-
-#PROVIDES by gcc-locale 
-PROVIDES += "gcc-locale"
-RPROVIDES_gcc-locale += "gcc-locale"
-
-#PROVIDES by gcc-objc-64bit 
-PROVIDES += "gcc-objc-64bit"
-RPROVIDES_gcc-objc-64bit += "gcc-objc-64bit"
-
-#PROVIDES by gcc-c++ 
-PROVIDES += "gcc-c++"
-RPROVIDES_gcc-c++ += "gcc-c++"
-PROVIDES += "c++_compiler"
-RPROVIDES_gcc-c++ += "c++_compiler"
-
-#PROVIDES by gcc-fortran 
-PROVIDES += "gcc-fortran"
-RPROVIDES_gcc-fortran += "gcc-fortran"
-
-#PROVIDES by gcc-c++-64bit 
-PROVIDES += "gcc-c++-64bit"
-RPROVIDES_gcc-c++-64bit += "gcc-c++-64bit"
-
-#PROVIDES by gcc-z9 
-PROVIDES += "gcc-z9"
-RPROVIDES_gcc-z9 += "gcc-z9"
-
-#PROVIDES by gcc-objc-32bit 
-PROVIDES += "gcc-objc-32bit"
-RPROVIDES_gcc-objc-32bit += "gcc-objc-32bit"
-
-#PROVIDES by gcc-java 
-PROVIDES += "gcc-java"
-RPROVIDES_gcc-java += "gcc-java"
-
-#PROVIDES by libgcj-devel 
-PROVIDES += "libgcj-devel"
-RPROVIDES_libgcj-devel += "libgcj-devel"
-
-#PROVIDES by gcc-c++-32bit 
-PROVIDES += "gcc-c++-32bit"
-RPROVIDES_gcc-c++-32bit += "gcc-c++-32bit"
-
-#PROVIDES by gcc-ada 
-PROVIDES += "gcc-ada"
-RPROVIDES_gcc-ada += "gcc-ada"
-
-#PROVIDES by gcc-32bit 
-PROVIDES += "gcc-32bit"
-RPROVIDES_gcc-32bit += "gcc-32bit"
-
-#PROVIDES by gcc-objc 
-PROVIDES += "gcc-objc"
-RPROVIDES_gcc-objc += "gcc-objc"
-
-#PROVIDES by gcc-fortran-64bit 
-PROVIDES += "gcc-fortran-64bit"
-RPROVIDES_gcc-fortran-64bit += "gcc-fortran-64bit"
-
-#PROVIDES by cpp 
-PROVIDES += "cpp"
-RPROVIDES_cpp += "cpp"
-
-#PROVIDES by gcc-gij-64bit 
-PROVIDES += "gcc-gij-64bit"
-RPROVIDES_gcc-gij-64bit += "gcc-gij-64bit"
-
-
-RDEPENDS = ""
-#RDEPENDS of gcc-gij 
-RDEPENDS_gcc-gij += "gcc47-gij"
-
-#RDEPENDS of gcc-gij-32bit 
-RDEPENDS_gcc-gij-32bit += "gcc47-gij-32bit"
-
-#RDEPENDS of gcc-obj-c++ 
-RDEPENDS_gcc-obj-c++ += "gcc47-obj-c++"
-# the RDEPENDS rules is ignore "gcc-objc = 4.7"
-RDEPENDS_gcc-obj-c++ += "gcc-objc"
-
-#RDEPENDS of gcc-fortran-32bit 
-RDEPENDS_gcc-fortran-32bit += "gcc47-fortran-32bit"
-# the RDEPENDS rules is ignore "gcc-fortran = 4.7"
-RDEPENDS_gcc-fortran-32bit += "gcc-fortran"
-
-#RDEPENDS of gcc-info 
-RDEPENDS_gcc-info += "gcc47-info"
-
-#RDEPENDS of gcc 
-RDEPENDS_gcc += "cpp"
-RDEPENDS_gcc += "gcc47"
-
-#RDEPENDS of libstdc++-devel 
-RDEPENDS_libstdc++-devel += "libstdc++47-devel"
-
-#RDEPENDS of gcc-64bit 
-# the RDEPENDS rules is ignore "gcc = 4.7"
-RDEPENDS_gcc-64bit += "gcc"
-RDEPENDS_gcc-64bit += "gcc47-64bit"
-
-#RDEPENDS of gcc-locale 
-RDEPENDS_gcc-locale += "gcc47-locale"
-
-#RDEPENDS of gcc-objc-64bit 
-RDEPENDS_gcc-objc-64bit += "gcc47-objc-64bit"
-# the RDEPENDS rules is ignore "gcc-objc = 4.7"
-RDEPENDS_gcc-objc-64bit += "gcc-objc"
-
-#RDEPENDS of gcc-c++ 
-# the RDEPENDS rules is ignore "gcc = 4.7"
-RDEPENDS_gcc-c++ += "gcc"
-RDEPENDS_gcc-c++ += "gcc47-c++"
-
-#RDEPENDS of gcc-fortran 
-# the RDEPENDS rules is ignore "gcc = 4.7"
-RDEPENDS_gcc-fortran += "gcc"
-RDEPENDS_gcc-fortran += "gcc47-fortran"
-
-#RDEPENDS of gcc-c++-64bit 
-# the RDEPENDS rules is ignore "gcc-64bit = 4.7"
-RDEPENDS_gcc-c++-64bit += "gcc-64bit"
-# the RDEPENDS rules is ignore "gcc-c++ = 4.7"
-RDEPENDS_gcc-c++-64bit += "gcc-c++"
-RDEPENDS_gcc-c++-64bit += "libstdc++47-devel-64bit"
-
-#RDEPENDS of gcc-z9 
-RDEPENDS_gcc-z9 += "gcc"
-
-#RDEPENDS of gcc-objc-32bit 
-RDEPENDS_gcc-objc-32bit += "gcc47-objc-32bit"
-# the RDEPENDS rules is ignore "gcc-objc = 4.7"
-RDEPENDS_gcc-objc-32bit += "gcc-objc"
-
-#RDEPENDS of gcc-java 
-RDEPENDS_gcc-java += "gcc47-java"
-# the RDEPENDS rules is ignore "libgcj-devel = 4.7"
-RDEPENDS_gcc-java += "libgcj-devel"
-# the RDEPENDS rules is ignore "gcc = 4.7"
-RDEPENDS_gcc-java += "gcc"
-
-#RDEPENDS of libgcj-devel 
-RDEPENDS_libgcj-devel += "libgcj47-devel"
-
-#RDEPENDS of gcc-c++-32bit 
-# the RDEPENDS rules is ignore "gcc-32bit = 4.7"
-RDEPENDS_gcc-c++-32bit += "gcc-32bit"
-# the RDEPENDS rules is ignore "gcc-c++ = 4.7"
-RDEPENDS_gcc-c++-32bit += "gcc-c++"
-RDEPENDS_gcc-c++-32bit += "libstdc++47-devel-32bit"
-
-#RDEPENDS of gcc-ada 
-# the RDEPENDS rules is ignore "gcc = 4.7"
-RDEPENDS_gcc-ada += "gcc"
-RDEPENDS_gcc-ada += "gcc47-ada"
-
-#RDEPENDS of gcc-32bit 
-# the RDEPENDS rules is ignore "gcc = 4.7"
-RDEPENDS_gcc-32bit += "gcc"
-RDEPENDS_gcc-32bit += "gcc47-32bit"
-
-#RDEPENDS of gcc-objc 
-# the RDEPENDS rules is ignore "gcc = 4.7"
-RDEPENDS_gcc-objc += "gcc"
-RDEPENDS_gcc-objc += "gcc47-objc"
-
-#RDEPENDS of gcc-fortran-64bit 
-RDEPENDS_gcc-fortran-64bit += "gcc47-fortran-64bit"
-# the RDEPENDS rules is ignore "gcc-fortran = 4.7"
-RDEPENDS_gcc-fortran-64bit += "gcc-fortran"
-
-#RDEPENDS of cpp 
-RDEPENDS_cpp += "cpp47"
-
-#RDEPENDS of gcc-gij-64bit 
-RDEPENDS_gcc-gij-64bit += "gcc47-gij-64bit"
-
-
-PACKAGES = ""
-PACKAGES += "gcc"
-PACKAGES += "libstdc++-devel"
-PACKAGES += "gcc-ada"
-PACKAGES += "gcc-"
-PACKAGES += "gcc-32bit"
-PACKAGES += "gcc-gij"
-PACKAGES += "gcc-objc"
-PACKAGES += "gcc-c++-32bit"
-PACKAGES += "gcc-info"
-PACKAGES += "gcc-obj-c++"
-PACKAGES += "gcc-objc-32bit"
-PACKAGES += "gcc-java"
-PACKAGES += "cpp"
-PACKAGES += "libgcj-devel"
-PACKAGES += "gcc-c++"
-PACKAGES += "gcc-gij-32bit"
-PACKAGES += "gcc-locale"
-
-gccfiles = ""
-
-libstdc++-develfiles = ""
-
-gcc-adafiles = "/usr/bin/gnat /usr/bin/gnatbind /usr/bin/gnatbl /usr/bin/gnatchop /usr/bin/gnatclean /usr/bin/gnatfind /usr/bin/gnatkr /usr/bin/gnatlink /usr/bin/gnatls /usr/bin/gnatmake /usr/bin/gnatname /usr/bin/gnatprep /usr/bin/gnatxref /usr/bin/gprmake "
-
-gcc-files = "/usr/bin/gcc /usr/bin/cc /usr/bin/gcov "
-
-gcc-32bitfiles = ""
-
-gcc-gijfiles = "/usr/bin/gij /usr/bin/gappletviewer /usr/bin/gjar /usr/bin/gjarsigner /usr/bin/gjavah /usr/bin/gkeytool /usr/bin/gnative2ascii /usr/bin/gorbd /usr/bin/grmic /usr/bin/grmid /usr/bin/grmiregistry /usr/bin/gserialver /usr/bin/gtnameserv "
-
-gcc-objcfiles = ""
-
-gcc-c++-32bitfiles = ""
-
-gcc-infofiles = ""
-
-gcc-obj-c++files = ""
-
-gcc-objc-32bitfiles = ""
-
-gcc-javafiles = "/usr/bin/gcj /usr/bin/gcjh /usr/bin/gcj-dbtool /usr/bin/jcf-dump /usr/bin/jv-convert /usr/bin/gc-analyze "
-
-cppfiles = "/lib/cpp /usr/bin/cpp "
-
-libgcj-develfiles = " "
-
-gcc-c++files = "/usr/bin/g++ /usr/bin/c++ "
-
-gcc-gij-32bitfiles = "/usr/bin/gij32 /usr/bin/grmiregistry32   "
-
-gcc-localefiles = ""
-
-FILES_gcc = "${gccfiles}"
-FILES_libstdc++-devel = "${libstdc++-develfiles}"
-FILES_gcc-ada = "${gcc-adafiles}"
-FILES_gcc- = "${gcc-files}"
-FILES_gcc-32bit = "${gcc-32bitfiles}"
-FILES_gcc-gij = "${gcc-gijfiles}"
-FILES_gcc-objc = "${gcc-objcfiles}"
-FILES_gcc-c++-32bit = "${gcc-c++-32bitfiles}"
-FILES_gcc-info = "${gcc-infofiles}"
-FILES_gcc-obj-c++ = "${gcc-obj-c++files}"
-FILES_gcc-objc-32bit = "${gcc-objc-32bitfiles}"
-FILES_gcc-java = "${gcc-javafiles}"
-FILES_cpp = "${cppfiles}"
-FILES_libgcj-devel = "${libgcj-develfiles}"
-FILES_gcc-c++ = "${gcc-c++files}"
-FILES_gcc-gij-32bit = "${gcc-gij-32bitfiles}"
-FILES_gcc-locale = "${gcc-localefiles}"
-
-SPECFILES = "packaging/gcc.spec"
-
-BBCLASSEXTEND =+ "native"
-
-require recipes-BaseSystem/tizenBuildUtils/tizenBuildUtils.inc
-
-require gcc-depends.inc
-require gcc-extraconf.inc
index 513fcfb..e4fb9e2 100644 (file)
@@ -1,5 +1,5 @@
-require gcc.inc
+require recipes-Development/gcc/gcc-${PV}.inc
+require gcc-configure-target.inc
+require gcc-package-target.inc
 
-S = "${WORKDIR}/git"
-
-SRC_URI = "git://tz.otcshare.org/profile/base/gcc.git;protocol=ssh;tag=master"
+ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}"
diff --git a/meta-tizen/recipes-Development/gcc/libgcc_git.bb b/meta-tizen/recipes-Development/gcc/libgcc_git.bb
new file mode 100644 (file)
index 0000000..c2f2b33
--- /dev/null
@@ -0,0 +1,145 @@
+require recipes-Development/gcc/gcc-${PV}.inc
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
+
+PACKAGES = "\
+  ${PN} \
+  ${PN}-dev \
+  ${PN}-dbg \
+  libgcov-dev \
+  "
+
+FILES_${PN} = "${base_libdir}/libgcc*.so.*"
+FILES_${PN}-dev = " \
+  ${base_libdir}/libgcc*.so \
+  ${libdir}/${TARGET_SYS}/${BINV}/*crt* \
+  ${libdir}/${TARGET_SYS}/${BINV}/64 \
+  ${libdir}/${TARGET_SYS}/${BINV}/32 \
+  ${libdir}/${TARGET_SYS}/${BINV}/x32 \
+  ${libdir}/${TARGET_SYS}/${BINV}/n32 \
+  ${libdir}/${TARGET_SYS}/${BINV}/libgcc*"
+FILES_libgcov-dev = " \
+  ${libdir}/${TARGET_SYS}/${BINV}/libgcov.a \
+  "
+FILES_${PN}-dbg += "${base_libdir}/.debug/"
+
+do_configure () {
+       target=`echo ${MULTIMACH_TARGET_SYS} | sed -e s#-nativesdk##`
+       install -d ${D}${base_libdir} ${D}${libdir}
+       cp -fpPR ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$target/* ${B}
+       mkdir -p ${B}/${BPN}
+       cd ${B}/${BPN}
+       chmod a+x ${S}/${BPN}/configure
+       ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
+}
+
+do_compile () {
+       target=`echo ${TARGET_SYS} | sed -e s#-nativesdk##`
+       cd ${B}/${BPN}
+       oe_runmake MULTIBUILDTOP=${B}/$target/${BPN}/
+}
+
+do_install () {
+       target=`echo ${TARGET_SYS} | sed -e s#-nativesdk##`
+       cd ${B}/${BPN}
+       oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/${BPN}/ install
+
+       # Move libgcc_s into /lib
+       mkdir -p ${D}${base_libdir}
+       if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
+               mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
+       else
+               mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
+       fi
+
+       # install the runtime in /usr/lib/ not in /usr/lib/gcc on target
+       # so that cross-gcc can find it in the sysroot
+
+       mv ${D}${libdir}/gcc/* ${D}${libdir}
+       rm -rf ${D}${libdir}/gcc/
+       # unwind.h is installed here which is shipped in gcc-cross
+       # as well as target gcc and they are identical so we dont
+       # ship one with libgcc here
+       rm -rf ${D}${libdir}/${TARGET_SYS}/${BINV}/include
+}
+
+do_package[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
+do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
+do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
+do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
+
+BBCLASSEXTEND = "nativesdk"
+
+INSANE_SKIP_${PN}-dev = "staticdev"
+INSANE_SKIP_${MLPREFIX}libgcov-dev = "staticdev"
+
+addtask multilib_install after do_install before do_package do_populate_sysroot
+# this makes multilib gcc files findable for target gcc
+# e.g.
+#    /usr/lib/i586-pokymllib32-linux/4.7/
+# by creating this symlink to it
+#    /usr/lib64/x86_64-poky-linux/4.7/32
+
+python do_multilib_install() {
+    import re
+
+    multilibs = d.getVar('MULTILIB_VARIANTS', True)
+    if not multilibs or bb.data.inherits_class('nativesdk', d):
+        return
+
+    binv = d.getVar('BINV', True)
+
+    mlprefix = d.getVar('MLPREFIX', True)
+    if ('%slibgcc' % mlprefix) != d.getVar('PN', True):
+        return
+
+    if mlprefix:
+        orig_tune = d.getVar('DEFAULTTUNE_MULTILIB_ORIGINAL', True)
+        orig_tune_params = get_tune_parameters(orig_tune, d)
+        orig_tune_baselib = orig_tune_params['baselib']
+        orig_tune_bitness = orig_tune_baselib.replace('lib', '')
+        if not orig_tune_bitness:
+            orig_tune_bitness = '32'
+
+        src = '../../../' + orig_tune_baselib + '/' + \
+            d.getVar('TARGET_SYS_MULTILIB_ORIGINAL', True) + '/' + binv + '/'
+
+        dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \
+            d.getVar('TARGET_SYS', True) + '/' + binv + '/' + orig_tune_bitness
+
+        if os.path.lexists(dest):
+            os.unlink(dest)
+        os.symlink(src, dest)
+        return
+
+
+    for ml in multilibs.split():
+        tune = d.getVar('DEFAULTTUNE_virtclass-multilib-' + ml, True)
+        if not tune:
+            bb.warn('DEFAULTTUNE_virtclass-multilib-%s is not defined. Skipping...' % ml)
+            continue
+
+        tune_parameters = get_tune_parameters(tune, d)
+        tune_baselib = tune_parameters['baselib']
+        if not tune_baselib:
+            bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
+            continue
+
+        tune_arch = tune_parameters['arch']
+        tune_bitness = tune_baselib.replace('lib', '')
+        if not tune_bitness:
+            tune_bitness = '32' # /lib => 32bit lib
+
+        src = '../../../' + tune_baselib + '/' + \
+            tune_arch + d.getVar('TARGET_VENDOR', True) + 'ml' + ml + \
+            '-' + d.getVar('TARGET_OS', True) + '/' + binv + '/'
+
+        dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \
+            d.getVar('TARGET_SYS', True) + '/' + binv + '/' + tune_bitness
+
+        if os.path.lexists(dest):
+            os.unlink(dest)
+        os.symlink(src, dest)
+}