From 415d0d8a42aec319097aa47d38304c8abb957b34 Mon Sep 17 00:00:00 2001 From: Gabriel mermelstein Date: Wed, 16 Apr 2025 12:57:07 +0300 Subject: [PATCH] setting up nimbus-build-system --- .gitignore | 7 +++++ .gitmodules | 55 +++++++++++++++++++++++++++++++++++ Makefile | 32 ++++++++++++++++++++ add_submodule.sh | 20 +++++++++++++ vendor/nim-chronicles | 1 + vendor/nim-chronos | 1 + vendor/nim-confutils | 1 + vendor/nim-faststreams | 1 + vendor/nim-json-serialization | 1 + vendor/nim-libp2p | 1 + vendor/nim-results | 1 + vendor/nim-serialization | 1 + vendor/nim-stew | 1 + vendor/nim-taskpools | 1 + vendor/nimbus-build-system | 1 + 15 files changed, 125 insertions(+) create mode 100644 .gitmodules create mode 100755 add_submodule.sh create mode 160000 vendor/nim-chronicles create mode 160000 vendor/nim-chronos create mode 160000 vendor/nim-confutils create mode 160000 vendor/nim-faststreams create mode 160000 vendor/nim-json-serialization create mode 160000 vendor/nim-libp2p create mode 160000 vendor/nim-results create mode 160000 vendor/nim-serialization create mode 160000 vendor/nim-stew create mode 160000 vendor/nim-taskpools create mode 160000 vendor/nimbus-build-system diff --git a/.gitignore b/.gitignore index 6f5bb9f..898171b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,10 @@ for_reference do_not_commit build/* sds.nims +/.update.timestamp + +# Nimbus Build System +nimbus-build-system.paths + +# Nimble packages +/vendor/.nimble diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..fe38e76 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,55 @@ +[submodule "vendor/nimbus-build-system"] + path = vendor/nimbus-build-system + url = https://github.com/status-im/nimbus-build-system.git + ignore = untracked + branch = master +[submodule "vendor/nim-chronos"] + path = vendor/nim-chronos + url = https://github.com/status-im/nim-chronos.git + ignore = untracked + branch = master +[submodule "vendor/nim-results"] + path = vendor/nim-results + url = https://github.com/arnetheduck/nim-results.git + ignore = untracked + branch = master +[submodule "vendor/nim-stew"] + path = vendor/nim-stew + url = https://github.com/status-im/nim-stew.git + ignore = untracked + branch = master +[submodule "vendor/nim-chronicles"] + path = vendor/nim-chronicles + url = https://github.com/status-im/nim-chronicles.git + ignore = untracked + branch = master +[submodule "vendor/nim-faststreams"] + path = vendor/nim-faststreams + url = https://github.com/status-im/nim-faststreams.git + ignore = untracked + branch = master +[submodule "vendor/nim-json-serialization"] + path = vendor/nim-json-serialization + url = https://github.com/status-im/nim-json-serialization.git + ignore = untracked + branch = master +[submodule "vendor/nim-serialization"] + path = vendor/nim-serialization + url = https://github.com/status-im/nim-serialization.git + ignore = untracked + branch = master +[submodule "vendor/nim-taskpools"] + path = vendor/nim-taskpools + url = https://github.com/status-im/nim-taskpools.git + ignore = untracked + branch = master +[submodule "vendor/nim-confutils"] + path = vendor/nim-confutils + url = https://github.com/status-im/nim-confutils.git + ignore = untracked + branch = master +[submodule "vendor/nim-libp2p"] + path = vendor/nim-libp2p + url = https://github.com/vacp2p/nim-libp2p.git + ignore = untracked + branch = master diff --git a/Makefile b/Makefile index 1c478cd..31788b2 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,41 @@ .PHONY: libsds +export BUILD_SYSTEM_DIR := vendor/nimbus-build-system +# we don't want an error here, so we can handle things later, in the ".DEFAULT" target +-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk + +ifeq ($(NIM_PARAMS),) +# "variables.mk" was not included, so we update the submodules. +GIT_SUBMODULE_UPDATE := git submodule update --init --recursive +.DEFAULT: + +@ echo -e "Git submodules not found. Running '$(GIT_SUBMODULE_UPDATE)'.\n"; \ + $(GIT_SUBMODULE_UPDATE); \ + echo +# Now that the included *.mk files appeared, and are newer than this file, Make will restart itself: +# https://www.gnu.org/software/make/manual/make.html#Remaking-Makefiles +# +# After restarting, it will execute its original goal, so we don't have to start a child Make here +# with "$(MAKE) $(MAKECMDGOALS)". Isn't hidden control flow great? + +else # "variables.mk" was included. Business as usual until the end of this file. + +# default target, because it's the first one that doesn't start with '.' +all: | libsds + sds.nims: ln -s sds.nimble $@ +update: | update-common + rm -rf sds.nims && \ + $(MAKE) sds.nims $(HANDLE_OUTPUT) + +clean: + rm -rf build + deps: | sds.nims +# must be included after the default target +-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk STATIC ?= 0 @@ -16,4 +47,5 @@ ifeq ($(STATIC), 1) else echo -e $(BUILD_MSG) "build/$@.so" && \ $(ENV_SCRIPT) nim libsdsDynamic $(NIM_PARAMS) sds.nims +endif endif \ No newline at end of file diff --git a/add_submodule.sh b/add_submodule.sh new file mode 100755 index 0000000..133cb0a --- /dev/null +++ b/add_submodule.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Copyright (c) 2018-2020 Status Research & Development GmbH. Licensed under +# either of: +# - Apache License, version 2.0 +# - MIT license +# at your option. This file may not be copied, modified, or distributed except +# according to those terms. + +[ -z "$1" -o `echo "$1" | tr '/' '\n' | wc -l` != 2 ] && \ + { echo "Usage: `basename $0` some/repo [destdir] # 'destdir' defaults to 'vendor/repo'"; exit 1; } +REPO="$1" + +DEST="vendor/${REPO#*/}" +[ -n "$2" ] && DEST="$2" + +git submodule add --force https://github.com/${REPO}.git "$DEST" +git config -f .gitmodules submodule.${DEST}.ignore untracked +git config -f .gitmodules submodule.${DEST}.branch master + diff --git a/vendor/nim-chronicles b/vendor/nim-chronicles new file mode 160000 index 0000000..a8fb38a --- /dev/null +++ b/vendor/nim-chronicles @@ -0,0 +1 @@ +Subproject commit a8fb38a10bcb548df78e9a70bd77b26bb50abd12 diff --git a/vendor/nim-chronos b/vendor/nim-chronos new file mode 160000 index 0000000..b55e281 --- /dev/null +++ b/vendor/nim-chronos @@ -0,0 +1 @@ +Subproject commit b55e2816eb45f698ddaca8d8473e401502562db2 diff --git a/vendor/nim-confutils b/vendor/nim-confutils new file mode 160000 index 0000000..e214b39 --- /dev/null +++ b/vendor/nim-confutils @@ -0,0 +1 @@ +Subproject commit e214b3992a31acece6a9aada7d0a1ad37c928f3b diff --git a/vendor/nim-faststreams b/vendor/nim-faststreams new file mode 160000 index 0000000..2b08c77 --- /dev/null +++ b/vendor/nim-faststreams @@ -0,0 +1 @@ +Subproject commit 2b08c774afaafd600cf4c6f994cf78b8aa090c0c diff --git a/vendor/nim-json-serialization b/vendor/nim-json-serialization new file mode 160000 index 0000000..2b1c5eb --- /dev/null +++ b/vendor/nim-json-serialization @@ -0,0 +1 @@ +Subproject commit 2b1c5eb11df3647a2cee107cd4cce3593cbb8bcf diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p new file mode 160000 index 0000000..ac25da6 --- /dev/null +++ b/vendor/nim-libp2p @@ -0,0 +1 @@ +Subproject commit ac25da6cea158768bbc060b7be2fbe004206f3bb diff --git a/vendor/nim-results b/vendor/nim-results new file mode 160000 index 0000000..df8113d --- /dev/null +++ b/vendor/nim-results @@ -0,0 +1 @@ +Subproject commit df8113dda4c2d74d460a8fa98252b0b771bf1f27 diff --git a/vendor/nim-serialization b/vendor/nim-serialization new file mode 160000 index 0000000..548d0ad --- /dev/null +++ b/vendor/nim-serialization @@ -0,0 +1 @@ +Subproject commit 548d0adc9797a10b2db7f788b804330306293088 diff --git a/vendor/nim-stew b/vendor/nim-stew new file mode 160000 index 0000000..d7a6868 --- /dev/null +++ b/vendor/nim-stew @@ -0,0 +1 @@ +Subproject commit d7a6868ba84165e7fdde427af9a1fc3f5f5cc151 diff --git a/vendor/nim-taskpools b/vendor/nim-taskpools new file mode 160000 index 0000000..7b74a71 --- /dev/null +++ b/vendor/nim-taskpools @@ -0,0 +1 @@ +Subproject commit 7b74a716a40249720fd7da428113147942b9642d diff --git a/vendor/nimbus-build-system b/vendor/nimbus-build-system new file mode 160000 index 0000000..5f10509 --- /dev/null +++ b/vendor/nimbus-build-system @@ -0,0 +1 @@ +Subproject commit 5f10509cf880dc035e517ca7bac3163cd5206ba8