ported Nim to proprietary CrossOS [backport] (#18889)

This commit is contained in:
Andreas Rumpf 2021-09-24 13:24:41 +02:00 • committed by GitHub
commit 5d315ebcc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 4 deletions

View file

@ -74,6 +74,8 @@ _nimBuildCsourcesIfNeeded(){
makeX=gmake makeX=gmake
elif [ "$unamestr" = 'NetBSD' ]; then elif [ "$unamestr" = 'NetBSD' ]; then
makeX=gmake makeX=gmake
elif [ "$unamestr" = 'CROSSOS' ]; then
makeX=gmake
else else
makeX=make makeX=make
fi fi

View file

@ -13,6 +13,7 @@ Platforms: """
netbsd: i386;amd64 netbsd: i386;amd64
openbsd: i386;amd64;arm;arm64 openbsd: i386;amd64;arm;arm64
dragonfly: i386;amd64 dragonfly: i386;amd64
crossos: amd64
haiku: i386;amd64 haiku: i386;amd64
android: i386;arm;arm64 android: i386;arm;arm64
nintendoswitch: arm64 nintendoswitch: arm64

View file

@ -577,11 +577,13 @@ proc isDefined*(conf: ConfigRef; symbol: string): bool =
osQnx, osAtari, osAix, osQnx, osAtari, osAix,
osHaiku, osVxWorks, osSolaris, osNetbsd, osHaiku, osVxWorks, osSolaris, osNetbsd,
osFreebsd, osOpenbsd, osDragonfly, osMacosx, osIos, osFreebsd, osOpenbsd, osDragonfly, osMacosx, osIos,
osAndroid, osNintendoSwitch, osFreeRTOS} osAndroid, osNintendoSwitch, osFreeRTOS, osCrossos}
of "linux": of "linux":
result = conf.target.targetOS in {osLinux, osAndroid} result = conf.target.targetOS in {osLinux, osAndroid}
of "bsd": of "bsd":
result = conf.target.targetOS in {osNetbsd, osFreebsd, osOpenbsd, osDragonfly} result = conf.target.targetOS in {osNetbsd, osFreebsd, osOpenbsd, osDragonfly, osCrossos}
of "freebsd":
result = conf.target.targetOS in {osFreebsd, osCrossos}
of "emulatedthreadvars": of "emulatedthreadvars":
result = platform.OS[conf.target.targetOS].props.contains(ospLacksThreadVars) result = platform.OS[conf.target.targetOS].props.contains(ospLacksThreadVars)
of "msdos": result = conf.target.targetOS == osDos of "msdos": result = conf.target.targetOS == osDos

View file

@ -20,7 +20,7 @@ type
TSystemOS* = enum # Also add OS in initialization section and alias TSystemOS* = enum # Also add OS in initialization section and alias
# conditionals to condsyms (end of module). # conditionals to condsyms (end of module).
osNone, osDos, osWindows, osOs2, osLinux, osMorphos, osSkyos, osSolaris, osNone, osDos, osWindows, osOs2, osLinux, osMorphos, osSkyos, osSolaris,
osIrix, osNetbsd, osFreebsd, osOpenbsd, osDragonfly, osAix, osPalmos, osQnx, osIrix, osNetbsd, osFreebsd, osOpenbsd, osDragonfly, osCrossos, osAix, osPalmos, osQnx,
osAmiga, osAtari, osNetware, osMacos, osMacosx, osIos, osHaiku, osAndroid, osVxWorks osAmiga, osAtari, osNetware, osMacos, osMacosx, osIos, osHaiku, osAndroid, osVxWorks
osGenode, osJS, osNimVM, osStandalone, osNintendoSwitch, osFreeRTOS, osAny osGenode, osJS, osNimVM, osStandalone, osNintendoSwitch, osFreeRTOS, osAny
@ -105,6 +105,10 @@ const
scriptExt: ".sh", curDir: ".", scriptExt: ".sh", curDir: ".",
exeExt: "", extSep: ".", exeExt: "", extSep: ".",
props: {ospNeedsPIC, ospPosix}), props: {ospNeedsPIC, ospPosix}),
(name: "CROSSOS", parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/",
objExt: ".o", newLine: "\x0A", pathSep: ":", dirSep: "/",
scriptExt: ".sh", curDir: ".", exeExt: "", extSep: ".",
props: {ospNeedsPIC, ospPosix}),
(name: "AIX", parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", (name: "AIX", parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/",
objExt: ".o", newLine: "\x0A", pathSep: ":", dirSep: "/", objExt: ".o", newLine: "\x0A", pathSep: ":", dirSep: "/",
scriptExt: ".sh", curDir: ".", exeExt: "", extSep: ".", scriptExt: ".sh", curDir: ".", exeExt: "", extSep: ".",

View file

@ -3007,7 +3007,7 @@ when not weirdTarget and (defined(freebsd) or defined(dragonfly) or defined(netb
proc sysctl(name: ptr cint, namelen: cuint, oldp: pointer, oldplen: ptr csize_t, proc sysctl(name: ptr cint, namelen: cuint, oldp: pointer, oldplen: ptr csize_t,
newp: pointer, newplen: csize_t): cint newp: pointer, newplen: csize_t): cint
{.importc: "sysctl",header: """#include <sys/types.h> {.importc: "sysctl",header: """#include <sys/types.h>
#include <sys/sysctl.h>"""} #include <sys/sysctl.h>""".}
const const
CTL_KERN = 1 CTL_KERN = 1
KERN_PROC = 14 KERN_PROC = 14

View file

@ -109,6 +109,11 @@ case $uos in
CC="clang" CC="clang"
LINK_FLAGS="$LINK_FLAGS -lm" LINK_FLAGS="$LINK_FLAGS -lm"
;; ;;
*crossos* )
myos="crossos"
CC="clang"
LINK_FLAGS="$LINK_FLAGS -lm"
;;
*openbsd* ) *openbsd* )
myos="openbsd" myos="openbsd"
CC="clang" CC="clang"