Initial commit

This commit is contained in:
Ehmry - 2019-03-07 17:52:06 +01:00
commit 00415c56ee
16 changed files with 288 additions and 0 deletions

19
README.md Normal file
View File

@ -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.

0
Tupfile.ini Normal file
View File

69
Tuprules.tup Normal file
View File

@ -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)/<runtimes>
!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

14
app/hello-world/Tupfile Normal file
View File

@ -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 |>

2
app/hello-world/archives Normal file
View File

@ -0,0 +1,2 @@
@SDK_USER@/src/vfs/@SDK_VERSION@
@DEPOT_USER@/src/hello-world/@DEPOT_VERSION@

View File

@ -0,0 +1,8 @@
/* Genode includes */
#include <base/component.h>
#include <base/log.h>
void Component::construct(Genode::Env &)
{
Genode::log("Hello world!");
}

13
app/hello-world/runtime Normal file
View File

@ -0,0 +1,13 @@
<runtime ram="2M" caps="96" binary="hello-world">
<requires>
<log/>
</requires>
<content>
<rom label="hello-world"/>
</content>
<config/>
</runtime>

28
errata/base_types.xsd Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="Boolean">
<xs:restriction base="xs:string">
<xs:enumeration value="true" />
<xs:enumeration value="yes" />
<xs:enumeration value="on" />
<xs:enumeration value="false" />
<xs:enumeration value="no" />
<xs:enumeration value="off" />
</xs:restriction>
</xs:simpleType><!-- Boolean -->
<xs:simpleType name="Number_of_bytes">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType><!-- Number_of_bytes -->
<xs:simpleType name="Session_label">
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="160"/>
</xs:restriction>
</xs:simpleType><!-- Session_label -->
</xs:schema>

68
errata/runtime.xsd Normal file
View File

@ -0,0 +1,68 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="base_types.xsd"/>
<xs:complexType name="template_service">
<xs:choice minOccurs="0" maxOccurs="unbounded"/>
<xs:attribute name="label" type="Session_label" />
</xs:complexType>
<xs:complexType name="template_services">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="audio_in" type="template_service"/>
<xs:element name="audio_out" type="template_service"/>
<xs:element name="block" type="template_service"/>
<xs:element name="file_system" type="template_service"/>
<xs:element name="framebuffer" type="template_service"/>
<xs:element name="input" type="template_service"/>
<xs:element name="log" type="template_service"/>
<xs:element name="nic" type="template_service"/>
<xs:element name="nitpicker" type="template_service"/>
<xs:element name="report" type="template_service"/>
<xs:element name="rm" type="template_service"/>
<xs:element name="rom" type="template_service"/>
<xs:element name="rtc" type="template_service"/>
<xs:element name="terminal" type="template_service"/>
</xs:choice>
</xs:complexType>
<xs:element name="runtime">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="requires" type="template_services"/>
<xs:element name="provides" type="template_services"/>
<xs:element name="content">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="rom">
<xs:complexType>
<xs:attribute name="label" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="config">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip" />
</xs:sequence>
<xs:anyAttribute processContents="skip"/>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:attribute name="ram" type="Number_of_bytes" />
<xs:attribute name="caps" type="xs:positiveInteger" />
<xs:attribute name="binary" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:schema>

25
index/Tupfile Normal file
View File

@ -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)/<runtimes> |> ^ generate index^ \
echo '<index>' > %o; \
echo %<runtimes> | tr ' ' '\n' | sort |\
sed \
-e 's|\.\./depot/| <pkg path="|' \
-e 's|runtime|"/>|' \
- >> %o; \
echo '</index>' >> %o |> $(DEPOT_INDEX_FILE) {index}
endif
ifdef DEPOT_KEY
: {index} |> xz -c %f > %o |> $(PUBLIC_DIR)/index/%b.xz {dist}
: {dist} |> !public_signature |>
endif

7
index/index.xml Normal file
View File

@ -0,0 +1,7 @@
<index>
<index name="Example">
<pkg path="@DEPOT_USER@/pkg/hello-world/@DEPOT_VERSION@" info="An example"/>
</index>
</index>

9
nim/README.md Normal file
View File

@ -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)
```

2
nim/Tuprules.tup Normal file
View File

@ -0,0 +1,2 @@
NIMBLE_BINARIES_INCLUDE = $(TUP_CWD)/binaries.tup
NIMBLE_PACKAGE_INCLUDE = $(TUP_CWD)/package.tup

9
nim/binaries.tup Normal file
View File

@ -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 ./<binaries>
: foreach src/*.nim |> !nim_build |> {output}
: foreach {output} |> !strip_to_depot |> {binary}
: {binary} |> !publish_bin |>

7
nim/package.tup Normal file
View File

@ -0,0 +1,7 @@
include_rules
: archives | ./<binaries> |> !archives_to_depot |> {package}
: runtime | ./<binaries> |> !runtime_to_depot |> {package}
: {package} |> !publish_pkg |>

8
tup.config Normal file
View File

@ -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