summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2024-04-17 21:47:39 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2024-04-21 17:19:59 +0200
commit65ebd7525f9cbb93450a104d9e9a635c7f1ef104 (patch)
treedadc34a1a7ef5c9b8e277424732e4cca0884cbf7
parent7164660d63052bfa47a082711a64529b026b35f2 (diff)
downloadrebel-65ebd7525f9cbb93450a104d9e9a635c7f1ef104.tar
rebel-65ebd7525f9cbb93450a104d9e9a635c7f1ef104.zip
examples: Add RecipeLang example
-rw-r--r--examples/recipes/gmp/build.recipe69
1 files changed, 69 insertions, 0 deletions
diff --git a/examples/recipes/gmp/build.recipe b/examples/recipes/gmp/build.recipe
new file mode 100644
index 0000000..44e87d6
--- /dev/null
+++ b/examples/recipes/gmp/build.recipe
@@ -0,0 +1,69 @@
+// External definitions used by this recipe:
+//
+// workdir: String
+// name: String
+// destdir: String
+// build: Platform
+// build_depend: (task: TaskID) -> TaskDep
+// host_depend: (task: TaskID) -> TaskDep
+
+version = "6.3.0";
+sourcedir = "{{workdir}}/{{name}}-{{version}}";
+builddir = "{{workdir}}/{{name}}-build";
+
+fetch source {
+ url = ["https://invalid/{{name}}-{{version}}.tar.xz"];
+ // TODO: Move to lockfile
+ sha256 = "a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898";
+}
+
+task unpack() {
+ depends = [source];
+
+ run = ```
+ tar xf {{source.path}}
+ ```;
+}
+
+task configure(host: Platform) {
+ parent = unpack();
+ depends = [
+ build_depend(toolchain::build_depends),
+ host_depend(toolchain::depends),
+ ];
+
+ run = ```
+ mkdir {{builddir}}
+ cd {{builddir}}
+ {{sourcedir}}/configure \
+ --build={{build.gnu_triplet}} \
+ --host={{host.gnu_triplet}} \
+ --prefix={{host.prefix}}
+ ```;
+}
+
+task compile(host: Platform) {
+ parent = configure(host);
+
+ run = ```
+ cd {{builddir}}
+ make
+ ```;
+}
+
+task install(host: Platform) {
+ parent = compile(host);
+
+ output = {
+ default = {
+ runtime_depends = [host_depend(toolchain::depends)],
+ },
+ };
+
+ run = ```
+ cd {{builddir}}
+ make DESTDIR={{destdir}} install
+ rm {{destdir}}{{host.prefix}}/lib/*.a
+ rm {{destdir}}{{host.prefix}}/lib/*.la
+ ```;
+}