diff --git a/.github/workflows/macos-toolchain.yml b/.github/workflows/macos-toolchain.yml index bbf409cff..ddaa4f8dd 100644 --- a/.github/workflows/macos-toolchain.yml +++ b/.github/workflows/macos-toolchain.yml @@ -19,9 +19,11 @@ jobs: - uses: n1hility/cancel-previous-runs@v2 with: token: ${{ secrets.GITHUB_TOKEN }} + - name: install dependencies + run: brew install --verbose nikitabobko/tap/brew-install-path - name: build mips binutils - run: brew install ./tools/macos-mips/mipsel-none-elf-binutils.rb --debug + run: brew install-path --verbose ./tools/macos-mips/mipsel-none-elf-binutils.rb - name: build mips gcc - run: brew install ./tools/macos-mips/mipsel-none-elf-gcc.rb --debug + run: brew install-path --verbose ./tools/macos-mips/mipsel-none-elf-gcc.rb - name: build openbios run: make -C ./src/mips/openbios \ No newline at end of file diff --git a/README.md b/README.md index 78f7c4a38..d6496511e 100644 --- a/README.md +++ b/README.md @@ -130,8 +130,9 @@ You need MacOS Catalina or later with the latest XCode to build, as well as a fe Compiling OpenBIOS will require a mips compiler, that you can generate using the following commands: ```bash -brew install ./tools/macos-mips/mipsel-none-elf-binutils.rb -brew install ./tools/macos-mips/mipsel-none-elf-gcc.rb +brew install nikitabobko/tap/brew-install-path +brew install-path ./tools/macos-mips/mipsel-none-elf-binutils.rb +brew install-path ./tools/macos-mips/mipsel-none-elf-gcc.rb ``` Then, you can compile OpenBIOS using `make -C ./src/mips/openbios`. diff --git a/src/mips/openbios/card/device.c b/src/mips/openbios/card/device.c index 1c807b42c..94e9fba11 100644 --- a/src/mips/openbios/card/device.c +++ b/src/mips/openbios/card/device.c @@ -632,9 +632,9 @@ static const struct Device s_cardDevice = { .desc = "MEMORY CARD", .init = (void (*)())psxdummy, .open = dev_bu_open, - .action = psxdummy, + .action = (int (*)(struct File *, enum FileAction))psxdummy, .close = dev_bu_close, - .ioctl = psxdummy, + .ioctl = (int (*)(struct File *, int, int))psxdummy, .read = dev_bu_read, .write = dev_bu_write, .erase = dev_bu_erase, diff --git a/src/mips/openbios/cdrom/cdrom.c b/src/mips/openbios/cdrom/cdrom.c index 2f3698dfa..6ce570ade 100644 --- a/src/mips/openbios/cdrom/cdrom.c +++ b/src/mips/openbios/cdrom/cdrom.c @@ -101,18 +101,18 @@ static const struct Device s_cdromDevice = { .desc = "CD-ROM", .init = (void (*)())psxdummy, .open = dev_cd_open, - .action = psxdummy, - .close = psxdummy, - .ioctl = psxdummy, + .action = (int (*)(struct File *, enum FileAction))psxdummy, + .close = (int (*)(struct File *))psxdummy, + .ioctl = (int (*)(struct File *, int, int))psxdummy, .read = dev_cd_read, - .write = psxdummy, - .erase = psxdummy, + .write = (int (*)(struct File *, void *, int))psxdummy, + .erase = (int (*)(struct File *, const char *))psxdummy, .undelete = psxdummy, .firstFile = dev_cd_firstFile, .nextFile = dev_cd_nextFile, - .format = psxdummy, + .format = (int (*)(struct File *))psxdummy, .chdir = dev_cd_chdir, - .rename = psxdummy, + .rename = (int (*)(struct File *, const char *, struct File *, const char *))psxdummy, .deinit = deinitCDRom, .check = psxdummy, }; diff --git a/src/mips/openbios/tty/tty.c b/src/mips/openbios/tty/tty.c index abc9014d5..f45e07088 100644 --- a/src/mips/openbios/tty/tty.c +++ b/src/mips/openbios/tty/tty.c @@ -54,17 +54,17 @@ static const struct Device s_ttyDevice = { .init = dev_tty_init, .open = dev_tty_open, .action = dev_tty_action, - .close = psxdummy, + .close = (int (*)(struct File *))psxdummy, .ioctl = dev_tty_ioctl, - .read = psxdummy, - .write = psxdummy, - .erase = psxdummy, + .read = (int (*)(struct File *, void *, int))psxdummy, + .write = (int (*)(struct File *, void *, int))psxdummy, + .erase = (int (*)(struct File *, const char *))psxdummy, .undelete = psxdummy, .firstFile = (struct DirEntry * (*)(struct File *, const char *, struct DirEntry *)) psxdummy, .nextFile = (struct DirEntry * (*)(struct File *, struct DirEntry *)) psxdummy, - .format = psxdummy, + .format = (int (*)(struct File *))psxdummy, .chdir = psxdummy, - .rename = psxdummy, + .rename = (int (*)(struct File *, const char *, struct File *, const char *))psxdummy, .deinit = (void (*)())psxdummy, .check = psxdummy, }; @@ -77,19 +77,19 @@ static const struct Device s_dummyDevice = { .blockSize = 1, .desc = "CONSOLE", .init = (void (*)())psxdummy, - .open = psxdummy, - .action = psxdummy, - .close = psxdummy, - .ioctl = psxdummy, - .read = psxdummy, - .write = psxdummy, - .erase = psxdummy, + .open = (int (*)(struct File *, const char *, int))psxdummy, + .action = (int (*)(struct File *, enum FileAction))psxdummy, + .close = (int (*)(struct File *))psxdummy, + .ioctl = (int (*)(struct File *, int, int))psxdummy, + .read = (int (*)(struct File *, void *, int))psxdummy, + .write = (int (*)(struct File *, void *, int))psxdummy, + .erase = (int (*)(struct File *, const char *))psxdummy, .undelete = psxdummy, .firstFile = (struct DirEntry * (*)(struct File *, const char *, struct DirEntry *)) psxdummy, .nextFile = (struct DirEntry * (*)(struct File *, struct DirEntry *)) psxdummy, - .format = psxdummy, + .format = (int (*)(struct File *))psxdummy, .chdir = psxdummy, - .rename = psxdummy, + .rename = (int (*)(struct File *, const char *, struct File *, const char *))psxdummy, .deinit = (void (*)())psxdummy, .check = psxdummy, }; diff --git a/src/mips/psyqo/GETTING_STARTED.md b/src/mips/psyqo/GETTING_STARTED.md index d7000f8e7..6c237d207 100644 --- a/src/mips/psyqo/GETTING_STARTED.md +++ b/src/mips/psyqo/GETTING_STARTED.md @@ -26,8 +26,9 @@ trizen -S cross-mipsel-linux-gnu-binutils cross-mipsel-linux-gnu-gcc Using [Homebrew](https://brew.sh/), you can install the mips toolchain after downloading [these two scripts](https://github.com/grumpycoders/pcsx-redux/tree/main/tools/macos-mips) (or cloning the whole PCSX-Redux repository). ```bash -brew install ./tools/macos-mips/mipsel-none-elf-binutils.rb -brew install ./tools/macos-mips/mipsel-none-elf-gcc.rb +brew install nikitabobko/tap/brew-install-path +brew install-path ./tools/macos-mips/mipsel-none-elf-binutils.rb +brew install-path ./tools/macos-mips/mipsel-none-elf-gcc.rb ``` ## Windows diff --git a/src/mips/psyqo/src/xprintf.c b/src/mips/psyqo/src/xprintf.c index 1933f44fc..ad82e7eec 100644 --- a/src/mips/psyqo/src/xprintf.c +++ b/src/mips/psyqo/src/xprintf.c @@ -315,11 +315,7 @@ static const info fmtinfo[] = { ** seems to make a big difference in determining how fast this beast ** will run. */ -int vxprintf(func, arg, format, ap) void (*func)(const char *, int, void *); -void *arg; -const char *format; -va_list ap; -{ +int vxprintf(void (*func)(const char *, int, void *), void *arg, const char *format, va_list ap) { register const char *fmt; /* The format string. */ register int c; /* Next character in the format string */ register char *bufpt; /* Pointer to the conversion buffer */ @@ -704,10 +700,7 @@ struct s_strargument { /* Describes the string being written to */ char *last; /* Last available slot in the string */ }; -static void sout(txt, amt, arg) char *txt; -int amt; -void *arg; -{ +static void sout(const char *txt, int amt, void *arg) { register char *head; register const char *t; register int a; @@ -756,10 +749,7 @@ struct sgMprintf { }; /* The xprintf callback function. */ -static void mout(zNewText, nNewChar, arg) char *zNewText; -int nNewChar; -void *arg; -{ +static void mout(const char *zNewText, int nNewChar, void *arg) { struct sgMprintf *pM = (struct sgMprintf *)arg; if (pM->nChar + nNewChar + 1 > pM->nAlloc) { pM->nAlloc = pM->nChar + nNewChar * 2 + 1; diff --git a/tools/linux-mips/spawn-compiler.sh b/tools/linux-mips/spawn-compiler.sh index 389413aea..525c5d5e1 100755 --- a/tools/linux-mips/spawn-compiler.sh +++ b/tools/linux-mips/spawn-compiler.sh @@ -13,21 +13,21 @@ set -ex PREFIX=${PREFIX:-"/usr/local"} -for url in https://ftpmirror.gnu.org/gnu/binutils/binutils-2.43.tar.gz https://mirrors.kernel.org/gnu/binutils/binutils-2.43.tar.gz ; do +for url in https://ftpmirror.gnu.org/gnu/binutils/binutils-2.45.tar.gz https://mirrors.kernel.org/gnu/binutils/binutils-2.45.tar.gz ; do wget --max-redirect=2 --timeout=60 --continue --trust-server-names $url && break done -tar xvfz binutils-2.43.tar.gz -cd binutils-2.43 +tar xvfz binutils-2.45.tar.gz +cd binutils-2.45 ./configure --target=mipsel-none-elf --disable-multilib --disable-nls --disable-werror --prefix=$PREFIX make make install-strip cd .. -for url in https://ftpmirror.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.gz https://mirrors.kernel.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.gz ; do +for url in https://ftpmirror.gnu.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.gz https://mirrors.kernel.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.gz ; do wget --max-redirect=2 --timeout=60 --continue --trust-server-names $url && break done -tar xvfz gcc-14.2.0.tar.gz -cd gcc-14.2.0 +tar xvfz gcc-15.2.0.tar.gz +cd gcc-15.2.0 ./contrib/download_prerequisites mkdir build cd build diff --git a/tools/macos-mips/mipsel-none-elf-binutils.rb b/tools/macos-mips/mipsel-none-elf-binutils.rb index 52962e4e0..b18f67c7b 100644 --- a/tools/macos-mips/mipsel-none-elf-binutils.rb +++ b/tools/macos-mips/mipsel-none-elf-binutils.rb @@ -1,12 +1,14 @@ class MipselNoneElfBinutils < Formula desc "FSF Binutils for mipsel cross development" homepage "https://www.gnu.org/software/binutils/" - url "https://ftpmirror.gnu.org/gnu/binutils/binutils-2.43.tar.gz" - mirror "https://mirrors.kernel.org/gnu/binutils/binutils-2.43.tar.gz" - sha256 "025c436d15049076ebe511d29651cc4785ee502965a8839936a65518582bdd64" + url "https://ftpmirror.gnu.org/gnu/binutils/binutils-2.45.tar.gz" + mirror "https://mirrors.kernel.org/gnu/binutils/binutils-2.45.tar.gz" + sha256 "8a3eb4b10e7053312790f21ee1a38f7e2bbd6f4096abb590d3429e5119592d96" depends_on "texinfo" => :build + patch :DATA + def install system "./configure", "--target=mipsel-none-elf", "--disable-multilib", @@ -20,3 +22,47 @@ def install assert_match "f()", shell_output("#{bin}/mipsel-none-elf-c++filt _Z1fv") end end + +__END__ +diff --git a/zlib/zutil.h b/zlib/zutil.h +index 0bd2dbcba..bb513cb4b 100644 +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -137,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) + # define OS_CODE 7 +-# ifndef Z_SOLO +-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-# include /* for fdopen */ +-# else +-# ifndef fdopen +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-# endif +-# endif +-# endif + #endif + + #ifdef __acorn +@@ -170,18 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + # define OS_CODE 19 + #endif + +-#if defined(_BEOS_) || defined(RISCOS) +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-#endif +- +-#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX +-# if defined(_WIN32_WCE) +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-# else +-# define fdopen(fd,type) _fdopen(fd,type) +-# endif +-#endif +- + #if defined(__BORLANDC__) && !defined(MSDOS) + #pragma warn -8004 + #pragma warn -8008 diff --git a/tools/macos-mips/mipsel-none-elf-gcc.rb b/tools/macos-mips/mipsel-none-elf-gcc.rb index d59a03b94..25ceef7bf 100644 --- a/tools/macos-mips/mipsel-none-elf-gcc.rb +++ b/tools/macos-mips/mipsel-none-elf-gcc.rb @@ -1,9 +1,9 @@ class MipselNoneElfGcc < Formula desc "The GNU compiler collection for mipsel" homepage "https://gcc.gnu.org" - url "https://ftpmirror.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz" - mirror "https://mirrors.kernel.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz" - sha256 "a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9" + url "https://ftpmirror.gnu.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.xz" + mirror "https://mirrors.kernel.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.xz" + sha256 "438fd996826b0c82485a29da03a72d71d6e3541a83ec702df4271f6fe025d24e" depends_on "gmp" depends_on "mipsel-none-elf-binutils" @@ -11,6 +11,8 @@ class MipselNoneElfGcc < Formula depends_on "mpfr" depends_on "gnu-sed" + patch :DATA + def install ENV.prepend_path "PATH", Formula["gnu-sed"].opt_libexec/"gnubin" mkdir "mipsel-none-elf-gcc-build" do @@ -50,3 +52,47 @@ def install system "#{bin}/mipsel-none-elf-gcc", "-c", "-o", "test-c.o", "test-c.c" end end + +__END__ +diff --git a/zlib/zutil.h b/zlib/zutil.h +index 0bd2dbcba..bb513cb4b 100644 +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -130,17 +130,8 @@ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) + # define OS_CODE 7 +-# ifndef Z_SOLO +-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-# include /* for fdopen */ +-# else +-# ifndef fdopen +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-# endif +-# endif +-# endif + #endif + + #ifdef __acorn +@@ -163,19 +154,12 @@ + # define OS_CODE 19 + #endif + +-#if defined(_BEOS_) || defined(RISCOS) +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-#endif +- + #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX + # if defined(_WIN32_WCE) +-# define fdopen(fd,mode) NULL /* No fdopen() */ + # ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; + # define _PTRDIFF_T_DEFINED + # endif +-# else +-# define fdopen(fd,type) _fdopen(fd,type) + # endif + #endif diff --git a/tools/macos-mips/mipsel-none-elf-gdb.rb b/tools/macos-mips/mipsel-none-elf-gdb.rb index 408ee3e5e..875e04dfd 100644 --- a/tools/macos-mips/mipsel-none-elf-gdb.rb +++ b/tools/macos-mips/mipsel-none-elf-gdb.rb @@ -1,9 +1,9 @@ class MipselNoneElfGdb < Formula desc "GDB: The GNU Project Debugger compiled for Mips" homepage "https://sourceware.org/gdb/" - url "https://ftpmirror.gnu.org/gnu/gdb/gdb-15.1.tar.xz" - mirror "https://mirrors.kernel.org/gnu/gdb/gdb-15.1.tar.xz" - sha256 "38254eacd4572134bca9c5a5aa4d4ca564cbbd30c369d881f733fb6b903354f2" + url "https://ftpmirror.gnu.org/gnu/gdb/gdb-16.3.tar.xz" + mirror "https://mirrors.kernel.org/gnu/gdb/gdb-16.3.tar.xz" + sha256 "bcfcd095528a987917acf9fff3f1672181694926cc18d609c99d0042c00224c5" # inspired by https://github.com/orgs/Homebrew/discussions/1114#discussioncomment-8863715 diff --git a/tools/macos-mips/zlib.patch b/tools/macos-mips/zlib.patch new file mode 100644 index 000000000..6665e7917 --- /dev/null +++ b/tools/macos-mips/zlib.patch @@ -0,0 +1,52 @@ +From 4bd9a71f3539b5ce47f0c67ab5e01f3196dc8ef9 Mon Sep 17 00:00:00 2001 +From: Mark Adler +Date: Tue, 12 Dec 2023 22:19:05 -0600 +Subject: [PATCH] Remove fdopen #defines in zutil.h. + +fdopen() is not used by zlib anymore. The #defines are vestigial. +--- + zutil.h | 23 +---------------------- + 1 file changed, 1 insertion(+), 22 deletions(-) + +diff --git a/zutil.h b/zutil.h +index 0bd2dbcba..bb513cb4b 100644 +--- a/zutil.h ++++ b/zutil.h +@@ -137,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) + # define OS_CODE 7 +-# ifndef Z_SOLO +-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-# include /* for fdopen */ +-# else +-# ifndef fdopen +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-# endif +-# endif +-# endif + #endif + + #ifdef __acorn +@@ -170,18 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + # define OS_CODE 19 + #endif + +-#if defined(_BEOS_) || defined(RISCOS) +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-#endif +- +-#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX +-# if defined(_WIN32_WCE) +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-# else +-# define fdopen(fd,type) _fdopen(fd,type) +-# endif +-#endif +- + #if defined(__BORLANDC__) && !defined(MSDOS) + #pragma warn -8004 + #pragma warn -8008 diff --git a/tools/vscode-extension/scripts/mipsel-none-elf-binutils.rb b/tools/vscode-extension/scripts/mipsel-none-elf-binutils.rb index 52962e4e0..b18f67c7b 100644 --- a/tools/vscode-extension/scripts/mipsel-none-elf-binutils.rb +++ b/tools/vscode-extension/scripts/mipsel-none-elf-binutils.rb @@ -1,12 +1,14 @@ class MipselNoneElfBinutils < Formula desc "FSF Binutils for mipsel cross development" homepage "https://www.gnu.org/software/binutils/" - url "https://ftpmirror.gnu.org/gnu/binutils/binutils-2.43.tar.gz" - mirror "https://mirrors.kernel.org/gnu/binutils/binutils-2.43.tar.gz" - sha256 "025c436d15049076ebe511d29651cc4785ee502965a8839936a65518582bdd64" + url "https://ftpmirror.gnu.org/gnu/binutils/binutils-2.45.tar.gz" + mirror "https://mirrors.kernel.org/gnu/binutils/binutils-2.45.tar.gz" + sha256 "8a3eb4b10e7053312790f21ee1a38f7e2bbd6f4096abb590d3429e5119592d96" depends_on "texinfo" => :build + patch :DATA + def install system "./configure", "--target=mipsel-none-elf", "--disable-multilib", @@ -20,3 +22,47 @@ def install assert_match "f()", shell_output("#{bin}/mipsel-none-elf-c++filt _Z1fv") end end + +__END__ +diff --git a/zlib/zutil.h b/zlib/zutil.h +index 0bd2dbcba..bb513cb4b 100644 +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -137,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) + # define OS_CODE 7 +-# ifndef Z_SOLO +-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-# include /* for fdopen */ +-# else +-# ifndef fdopen +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-# endif +-# endif +-# endif + #endif + + #ifdef __acorn +@@ -170,18 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ + # define OS_CODE 19 + #endif + +-#if defined(_BEOS_) || defined(RISCOS) +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-#endif +- +-#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX +-# if defined(_WIN32_WCE) +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-# else +-# define fdopen(fd,type) _fdopen(fd,type) +-# endif +-#endif +- + #if defined(__BORLANDC__) && !defined(MSDOS) + #pragma warn -8004 + #pragma warn -8008 diff --git a/tools/vscode-extension/scripts/mipsel-none-elf-gcc.rb b/tools/vscode-extension/scripts/mipsel-none-elf-gcc.rb index d59a03b94..25ceef7bf 100644 --- a/tools/vscode-extension/scripts/mipsel-none-elf-gcc.rb +++ b/tools/vscode-extension/scripts/mipsel-none-elf-gcc.rb @@ -1,9 +1,9 @@ class MipselNoneElfGcc < Formula desc "The GNU compiler collection for mipsel" homepage "https://gcc.gnu.org" - url "https://ftpmirror.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz" - mirror "https://mirrors.kernel.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz" - sha256 "a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9" + url "https://ftpmirror.gnu.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.xz" + mirror "https://mirrors.kernel.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.xz" + sha256 "438fd996826b0c82485a29da03a72d71d6e3541a83ec702df4271f6fe025d24e" depends_on "gmp" depends_on "mipsel-none-elf-binutils" @@ -11,6 +11,8 @@ class MipselNoneElfGcc < Formula depends_on "mpfr" depends_on "gnu-sed" + patch :DATA + def install ENV.prepend_path "PATH", Formula["gnu-sed"].opt_libexec/"gnubin" mkdir "mipsel-none-elf-gcc-build" do @@ -50,3 +52,47 @@ def install system "#{bin}/mipsel-none-elf-gcc", "-c", "-o", "test-c.o", "test-c.c" end end + +__END__ +diff --git a/zlib/zutil.h b/zlib/zutil.h +index 0bd2dbcba..bb513cb4b 100644 +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -130,17 +130,8 @@ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) + # define OS_CODE 7 +-# ifndef Z_SOLO +-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +-# include /* for fdopen */ +-# else +-# ifndef fdopen +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-# endif +-# endif +-# endif + #endif + + #ifdef __acorn +@@ -163,19 +154,12 @@ + # define OS_CODE 19 + #endif + +-#if defined(_BEOS_) || defined(RISCOS) +-# define fdopen(fd,mode) NULL /* No fdopen() */ +-#endif +- + #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX + # if defined(_WIN32_WCE) +-# define fdopen(fd,mode) NULL /* No fdopen() */ + # ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; + # define _PTRDIFF_T_DEFINED + # endif +-# else +-# define fdopen(fd,type) _fdopen(fd,type) + # endif + #endif diff --git a/tools/vscode-extension/scripts/mipsel-none-elf-gdb.rb b/tools/vscode-extension/scripts/mipsel-none-elf-gdb.rb index 408ee3e5e..875e04dfd 100644 --- a/tools/vscode-extension/scripts/mipsel-none-elf-gdb.rb +++ b/tools/vscode-extension/scripts/mipsel-none-elf-gdb.rb @@ -1,9 +1,9 @@ class MipselNoneElfGdb < Formula desc "GDB: The GNU Project Debugger compiled for Mips" homepage "https://sourceware.org/gdb/" - url "https://ftpmirror.gnu.org/gnu/gdb/gdb-15.1.tar.xz" - mirror "https://mirrors.kernel.org/gnu/gdb/gdb-15.1.tar.xz" - sha256 "38254eacd4572134bca9c5a5aa4d4ca564cbbd30c369d881f733fb6b903354f2" + url "https://ftpmirror.gnu.org/gnu/gdb/gdb-16.3.tar.xz" + mirror "https://mirrors.kernel.org/gnu/gdb/gdb-16.3.tar.xz" + sha256 "bcfcd095528a987917acf9fff3f1672181694926cc18d609c99d0042c00224c5" # inspired by https://github.com/orgs/Homebrew/discussions/1114#discussioncomment-8863715 diff --git a/tools/vscode-extension/tools.js b/tools/vscode-extension/tools.js index d2149de5c..2ce1d9a2c 100644 --- a/tools/vscode-extension/tools.js +++ b/tools/vscode-extension/tools.js @@ -20,14 +20,14 @@ let extensionUri let globalStorageUri let requiresReboot = false -async function checkInstalled (name) { +async function checkInstalled(name) { if (tools[name].installed === undefined) { tools[name].installed = await tools[name].check() } return tools[name].installed } -async function checkCommands (commands, args) { +async function checkCommands(commands, args) { for (const command of commands) { try { await execFile(command, args) @@ -42,7 +42,7 @@ async function checkCommands (commands, args) { let mipsInstalling = false let win32MipsToolsInstalling = false -async function installMips () { +async function installMips() { if (mipsInstalling) return mipsInstalling = true try { @@ -62,7 +62,7 @@ async function installMips () { } } -async function installToolchain () { +async function installToolchain() { switch (process.platform) { case 'win32': try { @@ -107,9 +107,9 @@ async function installToolchain () { 'scripts', 'mipsel-none-elf-gcc.rb' ).fsPath + await terminal.run('brew', ['install', 'nikitabobko/tap/brew-install-path']) await terminal.run('brew', [ - 'install', - '--formula', + 'install-path', binutilsScriptPath, gccScriptPath ]) @@ -139,9 +139,9 @@ async function installToolchain () { 'scripts', 'mipsel-none-elf-gcc.rb' ).fsPath + await terminal.run('brew', ['install', 'nikitabobko/tap/brew-install-path']) await terminal.run('brew', [ - 'install', - '--formula', + 'install-path', binutilsScriptPath, gccScriptPath ]) @@ -170,7 +170,7 @@ async function installToolchain () { } } -async function installGDB () { +async function installGDB() { switch (process.platform) { case 'win32': try { @@ -240,7 +240,7 @@ async function installGDB () { } } -async function installMake () { +async function installMake() { switch (process.platform) { case 'win32': try { @@ -285,7 +285,7 @@ async function installMake () { } } -async function installCMake () { +async function installCMake() { switch (process.platform) { case 'win32': const release = await octokit.rest.repos.getLatestRelease({ @@ -361,7 +361,7 @@ async function installCMake () { } } -async function installGit () { +async function installGit() { switch (process.platform) { case 'win32': { const release = await octokit.rest.repos.getLatestRelease({ @@ -400,7 +400,7 @@ async function installGit () { } } -async function installPython () { +async function installPython() { switch (process.platform) { case 'win32': const tags = await octokit.rest.repos.listTags({ @@ -457,7 +457,7 @@ async function installPython () { } } -async function checkPython () { +async function checkPython() { switch (process.platform) { case 'win32': /* @@ -510,7 +510,7 @@ async function checkPython () { } } -function unpackPsyq (destination) { +function unpackPsyq(destination) { const filename = vscode.Uri.joinPath( globalStorageUri, tools.psyq.filename @@ -666,7 +666,7 @@ const tools = { } } -function checkLocalFile (filename) { +function checkLocalFile(filename) { return new Promise((resolve) => { filename = vscode.Uri.joinPath(globalStorageUri, filename).fsPath fs.access(filename, fs.constants.F_OK, (err) => { diff --git a/tools/win32-gdb/Dockerfile b/tools/win32-gdb/Dockerfile index 415e3af13..47ac13f66 100644 --- a/tools/win32-gdb/Dockerfile +++ b/tools/win32-gdb/Dockerfile @@ -1,10 +1,10 @@ # escape=` -# Dockerfile to generate the Windows gdb-multiarch-15.1.zip package. +# Dockerfile to generate the Windows gdb-multiarch-16.3.zip package. FROM mcr.microsoft.com/windows/servercore:ltsc2022 WORKDIR C:\windows\temp -SHELL ["powershell", "-command"] +SHELL ["powershell", "-command"] RUN Invoke-WebRequest -UserAgent 'DockerCI' -outfile 7zsetup.exe http://www.7-zip.org/a/7z1604-x64.exe @@ -45,23 +45,23 @@ RUN C:\msys64\usr\bin\bash.exe -l -c 'pacman -S --needed --noconfirm mingw-w64-x RUN C:\msys64\usr\bin\bash.exe -l -c 'pacman -S --needed --noconfirm mingw-w64-x86_64-python mingw-w64-x86_64-readline' RUN C:\msys64\usr\bin\bash.exe -l -c 'pacman -Scc --noconfirm' -ARG GDB=https://ftpmirror.gnu.org/gnu/gdb/gdb-15.1.tar.xz +ARG GDB=https://ftpmirror.gnu.org/gnu/gdb/gdb-16.3.tar.xz RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` - Invoke-WebRequest $env:GDB -OutFile "C:\Windows\Temp\gdb-15.1.tar.xz"; ` - Start-Process -FilePath "C:\7-Zip\7z.exe" -ArgumentList e, "C:\Windows\Temp\gdb-15.1.tar.xz", `-oC:\Windows\Temp\ -NoNewWindow -PassThru -Wait; ` - Start-Process -FilePath "C:\7-Zip\7z.exe" -ArgumentList x, "C:\Windows\Temp\gdb-15.1.tar", `-oC:\ -NoNewWindow -PassThru -Wait; ` + Invoke-WebRequest $env:GDB -OutFile "C:\Windows\Temp\gdb-16.3.tar.xz"; ` + Start-Process -FilePath "C:\7-Zip\7z.exe" -ArgumentList e, "C:\Windows\Temp\gdb-16.3.tar.xz", `-oC:\Windows\Temp\ -NoNewWindow -PassThru -Wait; ` + Start-Process -FilePath "C:\7-Zip\7z.exe" -ArgumentList x, "C:\Windows\Temp\gdb-16.3.tar", `-oC:\ -NoNewWindow -PassThru -Wait; ` Remove-Item @('C:\Windows\Temp\*', 'C:\Users\*\Appdata\Local\Temp\*') -Force -Recurse; ENV MSYSTEM MINGW64 -RUN C:\msys64\usr\bin\bash.exe -l -c 'mkdir /BUILD && cd /BUILD && /c/gdb-15.1/configure --disable-gdbtk --disable-shared --disable-readline --with-system-readline --with-expat --with-system-zlib --without-guile --without-babeltrace --enable-tui --with-lzma --without-python --with-xxhash --with-mpfr=/mingw64 --enable-64-bit-bfd --enable-targets=all --disable-sim --prefix=/DIST || (cat /BUILD/config.log && exit 1)' +RUN C:\msys64\usr\bin\bash.exe -l -c 'mkdir /BUILD && cd /BUILD && /c/gdb-16.3/configure --disable-gdbtk --disable-shared --disable-readline --with-system-readline --with-expat --with-system-zlib --without-guile --without-babeltrace --enable-tui --with-lzma --without-python --with-xxhash --with-mpfr=/mingw64 --enable-64-bit-bfd --enable-targets=all --disable-sim --prefix=/DIST || (cat /BUILD/config.log && exit 1)' RUN C:\msys64\usr\bin\bash.exe -l -c 'LOADLIBES=-lws2_32\ -lbcrypt make -C /BUILD all' RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /BUILD install-strip' RUN C:\msys64\usr\bin\bash.exe -l -c 'cd /DIST/bin && ldd *.exe | cut -f2 -d\> | cut -f2 -d\ | grep mingw64 | while read f ; do cp $f . ; done' -RUN C:\msys64\usr\bin\bash.exe -l -c 'cp /c/gdb-15.1/COPYING* /DIST' +RUN C:\msys64\usr\bin\bash.exe -l -c 'cp /c/gdb-16.3/COPYING* /DIST' RUN C:\msys64\usr\bin\bash.exe -l -c 'cp /DIST/bin/gdb.exe /DIST/bin/gdb-multiarch.exe' -RUN C:\msys64\usr\bin\bash.exe -l -c 'cd /DIST && zip /c/gdb-multiarch-15.1.zip . -r' +RUN C:\msys64\usr\bin\bash.exe -l -c 'cd /DIST && zip /c/gdb-multiarch-16.3.zip . -r' CMD C:\msys64\usr\bin\bash.exe -l diff --git a/tools/win32-mips/Dockerfile b/tools/win32-mips/Dockerfile index 0401af857..105b0b5f2 100644 --- a/tools/win32-mips/Dockerfile +++ b/tools/win32-mips/Dockerfile @@ -45,36 +45,36 @@ RUN C:\msys64\usr\bin\bash.exe -l -c 'pacman -S --needed --noconfirm mingw-w64-x RUN C:\msys64\usr\bin\bash.exe -l -c 'pacman -S --needed --noconfirm mingw-w64-x86_64-python mingw-w64-x86_64-readline' RUN C:\msys64\usr\bin\bash.exe -l -c 'pacman -Scc --noconfirm' -ARG BINUTILS=https://ftpmirror.gnu.org/gnu/binutils/binutils-2.43.tar.xz -ARG GCC=https://ftpmirror.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz +ARG BINUTILS=https://ftpmirror.gnu.org/gnu/binutils/binutils-2.45.tar.xz +ARG GCC=https://ftpmirror.gnu.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.xz RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` - Invoke-WebRequest $env:BINUTILS -OutFile "C:\Windows\Temp\binutils-2.43.tar.xz"; ` - Start-Process -FilePath "C:\7-Zip\7z.exe" -ArgumentList e, "C:\Windows\Temp\binutils-2.43.tar.xz", `-y, `-oC:\Windows\Temp\ -NoNewWindow -PassThru -Wait; ` - Start-Process -FilePath "C:\7-Zip\7z.exe" -ArgumentList x, "C:\Windows\Temp\binutils-2.43.tar", `-y, `-oC:\ -NoNewWindow -PassThru -Wait; ` + Invoke-WebRequest $env:BINUTILS -OutFile "C:\Windows\Temp\binutils-2.45.tar.xz"; ` + Start-Process -FilePath "C:\7-Zip\7z.exe" -ArgumentList e, "C:\Windows\Temp\binutils-2.45.tar.xz", `-y, `-oC:\Windows\Temp\ -NoNewWindow -PassThru -Wait; ` + Start-Process -FilePath "C:\7-Zip\7z.exe" -ArgumentList x, "C:\Windows\Temp\binutils-2.45.tar", `-y, `-oC:\ -NoNewWindow -PassThru -Wait; ` Remove-Item @('C:\Windows\Temp\*', 'C:\Users\*\Appdata\Local\Temp\*') -Force -Recurse; RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` - Invoke-WebRequest $env:GCC -OutFile "C:\Windows\Temp\gcc-14.2.0.tar.xz"; ` - Start-Process -FilePath "C:\7-Zip\7z.exe" -ArgumentList e, "C:\Windows\Temp\gcc-14.2.0.tar.xz", `-y, `-oC:\Windows\Temp\ -NoNewWindow -PassThru -Wait; ` - Start-Process -FilePath "C:\7-Zip\7z.exe" -ArgumentList x, "C:\Windows\Temp\gcc-14.2.0.tar", `-y, `-oC:\ -NoNewWindow -PassThru -Wait; ` + Invoke-WebRequest $env:GCC -OutFile "C:\Windows\Temp\gcc-15.2.0.tar.xz"; ` + Start-Process -FilePath "C:\7-Zip\7z.exe" -ArgumentList e, "C:\Windows\Temp\gcc-15.2.0.tar.xz", `-y, `-oC:\Windows\Temp\ -NoNewWindow -PassThru -Wait; ` + Start-Process -FilePath "C:\7-Zip\7z.exe" -ArgumentList x, "C:\Windows\Temp\gcc-15.2.0.tar", `-y, `-oC:\ -NoNewWindow -PassThru -Wait; ` Remove-Item @('C:\Windows\Temp\*', 'C:\Users\*\Appdata\Local\Temp\*') -Force -Recurse; ENV MSYSTEM MINGW64 -RUN C:\msys64\usr\bin\bash.exe -l -c 'cd /c/binutils-2.43 && /c/binutils-2.43/configure --target=mipsel-none-elf --disable-multilib --disable-nls --disable-werror --prefix=/DIST || (cat /BUILD/config.log && exit 1)' +RUN C:\msys64\usr\bin\bash.exe -l -c 'cd /c/binutils-2.45 && /c/binutils-2.45/configure --target=mipsel-none-elf --disable-multilib --disable-nls --disable-werror --prefix=/DIST || (cat /BUILD/config.log && exit 1)' -RUN C:\msys64\usr\bin\bash.exe -l -c 'cd /c/binutils-2.43/libiberty && sed -i s/\\\\buint\\\\b/unsigned/ rust-demangle.c' +RUN C:\msys64\usr\bin\bash.exe -l -c 'cd /c/binutils-2.45/libiberty && sed -i s/\\\\buint\\\\b/unsigned/ rust-demangle.c' -RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /c/binutils-2.43 all -j8' -RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /c/binutils-2.43 install-strip' -RUN C:\msys64\usr\bin\bash.exe -l -c 'cp /c/binutils-2.43/COPYING* /DIST' +RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /c/binutils-2.45 all -j8' +RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /c/binutils-2.45 install-strip' +RUN C:\msys64\usr\bin\bash.exe -l -c 'cp /c/binutils-2.45/COPYING* /DIST' -RUN C:\msys64\usr\bin\bash.exe -l -c 'mkdir /c/gcc-14.2.0/build && cd /c/gcc-14.2.0/build && ../configure --target=mipsel-none-elf --without-isl --disable-nls --disable-threads --disable-shared --disable-libssp --disable-libstdcxx-pch --disable-libgomp --disable-werror --without-headers --disable-hosted-libstdcxx --with-as=/DIST/bin/mipsel-none-elf-as --with-ld=/DIST/bin/mipsel-none-elf-ld --enable-languages=c,c++ --prefix=/DIST || (cat /BUILD/config.log && exit 1)' -RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /c/gcc-14.2.0/build all-gcc -j4' -RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /c/gcc-14.2.0/build all-target-libgcc -j4' -RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /c/gcc-14.2.0/build all-target-libstdc++-v3 -j4' -RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /c/gcc-14.2.0/build install-strip-gcc install-strip-target-libgcc install-strip-target-libstdc++-v3' +RUN C:\msys64\usr\bin\bash.exe -l -c 'mkdir /c/gcc-15.2.0/build && cd /c/gcc-15.2.0/build && ../configure --target=mipsel-none-elf --without-isl --disable-nls --disable-threads --disable-shared --disable-libssp --disable-libstdcxx-pch --disable-libgomp --disable-werror --without-headers --disable-hosted-libstdcxx --with-as=/DIST/bin/mipsel-none-elf-as --with-ld=/DIST/bin/mipsel-none-elf-ld --enable-languages=c,c++ --prefix=/DIST || (cat /BUILD/config.log && exit 1)' +RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /c/gcc-15.2.0/build all-gcc -j4' +RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /c/gcc-15.2.0/build all-target-libgcc -j4' +RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /c/gcc-15.2.0/build all-target-libstdc++-v3 -j4' +RUN C:\msys64\usr\bin\bash.exe -l -c 'make -C /c/gcc-15.2.0/build install-strip-gcc install-strip-target-libgcc install-strip-target-libstdc++-v3' RUN C:\msys64\usr\bin\bash.exe -l -c 'for t in cat cp echo mkdir rm touch which ; do cp /usr/bin/$t.exe /DIST/bin ; done' RUN C:\msys64\usr\bin\bash.exe -l -c 'cp /mingw64/bin/mingw32-make.exe /DIST/bin/make.exe'