summaryrefslogtreecommitdiffstats
path: root/examples/recipes/gmp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/recipes/gmp')
-rw-r--r--examples/recipes/gmp/build.recipe67
-rw-r--r--examples/recipes/gmp/build.yml55
2 files changed, 122 insertions, 0 deletions
diff --git a/examples/recipes/gmp/build.recipe b/examples/recipes/gmp/build.recipe
new file mode 100644
index 0000000..19a25f6
--- /dev/null
+++ b/examples/recipes/gmp/build.recipe
@@ -0,0 +1,67 @@
+// External definitions used by this recipe:
+//
+// workdir: String
+// name: String
+// destdir: String
+// build: Platform
+// build_depend: (task: TaskID) -> TaskDep
+// host_depend: (task: TaskID) -> TaskDep
+
+let version = "6.3.0";
+let sourcedir = "{{workdir}}/{{name}}-{{version}}";
+let builddir = "{{workdir}}/{{name}}-build";
+
+fetch source {
+ url: ["https://invalid/{{name}}-{{version}}.tar.xz"],
+ // TODO: Move to lockfile
+ sha256: "a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898",
+}
+
+task unpack() {
+ task.depends = [source];
+
+ ```
+ tar xf {{source.path}}
+ ```
+}
+
+task configure(host: Platform) {
+ task.parent = unpack();
+ task.depends = [
+ build_depend(toolchain::build_depends),
+ host_depend(toolchain::depends),
+ ];
+
+ ```
+ mkdir {{builddir}}
+ cd {{builddir}}
+ {{sourcedir}}/configure \
+ --build={{build.gnu_triplet}} \
+ --host={{host.gnu_triplet}} \
+ --prefix={{host.prefix}}
+ ```
+}
+
+task compile(host: Platform) {
+ task.parent = configure(host);
+
+ ```
+ cd {{builddir}}
+ make
+ ```
+}
+
+task install(host: Platform) {
+ task.parent = compile(host);
+
+ task.output["default"] = {
+ runtime_depends: [host_depend(toolchain::depends)],
+ };
+
+ ```
+ cd {{builddir}}
+ make DESTDIR={{destdir}} install
+ rm {{destdir}}{{host.prefix}}/lib/*.a
+ rm {{destdir}}{{host.prefix}}/lib/*.la
+ ```
+}
diff --git a/examples/recipes/gmp/build.yml b/examples/recipes/gmp/build.yml
new file mode 100644
index 0000000..322f0f0
--- /dev/null
+++ b/examples/recipes/gmp/build.yml
@@ -0,0 +1,55 @@
+meta:
+ version: '6.3.0'
+tasks:
+ unpack:
+ fetch:
+ - name: '{{name}}-{{version}}.tar.xz'
+ sha256: 'a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898'
+ run: |
+ tar xf {{dldir}}/{{name}}-{{version}}.tar.xz
+
+ configure:
+ args:
+ host: 'platform'
+ parent:
+ task: 'unpack'
+ build_depends:
+ - recipe: 'toolchain'
+ task: 'build_depends'
+ depends:
+ - recipe: 'toolchain'
+ task: 'depends'
+ run: |
+ mkdir {{name}}-build
+ cd {{name}}-build
+ ../{{name}}-{{version}}/configure \
+ --build={{build.gnu_triplet}} \
+ --host={{host.gnu_triplet}} \
+ --prefix={{host.prefix}}
+ find -name config.log -delete
+
+ compile:
+ args:
+ host: 'platform'
+ parent:
+ task: 'configure'
+ run: |
+ cd {{name}}-build
+ make
+
+ install:
+ args:
+ host: 'platform'
+ parent:
+ task: 'compile'
+ output:
+ default:
+ runtime_depends:
+ - recipe: 'toolchain'
+ task: 'depends'
+ run: |
+ cd {{name}}-build
+ make DESTDIR={{destdir}} install
+ rm {{destdir}}{{host.prefix}}/lib/*.a
+ rm {{destdir}}{{host.prefix}}/lib/*.la
+