Merge remote-tracking branch 'origin/main' into fuckit

# Conflicts:
#	.github/workflows/linux-build.yml
This commit is contained in:
Nicolas "Pixel" Noble
2025-09-20 22:33:20 -07:00
51 changed files with 620 additions and 286 deletions
+5
View File
@@ -40,6 +40,9 @@ cp pcsx-redux.icns ${APPROOT}/Contents/Resources/AppIcon.icns
# Remove source images that were used to create the app icon.
rm -rfv ${APPROOT}/Contents/Resources/share/icons
# Remove temporary image files
rm -rfv pcsx-redux.iconset pcsx-redux.icns
# Create the required Info.plist and version.plist files
# with the minimum information.
PlistBuddy ${APPROOT}/Contents/Info.plist -c "add CFBundleDisplayName string ${APP}"
@@ -54,6 +57,8 @@ PlistBuddy ${APPROOT}/Contents/Info.plist -c "add CFBundleInfoDictionaryVersion
PlistBuddy ${APPROOT}/Contents/Info.plist -c "add CFBundleName string ${APP}"
PlistBuddy ${APPROOT}/Contents/Info.plist -c "add CFBundlePackageType string APPL"
PlistBuddy ${APPROOT}/Contents/Info.plist -c "add NSHumanReadableCopyright string Copyright PCSX-Redux Authors"
PlistBuddy ${APPROOT}/Contents/Info.plist -c "add LSApplicationCategoryType string public.app-category.games"
PlistBuddy ${APPROOT}/Contents/Info.plist -c "add LSSupportsGameMode bool true"
PlistBuddy ${APPROOT}/Contents/Info.plist -c "add LSMinimumSystemVersion string 10.15"
+9 -4
View File
@@ -13,15 +13,20 @@ jobs:
image: archlinux:latest
steps:
- name: Install dependencies
run: |
run: |
pacman -Syu --noconfirm --needed capstone curl ffmpeg freetype2 glfw libuv sdl2 zlib git make pkg-config sudo base-devel pacman-contrib
- uses: actions/checkout@v3
with:
set-safe-directory: true
- name: Create builduser
run: |
useradd builduser -m
passwd -d builduser
- name: Build AUR Package
run: |
git clone https://aur.archlinux.org/pcsx-redux-git.git
chown -R builduser:builduser pcsx-redux-git
cd pcsx-redux-git
mkdir /build
git clone https://aur.archlinux.org/pcsx-redux-git.git /build/pcsx-redux-git
chown -R builduser:builduser /build
cd /build/pcsx-redux-git
sed -i s,git+https://github.com/grumpycoders/pcsx-redux.git,git+file://$GITHUB_WORKSPACE#commit=$GITHUB_SHA,g PKGBUILD
sudo -u builduser makepkg
+4 -1
View File
@@ -11,6 +11,7 @@ jobs:
runs-on: ubuntu-latest
container:
image: ghcr.io/grumpycoders/pcsx-redux-build:latest
options: --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined
env:
TEST_RESULTS: /tmp/test-results
steps:
@@ -45,6 +46,7 @@ jobs:
npx @appdistrib/cli buildid > buildid.json
git config --global --add safe.directory /__w/pcsx-redux/pcsx-redux
make install install-openbios DESTDIR=AppDir/usr
sed -i s:/usr/bin/:: AppDir/usr/share/applications/pcsx-redux.desktop
echo '{' > version.json
echo ' "version": "'`git rev-parse HEAD | cut -c 1-8`'",' >> version.json
echo ' "buildId": '`jq -r .buildid buildid.json`',' >> version.json
@@ -62,7 +64,8 @@ jobs:
echo ' ]' >> version.json
echo '}' >> version.json
cp version.json AppDir/usr/share/pcsx-redux/resources
appimage-builder --skip-tests
linuxdeploy -v 3 --appdir=AppDir -e AppDir/usr/bin/pcsx-redux -d AppDir/usr/share/applications/pcsx-redux.desktop -i AppDir/usr/share/icons/hicolor/256x256/apps/pcsx-redux.png -o appimage
mv PCSX-Redux-x86_64.AppImage PCSX-Redux-HEAD-x86_64.AppImage
- run: |
make -C src/mips/openbios clean
make -C src/mips/tests -j 2 PCSX_TESTS=true
+1 -1
View File
@@ -26,4 +26,4 @@ jobs:
- name: Build OpenBIOS with it
run: make -C src/mips/openbios -j 6 all
- name: Build psyqo examples with it
run: for d in src/mips/psyqo/examples/* src/mips/psyqo-paths/examples/* src/mips/psyqo-lua/examples/* ; do make -C $d -j 6 all TEST=true ; done
run: for d in src/mips/psyqo/examples/* src/mips/psyqo-paths/examples/* src/mips/psyqo-lua/examples/*; do if [ -d "$d" ]; then make -C "$d" -j 6 all TEST=true; fi; done
+4 -2
View File
@@ -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
+1 -1
View File
@@ -58,7 +58,7 @@ fb.bat
# macos files
.DS_store
PCSX-Redux.app
# Savestate files
*.sstate
+3 -1
View File
@@ -270,7 +270,9 @@ install-openbios: openbios
appimage:
rm -rf AppDir
DESTDIR=AppDir/usr $(MAKE) $(MAKEOPTS) install
appimage-builder --skip-tests
sed -i s:/usr/bin/:: AppDir/usr/share/applications/pcsx-redux.desktop
linuxdeploy -v 3 --appdir=AppDir -e AppDir/usr/bin/pcsx-redux -d AppDir/usr/share/applications/pcsx-redux.desktop -i AppDir/usr/share/icons/hicolor/256x256/apps/pcsx-redux.png -o appimage
mv PCSX-Redux-x86_64.AppImage PCSX-Redux-HEAD-x86_64.AppImage
ifeq ($(CROSS),arm64)
third_party/luajit/src/libluajit.a:
+3 -2
View File
@@ -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`.
+1 -1
View File
@@ -7,4 +7,4 @@ ROOT=$(pwd)
cd $CWD
docker pull ghcr.io/grumpycoders/pcsx-redux-build-cross:latest
docker run --rm --env-file ${ROOT}/cross-env.list -i -w/project${CWD#$ROOT} -v "${ROOT}:/project" -u `id -u`:`id -g` ghcr.io/grumpycoders/pcsx-redux-build-cross make CROSS=arm64 $@
docker run --rm --env-file ${ROOT}/cross-env.list -i -w/project${CWD#$ROOT} -v "${ROOT}:/project" -u `id -u`:`id -g` --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined ghcr.io/grumpycoders/pcsx-redux-build-cross make CROSS=arm64 $@
+1 -1
View File
@@ -7,4 +7,4 @@ ROOT=$(pwd)
cd $CWD
docker pull ghcr.io/grumpycoders/pcsx-redux-build:latest
docker run --rm --env-file ${ROOT}/env.list -i -w/project${CWD#$ROOT} -v "${ROOT}:/project" -u `id -u`:`id -g` ghcr.io/grumpycoders/pcsx-redux-build:latest make $@
docker run --rm --env-file ${ROOT}/env.list -i -w/project${CWD#$ROOT} -v "${ROOT}:/project" -u `id -u`:`id -g` --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined ghcr.io/grumpycoders/pcsx-redux-build:latest make $@
+1 -1
View File
@@ -7,4 +7,4 @@ ROOT=$(pwd)
cd $CWD
docker pull ghcr.io/grumpycoders/pcsx-redux-build:latest
docker run --rm --env-file ${ROOT}/env.list -t -i -w/project${CWD#$ROOT} -v "${ROOT}:/project" -u `id -u`:`id -g` ghcr.io/grumpycoders/pcsx-redux-build:latest bash -l
docker run --rm --env-file ${ROOT}/env.list -t -i -w/project${CWD#$ROOT} -v "${ROOT}:/project" -u `id -u`:`id -g` --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined ghcr.io/grumpycoders/pcsx-redux-build:latest bash -l
+4 -5
View File
@@ -104,7 +104,7 @@ let
};
fetchSubmodule = { owner, repo, rev, hash }@args:
"cp -ru --no-preserve=all ${(fetchFromGitHub args).out} source/third_party/${repo}";
"cp -ruT --no-preserve=all ${(fetchFromGitHub args).out} source/third_party/${repo}";
in stdenv.mkDerivation {
pname = "pcsx-redux";
@@ -112,8 +112,8 @@ in stdenv.mkDerivation {
inherit src;
postUnpack = ''
cp -ru --no-preserve=all ${miniaudio.out} source/third_party/miniaudio
cp -ru --no-preserve=all ${tracy.src} source/third_party/tracy
cp -ruT --no-preserve=all ${miniaudio.out} source/third_party/miniaudio
cp -ruT --no-preserve=all ${tracy.src} source/third_party/tracy
'' + builtins.concatStringsSep "\n" (map fetchSubmodule submodules);
nativeBuildInputs = [
@@ -165,9 +165,8 @@ in stdenv.mkDerivation {
# TODO: learn how to use separate debug info
dontStrip = debugBuild;
enableDebugging = debugBuild;
enableParallelBuilding = true;
NIX_BUILD_CORES = 4;
meta = {
homepage = "https://pcsx-redux.consoledev.net";
+2
View File
@@ -71,6 +71,8 @@ class Emitter : public MacroAssembler {
return VirtualProtect(s_codeCache, allocSize, PAGE_EXECUTE_READWRITE, &oldProtect) != 0;
#elif !defined(__APPLE__)
return mprotect(s_codeCache, allocSize, PROT_READ | PROT_WRITE | PROT_EXEC) != -1;
#else
return false;
#endif
}
+1 -4
View File
@@ -67,8 +67,7 @@ bool DynaRecCPU::Init() {
PCSX::g_system->message("[Dynarec] Failed to allocate executable memory.\nTry disabling the Dynarec CPU.");
return false;
}
#endif
#if defined(__APPLE__)
#else
gen.setRW(); // M1 wants buffer marked as readable/writable with mprotect before emitting code
#endif
emitDispatcher(); // Emit our assembly dispatcher
@@ -102,8 +101,6 @@ void DynaRecCPU::Shutdown() {
delete[] m_ramBlocks;
delete[] m_biosBlocks;
delete[] m_dummyBlocks;
gen.dumpBuffer(); // dump buffer on shutdown/hard-reset for diagnostics
}
/// Params: A program counter value
+6
View File
@@ -237,6 +237,12 @@ class DynaRecCPU final : public PCSX::R3000Acpu {
virtual void Shutdown() final;
virtual bool isDynarec() final { return true; }
virtual void invalidateCache() override final {
memset(m_regs.iCacheAddr, 0xff, sizeof(m_regs.iCacheAddr));
memset(m_regs.iCacheCode, 0xff, sizeof(m_regs.iCacheCode));
uncompileAll(); // Mark all blocks as uncompiled
}
virtual void SetPGXPMode(uint32_t pgxpMode) final {
if (pgxpMode != 0) {
throw std::runtime_error("PGXP not supported in x64 JIT");
+1
View File
@@ -35,6 +35,7 @@ PCSX::Arguments::Arguments(const CommandLine::args& args) {
if (std::filesystem::exists("pcsx.json")) m_portable = true;
if (std::filesystem::exists(std::filesystem::path("vsprojects") / "pcsx-redux.sln")) m_portable = true;
if (std::filesystem::exists(std::filesystem::path("..") / "pcsx-redux.sln")) m_portable = true;
if (args.get<bool>("no-portable")) m_portable = false;
if (args.get<bool>("safe") || args.get<bool>("testmode") || args.get<bool>("cli")) m_safeModeEnabled = true;
if (args.get<bool>("resetui")) m_uiResetRequested = true;
if (args.get<bool>("noshaders")) m_shadersDisabled = true;
+11 -1
View File
@@ -520,7 +520,7 @@ void PCSX::GdbClient::processCommand() {
uint8_t n = fromHexChar(m_cmd[1]);
n <<= 4;
n |= fromHexChar(m_cmd[2]);
dumpOneRegister(n);
write(dumpOneRegister(n));
} else if (StringsHelpers::startsWith(m_cmd, "P")) {
if ((m_cmd.length() != 12) || (m_cmd[3] != '=')) {
write("E00");
@@ -760,6 +760,16 @@ void PCSX::GdbClient::processMonitorCommand(const std::string& cmd) {
g_emulator->m_cdrom->setIso(new CDRIso(pathView));
g_emulator->m_cdrom->parseIso();
}
} else if (words[0] == "sharedmem") {
if (words.size() != 2) {
writeEscaped("Usage: sharedmem <type>");
} else {
if (words[1] == "wram") {
writeEscaped(g_emulator->m_mem->m_wramShared.getSharedName());
} else {
writeEscaped("Unknown type. Valid types: wram");
}
}
}
write("OK");
}
+1
View File
@@ -307,6 +307,7 @@ class Memory {
uint32_t m_biosCRC = 0;
// Shared memory wrappers, pointers below point to these where appropriate
friend class GdbClient;
SharedMem m_wramShared;
uint32_t m_BIU = 0;
+10 -4
View File
@@ -39,22 +39,28 @@ static __inline__ void pcsx_initMsan() { *((volatile char* const)0x1f802089) = 0
static __inline__ void pcsx_resetMsan() { *((volatile char* const)0x1f802089) = 1; }
static __inline__ void* pcsx_msanAlloc(uint32_t size) {
register uint32_t a0 asm("a0") = size;
return *((void* volatile* const)0x1f80208c);
void* ret;
__asm__ volatile("lw %0, 0x208c(%1)" : "=r"(ret) : "r"(0x1f800000), "r"(a0));
return ret;
}
static __inline__ void pcsx_msanFree(void* ptr) { *((void* volatile* const)0x1f80208c) = ptr; }
static __inline__ void* pcsx_msanRealloc(void* ptr, uint32_t size) {
register void* a0 asm("a0") = ptr;
register uint32_t a1 asm("a1") = size;
return *((void* volatile* const)0x1f802090);
void* ret;
__asm__ volatile("lw %0, 0x2090(%1)" : "=r"(ret) : "r"(0x1f800000), "r"(a0), "r"(a1));
return ret;
}
static __inline__ void pcsx_msanSetChainPtr(void* headerAddr, void* ptrToNext, uint32_t wordCount) {
register void* a0 asm("a0") = ptrToNext;
register uint32_t a1 asm("a1") = wordCount;
*((void* volatile* const)0x1f802094) = headerAddr;
__asm__ volatile("sw %0, 0x2094(%1)" : : "r"(a0), "r"(0x1f800000), "r"(a1));
}
static __inline__ void* pcsx_msanGetChainPtr(void* headerAddr) {
register void* a0 asm("a0") = headerAddr;
return *((void* volatile* const)0x1f802094);
void* ret;
__asm__ volatile("lw %0, 0x2094(%1)" : "=r"(ret) : "r"(0x1f800000), "r"(a0));
return ret;
}
static __inline__ int pcsx_present() { return *((volatile uint32_t* const)0x1f802080) == 0x58534350; }
+2 -2
View File
@@ -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,
+7 -7
View File
@@ -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,
};
+2 -2
View File
@@ -34,8 +34,8 @@ int cdromRead(int count, void *buffer, uint32_t mode);
int cdromSetMode(uint32_t mode);
int cdromIOVerifier();
int cdromDMAVerifier();
void cdromIOHandler();
void cdromDMAHandler();
void cdromIOHandler(int v);
void cdromDMAHandler(int v);
void getLastCDRomError(uint8_t *err1, uint8_t *err2);
int cdromInnerInit();
enum AutoAckType {
+1 -1
View File
@@ -29,7 +29,7 @@ SOFTWARE.
#include <stdint.h>
void GPU_dw(unsigned x, unsigned y, unsigned w, unsigned h, const void* src);
void GPU_mem2vram();
void GPU_mem2vram(unsigned x, unsigned y, unsigned w, unsigned h, const void* src);
void GPU_send(uint32_t cmd);
int GPU_cw(uint32_t cmd);
void GPU_cwb(uint32_t* cmds, int count);
+15 -15
View File
@@ -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,
};
+3 -2
View File
@@ -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
+66 -31
View File
@@ -34,6 +34,7 @@ SOFTWARE.
#include "common/psxlibc/ucontext.h"
#include "common/syscalls/syscalls.h"
#include "psyqo/kernel.hh"
namespace psyqo {
@@ -43,7 +44,7 @@ namespace psyqo {
* @details C++20 introduced the concept of coroutines in the language. This
* type can be used to properly hold a coroutine and yield and resume it
* within psyqo. An important caveat of using coroutines is that the language
* insist on calling `new` and `delete` silently within the coroutine object.
* insists on calling `new` and `delete` silently within the coroutine object.
* This may be a problem for users who don't want to use the heap.
*
* @tparam T The type the coroutine returns. `void` by default.
@@ -55,16 +56,50 @@ struct Coroutine {
typedef typename std::conditional<std::is_void<T>::value, Empty, T>::type SafeT;
Coroutine() = default;
Coroutine(Coroutine &&other) = default;
Coroutine &operator=(Coroutine &&other) = default;
Coroutine(Coroutine &&other) {
if (m_handle) m_handle.destroy();
m_handle = nullptr;
m_handle = other.m_handle;
m_value = eastl::move(other.m_value);
m_suspended = other.m_suspended;
m_earlyResume = other.m_earlyResume;
other.m_handle = nullptr;
other.m_value = SafeT{};
other.m_suspended = true;
other.m_earlyResume = false;
}
Coroutine &operator=(Coroutine &&other) {
if (this != &other) {
if (m_handle) m_handle.destroy();
m_handle = nullptr;
m_handle = other.m_handle;
m_value = eastl::move(other.m_value);
m_suspended = other.m_suspended;
m_earlyResume = other.m_earlyResume;
other.m_handle = nullptr;
other.m_value = SafeT{};
other.m_suspended = true;
other.m_earlyResume = false;
}
return *this;
}
Coroutine(Coroutine const &) = delete;
Coroutine &operator=(Coroutine const &) = delete;
~Coroutine() {
if (m_handle) m_handle.destroy();
m_handle = nullptr;
}
/**
* @brief The awaiter type.
*
* @details The awaiter type is the type that is used to suspend the coroutine
* after scheduling an asychronous operation. The keyword `co_await` can be used
* after scheduling an asynchronous operation. The keyword `co_await` can be used
* on an instance of the object to suspend the current coroutine. Creating an
* instance of this object is done by calling `coroutine.awaiter()`.
*/
@@ -158,16 +193,15 @@ struct Coroutine {
std::suspend_always final_suspend() noexcept { return {}; }
void unhandled_exception() {}
void return_void() {
auto awaitingCoroutine = m_awaitingCoroutine;
if (awaitingCoroutine) {
// This doesn't feel right, but I don't know how to do it otherwise,
// since the coroutine is a template and I can't forward the type.
__builtin_coro_resume(awaitingCoroutine);
if (m_awaitingCoroutine) {
Kernel::queueCallback([h = m_awaitingCoroutine]() { h.resume(); });
m_awaitingCoroutine = nullptr;
}
}
[[no_unique_address]] Empty m_value;
void *m_awaitingCoroutine = nullptr;
std::coroutine_handle<> m_awaitingCoroutine;
};
struct PromiseValue {
Coroutine<T> get_return_object() {
return Coroutine{eastl::move(std::coroutine_handle<Promise>::from_promise(*this))};
@@ -177,21 +211,21 @@ struct Coroutine {
void unhandled_exception() {}
void return_value(T &&value) {
m_value = eastl::move(value);
auto awaitingCoroutine = m_awaitingCoroutine;
if (awaitingCoroutine) {
// This doesn't feel right, but I don't know how to do it otherwise,
// since the coroutine is a template and I can't forward the type.
__builtin_coro_resume(awaitingCoroutine);
if (m_awaitingCoroutine) {
Kernel::queueCallback([h = m_awaitingCoroutine]() { h.resume(); });
m_awaitingCoroutine = nullptr;
}
}
T m_value;
void *m_awaitingCoroutine = nullptr;
std::coroutine_handle<> m_awaitingCoroutine;
};
typedef typename std::conditional<std::is_void<T>::value, PromiseVoid, PromiseValue>::type Promise;
Coroutine(std::coroutine_handle<Promise> &&handle) : m_handle(eastl::move(handle)) {}
std::coroutine_handle<Promise> m_handle;
[[no_unique_address]] SafeT m_value;
void *m_awaitingCoroutine = nullptr;
bool m_suspended = true;
bool m_earlyResume = false;
@@ -201,31 +235,32 @@ struct Coroutine {
constexpr bool await_ready() { return m_handle.done(); }
template <typename U>
constexpr void await_suspend(std::coroutine_handle<U> h) {
auto &promise = m_handle.promise();
promise.m_awaitingCoroutine = h.address();
m_handle.promise().m_awaitingCoroutine = h;
resume();
}
constexpr SafeT await_resume() {
SafeT value = eastl::move(m_handle.promise().m_value);
m_handle.destroy();
return value;
constexpr T await_resume() {
if constexpr (std::is_void<T>::value) {
return;
} else {
return eastl::move(m_handle.promise().m_value);
}
}
};
class StackfulBase {
protected:
void initializeInternal(eastl::function<void()>&& func, void* ss_sp, unsigned ss_size);
void initializeInternal(eastl::function<void()> &&func, void *ss_sp, unsigned ss_size);
void resume();
void yield();
[[nodiscard]] bool isAlive() const { return m_isAlive; }
StackfulBase() = default;
StackfulBase(const StackfulBase&) = delete;
StackfulBase& operator=(const StackfulBase&) = delete;
StackfulBase(const StackfulBase &) = delete;
StackfulBase &operator=(const StackfulBase &) = delete;
private:
static void trampoline(void* arg) {
StackfulBase* self = static_cast<StackfulBase*>(arg);
static void trampoline(void *arg) {
StackfulBase *self = static_cast<StackfulBase *>(arg);
self->trampoline();
}
void trampoline();
@@ -254,8 +289,8 @@ class Stackful : public StackfulBase {
static constexpr unsigned c_stackSize = (StackSize + 7) & ~7;
Stackful() = default;
Stackful(const Stackful&) = delete;
Stackful& operator=(const Stackful&) = delete;
Stackful(const Stackful &) = delete;
Stackful &operator=(const Stackful &) = delete;
/**
* @brief Initialize the coroutine with a function and an argument.
@@ -263,7 +298,7 @@ class Stackful : public StackfulBase {
* @param func Function to be executed by the coroutine.
* @param arg Argument to be passed to the function.
*/
void initialize(eastl::function<void()>&& func) {
void initialize(eastl::function<void()> &&func) {
initializeInternal(eastl::move(func), m_stack.data, c_stackSize);
}
+7
View File
@@ -0,0 +1,7 @@
## See Also
The following list contains community-made examples which have made use of various aspects of psyqo.
| Example | Author | Description
| :--- | :--- | :---
| [psyqo-cdrom-cube](https://github.com/Forceh91/psyqo-cdrom-cube) | [Forceh91](https://github.com/forceh91) | This example attempts to give a real-world example of loading a model off of the CD-ROM for rendering
+1 -2
View File
@@ -62,8 +62,7 @@ PCSXLuaScene pcsxLuaScene;
void pcsxRegisterVariable(void* address, const char* name) {
register void* a0 asm("a0") = address;
register const char* a1 asm("a1") = name;
__asm__ volatile("" : : "r"(a0), "r"(a1));
*((volatile uint8_t* const)0x1f802081) = 255;
__asm__ volatile("sw %0, 0x2081(%1)" : : "r"(255), "r"(0x1f800000), "r"(a0), "r"(a1));
}
} // namespace
+1 -1
View File
@@ -172,7 +172,7 @@ class FixedPoint {
return U((value - scale / 2) / scale);
}
}
return U(value + scale / 2) / U(scale);
return U((value + scale / 2) / scale);
}
/**
+2 -1
View File
@@ -165,6 +165,7 @@ struct TPageLoc {
}
private:
TPageLoc(uint8_t i) : info(i) {}
uint8_t info = 0;
friend struct TPageAttr;
};
@@ -246,7 +247,7 @@ struct TPageAttr {
}
uint8_t getPageX() const { return info & 0x000f; }
uint8_t getPageY() const { return (info >> 4) & 0x0001; }
uint8_t getPageLoc() const { return info & 0x001f; }
TPageLoc getPageLoc() const { return TPageLoc(info & 0x001f); }
Prim::TPageAttr::SemiTrans getSemiTrans() const {
return static_cast<Prim::TPageAttr::SemiTrans>((info >> 5) & 0x0003);
}
+65 -60
View File
@@ -64,82 +64,87 @@ void psyqo::CDRomDevice::ActionBase::queueCallbackFromISR(bool success) {
}
void psyqo::CDRomDevice::irq() {
Kernel::assert(m_action != nullptr, "CDRomDevice::irq() called with no action - spurious interrupt?");
uint8_t cause = Hardware::CDRom::Cause;
bool ranOnce = false;
while (true) {
uint8_t cause = Hardware::CDRom::Cause;
if (ranOnce && ((cause & 15) == 0)) break;
ranOnce = true;
Kernel::assert(m_action != nullptr, "CDRomDevice::irq() called with no action - spurious interrupt?");
if (cause & 7) {
Hardware::CDRom::Cause = 7;
}
if (cause & 7) {
Hardware::CDRom::Cause = 7;
}
if (cause & 0x18) {
Hardware::CDRom::Cause = 0x18;
}
if (cause & 0x18) {
Hardware::CDRom::Cause = 0x18;
}
bool callCallback = false;
Response response;
while ((Hardware::CDRom::Ctrl.access() & 0x20) && (response.size() < 16)) {
response.push_back(Hardware::CDRom::Response);
}
bool callCallback = false;
Response response;
while ((Hardware::CDRom::Ctrl.access() & 0x20) && (response.size() < 16)) {
response.push_back(Hardware::CDRom::Response);
}
#ifdef DEBUG_CDROM_RESPONSES
if (m_blocking) {
ramsyscall_printf("Got CD-Rom response:");
for (auto byte : response) {
ramsyscall_printf(" %02x", byte);
}
syscall_puts("\n");
} else {
Kernel::queueCallbackFromISR([response]() {
if (m_blocking) {
ramsyscall_printf("Got CD-Rom response:");
for (auto byte : response) {
ramsyscall_printf(" %02x", byte);
}
syscall_puts("\n");
});
}
#endif
switch (cause & 7) {
case 1:
callCallback = m_action->dataReady(response);
break;
case 2:
callCallback = m_action->complete(response);
break;
case 3:
callCallback = m_action->acknowledge(response);
break;
case 4:
callCallback = m_action->end(response);
break;
case 5: {
m_success = false;
callCallback = true;
#ifdef DEBUG_CDROM_ERRORS
m_callback = [callback = eastl::move(m_callback), name = m_action->name(),
response = eastl::move(response)](bool) {
ramsyscall_printf("Got CD-Rom error during action %s:", name);
} else {
Kernel::queueCallbackFromISR([response]() {
ramsyscall_printf("Got CD-Rom response:");
for (auto byte : response) {
ramsyscall_printf(" %02x", byte);
}
syscall_puts("\n");
callback(false);
};
});
}
#endif
} break;
default:
Kernel::abort("CDRomDevice::irq() invoked with unknown cause");
break;
}
if (callCallback) {
Kernel::assert(!!m_callback, "Wrong CDRomDevice state");
m_action = nullptr;
if (m_blocking) {
actionComplete();
} else {
eastl::atomic_signal_fence(eastl::memory_order_acquire);
Kernel::queueCallbackFromISR([this]() { actionComplete(); });
switch (cause & 7) {
case 1:
callCallback = m_action->dataReady(response);
break;
case 2:
callCallback = m_action->complete(response);
break;
case 3:
callCallback = m_action->acknowledge(response);
break;
case 4:
callCallback = m_action->end(response);
break;
case 5: {
m_success = false;
callCallback = true;
#ifdef DEBUG_CDROM_ERRORS
m_callback = [callback = eastl::move(m_callback), name = m_action->name(),
response = eastl::move(response)](bool) {
ramsyscall_printf("Got CD-Rom error during action %s:", name);
for (auto byte : response) {
ramsyscall_printf(" %02x", byte);
}
syscall_puts("\n");
callback(false);
};
#endif
} break;
default:
Kernel::abort("CDRomDevice::irq() invoked with unknown cause");
break;
}
if (callCallback) {
Kernel::assert(!!m_callback, "Wrong CDRomDevice state");
m_action = nullptr;
if (m_blocking) {
actionComplete();
} else {
eastl::atomic_signal_fence(eastl::memory_order_acquire);
Kernel::queueCallbackFromISR([this]() { actionComplete(); });
}
}
}
}
+3 -13
View File
@@ -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;
+22 -6
View File
@@ -29,17 +29,33 @@ SOFTWARE.
#include <any>
#include <functional>
#include <memory>
#include <typeindex>
#include <typeinfo>
#include <utility>
#include "support/hashtable.h"
#include "support/list.h"
#if defined(_CPPRTTI) || defined(__GXX_RTTI) || defined(__cpp_rtti)
#define PCSX_RTTI 1
#include <typeindex>
#include <typeinfo>
#define PCSX_HASH_TYPE(type) typeid(type).hash_code()
#else
#define PCSX_RTTI 0
#define CTTI_HAS_ENUM_AWARE_PRETTY_FUNCTION 1
#include "ctti/type_id.hpp"
#define PCSX_HASH_TYPE(type) ctti::unnamed_type_id<type>().hash()
#endif
namespace PCSX {
namespace EventBus {
#if PCSX_RTTI
typedef std::size_t HashType;
#else
typedef std::uint64_t HashType;
#endif
struct ListenerElementBaseEventBusList {};
struct ListenerElementBase;
typedef PCSX::Intrusive::List<ListenerElementBase> ListenerBaseListType;
@@ -70,7 +86,7 @@ class Listener {
};
struct ListenerElementsHashTableList;
typedef PCSX::Intrusive::HashTable<std::size_t, ListenerElementsHashTableList> ListenersHashTable;
typedef PCSX::Intrusive::HashTable<HashType, ListenerElementsHashTableList> ListenersHashTable;
struct ListenerElementsHashTableList : public ListenersHashTable::Node {
~ListenerElementsHashTableList() { list.destroyAll(); }
ListenerBaseEventBusList list;
@@ -82,7 +98,7 @@ class EventBus {
template <typename Event>
void signal(const Event& event) {
using Functor = typename ListenerElement<Event>::Functor;
auto list = m_table.find(typeid(Event).hash_code());
auto list = m_table.find(PCSX_HASH_TYPE(Event));
if (list == m_table.end()) return;
for (auto& listener : list->list) {
std::any cb = listener.getCB();
@@ -92,7 +108,7 @@ class EventBus {
}
private:
void listen(std::size_t id, ListenerElementBase* listenerElement) {
void listen(HashType id, ListenerElementBase* listenerElement) {
auto list = m_table.find(id);
if (list == m_table.end()) {
list = m_table.insert(id, new ListenerElementsHashTableList());
@@ -107,7 +123,7 @@ template <typename Event>
void Listener::listen(typename ListenerElement<Event>::Functor&& cb) {
ListenerElement<Event>* element = new ListenerElement(std::move(cb));
m_listeners.push_back(element);
m_bus->listen(typeid(Event).hash_code(), element);
m_bus->listen(PCSX_HASH_TYPE(Event), element);
}
} // namespace EventBus
+5 -2
View File
@@ -37,11 +37,11 @@ bool PCSX::SharedMem::init(const char* id, size_t size, bool initToZero) {
// Try to create a shared memory mapping, if an id is provided
if (id != nullptr) {
// Build the full name to share as
std::string fullname = getSharedName(id, static_cast<uint32_t>(GetCurrentProcessId()));
m_sharedName = getSharedName(id, static_cast<uint32_t>(GetCurrentProcessId()));
// Create the memory mapping handle
m_fileHandle =
CreateFileMappingA(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, static_cast<uint32_t>(size >> 32),
static_cast<uint32_t>(size), fullname.c_str());
static_cast<uint32_t>(size), m_sharedName.c_str());
if (m_fileHandle != INVALID_HANDLE_VALUE) {
// Create a view of the memory mapping at 0 offset
void* basePointer = MapViewOfFileEx(m_fileHandle, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, size, nullptr);
@@ -56,9 +56,11 @@ bool PCSX::SharedMem::init(const char* id, size_t size, bool initToZero) {
} else {
CloseHandle(m_fileHandle);
m_fileHandle = nullptr;
m_sharedName.clear();
}
} else {
m_fileHandle = nullptr;
m_sharedName.clear();
}
}
// Alloc memory directly if we opted out or had problems creating the memory map
@@ -76,6 +78,7 @@ PCSX::SharedMem::~SharedMem() {
m_mem = nullptr;
CloseHandle(m_fileHandle);
m_fileHandle = nullptr;
m_sharedName.clear();
} else {
free(m_mem);
}
+2
View File
@@ -49,6 +49,8 @@ class SharedMem {
uint8_t* getPtr() { return m_mem; }
size_t getSize() { return m_size; }
const std::string& getSharedName() { return m_sharedName; }
private:
std::string getSharedName(const char* id, uint32_t pid);
+9 -2
View File
@@ -26,6 +26,7 @@ SOFTWARE.
#ifdef __linux__
#include <filesystem>
#include <stdlib.h>
#include "fmt/format.h"
@@ -41,7 +42,7 @@ bool PCSX::Update::applyUpdate(const std::filesystem::path& binDir) {
ZipArchive zip(m_download);
if (zip.failed()) return false;
std::string filename;
std::filesystem::path filename;
zip.listAllFiles([&zip, &filename, &tmp](std::string_view name) {
IO<File> out(new UvFile(tmp / name, FileOps::TRUNCATE));
@@ -51,10 +52,16 @@ bool PCSX::Update::applyUpdate(const std::filesystem::path& binDir) {
filename = out->filename();
});
std::filesystem::permissions(filename,
std::filesystem::perms::owner_all | std::filesystem::perms::group_exec |
std::filesystem::perms::group_read | std::filesystem::perms::others_exec |
std::filesystem::perms::others_read,
std::filesystem::perm_options::replace);
std::string cmd = fmt::format(
"dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call "
"/org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:\"file://{}\" string:\"\"",
filename);
filename.string());
system(cmd.c_str());
return true;
+1 -1
View File
@@ -27,7 +27,7 @@ The tool takes a json file as input, which can have the following structure:
"application_id": "MY_APP_ID",
"copyright": "MY_COPYRIGHT",
"abstract": "MY_ABSTRACT",
"bibliographic": "MY_BIBLIOGRAPHIC",
"bibliographic": "MY_BIBLIOGRAPHIC"
}
}
```
+19 -9
View File
@@ -96,6 +96,7 @@ int main(int argc, char** argv) {
const auto inputs = args.positional();
const auto license = args.get<std::string>("license");
const bool asksForHelp = !!args.get<bool>("h");
const bool quiet = !!args.get<bool>("q");
const bool hasOutput = output.has_value();
const bool hasExactlyOneInput = inputs.size() == 1;
@@ -107,6 +108,7 @@ Usage: {} input.json [-h] -o output.bin
-basedir path optional: base directory for the input files.
-license file optional: use this license file.
-threads count optional: number of threads to use for compression.
-q optional: only print errors.
-h displays this help information and exit.
)",
argv[0]);
@@ -199,7 +201,9 @@ Usage: {} input.json [-h] -o output.bin
fmt::print("Too many files specified ({}), max allowed is {}\n", filesCount, c_maximumSectorCount);
return -1;
}
fmt::print("Index size: {}\n", indexSectorsCount * 2048);
if (!quiet) {
fmt::print("Index size: {}\n", indexSectorsCount * 2048);
}
PCSX::PS1Packer::Options options;
options.booty = false;
@@ -219,8 +223,10 @@ Usage: {} input.json [-h] -o output.bin
fmt::print("Executable size is not a multiple of 2048\n");
return -1;
}
fmt::print("Executable size: {}\n", compressedExecutable->size());
fmt::print("Executable location: {}\n", 23 + indexSectorsCount);
if (!quiet) {
fmt::print("Executable size: {}\n", compressedExecutable->size());
fmt::print("Executable location: {}\n", 23 + indexSectorsCount);
}
const unsigned executableSectorsCount = compressedExecutable->size() / 2048;
unsigned currentSector = 23 + indexSectorsCount;
@@ -356,11 +362,13 @@ Usage: {} input.json [-h] -o output.bin
return -1;
}
IndexEntry* entry = &indexEntryData[workUnitIndex];
fmt::print("Processed file: {}\n", workUnit.fileInfo["path"].get<std::string>());
fmt::print(" Original size: {}\n", entry->getDecompSize());
fmt::print(" Compressed size: {}\n", entry->getCompressedSize() * 2048);
fmt::print(" Compression method: {}\n", static_cast<uint32_t>(entry->getCompressionMethod()));
fmt::print(" Sector offset: {}\n", currentSector);
if (!quiet) {
fmt::print("Processed file: {}\n", workUnit.fileInfo["path"].get<std::string>());
fmt::print(" Original size: {}\n", entry->getDecompSize());
fmt::print(" Compressed size: {}\n", entry->getCompressedSize() * 2048);
fmt::print(" Compression method: {}\n", static_cast<uint32_t>(entry->getCompressionMethod()));
fmt::print(" Sector offset: {}\n", currentSector);
}
entry->setSectorOffset(currentSector);
unsigned sectorCount = entry->getCompressedSize();
for (unsigned sector = 0; sector < sectorCount; sector++) {
@@ -370,7 +378,9 @@ Usage: {} input.json [-h] -o output.bin
}
}
fmt::print("Processed {} files.\n", filesCount);
if (!quiet) {
fmt::print("Processed {} files.\n", filesCount);
}
uint8_t empty[2048] = {0};
for (unsigned i = 0; i < 150; i++) {
+15 -11
View File
@@ -36,21 +36,25 @@ RUN apt install -y xvfb
RUN apt install -y python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace
RUN apt install -y glibc-tools lcov
RUN apt install -y file
WORKDIR /tmp
RUN wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage && \
chmod +x /tmp/appimagetool-x86_64.AppImage && \
cd /opt && /tmp/appimagetool-x86_64.AppImage --appimage-extract && \
mv squashfs-root appimage-tool.AppDir && \
ln -s /opt/appimage-tool.AppDir/AppRun /usr/bin/appimagetool && \
rm /tmp/appimagetool-x86_64.AppImage
WORKDIR /
RUN pip3 install --break-system-packages appimage-builder pydpkg
COPY appimage-dpkg.patch /appimage-dpkg.patch
RUN patch -p 1 < appimage-dpkg.patch
# AppImage dependencies
RUN apt install -y libfuse2t64
RUN apt install -y fuse
# AppImage tools
RUN apt install -y imagemagick-6.q16 gtk-update-icon-cache appstream
RUN apt install -y squashfs-tools zip zsync
WORKDIR /tmp
RUN wget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage && \
chmod +x appimagetool-x86_64.AppImage && \
mv appimagetool-x86_64.AppImage /usr/bin/appimagetool
RUN wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage && \
chmod +x linuxdeploy-x86_64.AppImage && \
mv linuxdeploy-x86_64.AppImage /usr/bin/linuxdeploy
RUN mkdir /project
RUN mkdir -p /home/coder/dconf
RUN chmod a+rwx /home/coder/dconf
WORKDIR /project
-22
View File
@@ -1,22 +0,0 @@
diff --git a/appimagebuilder/modules/deploy/apt/package.py b/appimagebuilder/modules/deploy/apt/package.py
index 792a724d..6b59d3a3 100644
--- a/usr/local/lib/python3.12/dist-packages/appimagebuilder/modules/deploy/apt/package.py
+++ b/usr/local/lib/python3.12/dist-packages/appimagebuilder/modules/deploy/apt/package.py
@@ -13,7 +13,7 @@
import urllib
from pathlib import Path
-from packaging import version
+from pydpkg import Dpkg
class Package:
@@ -76,7 +76,7 @@ def __str__(self):
def __gt__(self, other):
if isinstance(other, Package):
- return version.parse(self.version) > version.parse(other.version)
+ return Dpkg.compare_versions(self.version, other.version) > 0
def __hash__(self):
return self.__str__().__hash__()
+6 -6
View File
@@ -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
+49 -3
View File
@@ -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 @@ class MipselNoneElfBinutils < Formula
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
+49 -3
View File
@@ -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 @@ class MipselNoneElfGcc < Formula
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 <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
+3 -3
View File
@@ -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
+52
View File
@@ -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
-# 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
@@ -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 @@ class MipselNoneElfBinutils < Formula
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
@@ -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 @@ class MipselNoneElfGcc < Formula
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 <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
@@ -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
+16 -16
View File
@@ -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) => {
+9 -9
View File
@@ -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
+18 -18
View File
@@ -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'