Update Nim to 0.18.0

Fix #2804
This commit is contained in:
Emery Hemingway 2018-05-03 09:56:27 +02:00 committed by Christian Helmuth
parent f78d856b37
commit 51722c1fe6
8 changed files with 70 additions and 46 deletions

View File

@ -1 +0,0 @@
83abcf5efae001cbe80d473b18d8e5314f1e1500

View File

@ -1,11 +0,0 @@
LICENSE := MIT
VERSION := 0.17.2
DOWNLOADS := nim-csources.archive
OWNER = nim-lang
REPO = csources
REV = 08c310bb8277611711ca06619526ec08f1feffaf
URL(nim-csources) := https://github.com/$(OWNER)/$(REPO)/archive/$(REV).tar.gz
SHA(nim-csources) := 659cbaf6081ede035342dbb05c70fd9184d1446b
DIR(nim-csources) := .

View File

@ -1 +1 @@
4a41139874bbb2040edacd4b4243526024a5d8d2
c66ded577d94199d842f558d532789e4099c0481

View File

@ -1,11 +1,10 @@
LICENSE := MIT
VERSION := 0.17.2
VERSION := 0.18.0
DOWNLOADS := nim.archive
OWNER := ehmry
REPO := nim
REV := 72df699c3eecf7fa1cf94c02fa460e70d5569ff4
URL(nim) := https://github.com/$(OWNER)/$(REPO)/archive/$(REV).tar.gz
SHA(nim) := 224dabf62a3355c305b9d81682b6cead218cc2d8
URL(nim) := https://nim-lang.org/download/nim-$(VERSION).tar.xz
SHA(nim) := 45c74adb35f08dfa9add1112ae17330e5d902ebb4a36e7046caee8b79e6f3bd0
DIR(nim) := .
PATCHES := $(wildcard $(REP_DIR)/src/app/nim/*.patch)
PATCH_OPT := -p1

View File

@ -0,0 +1,17 @@
diff --git a/config/nim.cfg b/config/nim.cfg
index a2a774b23..a664e3e7b 100644
--- a/config/nim.cfg
+++ b/config/nim.cfg
@@ -243,3 +243,12 @@ vcc.cpp.options.size = "/O1"
# Configuration for the Tiny C Compiler:
tcc.options.always = "-w"
+
+# Configuration for Genode toolchain
+amd64.genode.gcc.path = "/usr/local/genode-gcc/bin"
+amd64.genode.gcc.exe = "genode-x86-gcc"
+amd64.genode.gcc.cpp.exe = "genode-x86-g++"
+
+arm.genode.gcc.path = "/usr/local/genode-gcc/bin"
+arm.genode.gcc.exe = "genode-arm-gcc"
+arm.genode.gcc.cpp.exe = "genode-arm-g++"

View File

@ -0,0 +1,35 @@
commit 90f5e157c7f8edabcc625ee96e9db157da955d47
Author: Emery Hemingway <emery@vfemail.net>
Date: Wed May 2 21:29:53 2018 +0200
Disable setTerminate when noCppExceptions is defined
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index ff3e6714d..d838f9b9c 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -265,7 +265,7 @@ proc rdCharLoc(a: TLoc): Rope =
proc genObjectInit(p: BProc, section: TCProcSection, t: PType, a: TLoc,
takeAddr: bool) =
- if p.module.compileToCpp and t.isException:
+ if p.module.compileToCpp and t.isException and not isDefined("noCppExceptions"):
# init vtable in Exception object for polymorphic exceptions
includeHeader(p.module, "<new>")
linefmt(p, section, "new ($1) $2;$n", rdLoc(a), getTypeDesc(p.module, t))
diff --git a/lib/system.nim b/lib/system.nim
index 5c0970f85..49f2a29bf 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -4172,8 +4172,9 @@ template doAssertRaises*(exception, code: untyped): typed =
if wrong:
raiseAssert(astToStr(exception) & " wasn't raised by:\n" & astToStr(code))
-when defined(cpp) and appType != "lib" and not defined(js) and
- not defined(nimscript) and hostOS != "standalone":
+when defined(cpp) and appType != "lib" and
+ not defined(js) and not defined(nimscript) and
+ hostOS != "standalone" and not defined(noCppExceptions):
proc setTerminate(handler: proc() {.noconv.})
{.importc: "std::set_terminate", header: "<exception>".}
setTerminate proc() {.noconv.} =

View File

@ -103,9 +103,6 @@ suite "time":
echo "An hour from now : ", getLocalTime(getTime()) + 1.hours
echo "An hour from (UTC) now: ", getGmTime(getTime()) + initInterval(0,0,0,1)
test "getTime":
assert(getTime() != 0.Time)
suite "garbage collector":
echo GC_getStatistics()

View File

@ -15,7 +15,7 @@ help:
@$(ECHO) "install - copy Nim compiler and standard library to '$(INSTALL_LOCATION)'"
@$(ECHO)
.PHONY: build help install
.PHONY: help install
GENODE_DIR ?= $(realpath $(dir $(firstword $(MAKEFILE_LIST)))/..)
include $(GENODE_DIR)/tool/ports/mk/common.inc
@ -24,31 +24,31 @@ LOCAL_INSTALL_LOCATION ?= /usr/local
INSTALL_LOCATION := $(LOCAL_INSTALL_LOCATION)/genode-nim
NIM_CONTRIB_DIR = $(shell $(GENODE_DIR)/tool/ports/current nim)
NIM_CSOURCES_CONTRIB_DIR = $(shell $(GENODE_DIR)/tool/ports/current nim-csources)
BUILD_DIR = build/nim
install: build
@$(ECHO) "$(BRIGHT_COL)installing Nim to '$(INSTALL_LOCATION)'...$(DEFAULT_COL)"
$(VERBOSE)sudo rm -rf $(INSTALL_LOCATION)
$(VERBOSE)sudo mkdir -p $(INSTALL_LOCATION)
$(VERBOSE)sudo cp -a $(BUILD_DIR)/* $(INSTALL_LOCATION)
build: $(BUILD_DIR)/bin/nim $(BUILD_DIR)/koch
$(BUILD_DIR)/bin/nim: $(BUILD_DIR)/koch
@$(ECHO) "$(BRIGHT_COL)building Nim compiler...$(DEFAULT_COL)"
$(VERBOSE)cd $(BUILD_DIR) && ./koch boot -d:release --verbosity:0 --hint[Processing]:off
$(BUILD_DIR)/koch: $(BUILD_DIR)/koch.nim $(BUILD_DIR)/.bootstrap.tag
$(BUILD_DIR)/koch: $(BUILD_DIR)/.bootstrap.tag
@$(ECHO) "$(BRIGHT_COL)building Koch...$(DEFAULT_COL)"
$(VERBOSE)cd $(BUILD_DIR) && ./bin/nim c koch
$(BUILD_DIR)/.bootstrap.tag: $(BUILD_DIR)/csources
$(BUILD_DIR)/.bootstrap.tag: $(BUILD_DIR)/build.sh
@$(ECHO) "$(BRIGHT_COL)building bootstrap compiler...$(DEFAULT_COL)"
$(VERBOSE)cd $(BUILD_DIR)/csources && sh build.sh
$(VERBOSE)cd $(BUILD_DIR) && sh build.sh
@touch $@
$(BUILD_DIR)/csources: $(NIM_CSOURCES_CONTRIB_DIR) $(BUILD_DIR)/koch.nim
@$(ECHO) "$(BRIGHT_COL)copying Nim C sources...$(DEFAULT_COL)"
$(VERBOSE)mkdir -p $@
$(VERBOSE)cp -a $</* $@
$(BUILD_DIR)/koch.nim: $(NIM_CONTRIB_DIR)
$(BUILD_DIR)/build.sh: $(NIM_CONTRIB_DIR)
@$(ECHO) "$(BRIGHT_COL)copying Nim sources...$(DEFAULT_COL)"
$(VERBOSE)mkdir -p $(BUILD_DIR)
$(VERBOSE)cp -a $</* $(BUILD_DIR)
@ -57,17 +57,5 @@ $(NIM_CONTRIB_DIR):
@$(ECHO) "$(BRIGHT_COL)preparing Nim...$(DEFAULT_COL)"
$(VERBOSE)$(GENODE_DIR)/tool/ports/prepare_port nim
$(NIM_CSOURCES_CONTRIB_DIR):
@$(ECHO) "$(BRIGHT_COL)preparing Nim C sources...$(DEFAULT_COL)"
$(VERBOSE)$(GENODE_DIR)/tool/ports/prepare_port nim-csources
copy: build
@$(ECHO) "$(BRIGHT_COL)installing Nim to '$(INSTALL_LOCATION)'...$(DEFAULT_COL)"
$(VERBOSE)rm -r $(BUILD_DIR)/csources
$(VERBOSE)sudo mkdir -p $(INSTALL_LOCATION)
$(VERBOSE)sudo cp -a $(BUILD_DIR)/* $(INSTALL_LOCATION)
install: copy
clean:
$(VERBOSE)rm -rf $(BUILD_DIR)