From d834e652d81ea54bef575576f2d5706f41c8db6d Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 27 Apr 2019 19:54:22 +0200 Subject: [PATCH 1/2] Update - Automatic package versions - Generate Makefile for creating signed packages - Build with x86_64 variant by default - Add Nim example - Runtime schema fixes --- Tupfile | 70 +++++++++++++++ Tuprules.tup | 149 ++++++++++++++++++++------------ app/hello-world/Tupfile | 22 +++-- app/hello-world/archives | 2 - app/hello-world/component.cc | 3 +- build-x86_64/tup.config | 8 ++ errata/bin.mk.awk | 12 +++ errata/bin.tup | 14 +++ errata/pkg.mk.awk | 13 +++ errata/pkg.tup | 0 errata/raw.mk.awk | 8 ++ errata/raw.tup | 14 +++ errata/runtime.xsd | 2 + index.xml | 6 ++ index/Tupfile | 25 ------ index/index.xml | 7 -- nim/Tuprules.tup | 11 +++ nim/binaries.tup | 14 ++- nim/hello_nim/Tupfile | 10 +++ nim/hello_nim/hello_nim.nimble | 12 +++ nim/hello_nim/runtime | 14 +++ nim/hello_nim/src/hello_nim.nim | 8 ++ nim/package.tup | 9 +- tup.config | 8 -- 24 files changed, 322 insertions(+), 119 deletions(-) create mode 100644 Tupfile delete mode 100644 app/hello-world/archives create mode 100644 build-x86_64/tup.config create mode 100644 errata/bin.mk.awk create mode 100644 errata/bin.tup create mode 100644 errata/pkg.mk.awk create mode 100644 errata/pkg.tup create mode 100644 errata/raw.mk.awk create mode 100644 errata/raw.tup create mode 100644 index.xml delete mode 100644 index/Tupfile delete mode 100644 index/index.xml create mode 100644 nim/hello_nim/Tupfile create mode 100644 nim/hello_nim/hello_nim.nimble create mode 100644 nim/hello_nim/runtime create mode 100644 nim/hello_nim/src/hello_nim.nim delete mode 100644 tup.config diff --git a/Tupfile b/Tupfile new file mode 100644 index 000000000..a9528a8ea --- /dev/null +++ b/Tupfile @@ -0,0 +1,70 @@ +.gitignore +include_rules + +ifndef SCULPT_VERSION +error CONFIG_SCULPT_VERSION is undefined +endif + +ifndef PUBLIC_USER +error CONFIG_PUBLIC_USER is undefined +endif + +SHORT_SUM = b2sum -l24 + +: $(DEPOT_DIR)/ $(DEPOT_DIR)/ |> \ + for f in % %; do \ + awk -F '/' '{print "s|local/"$2"/"$3"/current|@(PUBLIC_USER)/"$2"/"$3"/"$4"|"}' $f >> %o; done; \ +|> $(VERSIONS_SED_FILE) + # Generate a listing of all raw archives + +: $(DEPOT_DIR)/ |> \ + touch %o; \ + for f in %; do cat $f >> %o; done; \ +|> $(RAW_LISTING) + # Generate a listing of all raw archives + +: $(DEPOT_DIR)/ |> \ + for f in %; do tail -n1 $f >> %o; done; \ +|> $(BIN_LISTING) + # Generate a listing of all binary archives + +: $(DEPOT_DIR)/ |> ^ generate package version sed script^ \ + for d in `dirname % | tr ' ' '\n' | sort -u`; do \ + echo $d/`cat $d/.ARCHIVES $d/runtime | $(SHORT_SUM)` | awk -F '/' \ + '{print "s|local/pkg/"$3"/current|@(PUBLIC_USER)/pkg/"$3"/"substr($5,0,6)"|"}' >> %o; \ + done \ +|> $(PKG_SED_FILE) + # Generate sed commands for replacing package versions + +: $(DEPOT_DIR)/ $(DEPOT_DIR)/ $(PKG_SED_FILE) |> \ + ^ generate public makefile^ \ + echo PUBLIC_USER=@(PUBLIC_USER) >> %o; \ + echo PUBLIC_ARCH=@(TUP_ARCH) >> %o; \ + echo "all: public/@(PUBLIC_USER)/index/@(SCULPT_VERSION).xz.sig" >> %o; \ + echo %%.xz.sig: %%.xz >> %o; \ + echo " @echo sign \$<" >> %o; \ + echo " @gpg --detach-sign --digest-algo SHA256 --no-tty --local-user @(PUBLIC_KEY) < \$< > tmp" >> %o; \ + echo " @mv tmp \$@" >> %o; \ + for f in %; do \ + awk -F '/' -f errata/raw.mk.awk $f >> %o; done; \ + for f in %; do \ + awk -F '/' -f errata/bin.mk.awk $f >> %o; done; \ + awk -F '/' -f errata/pkg.mk.awk $(PKG_SED_FILE) >> %o; done \ +|> Makefile + # Generate the makefile for creating signed package tarballs + +: index.xml | $(PKG_SED_FILE) |> ^ generate public index^ \ + xmllint %f | sed \ + -e 's|_/pkg/\([^"]*\)|local/pkg/\1/current|' \ + -f $(PKG_SED_FILE) \ + | xz > %o; \ +|> public/@(PUBLIC_USER)/index/@(SCULPT_VERSION).xz + +AWK_RUNTIME_PATH = awk -v RS=' ' -F '/' \ + '/runtime/ {print " "}' + +: $(DEPOT_DIR)/ |> ^ generate local index^ \ + echo '' > %o; \ + echo % | $(AWK_RUNTIME_PATH) | sort >> %o; \ + echo '' >> %o |> $(DEPOT_DIR)/index/@(SCULPT_VERSION) + # Generate the depot index file diff --git a/Tuprules.tup b/Tuprules.tup index aee42341e..7c1ecf12f 100644 --- a/Tuprules.tup +++ b/Tuprules.tup @@ -1,69 +1,110 @@ -.gitignore - -export PKG_CONFIG_PATH - -CC = `pkg-config genode-base --variable cc` -CXX = `pkg-config genode-base --variable cxx` -LD = `pkg-config genode-base --variable ld` -AR = `pkg-config genode-base --variable ar` - -ifndef DEPOT_USER -error CONFIG_DEPOT_USER is undefined +ifeq ($(RAW_NAME),) +RAW_NAME = $(TARGET_NAME) endif -ifndef DEPOT_VERSION -error CONFIG_DEPOT_VERSION is undefined +ifeq ($(BIN_NAME),) +BIN_NAME = $(TARGET_NAME) endif -DEPOT_DIR = $(TUP_CWD)/depot/@(DEPOT_USER) -PUBLIC_DIR = $(TUP_CWD)/public/@(DEPOT_USER) +ifeq ($(PKG_NAME),) +PKG_NAME = $(TARGET_NAME) +endif -DEPOT_BIN_DIR = $(DEPOT_DIR)/bin/x86_64 -PUBLIC_BIN_DIR = $(PUBLIC_DIR)/bin/x86_64 +GIT_VERSION=`git describe --always` +BIN_VERSION=$(GIT_VERSION) +PKG_VERSION=$(GIT_VERSION) +ifeq ($(RAW_VERSION),) +RAW_VERSION=$(GIT_VERSION) +endif + +DEPOT_DIR = $(TUP_CWD)/depot +DEPOT_RAW_DIR = $(DEPOT_DIR)/raw +DEPOT_BIN_DIR = $(DEPOT_DIR)/bin/@(TUP_ARCH) DEPOT_PKG_DIR = $(DEPOT_DIR)/pkg + +PUBLIC_DIR = $(TUP_CWD)/public +PUBLIC_RAW_DIR = $(PUBLIC_DIR)/raw +PUBLIC_BIN_DIR = $(PUBLIC_DIR)/bin PUBLIC_PKG_DIR = $(PUBLIC_DIR)/pkg -DEPOT_RAW_DIR = $(DEPOT_DIR)/raw -PUBLIC_RAW_DIR = $(PUBLIC_DIR)/raw +RAW_DIR = $(DEPOT_RAW_DIR)/$(RAW_NAME)/current + # Destination for locally defined raw package -!strip_to_depot = |> ^ strip bin/%d^ strip -o %o %f |> $(DEPOT_BIN_DIR)/%d/@(DEPOT_VERSION)/%b +BIN_DIR = $(DEPOT_BIN_DIR)/$(BIN_NAME)/current + # Destination for locally defined binary package + +PKG_DIR = $(DEPOT_BIN_DIR)/$(BIN_NAME)/current + # Destination for locally defined runtime package + +!raw = |> ^ COLLECT %o^ \ + echo $(RAW_DEPENDS) local/raw/$(RAW_NAME)/$(RAW_VERSION) | tr ' ' '\n' > %o; \ + echo local/raw/$(RAW_NAME)/$(RAW_VERSION) > %o \ +|> $(RAW_DIR)/.ARCHIVES $(DEPOT_DIR)/ + +!bin = |> ^ COLLECT %o^ \ + echo $(BIN_DEPENDS) local/src/$(BIN_NAME)/$(BIN_VERSION) | tr ' ' '\n' > %o; \ +|> $(BIN_DIR)/.ARCHIVES $(DEPOT_DIR)/ + # Macro invoked in BIN_RULES + +RAW_RULES = $(TUP_CWD)/errata/raw.tup + # Rules for finalizing a locally defined raw package +BIN_RULES = $(TUP_CWD)/errata/bin.tup + # Rules for finalizing a locally defined binary package +PKG_RULES = $(TUP_CWD)/errata/pkg.tup + # Rules for finalizing a locally defined runtime package + +AWK_LOCAL_ARCHIVES = awk -F '/' \ + '{if ($1 != "local") {print $0} \ + else {print $1"/"$2"/"$3"/current"}}' + +!pkg = |> |> + +!collect_raw = |> ^ COLLECT %o^ \ + cp %f %o \ +|> $(RAW_DIR)/%b + +!collect_bin = |> ^ COLLECT %o^ \ + strip -o %o %f \ +|> $(DEPOT_BIN_DIR)/$(BIN_NAME)/current/%b + +!collect_pkg_runtime = | $(VERSIONS_SED_FILE) |> ^ package %f^ \ + xmllint --noout -schema $(ERRATA_DIR)/runtime.xsd %f; \ + cp %f $(DEPOT_PKG_DIR)/$(PKG_NAME)/current/runtime; \ + echo $(PKG_DEPENDS) | tr ' ' '\n' | sed \ + -e 's|_/\(.*\)/\(.*\)$|local/\1/\2/current|' \ + > $(DEPOT_PKG_DIR)/$(PKG_NAME)/current/archives; \ + sed -f $(VERSIONS_SED_FILE) $(DEPOT_PKG_DIR)/$(PKG_NAME)/current/archives \ + > $(DEPOT_PKG_DIR)/$(PKG_NAME)/current/.ARCHIVES; \ +|> \ + $(DEPOT_PKG_DIR)/$(PKG_NAME)/current/archives \ + $(DEPOT_PKG_DIR)/$(PKG_NAME)/current/.ARCHIVES \ + $(DEPOT_PKG_DIR)/$(PKG_NAME)/current/runtime \ + $(DEPOT_DIR)/ + +!collect_pkg = |> ^ COLLECT %o^ cp %f %o \ + |> $(DEPOT_PKG_DIR)/$(PKG_NAME)/current/%b \ + $(DEPOT_DIR)/ + +VERSIONS_SED_FILE = $(TUP_CWD)/versions.sed +PKG_SED_FILE = $(TUP_CWD)/pkg.sed + +RAW_LISTING = $(TUP_CWD)/raw-list +BIN_LISTING = $(TUP_CWD)/bin-list +PKG_LISTING = $(TUP_CWD)/pkg-list + +SDK_INCLUDE = $(TUP_CWD)/sdk.tup ERRATA_DIR = $(TUP_CWD)/errata -!archives_to_depot = |> ^ varse %d archives^ tup varsed %f %o |> $(DEPOT_PKG_DIR)/%d/@(DEPOT_VERSION)/archives +CC = @(CC_WRAPPER) `pkg-config genode-base --variable cc` +CXX = @(CXX_WRAPPER) `pkg-config genode-base --variable cxx` +LD = `pkg-config genode-base --variable ld` +AR = `pkg-config genode-base --variable ar` -!runtime_to_depot = |> ^ validate %d runtime^ \ - xmllint -schema $(ERRATA_DIR)/runtime.xsd --noout %f ; cp %f %o \ -|> $(DEPOT_PKG_DIR)/%d/@(DEPOT_VERSION)/runtime $(DEPOT_DIR)/ +!cc = |> ^ CC %f^ $(CC) $(DEFINES) $(CFLAGS) $(CFLAGS_%e) $(CFLAGS_%f) -c %f -o %o |> +!cxx = |> ^ CC %f^ $(CC) $(DEFINES) $(CXXFLAGS) $(CXXFLAGS_%e) $(CXXFLAGS_%f) -c %f -o %o |> +!ld = |> ^ LD %o^ $(LD) $(LDFLAGS) %f -o %o |> -!raw_to_depot = |> ^ raw/%d/%b^ cp -r %f %o |> $(DEPOT_RAW_DIR)/%d/@(DEPOT_VERSION)/%b - -ifndef DEPOT_KEY - -!publish_bin = |> |> -!publish_raw = |> |> -!publish_pkg = |> |> - -else - -SIGN_CMD = gpg --detach-sign --digest-algo SHA256 --no-tty --local-user @(DEPOT_KEY) - -!publish_bin = |> ^o publish %d binary^ \ - tar cfJ %o -C $(DEPOT_BIN_DIR)/%d . ; $(SIGN_CMD) < %o > %o.sig \ -|> $(PUBLIC_BIN_DIR)/%d/@(DEPOT_VERSION).tar.xz \ -| $(PUBLIC_BIN_DIR)/%d/@(DEPOT_VERSION).tar.xz.sig - -!publish_raw = |> ^o publish %d raw^ \ - tar cfJ %o -C $(DEPOT_RAW_DIR)/%d . ; $(SIGN_CMD) < %o > %o.sig \ -|> $(PUBLIC_RAW_DIR)/%d/@(DEPOT_VERSION).tar.xz \ -| $(PUBLIC_RAW_DIR)/%d/@(DEPOT_VERSION).tar.xz.sig - -!publish_pkg = |> ^o publish %d package^ \ - tar cfJ %o -C $(DEPOT_PKG_DIR)/%d . ; $(SIGN_CMD) < %o > %o.sig \ -|> $(PUBLIC_PKG_DIR)/%d/@(DEPOT_VERSION).tar.xz \ -| $(PUBLIC_PKG_DIR)/%d/@(DEPOT_VERSION).tar.xz.sig - -!public_signature = |> ^ sign %b^ $(SIGN_CMD) < %f > %o |> %f.sig - -endif +export PKG_CONFIG_PATH +PKG_CONFIG = PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(SDK_DIR)/pkgconfig pkg-config diff --git a/app/hello-world/Tupfile b/app/hello-world/Tupfile index d92f51c01..d7f4d31ef 100644 --- a/app/hello-world/Tupfile +++ b/app/hello-world/Tupfile @@ -1,14 +1,20 @@ +TARGET_NAME = hello-world include_rules -PKGS = genode-base genode-prg +PKG_CONFIGS = genode-base genode-prg -: foreach *.cc |> $(CC) `pkg-config --cflags $(PKGS)` -c %f -o %o |> %B.o {objs} -: {objs} |> $(LD) `pkg-config --libs $(PKGS)` %f -o %o |> %d {binary} +CXXFLAGS += `$(PKG_CONFIG) -cflags $(PKG_CONFIGS)` +LDFLAGS += `$(PKG_CONFIG) -libs $(PKG_CONFIGS)` -: {binary} |> !strip_to_depot |> +: foreach *.cc |> !cxx |> %B.o {objs} +: {objs} |> !ld |> %d {binary} -: archives | {binary} |> !archives_to_depot |> {package} -: runtime | {binary} |> !runtime_to_depot |> {package} +: {binary} |> !collect_bin |> -: |> !publish_bin |> -: |> !publish_pkg |> +PKG_DEPENDS += \ + _/src/$(BIN_NAME) \ + +: runtime |> !collect_pkg_runtime |> + +include $(BIN_RULES) +include $(PKG_RULES) diff --git a/app/hello-world/archives b/app/hello-world/archives deleted file mode 100644 index f6aae7850..000000000 --- a/app/hello-world/archives +++ /dev/null @@ -1,2 +0,0 @@ -@SDK_USER@/src/vfs/@SDK_VERSION@ -@DEPOT_USER@/src/hello-world/@DEPOT_VERSION@ diff --git a/app/hello-world/component.cc b/app/hello-world/component.cc index cdf2923a2..67b1b4b7f 100644 --- a/app/hello-world/component.cc +++ b/app/hello-world/component.cc @@ -2,7 +2,8 @@ #include #include -void Component::construct(Genode::Env &) +void Component::construct(Genode::Env &env) { Genode::log("Hello world!"); + env.parent().exit(0); } diff --git a/build-x86_64/tup.config b/build-x86_64/tup.config new file mode 100644 index 000000000..61a993482 --- /dev/null +++ b/build-x86_64/tup.config @@ -0,0 +1,8 @@ +CONFIG_TUP_ARCH=x86_64 + +CONFIG_SCULPT_VERSION=19.02 +CONFIG_PUBLIC_USER=foobar +CONFIG_PUBLIC_KEY=6E10414EE7160781F5FEE8FFB14D043A26B3D2C7 + +CONFIG_PUBLIC_SRC_LIBC=genodelabs/src/libc/2019-03-17 +CONFIG_PUBLIC_SRC_VFS=genodelabs/src/vfs/2019-03-18 diff --git a/errata/bin.mk.awk b/errata/bin.mk.awk new file mode 100644 index 000000000..0c6d344a3 --- /dev/null +++ b/errata/bin.mk.awk @@ -0,0 +1,12 @@ +{ if ($1 == "local") { + +{ tar="public/$(PUBLIC_USER)/bin/$(PUBLIC_ARCH)/"$3"/"$4".tar.xz" } + +{ print "all: " tar ".sig" } + +{ print tar": "FILENAME } +{ print " @echo tar $@" } +{ print " @mkdir -p $(dir $@)" } +{ print " @tar cfJ $@ --exclude=.ARCHIVES --transform=\"s|^\\.|"$4"|\" -C $(dir $<) ." } + +}} diff --git a/errata/bin.tup b/errata/bin.tup new file mode 100644 index 000000000..30af60fa7 --- /dev/null +++ b/errata/bin.tup @@ -0,0 +1,14 @@ +ifeq ($(BIN_NAME),) +error BIN_NAME is empty +endif + +ifeq ($(BIN_VERSION),) +error BIN_VERSION is empty +endif + +: |> !bin |> + # Finalize the metadata with the macro defined in the + # ../Tuprules.tup. The macro cannot be defined here + # because the "include" directive is not available for + # relative paths during "include_rules" so this file + # cannot be included by intermediate Tuprules.tup. diff --git a/errata/pkg.mk.awk b/errata/pkg.mk.awk new file mode 100644 index 000000000..b5104f6f0 --- /dev/null +++ b/errata/pkg.mk.awk @@ -0,0 +1,13 @@ +{ ver=substr($7,0,6) } +{ tar="public/$(PUBLIC_USER)/pkg/"$6"/"ver".tar.xz" } +{ sig=tar".sig" } + +{ print "all: " tar ".sig" } + +{ print tar": depot/pkg/"$6"/current/.ARCHIVES" } +{ print " @echo tar $@" } +{ print " @mkdir -p $(dir $@) "ver } +{ print " @sed -f pkg.sed $< > "ver"/archives" } +{ print " @cp $(dir $<)/runtime "ver } +{ print " @tar cfJ $@ "ver } +{ print " @rm -r "ver } diff --git a/errata/pkg.tup b/errata/pkg.tup new file mode 100644 index 000000000..e69de29bb diff --git a/errata/raw.mk.awk b/errata/raw.mk.awk new file mode 100644 index 000000000..a282bfc70 --- /dev/null +++ b/errata/raw.mk.awk @@ -0,0 +1,8 @@ +{ tar="public/$(PUBLIC_USER)/raw/"$3"/"$4".tar.xz" } + +{ print "all: " tar ".sig" } + +{ print tar": "FILENAME } +{ print " @echo tar $@" } +{ print " @mkdir -p $(dir $@)" } +{ print " @tar cfJ $@ --exclude=.ARCHIVES --transform=\"s|^\\.|"$4"|\" -C $(dir $<) ." } diff --git a/errata/raw.tup b/errata/raw.tup new file mode 100644 index 000000000..d8204ae28 --- /dev/null +++ b/errata/raw.tup @@ -0,0 +1,14 @@ +ifeq ($(RAW_NAME),) +error RAW_NAME is empty +endif + +ifeq ($(RAW_VERSION),) +error RAW_VERSION is empty +endif + +: |> !raw |> + # Finalize the metadata with the macro defined in the + # ../Tuprules.tup. The macro cannot be defined here + # because the "include" directive is not available for + # relative paths during "include_rules" so this file + # cannot be included by intermediate Tuprules.tup. diff --git a/errata/runtime.xsd b/errata/runtime.xsd index 4c17726c4..b3e696685 100644 --- a/errata/runtime.xsd +++ b/errata/runtime.xsd @@ -24,6 +24,7 @@ + @@ -62,6 +63,7 @@ + diff --git a/index.xml b/index.xml new file mode 100644 index 000000000..d303c040c --- /dev/null +++ b/index.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/index/Tupfile b/index/Tupfile deleted file mode 100644 index e2aeaf774..000000000 --- a/index/Tupfile +++ /dev/null @@ -1,25 +0,0 @@ -include_rules - -ifndef SCULPT_VERSION -error CONFIG_SCULPT_VERSION is undefined -endif - -DEPOT_INDEX_FILE = $(DEPOT_DIR)/index/@(SCULPT_VERSION) - -ifneq (@(DEPOT_USER),local) -: index.xml |> tup varsed %f - | xmllint - > %o |> $(DEPOT_INDEX_FILE) {index} -else -: $(DEPOT_DIR)/ |> ^ generate index^ \ - echo '' > %o; \ - echo % | tr ' ' '\n' | sort |\ - sed \ - -e 's|\.\./depot/| |' \ - - >> %o; \ - echo '' >> %o |> $(DEPOT_INDEX_FILE) {index} -endif - -ifdef DEPOT_KEY -: {index} |> xz -c %f > %o |> $(PUBLIC_DIR)/index/%b.xz {dist} -: {dist} |> !public_signature |> -endif diff --git a/index/index.xml b/index/index.xml deleted file mode 100644 index dc7d256df..000000000 --- a/index/index.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/nim/Tuprules.tup b/nim/Tuprules.tup index 9ef5f489c..6a92c1489 100644 --- a/nim/Tuprules.tup +++ b/nim/Tuprules.tup @@ -1,2 +1,13 @@ +# Nim default variables + +NIM_RELEASE_FLAG = -d:release + # Drop the relase flag with the line "NIM_RELEASE_FLAG=" + +NIM_SRC_DIR = src + # Build everything in this directory + +BIN_VERSION = $(GIT_VERSION) + # Use the git version as the binary package version + NIMBLE_BINARIES_INCLUDE = $(TUP_CWD)/binaries.tup NIMBLE_PACKAGE_INCLUDE = $(TUP_CWD)/package.tup diff --git a/nim/binaries.tup b/nim/binaries.tup index 51cc7300f..79d2ffee9 100644 --- a/nim/binaries.tup +++ b/nim/binaries.tup @@ -1,9 +1,7 @@ -# Drop the relase flag with the line "NIM_RELEASE_FLAG=" -NIM_RELEASE_FLAG = -d:release +!nim_build = |> ^o Nimble %B^ \ + nimble cpp $(NIM_RELEASE_FLAG) $(NIM_FLAGS) --os:genode -d:posix --parallelBuild:1 -o:%B %f \ +|> %B ./ -!nim_build = |> ^o Nimble %B^ nimble cpp $(NIM_RELEASE_FLAG) --os:genode -d:posix -o:%B %f |> %B ./ - -: foreach src/*.nim |> !nim_build |> {output} -: foreach {output} |> !strip_to_depot |> {binary} - -: {binary} |> !publish_bin |> +: foreach $(NIM_SRC_DIR)/*.nim |> !nim_build |> {binary} +: foreach {binary} |> !collect_bin |> +: |> !bin |> diff --git a/nim/hello_nim/Tupfile b/nim/hello_nim/Tupfile new file mode 100644 index 000000000..5b61c5b96 --- /dev/null +++ b/nim/hello_nim/Tupfile @@ -0,0 +1,10 @@ +TARGET_NAME = hello_nim + +PKG_DEPENDS += \ + @(PUBLIC_SRC_LIBC) \ + @(PUBLIC_SRC_VFS) \ + _/src/$(TARGET_NAME) \ + +include_rules +include $(NIMBLE_BINARIES_INCLUDE) +include $(NIMBLE_PACKAGE_INCLUDE) diff --git a/nim/hello_nim/hello_nim.nimble b/nim/hello_nim/hello_nim.nimble new file mode 100644 index 000000000..df2f82d67 --- /dev/null +++ b/nim/hello_nim/hello_nim.nimble @@ -0,0 +1,12 @@ +# Package + +version = "0.1.0" +author = "Emery Hemingway" +description = "Hello world example" +license = "None" +srcDir = "src" +bin = @["hello_nim"] + +# Dependencies + +requires "nim >= 0.19", "genode >= 18.05" diff --git a/nim/hello_nim/runtime b/nim/hello_nim/runtime new file mode 100644 index 000000000..101873fba --- /dev/null +++ b/nim/hello_nim/runtime @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/nim/hello_nim/src/hello_nim.nim b/nim/hello_nim/src/hello_nim.nim new file mode 100644 index 000000000..2fb34a08c --- /dev/null +++ b/nim/hello_nim/src/hello_nim.nim @@ -0,0 +1,8 @@ +import genode + # The Genode module must be imported + # to resolve link dependencies + +componentConstructHook = proc (env: GenodeEnv) = + echo("Hello, World!") + quit() + # exit must be explicit diff --git a/nim/package.tup b/nim/package.tup index e2c99cb1a..172f93911 100644 --- a/nim/package.tup +++ b/nim/package.tup @@ -1,7 +1,4 @@ -include_rules - -: archives | ./ |> !archives_to_depot |> {package} -: runtime | ./ |> !runtime_to_depot |> {package} - -: {package} |> !publish_pkg |> +PKG_VERSION = $(GIT_VERSION) +: runtime | ./ |> !collect_pkg_runtime |> +: |> !pkg |> diff --git a/tup.config b/tup.config deleted file mode 100644 index 1b4ac9ffc..000000000 --- a/tup.config +++ /dev/null @@ -1,8 +0,0 @@ -CONFIG_SCULPT_VERSION=19.02 -CONFIG_SDK_USER=ehmry -CONFIG_SDK_VERSION=19.02 -CONFIG_UPSTREAM_USER=ehmry -CONFIG_UPSTREAM_VERSION=19.02 -CONFIG_DEPOT_USER=local -CONFIG_DEPOT_VERSION=current -#CONFIG_DEPOT_KEY=6E10414EE7160781F5FEE8FFB14D043A26B3D2C7 From 828131b4b3d7dc71471c766e6a8c76530ead9a0a Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Tue, 14 May 2019 09:46:10 +0200 Subject: [PATCH 2/2] Add gitignore to build-x86_64 directory --- Tuprules.tup | 2 ++ build-x86_64/.gitignore | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 build-x86_64/.gitignore diff --git a/Tuprules.tup b/Tuprules.tup index 7c1ecf12f..f0c6a7a67 100644 --- a/Tuprules.tup +++ b/Tuprules.tup @@ -1,3 +1,5 @@ +.gitignore + ifeq ($(RAW_NAME),) RAW_NAME = $(TARGET_NAME) endif diff --git a/build-x86_64/.gitignore b/build-x86_64/.gitignore new file mode 100644 index 000000000..14849fb35 --- /dev/null +++ b/build-x86_64/.gitignore @@ -0,0 +1,2 @@ +/.gitignore +/public