diff options
Diffstat (limited to 'doc/examples/composition')
-rw-r--r-- | doc/examples/composition/elements/base.bst | 5 | ||||
-rw-r--r-- | doc/examples/composition/elements/base/alpine.bst | 31 | ||||
-rw-r--r-- | doc/examples/composition/elements/hello.bst | 22 | ||||
-rw-r--r-- | doc/examples/composition/elements/libhello.bst | 22 | ||||
-rw-r--r-- | doc/examples/composition/elements/runtime-only.bst | 23 | ||||
-rw-r--r-- | doc/examples/composition/files/hello/Makefile | 12 | ||||
-rw-r--r-- | doc/examples/composition/files/hello/hello.c | 20 | ||||
-rw-r--r-- | doc/examples/composition/files/libhello/Makefile | 17 | ||||
-rw-r--r-- | doc/examples/composition/files/libhello/libhello.c | 9 | ||||
-rw-r--r-- | doc/examples/composition/files/libhello/libhello.h | 8 | ||||
-rw-r--r-- | doc/examples/composition/project.conf | 12 |
11 files changed, 181 insertions, 0 deletions
diff --git a/doc/examples/composition/elements/base.bst b/doc/examples/composition/elements/base.bst new file mode 100644 index 000000000..1b85a9e8c --- /dev/null +++ b/doc/examples/composition/elements/base.bst @@ -0,0 +1,5 @@ +kind: stack +description: Base stack + +depends: +- base/alpine.bst diff --git a/doc/examples/composition/elements/base/alpine.bst b/doc/examples/composition/elements/base/alpine.bst new file mode 100644 index 000000000..be89f656f --- /dev/null +++ b/doc/examples/composition/elements/base/alpine.bst @@ -0,0 +1,31 @@ +kind: import +description: | + + Alpine Linux base runtime + +sources: +- kind: tar + url: alpine:integration-tests-base.v1.x86_64.tar.xz + ref: 3eb559250ba82b64a68d86d0636a6b127aa5f6d25d3601a79f79214dc9703639 + +public: + bst: + # + # Run ldconfig in the libdir before running anything + # + integration-commands: + - ldconfig "%{libdir}" + + # + # Extend the runtime split-rule domain for this element, + # such that we capture the runtime linker. + # + # There are various other things provided by this runtime + # such as tooling in /bin and an installation of python + # and perl, but we'll overlook these for the sake of + # this example. + # + split-rules: + runtime: + (>): + - "/lib/ld*.so*" diff --git a/doc/examples/composition/elements/hello.bst b/doc/examples/composition/elements/hello.bst new file mode 100644 index 000000000..c90254f10 --- /dev/null +++ b/doc/examples/composition/elements/hello.bst @@ -0,0 +1,22 @@ +kind: manual +description: | + + The hello application + +# Depend on the hello library +depends: +- libhello.bst + +# Stage the files/hello directory for building +sources: + - kind: local + path: files/hello + +# Now configure the commands to run +config: + + build-commands: + - make PREFIX="%{prefix}" + + install-commands: + - make -j1 PREFIX="%{prefix}" DESTDIR="%{install-root}" install diff --git a/doc/examples/composition/elements/libhello.bst b/doc/examples/composition/elements/libhello.bst new file mode 100644 index 000000000..53496c84c --- /dev/null +++ b/doc/examples/composition/elements/libhello.bst @@ -0,0 +1,22 @@ +kind: manual +description: | + + The libhello library + +# Depend on the base system +depends: +- base.bst + +# Stage the files/libhello directory for building +sources: + - kind: local + path: files/libhello + +# Now configure the commands to run +config: + + build-commands: + - make PREFIX="%{prefix}" + + install-commands: + - make -j1 PREFIX="%{prefix}" DESTDIR="%{install-root}" install diff --git a/doc/examples/composition/elements/runtime-only.bst b/doc/examples/composition/elements/runtime-only.bst new file mode 100644 index 000000000..9885b7396 --- /dev/null +++ b/doc/examples/composition/elements/runtime-only.bst @@ -0,0 +1,23 @@ +kind: compose + +# Dependencies of a compose element cannot be transient, +# we can only build-depend on the inputs of a composition. +# +build-depends: +- hello.bst + +config: + + # Only include files from the runtime domain + # + include: + - runtime + + # Don't include any files which do not match any existing + # split rule domains. + # + include-orphans: False + + # Run integration commands before composition + # + integrate: True diff --git a/doc/examples/composition/files/hello/Makefile b/doc/examples/composition/files/hello/Makefile new file mode 100644 index 000000000..21471d40f --- /dev/null +++ b/doc/examples/composition/files/hello/Makefile @@ -0,0 +1,12 @@ +# Sample makefile for hello.c +# +.PHONY: all install + +all: hello + +install: + install -d ${DESTDIR}${PREFIX}/bin + install -m 755 hello ${DESTDIR}${PREFIX}/bin + +hello: hello.c + $(CC) $< -o $@ -Wall -lhello diff --git a/doc/examples/composition/files/hello/hello.c b/doc/examples/composition/files/hello/hello.c new file mode 100644 index 000000000..83e762c29 --- /dev/null +++ b/doc/examples/composition/files/hello/hello.c @@ -0,0 +1,20 @@ +/* + * hello.c - Simple hello program + */ +#include <stdio.h> +#include <libhello.h> + +int main(int argc, char *argv[]) +{ + const char *person = NULL; + + if (argc > 1) + person = argv[1]; + + if (person) + hello(person); + else + hello("stranger"); + + return 0; +} diff --git a/doc/examples/composition/files/libhello/Makefile b/doc/examples/composition/files/libhello/Makefile new file mode 100644 index 000000000..63ee11069 --- /dev/null +++ b/doc/examples/composition/files/libhello/Makefile @@ -0,0 +1,17 @@ +# Sample makefile for hello library +# +.PHONY: all install + +all: libhello.so + +install: + install -d ${DESTDIR}${PREFIX}/lib + install -d ${DESTDIR}${PREFIX}/include + install -m 644 libhello.so ${DESTDIR}${PREFIX}/lib + install -m 644 libhello.h ${DESTDIR}${PREFIX}/include + +%.o: %.c %.h + $(CC) -c $< -o $@ -Wall + +libhello.so: libhello.o + $(CC) -shared -o $@ $< diff --git a/doc/examples/composition/files/libhello/libhello.c b/doc/examples/composition/files/libhello/libhello.c new file mode 100644 index 000000000..759b33926 --- /dev/null +++ b/doc/examples/composition/files/libhello/libhello.c @@ -0,0 +1,9 @@ +/* + * libhello.c - The hello library + */ +#include <stdio.h> + +void hello(const char *person) +{ + printf("Hello %s\n", person); +} diff --git a/doc/examples/composition/files/libhello/libhello.h b/doc/examples/composition/files/libhello/libhello.h new file mode 100644 index 000000000..f714f3659 --- /dev/null +++ b/doc/examples/composition/files/libhello/libhello.h @@ -0,0 +1,8 @@ +/* + * libhello.h - The hello library + */ + +/* + * A function to say hello to @person + */ +void hello(const char *person); diff --git a/doc/examples/composition/project.conf b/doc/examples/composition/project.conf new file mode 100644 index 000000000..dc82df72b --- /dev/null +++ b/doc/examples/composition/project.conf @@ -0,0 +1,12 @@ +# Unique project name +name: composition + +# Required BuildStream format version +format-version: 18 + +# Subdirectory where elements are stored +element-path: elements + +# Define an alias for our alpine tarball +aliases: + alpine: https://bst-integration-test-images.ams3.cdn.digitaloceanspaces.com/ |