commit 00415c56ee3df73e3e40a3d1c0ee0f5b43c7fff9 Author: Emery Hemingway Date: Thu Mar 7 17:52:06 2019 +0100 Initial commit diff --git a/README.md b/README.md new file mode 100644 index 000000000..c6e7870a1 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +This is a super-repository skeleton containing a [Tup](http://gittup.org/tup) +build system for Genode components and packages. It requires a Genode SDK to be +present and the PKG_CONFIG_PATH variable to be set appropriately, most likely to +`/opt/genode-sdk-x86_64/pkgconfig`. See http://github.com/ehmry/genode/releases +for an SDK. A the `pkg-config` tool and copy of the Genode toolchain is required +as well, see https://genode.org/download/tool-chain. + +To use this build-system, edit the `tup.config` to match your depot user and PGP +key as well as the version of the SDK. Unfortunately the build-system lacks any +knowledge about what packages are available in external depots, so external +package versions must be explicitly stated in `archives` file templates or +within `tup.config`. All `archives` files are treated as a template by +convention and and `@...@` string will be replaced by a corresponding CONFIG_... +value defined in `tup.config`. + +Please refer to the the [Tup documentation](http://gittup.org/tup/) for details +on how the build-system works. + +See http://github.com/ehmry/genode-ehmry as an example. diff --git a/Tupfile.ini b/Tupfile.ini new file mode 100644 index 000000000..e69de29bb diff --git a/Tuprules.tup b/Tuprules.tup new file mode 100644 index 000000000..aee42341e --- /dev/null +++ b/Tuprules.tup @@ -0,0 +1,69 @@ +.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 +endif + +ifndef DEPOT_VERSION +error CONFIG_DEPOT_VERSION is undefined +endif + +DEPOT_DIR = $(TUP_CWD)/depot/@(DEPOT_USER) +PUBLIC_DIR = $(TUP_CWD)/public/@(DEPOT_USER) + +DEPOT_BIN_DIR = $(DEPOT_DIR)/bin/x86_64 +PUBLIC_BIN_DIR = $(PUBLIC_DIR)/bin/x86_64 + +DEPOT_PKG_DIR = $(DEPOT_DIR)/pkg +PUBLIC_PKG_DIR = $(PUBLIC_DIR)/pkg + +DEPOT_RAW_DIR = $(DEPOT_DIR)/raw +PUBLIC_RAW_DIR = $(PUBLIC_DIR)/raw + +!strip_to_depot = |> ^ strip bin/%d^ strip -o %o %f |> $(DEPOT_BIN_DIR)/%d/@(DEPOT_VERSION)/%b + +ERRATA_DIR = $(TUP_CWD)/errata + +!archives_to_depot = |> ^ varse %d archives^ tup varsed %f %o |> $(DEPOT_PKG_DIR)/%d/@(DEPOT_VERSION)/archives + +!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)/ + +!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 diff --git a/app/hello-world/Tupfile b/app/hello-world/Tupfile new file mode 100644 index 000000000..d92f51c01 --- /dev/null +++ b/app/hello-world/Tupfile @@ -0,0 +1,14 @@ +include_rules + +PKGS = 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} + +: {binary} |> !strip_to_depot |> + +: archives | {binary} |> !archives_to_depot |> {package} +: runtime | {binary} |> !runtime_to_depot |> {package} + +: |> !publish_bin |> +: |> !publish_pkg |> diff --git a/app/hello-world/archives b/app/hello-world/archives new file mode 100644 index 000000000..f6aae7850 --- /dev/null +++ b/app/hello-world/archives @@ -0,0 +1,2 @@ +@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 new file mode 100644 index 000000000..cdf2923a2 --- /dev/null +++ b/app/hello-world/component.cc @@ -0,0 +1,8 @@ +/* Genode includes */ +#include +#include + +void Component::construct(Genode::Env &) +{ + Genode::log("Hello world!"); +} diff --git a/app/hello-world/runtime b/app/hello-world/runtime new file mode 100644 index 000000000..3ede21055 --- /dev/null +++ b/app/hello-world/runtime @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/errata/base_types.xsd b/errata/base_types.xsd new file mode 100644 index 000000000..c7a477743 --- /dev/null +++ b/errata/base_types.xsd @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/errata/runtime.xsd b/errata/runtime.xsd new file mode 100644 index 000000000..4c17726c4 --- /dev/null +++ b/errata/runtime.xsd @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/index/Tupfile b/index/Tupfile new file mode 100644 index 000000000..e2aeaf774 --- /dev/null +++ b/index/Tupfile @@ -0,0 +1,25 @@ +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 new file mode 100644 index 000000000..dc7d256df --- /dev/null +++ b/index/index.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/nim/README.md b/nim/README.md new file mode 100644 index 000000000..7311716a4 --- /dev/null +++ b/nim/README.md @@ -0,0 +1,9 @@ +This directory hosts component submodules written in Nim. Integration is simple, +commit a `Tupfile` containing the following to the upstream repository, assuming +the repository contains an `*,nimble`, an `archives`, and a `runtime` file. + +```tup +include_rules +include $(NIMBLE_BINARIES_INCLUDE) +include $(NIMBLE_PACKAGE_INCLUDE) +``` diff --git a/nim/Tuprules.tup b/nim/Tuprules.tup new file mode 100644 index 000000000..9ef5f489c --- /dev/null +++ b/nim/Tuprules.tup @@ -0,0 +1,2 @@ +NIMBLE_BINARIES_INCLUDE = $(TUP_CWD)/binaries.tup +NIMBLE_PACKAGE_INCLUDE = $(TUP_CWD)/package.tup diff --git a/nim/binaries.tup b/nim/binaries.tup new file mode 100644 index 000000000..51cc7300f --- /dev/null +++ b/nim/binaries.tup @@ -0,0 +1,9 @@ +# 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) --os:genode -d:posix -o:%B %f |> %B ./ + +: foreach src/*.nim |> !nim_build |> {output} +: foreach {output} |> !strip_to_depot |> {binary} + +: {binary} |> !publish_bin |> diff --git a/nim/package.tup b/nim/package.tup new file mode 100644 index 000000000..e2c99cb1a --- /dev/null +++ b/nim/package.tup @@ -0,0 +1,7 @@ +include_rules + +: archives | ./ |> !archives_to_depot |> {package} +: runtime | ./ |> !runtime_to_depot |> {package} + +: {package} |> !publish_pkg |> + diff --git a/tup.config b/tup.config new file mode 100644 index 000000000..1b4ac9ffc --- /dev/null +++ b/tup.config @@ -0,0 +1,8 @@ +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