diff options
Diffstat (limited to 'doc/examples')
10 files changed, 144 insertions, 0 deletions
diff --git a/doc/examples/integration-commands/elements/base.bst b/doc/examples/integration-commands/elements/base.bst new file mode 100644 index 000000000..1b85a9e8c --- /dev/null +++ b/doc/examples/integration-commands/elements/base.bst @@ -0,0 +1,5 @@ +kind: stack +description: Base stack + +depends: +- base/alpine.bst diff --git a/doc/examples/integration-commands/elements/base/alpine.bst b/doc/examples/integration-commands/elements/base/alpine.bst new file mode 100644 index 000000000..433f4773a --- /dev/null +++ b/doc/examples/integration-commands/elements/base/alpine.bst @@ -0,0 +1,17 @@ +kind: import +description: | + + Alpine Linux base runtime + +sources: +- kind: tar + url: alpine:integration-tests-base.v1.x86_64.tar.xz + ref: 3eb559250ba82b64a68d86d0636a6b127aa5f6d25d3601a79f79214dc9703639 + +# +# Run ldconfig in the libdir before running anything +# +public: + bst: + integration-commands: + - ldconfig "%{libdir}" diff --git a/doc/examples/integration-commands/elements/hello.bst b/doc/examples/integration-commands/elements/hello.bst new file mode 100644 index 000000000..c90254f10 --- /dev/null +++ b/doc/examples/integration-commands/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/integration-commands/elements/libhello.bst b/doc/examples/integration-commands/elements/libhello.bst new file mode 100644 index 000000000..53496c84c --- /dev/null +++ b/doc/examples/integration-commands/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/integration-commands/files/hello/Makefile b/doc/examples/integration-commands/files/hello/Makefile new file mode 100644 index 000000000..21471d40f --- /dev/null +++ b/doc/examples/integration-commands/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/integration-commands/files/hello/hello.c b/doc/examples/integration-commands/files/hello/hello.c new file mode 100644 index 000000000..83e762c29 --- /dev/null +++ b/doc/examples/integration-commands/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/integration-commands/files/libhello/Makefile b/doc/examples/integration-commands/files/libhello/Makefile new file mode 100644 index 000000000..63ee11069 --- /dev/null +++ b/doc/examples/integration-commands/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/integration-commands/files/libhello/libhello.c b/doc/examples/integration-commands/files/libhello/libhello.c new file mode 100644 index 000000000..759b33926 --- /dev/null +++ b/doc/examples/integration-commands/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/integration-commands/files/libhello/libhello.h b/doc/examples/integration-commands/files/libhello/libhello.h new file mode 100644 index 000000000..f714f3659 --- /dev/null +++ b/doc/examples/integration-commands/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/integration-commands/project.conf b/doc/examples/integration-commands/project.conf new file mode 100644 index 000000000..b33267005 --- /dev/null +++ b/doc/examples/integration-commands/project.conf @@ -0,0 +1,12 @@ +# Unique project name +name: integration-commands + +# Required BuildStream format version +format-version: 9 + +# Subdirectory where elements are stored +element-path: elements + +# Define an alias for our alpine tarball +aliases: + alpine: https://gnome7.codethink.co.uk/tarballs/ |