diff --git a/repos/libports/ports/nim-csources.hash b/repos/libports/ports/nim-csources.hash deleted file mode 100644 index 44056728ff..0000000000 --- a/repos/libports/ports/nim-csources.hash +++ /dev/null @@ -1 +0,0 @@ -83abcf5efae001cbe80d473b18d8e5314f1e1500 diff --git a/repos/libports/ports/nim-csources.port b/repos/libports/ports/nim-csources.port deleted file mode 100644 index dd9573c936..0000000000 --- a/repos/libports/ports/nim-csources.port +++ /dev/null @@ -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) := . diff --git a/repos/libports/ports/nim.hash b/repos/libports/ports/nim.hash index 85b4d0e9ae..d1f811a051 100644 --- a/repos/libports/ports/nim.hash +++ b/repos/libports/ports/nim.hash @@ -1 +1 @@ -4a41139874bbb2040edacd4b4243526024a5d8d2 +c66ded577d94199d842f558d532789e4099c0481 diff --git a/repos/libports/ports/nim.port b/repos/libports/ports/nim.port index ba588e7bbd..4a376c0d10 100644 --- a/repos/libports/ports/nim.port +++ b/repos/libports/ports/nim.port @@ -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 diff --git a/repos/libports/src/app/nim/nim.cfg.patch b/repos/libports/src/app/nim/nim.cfg.patch new file mode 100644 index 0000000000..8c51d13f2f --- /dev/null +++ b/repos/libports/src/app/nim/nim.cfg.patch @@ -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++" diff --git a/repos/libports/src/app/nim/noCppExceptions.patch b/repos/libports/src/app/nim/noCppExceptions.patch new file mode 100644 index 0000000000..05a17286f8 --- /dev/null +++ b/repos/libports/src/app/nim/noCppExceptions.patch @@ -0,0 +1,35 @@ +commit 90f5e157c7f8edabcc625ee96e9db157da955d47 +Author: Emery Hemingway +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, "") + 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: "".} + setTerminate proc() {.noconv.} = diff --git a/repos/libports/src/test/nim/main.nim b/repos/libports/src/test/nim/main.nim index 0a79a12fc5..91346de330 100644 --- a/repos/libports/src/test/nim/main.nim +++ b/repos/libports/src/test/nim/main.nim @@ -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() diff --git a/tool/tool_chain_nim b/tool/tool_chain_nim index 7f7b8e7825..ee2271723b 100755 --- a/tool/tool_chain_nim +++ b/tool/tool_chain_nim @@ -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 $