diff --git a/repos/base/mk/generic.mk b/repos/base/mk/generic.mk index 3f4ef8f422..dbfb663487 100644 --- a/repos/base/mk/generic.mk +++ b/repos/base/mk/generic.mk @@ -102,48 +102,6 @@ CUSTOM_ADA_INCLUDE ?= -I- $(INCLUDES) $(MSG_CONVERT)$@ $(VERBOSE)ar p $< $*.0.o > $@ -# -# Compiling Nim source code -# -ifneq ($(SRC_NIM),) - -ifeq ($(NIM_CPU),) -$(warning NIM_CPU not defined for any of the following SPECS: $(SPECS)) -else - -ifeq ($(wildcard $(NIM)),) -$(error Nim compiler not found at $(NIM), see the 'tool/tool_chain_nim' script) -endif - -NIM_MAKEFILES := $(foreach X,$(SRC_NIM),$(X).mk) - -NIM_ARGS = --compileOnly --os:genode --cpu:$(NIM_CPU) -NIM_ARGS += --verbosity:0 --hint[Processing]:off --nimcache:. -NIM_ARGS += --noCppExceptions -NIM_ARGS += $(foreach DIR,$(foreach REP,$(REPOSITORIES),$(wildcard $(REP)/include/nim)), --path:$(DIR)) -NIM_ARGS += $(NIM_OPT) - -# Generate the C++ sources and compilation info -# -# Unfortunately the existing sources must be purged -# because of comma problems in the JSON recipe -%.nim.mk: %.nim - $(MSG_BUILD)$(basename $@).cpp - $(VERBOSE) rm -f stdlib_*.cpp - $(VERBOSE)$(NIM) compileToCpp $(NIM_ARGS) $< - $(VERBOSE)$(JQ) --raw-output '"SRC_O_NIM +=" + (.link | join(" ")) +"\n" + (.compile | map((.[0] | sub("cpp$$";"o: ") | sub("c$$";"o: ")) + .[0] + "\n\t"+(.[1] | sub("^g\\++";"$$(MSG_COMP)$$@\n\t$$(VERBOSE)$$(NIM_CC)"))) | join("\n"))' < $(basename $(basename $@)).json > $@ - -NIM_CC := $(CXX) $(CXX_DEF) $(CC_CXX_OPT) $(INCLUDES) -D__GENODE__ - -# Parse the generated makefiles --include $(NIM_MAKEFILES) - -# Append the new objects -SRC_O += $(sort $(SRC_O_NIM)) - -endif -endif - # # Assembler files that must be preprocessed are fed to the C compiler. # diff --git a/repos/base/mk/global.mk b/repos/base/mk/global.mk index c7addbf76a..5118ba1324 100644 --- a/repos/base/mk/global.mk +++ b/repos/base/mk/global.mk @@ -54,16 +54,6 @@ GNATMAKE = $(CUSTOM_GNATMAKE) HOST_CC = $(CUSTOM_HOST_CC) ADA_CC = $(CUSTOM_ADA_CC) -# -# Nim toolchain -# -NIM ?= /usr/local/genode-nim/bin/nim - -# -# JSON parsing utility -# -JQ ?= jq - # # Compiler and Linker options # diff --git a/repos/base/mk/spec/arm.mk b/repos/base/mk/spec/arm.mk index 6b320482a6..c2d42ead85 100644 --- a/repos/base/mk/spec/arm.mk +++ b/repos/base/mk/spec/arm.mk @@ -5,8 +5,6 @@ REP_INC_DIR += include/spec/arm SPECS += 32bit -NIM_CPU ?= arm - # # Prevent compiler message # "note: the mangling of 'va_list' has changed in GCC 4.4" diff --git a/repos/base/mk/spec/release.mk b/repos/base/mk/spec/release.mk index ca37a47982..63b1a66bba 100644 --- a/repos/base/mk/spec/release.mk +++ b/repos/base/mk/spec/release.mk @@ -1,2 +1 @@ CC_OPT += -DGENODE_RELEASE -NIM_OPT += -d:release diff --git a/repos/base/mk/spec/x86_32.mk b/repos/base/mk/spec/x86_32.mk index 21a9f1208a..631e04c661 100644 --- a/repos/base/mk/spec/x86_32.mk +++ b/repos/base/mk/spec/x86_32.mk @@ -16,7 +16,5 @@ CC_MARCH ?= -march=i686 -m32 LD_MARCH ?= -melf_i386 AS_MARCH ?= -march=i686 --32 -NIM_CPU ?= i386 - include $(BASE_DIR)/mk/spec/32bit.mk include $(BASE_DIR)/mk/spec/x86.mk diff --git a/repos/base/mk/spec/x86_64.mk b/repos/base/mk/spec/x86_64.mk index ce1a8b20e7..4e041f4027 100644 --- a/repos/base/mk/spec/x86_64.mk +++ b/repos/base/mk/spec/x86_64.mk @@ -20,7 +20,5 @@ CC_MARCH ?= -m64 -mcmodel=large # LD_MARCH ?= -melf_x86_64 -NIM_CPU ?= amd64 - include $(BASE_DIR)/mk/spec/64bit.mk include $(BASE_DIR)/mk/spec/x86.mk diff --git a/repos/libports/lib/import/import-libc.mk b/repos/libports/lib/import/import-libc.mk index 93df325ba7..d6032470fa 100644 --- a/repos/libports/lib/import/import-libc.mk +++ b/repos/libports/lib/import/import-libc.mk @@ -53,8 +53,3 @@ CC_OPT += -D__ISO_C_VISIBLE=1999 # or 'sincosf', which is a GNU extension, not provided by our libc. # CC_OPT += -fno-builtin-sin -fno-builtin-cos -fno-builtin-sinf -fno-builtin-cosf - -# -# Enable Nim POSIX support when linking with this library -# -NIM_OPT += -d:posix diff --git a/repos/libports/lib/import/import-nim-threads.mk b/repos/libports/lib/import/import-nim-threads.mk deleted file mode 100644 index c42b778e5f..0000000000 --- a/repos/libports/lib/import/import-nim-threads.mk +++ /dev/null @@ -1 +0,0 @@ -NIM_OPT += --threads:on --tlsEmulation:on diff --git a/repos/libports/src/test/nim/main.nim b/repos/libports/src/test/nim/main.nim deleted file mode 100644 index 91346de330..0000000000 --- a/repos/libports/src/test/nim/main.nim +++ /dev/null @@ -1,110 +0,0 @@ -import unittest -const - Text = "Hello world!" - -suite "echo": - echo Text - -suite "system": - echo "compile date: ", CompileDate, " - ", CompileTime - echo("endianness: ", - case cpuEndian: - of littleEndian: - "littleEndian" - of bigEndian: - "bigEndian" - ) - echo "hostCPU: ", hostCPU - echo "NimVersion: ", NimVersion - echo "nativeStackTraceSupported: ", $nativeStackTraceSupported - echo "getStackTrace:\n", getStackTrace() - echo "getFreeMem: ", getFreeMem() - echo "getTotalMem: ", getTotalMem() - echo "getOccupiedMem: ", getOccupiedMem() - - test "isMainModule": - assert isMainModule == true - test "hostOS == genode": - assert hostOS == "genode" - - test "alloc/dealloc": - let p = alloc 768 - assert(not p.isNil) - dealloc p - - test "exception handling": - type NovelError = object of SystemError - try: raise newException(NovelError, "test exception") - except NovelError: - discard - -import locks, threadpool -suite "threadpool": - - test "spawn": - var L: Lock - - proc threadProc(interval: tuple[a,b: int]) = - for i in interval.a..interval.b: - acquire L - echo i - release L - - initLock L - for i in 0..3: - spawn threadProc((i*10, i*10+4)) - sync() - deinitLock L - - test "threadvar": - var - L: Lock - x {.threadvar.}: int - y: int - - proc printVal(id: string) = - acquire L - echo( - id, - " x: ", repr(addr(x)), - " y: ", repr(addr(y)) - ) - inc x - inc y - release L - - initLock L - release L - printVal("main thread") - for i in 1..4: - spawn printVal("spawn "& $i) - sync() - deinitLock L - -suite "I/O": - const - TestFile = "/testfile" - Text = NimVersion & " - " & CompileDate & " - " & CompileTime - test "writeFile": - writeFile(TestFile, Text) - test "readFile": - assert readFile(TestFile) == Text - -suite "staticExec": - const rev = staticExec("git describe") - echo "compile time 'git describe': ", rev - -import times -suite "time": - - echo "epochTime() float value: ", epochTime() - echo "getTime() float value: ", toSeconds(getTime()) - echo "cpuTime() float value: ", cpuTime() - echo "An hour from now : ", getLocalTime(getTime()) + 1.hours - echo "An hour from (UTC) now: ", getGmTime(getTime()) + initInterval(0,0,0,1) - -suite "garbage collector": - echo GC_getStatistics() - -echo "done" -quit 0 diff --git a/repos/libports/src/test/nim/target.mk b/repos/libports/src/test/nim/target.mk deleted file mode 100644 index c3280f8b70..0000000000 --- a/repos/libports/src/test/nim/target.mk +++ /dev/null @@ -1,8 +0,0 @@ -TARGET = test-nim -LIBS = nim-threads libc -SRC_NIM = main.nim - -# Enable extra system assertions -NIM_OPT += -d:useSysAssert - -CC_CXX_WARN_STRICT = diff --git a/repos/libports/src/test/nim_echo_server/main.nim b/repos/libports/src/test/nim_echo_server/main.nim deleted file mode 100644 index cb8ca32c28..0000000000 --- a/repos/libports/src/test/nim_echo_server/main.nim +++ /dev/null @@ -1,27 +0,0 @@ -import asyncnet, asyncdispatch - -const - CRLF* = "\c\L" - -proc processClient(address: string, client: AsyncSocket) {.async.} = - echo "accepted connection from ", address - while not client.isClosed(): - let line = await client.recvLine() - if line == "": - break - await client.send(line & CRLF) - echo address, " closed connection" - -proc serve() {.async.} = - let server = newAsyncSocket() - server.bindAddr(7.Port) - server.listen() - - echo "echo service listening on port 7" - - while true: - let res = await server.acceptAddr() - asyncCheck processClient(res[0], res[1]) - -asyncCheck serve() -runForever() diff --git a/repos/libports/src/test/nim_echo_server/target.mk b/repos/libports/src/test/nim_echo_server/target.mk deleted file mode 100644 index 64e4522f5b..0000000000 --- a/repos/libports/src/test/nim_echo_server/target.mk +++ /dev/null @@ -1,8 +0,0 @@ -TARGET = test-nim_echo_server -LIBS = libc -SRC_NIM = main.nim - -# Enable extra system assertions -NIM_OPT += -d:useSysAssert - -CC_CXX_WARN_STRICT = diff --git a/tool/tool_chain_nim b/tool/tool_chain_nim deleted file mode 100755 index ee2271723b..0000000000 --- a/tool/tool_chain_nim +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/make -f -# -# \brief Tool for preparing the Nim tool-chain for the Genode OS Framework -# \author Emery Hemingway -# \date 2017-07-04 -# - -help: - @$(ECHO) - @$(ECHO) "Build Nim compiler for the Genode OS Framework tool chain" - @$(ECHO) - @$(ECHO) "--- available commands ---" - @$(ECHO) "build - build Nim compiler" - @$(ECHO) "clean - clean everything except contrib sources" - @$(ECHO) "install - copy Nim compiler and standard library to '$(INSTALL_LOCATION)'" - @$(ECHO) - -.PHONY: help install - -GENODE_DIR ?= $(realpath $(dir $(firstword $(MAKEFILE_LIST)))/..) -include $(GENODE_DIR)/tool/ports/mk/common.inc - -LOCAL_INSTALL_LOCATION ?= /usr/local -INSTALL_LOCATION := $(LOCAL_INSTALL_LOCATION)/genode-nim - -NIM_CONTRIB_DIR = $(shell $(GENODE_DIR)/tool/ports/current nim) - -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)/.bootstrap.tag - @$(ECHO) "$(BRIGHT_COL)building Koch...$(DEFAULT_COL)" - $(VERBOSE)cd $(BUILD_DIR) && ./bin/nim c koch - -$(BUILD_DIR)/.bootstrap.tag: $(BUILD_DIR)/build.sh - @$(ECHO) "$(BRIGHT_COL)building bootstrap compiler...$(DEFAULT_COL)" - $(VERBOSE)cd $(BUILD_DIR) && sh build.sh - @touch $@ - -$(BUILD_DIR)/build.sh: $(NIM_CONTRIB_DIR) - @$(ECHO) "$(BRIGHT_COL)copying Nim sources...$(DEFAULT_COL)" - $(VERBOSE)mkdir -p $(BUILD_DIR) - $(VERBOSE)cp -a $