[Testing] Add support for building binutils with mingw64

This commit is contained in:
Herman S. 2026-02-14 16:53:07 +09:00
parent f2b9b57e18
commit 92b341e50c
3 changed files with 68 additions and 1 deletions

2
.gitignore vendored
View file

@ -95,10 +95,10 @@ node_modules/.bin/
/attic/
/content/
/third_party/binutils/binutils-2.24.tar.gz
/third_party/binutils/binutils-2.24/
/third_party/binutils/bin/
/third_party/binutils/powerpc-none-elf/
/third_party/binutils/share/
/third_party/binutils/binutils*
/third_party/vasm/
/tools/shader-playground/*.dll
/profile_print_times.py

View file

@ -0,0 +1,51 @@
diff -u -P -r libiberty/strerror.c libiberty/strerror.c
--- libiberty/strerror.c 2013-11-04 07:33:39.000000000 -0800
+++ libiberty/strerror.c 2026-02-14 00:00:00.000000000 -0800
@@ -469,8 +469,12 @@
#else
+#ifndef sys_nerr
extern int sys_nerr;
+#endif
+#ifndef sys_errlist
extern char *sys_errlist[];
+#endif
#endif
diff -u -P -r libiberty/waitpid.c libiberty/waitpid.c
--- libiberty/waitpid.c 2013-11-04 07:33:39.000000000 -0800
+++ libiberty/waitpid.c 2026-02-14 00:00:00.000000000 -0800
@@ -24,6 +24,13 @@
#include <sys/wait.h>
#endif
+#if defined(_WIN32) || defined(__MINGW32__)
+pid_t
+waitpid (pid_t pid, int *stat_loc, int options ATTRIBUTE_UNUSED)
+{
+ return -1;
+}
+#else
pid_t
waitpid (pid_t pid, int *stat_loc, int options ATTRIBUTE_UNUSED)
{
@@ -33,3 +40,4 @@
return wpid;
}
}
+#endif
diff -u -P -r intl/dcigettext.c intl/dcigettext.c
--- intl/dcigettext.c 2013-11-04 07:33:39.000000000 -0800
+++ intl/dcigettext.c 2026-02-14 00:00:00.000000000 -0800
@@ -148,7 +148,9 @@
char *getwd ();
# define getcwd(buf, max) getwd (buf)
# else
+# if !defined HAVE_UNISTD_H
char *getcwd ();
+# endif
# endif
# ifndef HAVE_STPCPY
static char *stpcpy PARAMS ((char *dest, const char *src));

View file

@ -37,6 +37,12 @@ echo ""
echo "Patching binutils with vmx128 support..."
patch -p0 < $THIS_SCRIPT_DIR/binutils-$SNAPSHOT_VERSION-vmx128.patch
if [ "$(uname -o 2>/dev/null)" = "Msys" ] && [ -n "$MINGW_PREFIX" ]; then
echo ""
echo "Patching binutils for mingw64 compatibility..."
patch -p0 < $THIS_SCRIPT_DIR/binutils-$SNAPSHOT_VERSION-mingw64.patch
fi
echo ""
echo "Running ./configure..."
./configure \
@ -58,6 +64,16 @@ echo ""
echo "Running make install..."
make install
if [ "$(uname -o 2>/dev/null)" = "Msys" ] && [ -n "$MINGW_PREFIX" ]; then
echo ""
echo "Copying MinGW runtime DLLs..."
for dll in libiconv-2.dll zlib1.dll; do
if [ -f "$MINGW_PREFIX/bin/$dll" ] && [ ! -f "$THIS_SCRIPT_DIR/bin/$dll" ]; then
cp "$MINGW_PREFIX/bin/$dll" "$THIS_SCRIPT_DIR/bin/"
fi
done
fi
cd ..
echo ""