Enable setting build-dir
build-dir is disabled by default and can be enabled with project conf
or through element
diff --git a/src/buildstream_plugins/elements/autotools.py b/src/buildstream_plugins/elements/autotools.py
index 5d29870..f291bb7 100644
--- a/src/buildstream_plugins/elements/autotools.py
+++ b/src/buildstream_plugins/elements/autotools.py
@@ -51,6 +51,14 @@
conf-global: |
--disable-gtk-doc --disable-static
+By default build-dir is not used. To improve probability build does not
+tamper with sources, you can set build-dir like
+
+.. code:: yaml
+
+ variables:
+ build-dir: _builddir
+
Here is the default configuration for the ``autotools`` element in full:
.. literalinclude:: ../../../src/buildstream_plugins/elements/autotools.yaml
diff --git a/src/buildstream_plugins/elements/autotools.yaml b/src/buildstream_plugins/elements/autotools.yaml
index 85f7393..80f35e0 100644
--- a/src/buildstream_plugins/elements/autotools.yaml
+++ b/src/buildstream_plugins/elements/autotools.yaml
@@ -1,6 +1,7 @@
# Autotools default configurations
variables:
+ build-dir: "."
autogen: |
export NOCONFIGURE=1;
@@ -44,8 +45,8 @@
%{conf-cmd} %{conf-args}
- make: make
- make-install: make -j1 DESTDIR="%{install-root}" install
+ make: make -C "%{build-dir}"
+ make-install: make -j1 -C "%{build-dir}" DESTDIR="%{install-root}" install
# Set this if the sources cannot handle parallelization.
#
@@ -93,6 +94,8 @@
- |
%{autogen}
- |
+ mkdir -p "%{build-dir}"
+ cd "%{build-dir}"
%{configure}
# Commands for building the software
diff --git a/tests/cachekey/project/elements/autotools1.expected b/tests/cachekey/project/elements/autotools1.expected
index 0dc7777..37031e1 100644
--- a/tests/cachekey/project/elements/autotools1.expected
+++ b/tests/cachekey/project/elements/autotools1.expected
@@ -1 +1 @@
-53651f0c81d32341b4cc46f12fb4a1123f66e2e65111d2176b5c5102e96de2e2
\ No newline at end of file
+184b5a595a9c7a56d7e58d3268de441b25ef4d02c46a0e2fd389238bc57aa467
\ No newline at end of file
diff --git a/tests/cachekey/project/target.expected b/tests/cachekey/project/target.expected
index 407d30c..0bd64a4 100644
--- a/tests/cachekey/project/target.expected
+++ b/tests/cachekey/project/target.expected
@@ -1 +1 @@
-c32929ce4692a7a87664b3245a7740fc518679979972c2d221c4ee6a802b12c3
\ No newline at end of file
+e93e7c247744177a6c603f9cb3cd1b02a477d706c29d5a56461a8e58c8bea552
\ No newline at end of file