diff options
| author | Tom Rini <trini@embeddedalley.com> | 2009-01-27 18:03:07 -0500 |
|---|---|---|
| committer | Tom Rini <trini@embeddedalley.com> | 2009-01-27 18:03:07 -0500 |
| commit | 2ae4d66192f2db96bbd79ddcc33e6aac7c1bd960 (patch) | |
| tree | 11a2c7c90703d8034d755297e156b420c075c8e7 /packages | |
| parent | ffee230ed0b6c49ef4a0b23bc850b843c429f19a (diff) | |
| parent | 04c9615b938eaabfbadc99c1707eb44657c95a61 (diff) | |
Merge trini/canadian-merge branch into org.openembedded.dev, fixup a
conflict on checksums.ini
Diffstat (limited to 'packages')
33 files changed, 1200 insertions, 3 deletions
diff --git a/packages/binutils/binutils-canadian-cross.inc b/packages/binutils/binutils-canadian-cross.inc new file mode 100644 index 0000000000..244c69ff8b --- /dev/null +++ b/packages/binutils/binutils-canadian-cross.inc @@ -0,0 +1,25 @@ +SECTION = "devel" +inherit canadian-cross +DEPENDS += "flex-native bison-native" +PROVIDES = "virtual/${TARGET_PREFIX}binutils" +PACKAGES = "" +EXTRA_OECONF = "--with-sysroot=${STAGING_DIR_HOST} \ + --program-prefix=${TARGET_PREFIX} \ + --enable-install-libbfd \ + --disable-werror" + +do_stage () { + # ugly hack introduce to link our staging area up + mkdir -p ${exec_prefix}/${SDK_SYS} + ln -s ${STAGING_INCDIR} ${exec_prefix}/${SDK_SYS}/include + ln -s ${STAGING_LIBDIR} ${exec_prefix}/${SDK_SYS}/lib + + oe_runmake install + + # We don't really need these, so we'll remove them... + rm -rf ${exec_prefix}/${SDK_SYS}/lib/ldscripts +} + +do_install () { + : +} diff --git a/packages/binutils/binutils-canadian-sdk_2.18.bb b/packages/binutils/binutils-canadian-sdk_2.18.bb new file mode 100644 index 0000000000..cf27cd06f8 --- /dev/null +++ b/packages/binutils/binutils-canadian-sdk_2.18.bb @@ -0,0 +1,29 @@ +SECTION = "devel" +require binutils_${PV}.bb +inherit canadian-sdk + +DEPENDS="\ + virtual/${HOST_PREFIX}binutils \ + virtual/${HOST_PREFIX}gcc \ + flex-native bison-native \ +" + +FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/binutils-${PV}" +EXTRA_OECONF = "--with-sysroot=${prefix}/${TARGET_SYS} \ + --program-prefix=${TARGET_PREFIX}" +PR = "r3" + +FILES_${PN}-dbg += "${prefix}/${TARGET_SYS}/bin/.debug" + +do_stage() { + : +} + +do_install () { + autotools_do_install + + # Install the libiberty header + install -d ${D}${includedir} + install -m 644 ${S}/include/ansidecl.h ${D}${includedir} + install -m 644 ${S}/include/libiberty.h ${D}${includedir} +} diff --git a/packages/binutils/mingw-binutils_2.17.50-20060824-1.bb b/packages/binutils/mingw-binutils_2.17.50-20060824-1.bb new file mode 100644 index 0000000000..9d17873270 --- /dev/null +++ b/packages/binutils/mingw-binutils_2.17.50-20060824-1.bb @@ -0,0 +1,12 @@ +PR = "r1" + +require binutils.inc + +DESCRIPTION = "A GNU collection of binary utilities - MinGW port" +HOMEPAGE = "http://www.mingw.org/" + +SRC_URI = "${SOURCEFORGE_MIRROR}/mingw/binutils-${PV}-src.tar.gz" + +S = "${WORKDIR}/binutils-${PV}-src" + +DEFAULT_PREFERENCE = "0" diff --git a/packages/gcc/files/canadian-build-modules-configure.patch b/packages/gcc/files/canadian-build-modules-configure.patch new file mode 100644 index 0000000000..8aede105c5 --- /dev/null +++ b/packages/gcc/files/canadian-build-modules-configure.patch @@ -0,0 +1,22 @@ +diff -urN gcc-4.2.2-orig/gcc/configure gcc-4.2.2/gcc/configure +--- gcc-4.2.2-orig/gcc/configure 2008-08-31 23:10:56.000000000 +0200 ++++ gcc-4.2.2/gcc/configure 2008-08-31 23:03:02.000000000 +0200 +@@ -12716,6 +12716,7 @@ + esac + saved_CFLAGS="${CFLAGS}" + CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ ++ CPP="${CPP_FOR_BUILD}" CPPFLAGS="${CPPFLAGS_FOR_BUILD}" \ + CONFIG_SITE= ${realsrcdir}/configure --cache-file=./other.cache \ + --enable-languages=${enable_languages-all} \ + --target=$target_alias --host=$build_alias --build=$build_alias +diff -urN gcc-4.2.2-orig/gcc/configure.ac gcc-4.2.2/gcc/configure.ac +--- gcc-4.2.2-orig/gcc/configure.ac 2008-08-31 23:10:53.000000000 +0200 ++++ gcc-4.2.2/gcc/configure.ac 2008-08-31 23:03:29.000000000 +0200 +@@ -1490,6 +1490,7 @@ + esac + saved_CFLAGS="${CFLAGS}" + CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ ++ CPP="${CPP_FOR_BUILD}" CPPFLAGS="${CPPFLAGS_FOR_BUILD}" \ + ${realsrcdir}/configure \ + --enable-languages=${enable_languages-all} \ + --target=$target_alias --host=$build_alias --build=$build_alias diff --git a/packages/gcc/files/pr22133-mingw-path-fixup.patch b/packages/gcc/files/pr22133-mingw-path-fixup.patch new file mode 100644 index 0000000000..429e9ffd0c --- /dev/null +++ b/packages/gcc/files/pr22133-mingw-path-fixup.patch @@ -0,0 +1,29 @@ +diff -rupN gcc-4.2.orig/gcc/c-incpath.c gcc-4.2/gcc/c-incpath.c +--- gcc-4.2.orig/gcc/c-incpath.c 2007-09-01 11:28:30.000000000 -0400 ++++ gcc-4.2/gcc/c-incpath.c 2008-08-17 16:56:01.000000000 -0400 +@@ -340,13 +340,18 @@ add_path (char *path, int chain, int cxx + cpp_dir *p; + + #if defined (HAVE_DOS_BASED_FILE_SYSTEM) +- /* Convert all backslashes to slashes. The native CRT stat() +- function does not recognize a directory that ends in a backslash +- (unless it is a drive root dir, such "c:\"). Forward slashes, +- trailing or otherwise, cause no problems for stat(). */ +- char* c; +- for (c = path; *c; c++) +- if (*c == '\\') *c = '/'; ++ /* Remove unnecessary trailing slashes. On some versions of MS ++ Windows, trailing _forward_ slashes cause no problems for stat(). ++ On newer versions, stat() does not recognise a directory that ends ++ in a '\\' or '/', unless it is a drive root dir, such as "c:/", ++ where it is obligatory. */ ++ int pathlen = strlen (path); ++ char* end = path + pathlen - 1; ++ /* Preserve the lead '/' or lead "c:/". */ ++ char* start = path + (pathlen > 2 && path[1] == ':' ? 3 : 1); ++ ++ for (; end > start && IS_DIR_SEPARATOR (*end); end--) ++ *end = 0; + #endif + + p = XNEW (cpp_dir); diff --git a/packages/gcc/files/pr33281-mingw-host-fragment.patch b/packages/gcc/files/pr33281-mingw-host-fragment.patch new file mode 100644 index 0000000000..e16fb4464a --- /dev/null +++ b/packages/gcc/files/pr33281-mingw-host-fragment.patch @@ -0,0 +1,38 @@ +--- + config/mh-mingw | 3 +++ + configure | 1 + + configure.in | 1 + + 3 files changed, 5 insertions(+) + +Index: gcc-4.2.3/config/mh-mingw +=================================================================== +--- /dev/null ++++ gcc-4.2.3/config/mh-mingw +@@ -0,0 +1,3 @@ ++# Add -D__USE_MINGW_ACCESS to enable the built compiler to work on Windows ++# Vista (see PR33281 for details). ++BOOT_CFLAGS += -D__USE_MINGW_ACCESS +Index: gcc-4.2.3/configure.in +=================================================================== +--- gcc-4.2.3.orig/configure.in ++++ gcc-4.2.3/configure.in +@@ -929,6 +929,7 @@ case "${host}" in + host_makefile_frag="config/mh-cygwin" + ;; + *-mingw32*) ++ host_makefile_frag="config/mh-mingw" + ;; + *-interix*) + host_makefile_frag="config/mh-interix" +Index: gcc-4.2.3/configure +=================================================================== +--- gcc-4.2.3.orig/configure ++++ gcc-4.2.3/configure +@@ -1769,6 +1769,7 @@ case "${host}" in + host_makefile_frag="config/mh-cygwin" + ;; + *-mingw32*) ++ host_makefile_frag="config/mh-mingw" + ;; + *-interix*) + host_makefile_frag="config/mh-interix" diff --git a/packages/gcc/files/pr35916-mingw-__USE_MINGW_ACCESS-everywhere.patch b/packages/gcc/files/pr35916-mingw-__USE_MINGW_ACCESS-everywhere.patch new file mode 100644 index 0000000000..faf44c27f9 --- /dev/null +++ b/packages/gcc/files/pr35916-mingw-__USE_MINGW_ACCESS-everywhere.patch @@ -0,0 +1,13 @@ +--- + config/mh-mingw | 1 + + 1 file changed, 1 insertion(+) + +Index: gcc-4.2.3/config/mh-mingw +=================================================================== +--- gcc-4.2.3.orig/config/mh-mingw ++++ gcc-4.2.3/config/mh-mingw +@@ -1,3 +1,4 @@ + # Add -D__USE_MINGW_ACCESS to enable the built compiler to work on Windows + # Vista (see PR33281 for details). + BOOT_CFLAGS += -D__USE_MINGW_ACCESS ++CFLAGS += -D__USE_MINGW_ACCESS diff --git a/packages/gcc/gcc-canadian-cross-initial.inc b/packages/gcc/gcc-canadian-cross-initial.inc new file mode 100644 index 0000000000..99c7a476ef --- /dev/null +++ b/packages/gcc/gcc-canadian-cross-initial.inc @@ -0,0 +1,4 @@ +require gcc-cross-initial.inc + +DEPENDS = "virtual/${TARGET_PREFIX}binutils" +DEPENDS += "virtual/${TARGET_PREFIX}libc-initial" diff --git a/packages/gcc/gcc-canadian-sdk_4.2.4.bb b/packages/gcc/gcc-canadian-sdk_4.2.4.bb new file mode 100644 index 0000000000..03d9ae364a --- /dev/null +++ b/packages/gcc/gcc-canadian-sdk_4.2.4.bb @@ -0,0 +1,31 @@ +inherit canadian-sdk + +PR = "r1" + +FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}" + +PACKAGES = "${PN}" + +require gcc-${PV}.inc + +# Correct gmp / mpfr +DEPENDS = "gmp-canadian mpfr-canadian" + +require gcc-configure-canadian-sdk.inc +require gcc-package-canadian-sdk.inc + +SRC_URI_append = "file://fortran-cross-compile-hack.patch;patch=1 \ + file://pr22133-mingw-path-fixup.patch;patch=1 \ + file://pr33281-mingw-host-fragment.patch;patch=1 \ + file://pr35916-mingw-__USE_MINGW_ACCESS-everywhere.patch;patch=1" + +ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}" + + +SRC_URI_append =+ "\ + file://canadian-build-modules-configure.patch;patch=1 \ +" + +EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \ + --disable-libgomp --disable-libmudflap \ + --with-mpfr=${STAGING_LIBDIR}" diff --git a/packages/gcc/gcc-configure-canadian-sdk.inc b/packages/gcc/gcc-configure-canadian-sdk.inc new file mode 100644 index 0000000000..489cb46371 --- /dev/null +++ b/packages/gcc/gcc-configure-canadian-sdk.inc @@ -0,0 +1,83 @@ +require gcc-configure-common.inc + +USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibc", "no", "", d )}' +USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibcgnueabi", "no", "", d )}' + +ARCH_FLAGS_FOR_TARGET="" + +# Tools for build +export CC_FOR_BUILD="${BUILD_CC}" +export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}" +export CPP_FOR_BUILD="${BUILD_CPP}" +export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}" +export CXX_FOR_BUILD="${BUILD_CXX}" +export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}" +export LD_FOR_BUILD="${BUILD_LD}" +export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}" +export AS_FOR_BUILD="${BUILD_PREFIX}as" +export AR_FOR_BUILD="${BUILD_PREFIX}ar" +export NM_FOR_BUILD="${BUILD_PREFIX}nm" +export RANLIB_FOR_BUILD="${BUILD_PREFIX}ranlib" +export GCJ_FOR_BUILD="${BUILD_PREFIX}gcj" +export GFORTRAN_FOR_BUILD="${BUILD_PREFIX}gfortran" +export DLLTOOL_FOR_BUILD="${BUILD_PREFIX}dlltool" +export WINDRES_FOR_BUILD="${BUILD_PREFIX}windres" + +# Tools for host +#CC +#CFLAGS +#CXX +#CXXFLAGS +#LD +LDFLAGS="" +#AS +#AR +#NM +#RANLIB +#GCJ +#GFORTRAN +export DLLTOOL="${HOST_PREFIX}dlltool" +export WINDRES="${HOST_PREFIX}windres" + +# Tools for target +export CC_FOR_TARGET="${TARGET_CC}" +export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}" +export CXX_FOR_TARGET="${TARGET_CXX}" +export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}" +export LD_FOR_TARGET="${TARGET_LD}" +export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}" +export AS_FOR_TARGET="${TARGET_PREFIX}as" +export AR_FOR_TARGET="${TARGET_PREFIX}ar" +export NM_FOR_TARGET="${TARGET_PREFIX}nm" +export RANLIB_FOR_TARGET="${TARGET_PREFIX}ranlib" +export GCJ_FOR_TARGET="${TARGET_PREFIX}gcj" +export GFORTRAN_FOR_TARGET="${TARGET_PREFIX}gfortran" +export DLLTOOL_FOR_TARGET="${TARGET_PREFIX}dlltool" +export WINDRES_FOR_TARGET="${TARGET_PREFIX}windres" + +EXTRA_OECONF_DEP ?= "" + +SYSROOT = "${WORKDIR}/sysroot" +EXTRA_OECONF += "" +EXTRA_OECONF_PATHS = " \ + --with-local-prefix=$dollar{prefix}/local \ + --with-gxx-include-dir=$dollar{prefix}/${TARGET_SYS}/usr/include/c++/${BINV} \ + --with-build-sysroot=${SYSROOT} \ + --with-sysroot=${SDK_REALPATH}/${TARGET_SYS} \ +" + +do_configure () { + # Work around Hardcoded path assumptions in gcc + mkdir -p ${SYSROOT}/usr + ln -sf ${STAGING_DIR_HOST}${layout_includedir} \ + ${SYSROOT}/usr/include + ln -sf ${STAGING_DIR_HOST}${layout_libdir} \ + ${SYSROOT}/usr/lib + (cd ${S} && gnu-configize) || die "failure running gnu-configize" + (cd ${S}/libstdc++-v3 && autoreconf) + canadian_sdk_runconf +} + +do_compile () { + oe_runmake +} diff --git a/packages/gcc/gcc-package-canadian-sdk.inc b/packages/gcc/gcc-package-canadian-sdk.inc new file mode 100644 index 0000000000..dff53cdd96 --- /dev/null +++ b/packages/gcc/gcc-package-canadian-sdk.inc @@ -0,0 +1,39 @@ +require gcc-package-sdk.inc + +PACKAGES += "libgcc libgcc-dev libgfortran-dev libmudflap libmudflap-dev" + +FILES_libgcc = "${libdir}/libgcc*.so.*" +FILES_libgcc-dev = "${libdir}/libgcc*.so" + +FILES_libstdc++ = "${libdir}/libstdc++.so.*" +FILES_libstdc++-dev = "\ + ${incluedir}/c++/${BINV} \ + ${libdir}/libstdc++.so \ + ${libdir}/libstdc++.la \ + ${libdir}/libstdc++.a \ + ${libdir}/libsupc++.la \ + ${libdir}/libsupc++.a \ +" + +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*.a \ +" + +# Packages emitted by our gcc-cross builds. +# +INHIBIT_PACKAGE_STRIP ?= "" +OLD_INHIBIT_PACKAGE_STRIP := "${INHIBIT_PACKAGE_STRIP}" +INHIBIT_PACKAGE_STRIP = "1" + +python do_package() { + if bb.data.getVar('DEBIAN_NAMES', d, 1): + bb.data.setVar('PKG_libgcc', 'libgcc1', d) + bb.build.exec_func('package_do_package', d) +} diff --git a/packages/gcc/mingw-gcc-3.4.5-20060117-2/includedir.patch b/packages/gcc/mingw-gcc-3.4.5-20060117-2/includedir.patch new file mode 100644 index 0000000000..8836560e7e --- /dev/null +++ b/packages/gcc/mingw-gcc-3.4.5-20060117-2/includedir.patch @@ -0,0 +1,12 @@ +diff -urN gcc-3.4.5-20060117-2-orig/gcc/Makefile.in gcc-3.4.5-20060117-2/gcc/Makefile.in +--- gcc-3.4.5-20060117-2-orig/gcc/Makefile.in 2005-12-12 02:24:01.000000000 +0100 ++++ gcc-3.4.5-20060117-2/gcc/Makefile.in 2008-10-02 16:07:17.000000000 +0200 +@@ -442,7 +442,7 @@ + # Directory to search for site-specific includes. + local_includedir = $(local_prefix)/include + # local_includedir=$(libsubdir)/$(unlibsubdir)/..`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'`/include +-includedir = $(prefix)/include ++includedir = @includedir@ + # where the info files go + infodir = @infodir@ + # Where cpp should go besides $prefix/bin if necessary diff --git a/packages/gcc/mingw-gcc-build.inc b/packages/gcc/mingw-gcc-build.inc new file mode 100644 index 0000000000..4d7440f6d5 --- /dev/null +++ b/packages/gcc/mingw-gcc-build.inc @@ -0,0 +1,43 @@ +gcclibdir ?= "${libdir}/gcc" +S = "${WORKDIR}/gcc-${PV}" +B = "${S}/build.${HOST_SYS}.${TARGET_SYS}" +BINV ?= "${PV}" + +LANGUAGES ?= "c,c++" + +EXTRA_OECONF_DEP ?= "" + +EXTRA_OECONF = "\ + ${@['--enable-clocale=generic', ''][bb.data.getVar('USE_NLS', d, 1) != 'no']} \ + --disable-shared \ + --enable-languages=${LANGUAGES} \ + --enable-threads=win32 \ + --enable-c99 \ + --enable-long-long \ + --disable-maintainer-mode \ + --disable-bootstrap \ + --enable-target-optspace \ + --disable-win32-registry \ + --without-x \ + --program-prefix=${TARGET_PREFIX} \ + ${EXTRA_OECONF_PATHS} \ + ${EXTRA_OECONF_DEP}" + +EXTRA_OECONF_PATHS = " \ + --with-local-prefix=${prefix}/local \ + --with-gxx-include-dir=${includedir}/c++/${BINV}" + +CPP = "" +CPPFLAGS = "" + +do_configure () { + oe_runconf +} + +do_stage_append () { + # Fixup various .la files + sed -i -e "s|installed=yes|installed=no|" -e "s|dependency_libs\s*=\s*.*|dependency_libs='-L${STAGING_DIR_HOST}${layout_libdir} ${LIBGCCS_VAR} -lc -lm '|" ${STAGING_DIR_HOST}${layout_libdir}/libsupc++.la || true + sed -i -e "s|installed=yes|installed=no|" -e "s|dependency_libs\s*=\s*.*|dependency_libs='-L${STAGING_DIR_HOST}${layout_libdir} ${LIBGCCS_VAR} -lc -lm '|" ${STAGING_DIR_HOST}${layout_libdir}/libstdc++.la || true + sed -i -e "s|installed=yes|installed=no|" -e "s|dependency_libs\s*=\s*.*|dependency_libs='-L${STAGING_DIR_HOST}${layout_libdir} ${LIBGCCS_VAR} -lc -lm '|" ${STAGING_DIR_HOST}${layout_libdir}/libg2c.la || true + sed -i -e "s|installed=yes|installed=no|" -e "s|dependency_libs\s*=\s*.*|dependency_libs='-L${STAGING_DIR_HOST}${layout_libdir} ${LIBGCCS_VAR} -lc -lm '|" ${STAGING_DIR_HOST}${layout_libdir}/libobjc.la || true +} diff --git a/packages/gcc/mingw-gcc-canadian-cross-initial_3.4.5-20060117-2.bb b/packages/gcc/mingw-gcc-canadian-cross-initial_3.4.5-20060117-2.bb new file mode 100644 index 0000000000..f5ff761739 --- /dev/null +++ b/packages/gcc/mingw-gcc-canadian-cross-initial_3.4.5-20060117-2.bb @@ -0,0 +1,7 @@ +require mingw-gcc-canadian-cross_${PV}.bb +require gcc-canadian-cross-initial.inc + +SRC_URI = "\ + ${SOURCEFORGE_MIRROR}/mingw/gcc-core-${PV}-src.tar.gz \ + file://includedir.patch;patch=1 \ +" diff --git a/packages/gcc/mingw-gcc-canadian-cross_3.4.5-20060117-2.bb b/packages/gcc/mingw-gcc-canadian-cross_3.4.5-20060117-2.bb new file mode 100644 index 0000000000..2a5d7f45d1 --- /dev/null +++ b/packages/gcc/mingw-gcc-canadian-cross_3.4.5-20060117-2.bb @@ -0,0 +1,26 @@ +PR = "r1" + +require gcc-configure-cross.inc +require mingw-gcc_${PV}.bb + +inherit canadian-cross + +FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/mingw-gcc-${PV}" + +DEPENDS = "\ + virtual/${TARGET_PREFIX}binutils \ + virtual/${TARGET_PREFIX}libc-for-gcc \ +" + +PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" + +do_configure_prepend() { + # ugly hack to come around the hardcoding of + # -isystem ${build_tooldir}/include which ends up pointing at + # $STAGING_DIR_SDK/$SDK_SYS/include + install -d ${STAGING_DIR_SDK}/${SDK_SYS} + ln -sf ${STAGING_DIR_SDK}${layout_includedir} \ + ${STAGING_DIR_SDK}/${SDK_SYS}/include + ln -sf ${STAGING_DIR_SDK}${layout_libdir} \ + ${STAGING_DIR_SDK}/${SDK_SYS}/lib +} diff --git a/packages/gdb/gdb-6.8/gdb-6.8-mingw-3.patch b/packages/gdb/gdb-6.8/gdb-6.8-mingw-3.patch new file mode 100644 index 0000000000..7bfcca7518 --- /dev/null +++ b/packages/gdb/gdb-6.8/gdb-6.8-mingw-3.patch @@ -0,0 +1,425 @@ +diff -urp gdb-6.8_orig/gdb/gdbserver/remote-utils.c gdb-6.8/gdb/gdbserver/remote-utils.c +--- gdb-6.8_orig/gdb/gdbserver/remote-utils.c 2008-01-29 16:51:50.000000000 -0800 ++++ gdb-6.8/gdb/gdbserver/remote-utils.c 2008-04-09 14:04:30.000000000 -0700 +@@ -617,7 +617,12 @@ input_interrupt (int unused) + + cc = read (remote_desc, &c, 1); + ++#ifdef _WIN32_WINNT ++ // its normal in windows for current_inferior to be null. ++ if (cc != 1 || c != '\003' /*|| current_inferior == NULL*/) ++#else + if (cc != 1 || c != '\003' || current_inferior == NULL) ++#endif + { + fprintf (stderr, "input_interrupt, count = %d c = %d ('%c')\n", + cc, c, c); +diff -urp gdb-6.8_orig/gdb/gdbserver/server.c gdb-6.8/gdb/gdbserver/server.c +--- gdb-6.8_orig/gdb/gdbserver/server.c 2008-02-19 13:36:54.000000000 -0800 ++++ gdb-6.8/gdb/gdbserver/server.c 2008-04-23 13:56:51.000000000 -0700 +@@ -29,6 +29,10 @@ + #include <sys/wait.h> + #endif + ++#ifdef _WIN32 ++#include <windows.h> ++#endif ++ + unsigned long cont_thread; + unsigned long general_thread; + unsigned long step_thread; +@@ -268,6 +272,20 @@ monitor_show_help (void) + monitor_output (" Enable general debugging messages\n"); + monitor_output (" set remote-debug <0|1>\n"); + monitor_output (" Enable remote protocol debugging messages\n"); ++#ifdef _WIN32 ++ monitor_output (" get processlist\n"); ++ monitor_output (" List remote processes with names and pid\n"); ++ monitor_output (" get processlistmi\n"); ++ monitor_output (" Process list in an MI-like format\n"); ++#endif ++ monitor_output (" set env <name=value>\n"); ++ monitor_output (" Set environment variable in remote environment\n"); ++ monitor_output (" cd <directory>\n"); ++ monitor_output (" Change current working directory\n"); ++ monitor_output (" pwd\n"); ++ monitor_output (" Print current working directory\n"); ++ monitor_output (" shell <command line>\n"); ++ monitor_output (" Execute command on remote target\n"); + monitor_output (" exit\n"); + monitor_output (" Quit GDBserver\n"); + } +@@ -279,6 +297,47 @@ monitor_show_help (void) + return; \ + } + ++#ifdef _WIN32 ++typedef DWORD (__stdcall *GETPROCESSIMAGEFILENAME)(HANDLE hProcess, LPTSTR lpImageFileName, DWORD nSize); ++typedef BOOL (__stdcall *ENUMPROCESSES)(DWORD* pProcessIds, DWORD cb, DWORD* pBytesReturned); ++ ++# define HAS_DEVICE(P) \ ++((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \ ++&& (P)[1] == ':') ++# define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0) ++# define ISSLASH(C) ((C) == '/' || (C) == '\\') ++ ++char * ++__basename (char const *name) ++{ ++ char const *base = name += FILE_SYSTEM_PREFIX_LEN (name); ++ int all_slashes = 1; ++ char const *p; ++ ++ for (p = name; *p; p++) ++ { ++ if (ISSLASH (*p)) ++ base = p + 1; ++ else ++ all_slashes = 0; ++ } ++ ++ /* If NAME is all slashes, arrange to return `/'. */ ++ if (*base == '\0' && ISSLASH (*name) && all_slashes) ++ --base; ++ ++ /* Make sure the last byte is not a slash. */ ++ //assert (all_slashes || !ISSLASH (*(p - 1))); ++ ++ return (char *) base; ++} ++#endif ++ ++#ifndef _POSIX_PATH_MAX ++#define _POSIX_PATH_MAX 1024 ++#define _POSIX_PATH_MAX_WAS_UNDEFINED ++#endif ++ + /* Handle all of the extended 'q' packets. */ + void + handle_query (char *own_buf, int packet_len, int *new_packet_len_p) +@@ -664,6 +723,158 @@ handle_query (char *own_buf, int packet_ + debug_threads = 1; + monitor_output ("Debug output enabled.\n"); + } ++#ifdef _WIN32 ++ else if (strncmp (mon, "get processlist", 15) == 0) ++ { ++ HINSTANCE lib = LoadLibrary("PSAPI.DLL"); ++ GETPROCESSIMAGEFILENAME imageFilename = (GETPROCESSIMAGEFILENAME)GetProcAddress(lib, "GetProcessImageFileNameA"); ++ ENUMPROCESSES enumProcesses = (ENUMPROCESSES)GetProcAddress(lib, "EnumProcesses"); ++ ++ char* name = (char*)malloc(MAX_PATH); ++ ++ int miMode = (strcmp(mon, "get processlistmi") == 0); ++ ++ DWORD* pids = (DWORD*)malloc(sizeof(DWORD)*1024); ++ memset(pids, 0, sizeof(pids)); ++ DWORD size = 0; ++ ++ if (!enumProcesses(pids, 1024 * sizeof(DWORD), &size)) ++ { ++ free(pids); ++ free(mon); ++ return; ++ } ++ ++ int cnt = 0; ++ int number = size / sizeof(DWORD); ++ ++ char* miOutput = NULL; ++ ++ if (!miMode) ++ monitor_output("Remote process list:\n"); ++ else ++ { ++ miOutput = (char*)malloc((number * 255) * sizeof(char)); ++ strcpy(miOutput, "^done,processlist=["); ++ } ++ ++ for (cnt = 0; cnt < number; cnt++) ++ { ++ HMODULE hProcess = (HMODULE)OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pids[cnt]); ++ strcpy(name, ""); ++ printf(name); ++ ++ imageFilename(hProcess, name, MAX_PATH); ++ ++ if (pids[cnt] > 4 && strcmp(name, "") != 0) ++ { ++ char item[2048] = ""; ++ char tmp[24] = "0"; ++ itoa(pids[cnt], tmp, 10); ++ strcat(item, tmp); ++ strcat(item, "="); ++ strcat(item, __basename(name)); ++ ++ if (!miMode) ++ { ++ strcat(item, "\n"); ++ monitor_output(item); ++ } ++ else ++ { ++ strcat(miOutput, item); ++ strcat(miOutput, ","); ++ } ++ } ++ ++ CloseHandle(hProcess); ++ } ++ ++ if (miMode) ++ { ++ strcat(miOutput, "]\n"); ++ monitor_output(miOutput); ++ free(miOutput); ++ } ++ ++ FreeLibrary(lib); ++ ++ free(pids); ++ free(name); ++ } ++#endif ++ else if (strncmp (mon, "set env ", 8) == 0) ++ { ++ char* envLine = mon + 8; ++ char* envName = strtok(envLine, "= "); ++ char* envValue = strtok(NULL, "= "); ++ if (envName && envValue) ++ { ++#ifdef _WIN32 ++ SetEnvironmentVariable(envName, envValue); ++#else ++ setenv(envName, envValue, 1); ++#endif ++ monitor_output("Target environment variable set ("); ++ monitor_output(envName); ++ monitor_output(" = "); ++ monitor_output(envValue); ++ monitor_output(").\n"); ++ } ++ else ++ monitor_output("Incorrect format for environment variable.\n"); ++ } ++ else if (strncmp (mon, "cd ", 3) == 0) ++ { ++ char* dir = mon + 3; ++ if (strlen(dir) > 0) ++ chdir(dir); ++ } ++ else if (strcmp(mon, "pwd") == 0) ++ { ++ long size = _POSIX_PATH_MAX; ++ char* current_directory = (char*)malloc(size); ++ getcwd(current_directory, size); ++ if (strlen(current_directory) > 0) ++ { ++ monitor_output(current_directory); ++ monitor_output("\n"); ++ } ++ free(current_directory); ++ } ++ else if (strncmp (mon, "shell ", 6) == 0) ++ { ++ char* arg = mon + 6; ++ ++ if (strlen(arg) == 0) ++ { ++ monitor_output("Inferior shells are not supported."); ++ free(mon); ++ return; ++ } ++ ++ long size = _POSIX_PATH_MAX; ++ char* current_directory = (char*)malloc(size); ++ getcwd(current_directory, size); ++ ++ int rc = system (arg); ++ char msg[255]; ++ if (rc == -1) ++ { ++ sprintf(msg, "Cannot execute '%s': %s.\n", arg, strerror(errno)); ++ monitor_output(msg); ++ } ++ else if (rc != -1) ++ { ++ sprintf(msg, "'%s' exited with status %d.\n", arg, rc); ++ monitor_output(msg); ++ } ++ |
