1
0
mirror of https://github.com/skeeto/w64devkit.git synced 2025-07-02 01:41:38 +03:00

Adopt Hannes Domani's relocatable mingw patch (#212)

3a38668f is incomplete, and requires the toolchain is located under a
path ending w64devkit/, which unfortunately made it into the 2.2.0
release. This patch is more complete, but must only be applied to the
native toolchain, not the cross toolchain, so it applies the patch late
in the build.
This commit is contained in:
Christopher Wellons
2025-06-08 09:17:47 -04:00
parent f2b69d2df5
commit ff4bb190f1
2 changed files with 31 additions and 1 deletions

View File

@ -259,9 +259,10 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-libraries/winpthreads/configure \
&& make install
WORKDIR /gcc
COPY src/crossgcc-*.patch $PREFIX/src/
RUN echo 'BEGIN {print "pecoff"}' \
>/gcc-$GCC_VERSION/libbacktrace/filetype.awk \
&& sed -i 's#/mingw/#/#' /gcc-$GCC_VERSION/gcc/config/mingw/mingw32.h \
&& cat $PREFIX/src/crossgcc-*.patch | patch -d/gcc-$GCC_VERSION -p1 \
&& /gcc-$GCC_VERSION/configure \
--prefix=$PREFIX \
--with-sysroot=$PREFIX \

View File

@ -0,0 +1,29 @@
Relocatable mingw paths (c/o Hannes Domani)
--- a/gcc/config/mingw/mingw32.h
+++ b/gcc/config/mingw/mingw32.h
@@ -91,3 +91,3 @@
#undef NATIVE_SYSTEM_HEADER_COMPONENT
-#define NATIVE_SYSTEM_HEADER_COMPONENT "MINGW"
+#undef NATIVE_SYSTEM_HEADER_DIR
@@ -234,3 +234,3 @@
#ifndef STANDARD_STARTFILE_PREFIX_1
-#define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/"
+#define STANDARD_STARTFILE_PREFIX_1 ""
#endif
@@ -240,7 +240,2 @@
-/* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR
- macro contains POSIX-style path. See bug 52947. */
-#undef NATIVE_SYSTEM_HEADER_DIR
-#define NATIVE_SYSTEM_HEADER_DIR "/mingw/include"
-
/* Output STRING, a string representing a filename, to FILE.
--- a/gcc/incpath.cc
+++ b/gcc/incpath.cc
@@ -191,4 +191,3 @@
}
- else if (!p->add_sysroot && relocated
- && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len))
+ if (relocated && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len))
{