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
parent 561b01004c
commit 5d315ebcc2
6 changed files with 18 additions and 4 deletions

View File

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

View File

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

View File

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

View File

@@ -20,7 +20,7 @@ type
TSystemOS* = enum # Also add OS in initialization section and alias
# conditionals to condsyms (end of module).
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
osGenode, osJS, osNimVM, osStandalone, osNintendoSwitch, osFreeRTOS, osAny
@@ -105,6 +105,10 @@ const
scriptExt: ".sh", curDir: ".",
exeExt: "", extSep: ".",
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: "/",
objExt: ".o", newLine: "\x0A", pathSep: ":", dirSep: "/",
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,
newp: pointer, newplen: csize_t): cint
{.importc: "sysctl",header: """#include <sys/types.h>
#include <sys/sysctl.h>"""}
#include <sys/sysctl.h>""".}
const
CTL_KERN = 1
KERN_PROC = 14

View File

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