Fix: nintendoswitch compilation (#21368)

* Fix: make nintendoswitch someGcc, remove symlink support for nintendoswitch, add getAppFilename for nintendoswitch

* Fix: use getApplHeuristic on nintendoswitch
This commit is contained in:
Dmitry Arkhipenko 2023-02-25 13:47:19 +03:00 • committed by GitHub
commit b2edfe7a02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 5 deletions

View file

@ -584,7 +584,8 @@ proc pread*(a1: cint, a2: pointer, a3: int, a4: Off): int {.
proc pwrite*(a1: cint, a2: pointer, a3: int, a4: Off): int {. proc pwrite*(a1: cint, a2: pointer, a3: int, a4: Off): int {.
importc, header: "<unistd.h>".} importc, header: "<unistd.h>".}
proc read*(a1: cint, a2: pointer, a3: int): int {.importc, header: "<unistd.h>".} proc read*(a1: cint, a2: pointer, a3: int): int {.importc, header: "<unistd.h>".}
proc readlink*(a1, a2: cstring, a3: int): int {.importc, header: "<unistd.h>".} when not defined(nintendoswitch):
proc readlink*(a1, a2: cstring, a3: int): int {.importc, header: "<unistd.h>".}
proc ioctl*(f: FileHandle, device: uint): int {.importc: "ioctl", proc ioctl*(f: FileHandle, device: uint): int {.importc: "ioctl",
header: "<sys/ioctl.h>", varargs, tags: [WriteIOEffect].} header: "<sys/ioctl.h>", varargs, tags: [WriteIOEffect].}
## A system call for device-specific input/output operations and other ## A system call for device-specific input/output operations and other
@ -603,7 +604,10 @@ proc setsid*(): Pid {.importc, header: "<unistd.h>".}
proc setuid*(a1: Uid): cint {.importc, header: "<unistd.h>".} proc setuid*(a1: Uid): cint {.importc, header: "<unistd.h>".}
proc sleep*(a1: cint): cint {.importc, header: "<unistd.h>".} proc sleep*(a1: cint): cint {.importc, header: "<unistd.h>".}
proc swab*(a1, a2: pointer, a3: int) {.importc, header: "<unistd.h>".} proc swab*(a1, a2: pointer, a3: int) {.importc, header: "<unistd.h>".}
proc symlink*(a1, a2: cstring): cint {.importc, header: "<unistd.h>".} when not defined(nintendoswitch):
proc symlink*(a1, a2: cstring): cint {.importc, header: "<unistd.h>".}
else:
proc symlink*(a1, a2: cstring): cint = -1
proc sync*() {.importc, header: "<unistd.h>".} proc sync*() {.importc, header: "<unistd.h>".}
proc sysconf*(a1: cint): int {.importc, header: "<unistd.h>".} proc sysconf*(a1: cint): int {.importc, header: "<unistd.h>".}
proc tcgetpgrp*(a1: cint): Pid {.importc, header: "<unistd.h>".} proc tcgetpgrp*(a1: cint): Pid {.importc, header: "<unistd.h>".}

View file

@ -254,7 +254,7 @@ proc findExe*(exe: string, followSymlinks: bool = true;
for ext in extensions: for ext in extensions:
var x = addFileExt(x, ext) var x = addFileExt(x, ext)
if fileExists(x): if fileExists(x):
when not defined(windows): when not (defined(windows) or defined(nintendoswitch)):
while followSymlinks: # doubles as if here while followSymlinks: # doubles as if here
if x.symlinkExists: if x.symlinkExists:
var r = newString(maxSymlinkLen) var r = newString(maxSymlinkLen)
@ -702,6 +702,8 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [ReadIOEffect], noW
result = getApplHaiku() result = getApplHaiku()
elif defined(openbsd): elif defined(openbsd):
result = getApplOpenBsd() result = getApplOpenBsd()
elif defined(nintendoswitch):
result = ""
# little heuristic that may work on other POSIX-like systems: # little heuristic that may work on other POSIX-like systems:
if result.len == 0: if result.len == 0:

View file

@ -67,7 +67,7 @@ proc expandSymlink*(symlinkPath: string): string {.noWeirdTarget.} =
## ##
## See also: ## See also:
## * `createSymlink proc`_ ## * `createSymlink proc`_
when defined(windows): when defined(windows) or defined(nintendoswitch):
result = symlinkPath result = symlinkPath
else: else:
result = newString(maxSymlinkLen) result = newString(maxSymlinkLen)

View file

@ -15,7 +15,7 @@ when defined(nimPreviewSlimSystem):
const const
hasThreadSupport = compileOption("threads") and not defined(nimscript) hasThreadSupport = compileOption("threads") and not defined(nimscript)
const someGcc = defined(gcc) or defined(llvm_gcc) or defined(clang) const someGcc = defined(gcc) or defined(llvm_gcc) or defined(clang) or defined(nintendoswitch)
const someVcc = defined(vcc) or defined(clang_cl) const someVcc = defined(vcc) or defined(clang_cl)
type type