Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/macos-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +22 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Pin the tap commit to avoid supply-chain drift.

Installing the external brew command from a moving tap HEAD can break CI unexpectedly. Pin the tap to a known commit, then install the formula.

-    - name: install dependencies
-      run: brew install --verbose nikitabobko/tap/brew-install-path
+    - name: install brew-install-path (pinned)
+      run: |
+        brew tap nikitabobko/tap https://github.com/nikitabobko/homebrew-tap
+        git -C "$(brew --repo nikitabobko/tap)" checkout <commit-sha>
+        brew install --verbose nikitabobko/tap/brew-install-path
+      shell: bash

Replace with the tested revision.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: install dependencies
run: brew install --verbose nikitabobko/tap/brew-install-path
- name: install brew-install-path (pinned)
run: |
brew tap nikitabobko/tap https://github.com/nikitabobko/homebrew-tap
git -C "$(brew --repo nikitabobko/tap)" checkout <commit-sha>
brew install --verbose nikitabobko/tap/brew-install-path
shell: bash
🤖 Prompt for AI Agents
.github/workflows/macos-toolchain.yml lines 22-23: currently installing an
external brew formula directly from the tap HEAD—pin the tap to a specific
commit to avoid supply-chain drift by (1) tapping the nikitabobko/tap repo, (2)
fetching and checking out the tested <commit-sha> in the tap repository, and
then (3) running the brew install of nikitabobko/tap/brew-install-path; replace
<commit-sha> with the known-good revision and ensure these steps are executed in
the workflow before the installation step.

- 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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
4 changes: 2 additions & 2 deletions src/mips/openbios/card/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 7 additions & 7 deletions src/mips/openbios/cdrom/cdrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Comment on lines +105 to 116
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Replace repeated casts with correctly-typed stubs to avoid UB and reduce warning surface.

Multiple fields cast psxdummy to incompatible signatures. Safer and clearer to use typed no-op wrappers. Also, nit: fix int, int spacing.

Apply within this block:

-    .action = (int (*)(struct File *, enum FileAction))psxdummy,
-    .close  = (int (*)(struct File *))psxdummy,
-    .ioctl  = (int (*)(struct File *, int,  int))psxdummy,
+    .action = cd_action_noop,
+    .close  = cd_close_noop,
+    .ioctl  = cd_ioctl_noop,
     .read   = dev_cd_read,
-    .write  = (int (*)(struct File *, void *, int))psxdummy,
-    .erase  = (int (*)(struct File *, const char *))psxdummy,
+    .write  = cd_write_noop,
+    .erase  = cd_erase_noop,
     .undelete = psxdummy,
     .firstFile = dev_cd_firstFile,
     .nextFile  = dev_cd_nextFile,
-    .format = (int (*)(struct File *))psxdummy,
+    .format = cd_format_noop,
     .chdir  = dev_cd_chdir,
-    .rename = (int (*)(struct File *, const char *, struct File *, const char *))psxdummy,
+    .rename = cd_rename_noop,

Add near the top of this file (or shared):

static int cd_action_noop(struct File *f, enum FileAction a){ (void)f; (void)a; return 0; }
static int cd_close_noop(struct File *f){ (void)f; return 0; }
static int cd_ioctl_noop(struct File *f, int a, int b){ (void)f; (void)a; (void)b; return 0; }
static int cd_write_noop(struct File *f, void *buf, int sz){ (void)f; (void)buf; (void)sz; return -1; } // write not supported
static int cd_erase_noop(struct File *f, const char *p){ (void)f; (void)p; return -1; }
static int cd_format_noop(struct File *f){ (void)f; return -1; }
static int cd_rename_noop(struct File *f, const char *o, struct File *u, const char *n){
    (void)f; (void)o; (void)u; (void)n; return -1;
}

Verification: run a quick scan to catch any remaining casts so we can standardize on wrappers.


🏁 Script executed:

#!/bin/bash
# Find device initializers still casting psxdummy
rg -nP '\.\s*(action|close|ioctl|write|erase|format|rename)\s*=\s*\([^)]*\)\s*psxdummy' -C2 src | sed -n '1,200p'

Length of output: 113


🏁 Script executed:

#!/bin/bash
# List all occurrences of psxdummy casts or assignments in the CD-ROM driver
rg -n 'psxdummy' -C2 src/mips/openbios/cdrom/cdrom.c

Length of output: 867


🏁 Script executed:

#!/bin/bash
# Show the struct initializer context in cdrom.c to identify field types
sed -n '1,50p' src/mips/openbios/cdrom/cdrom.c

Length of output: 2153


🏁 Script executed:

#!/bin/bash
# Display the struct initializer for the CD-ROM device to inspect all psxdummy assignments
sed -n '80,150p' src/mips/openbios/cdrom/cdrom.c

Length of output: 1994


Replace all psxdummy casts in the s_cdromDevice initializer with correctly-typed no-op stubs
Define static stub functions for each signature at the top of cdrom.c (or in a shared helper), for example:

static void          cd_init_noop(struct Device *d){ (void)d; }
static int           cd_action_noop(struct File *f, enum FileAction a){ (void)f; (void)a; return 0; }
static int           cd_close_noop(struct File *f){ (void)f; return 0; }
static int           cd_ioctl_noop(struct File *f, int a, int b){ (void)f; (void)a; (void)b; return 0; }
static ssize_t       cd_read_noop(struct File *f, void *buf, int sz){ (void)f; (void)buf; (void)sz; return -1; }
static int           cd_erase_noop(struct File *f, const char *p){ (void)f; (void)p; return -1; }
static int           cd_format_noop(struct File *f){ (void)f; return -1; }
static int           cd_undelete_noop(struct File *f){ (void)f; return 0; }
static int           cd_rename_noop(struct File *f, const char *o, struct File *u, const char *n){
    (void)f; (void)o; (void)u; (void)n; return -1;
}
static int           cd_check_noop(void){ return 0; }

Then update each initializer field in src/mips/openbios/cdrom/cdrom.c accordingly (and fix the double space in .ioctl = … int, int).

.check = psxdummy,
};
Expand Down
30 changes: 15 additions & 15 deletions src/mips/openbios/tty/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -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,
};
Expand Down
5 changes: 3 additions & 2 deletions src/mips/psyqo/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions tools/linux-mips/spawn-compiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 49 additions & 3 deletions tools/macos-mips/mipsel-none-elf-binutils.rb
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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 <unix.h> /* 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
52 changes: 49 additions & 3 deletions tools/macos-mips/mipsel-none-elf-gcc.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
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"
depends_on "libmpc"
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
Expand Down Expand Up @@ -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
Comment on lines +65 to +67
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Restore TARGET_OS_MAC in zlib’s MAC guard.

Same concern as the VSCode script: keep TARGET_OS_MAC to avoid OS_CODE/behavior changes on Apple.

-#if defined(MACOS)
+#if defined(MACOS) || defined(TARGET_OS_MAC)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
-#if defined(MACOS) || defined(TARGET_OS_MAC)
+#if defined(MACOS)
# define OS_CODE 7
#if defined(MACOS) || defined(TARGET_OS_MAC)
# define OS_CODE 7
🤖 Prompt for AI Agents
In tools/macos-mips/mipsel-none-elf-gcc.rb around lines 65 to 67, the
preprocessor guard was changed to remove TARGET_OS_MAC; restore TARGET_OS_MAC so
the condition checks both MACOS and TARGET_OS_MAC. Replace the current
single-symbol check with a compound check that uses defined(MACOS) ||
defined(TARGET_OS_MAC) so the original behavior and OS_CODE mapping remain
unchanged.

-# ifndef Z_SOLO
-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-# include <unix.h> /* 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
6 changes: 3 additions & 3 deletions tools/macos-mips/mipsel-none-elf-gdb.rb
Original file line number Diff line number Diff line change
@@ -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

Expand Down
52 changes: 52 additions & 0 deletions tools/macos-mips/zlib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From 4bd9a71f3539b5ce47f0c67ab5e01f3196dc8ef9 Mon Sep 17 00:00:00 2001
From: Mark Adler <[email protected]>
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
Comment on lines +19 to +21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Retain TARGET_OS_MAC in the condition.

Same rationale as in the embedded patches: avoid changing OS_CODE semantics on Apple hosts.

-#if defined(MACOS)
+#if defined(MACOS) || defined(TARGET_OS_MAC)
🤖 Prompt for AI Agents
In tools/macos-mips/zlib.patch around lines 19 to 21, the preprocessor condition
was changed to drop TARGET_OS_MAC; restore the original combined condition so
Apple-host detection still triggers. Replace the line with a condition that
checks both defined(MACOS) || defined(TARGET_OS_MAC) (i.e., revert to the
original compound #if) so OS_CODE remains unchanged on Apple hosts.

-# ifndef Z_SOLO
-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-# include <unix.h> /* 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
Loading
Loading