Will Salmon pushed to branch willsalmon/outOfSourecBuild at BuildStream / buildstream
Commits:
-
ab15c759
by William Salmon at 2018-10-02T12:41:04Z
-
2384ea4a
by William Salmon at 2018-10-02T12:41:05Z
7 changed files:
- buildstream/buildelement.py
- buildstream/plugins/elements/distutils.yaml
- buildstream/plugins/elements/meson.yaml
- buildstream/plugins/elements/pip.yaml
- buildstream/plugins/elements/qmake.yaml
- buildstream/source.py
- tests/format/variables.py
Changes:
... | ... | @@ -23,6 +23,40 @@ BuildElement - Abstract class for build elements |
23 | 23 |
The BuildElement class is a convenience element one can derive from for
|
24 | 24 |
implementing the most common case of element.
|
25 | 25 |
|
26 |
+Built-in functionality
|
|
27 |
+----------------------
|
|
28 |
+ |
|
29 |
+The BuildElement base class provides built in functionality that could be overridden by the
|
|
30 |
+individual plugins.
|
|
31 |
+ |
|
32 |
+This section will give a brief summary of how some of the common features work, some of them or the variables they
|
|
33 |
+use will be further detailed in the following sections.
|
|
34 |
+ |
|
35 |
+* Location for running commands
|
|
36 |
+ |
|
37 |
+ The ``command-subdir`` variable sets where the build commands will be executed, if the directory does not exist it
|
|
38 |
+ will be created, it is defined relative to the buildroot.
|
|
39 |
+ |
|
40 |
+* Location for configuring the project
|
|
41 |
+ |
|
42 |
+ The ``conf-root`` is defined by default as ``.`` and is the location that specific build element can use to look
|
|
43 |
+ for build configuration files, currently autotools and cmake use this.
|
|
44 |
+ |
|
45 |
+ The configuration commands are run in ``command-subdir`` and by default ``conf-root`` is ``.`` so if
|
|
46 |
+ ``conf-root`` is not set the configuration files in ``command-subdir`` will be used.
|
|
47 |
+ |
|
48 |
+ By setting ``conf-root`` to ``"%{build-root}/Source/conf_location"`` and your source elements ``directory`` variable
|
|
49 |
+ to ``Source`` then the configuration files in the directory ``conf_location`` with in your Source will be used.
|
|
50 |
+ However the location where your configuration command will be run will still be wherever you set your
|
|
51 |
+ ``command-subdir`` to be.
|
|
52 |
+ |
|
53 |
+ The ``conf-root`` variable is available since :ref:`format version 17 <project_format_version>`
|
|
54 |
+ |
|
55 |
+* Install Location
|
|
56 |
+ |
|
57 |
+ You should not change the ``install-root`` variable as it is a special writeable location in the sandbox but it is
|
|
58 |
+ useful when writing custom install instructions as it may need to be supplied as the ``DESTDIR``, please see the
|
|
59 |
+ cmake build element for example.
|
|
26 | 60 |
|
27 | 61 |
Abstract method implementations
|
28 | 62 |
-------------------------------
|
... | ... | @@ -8,7 +8,7 @@ variables: |
8 | 8 |
|
9 | 9 |
python-build: |
|
10 | 10 |
|
11 |
- %{python} setup.py build
|
|
11 |
+ %{python} %{conf-root}/setup.py build
|
|
12 | 12 |
|
13 | 13 |
install-args: |
|
14 | 14 |
|
... | ... | @@ -17,7 +17,7 @@ variables: |
17 | 17 |
|
18 | 18 |
python-install: |
|
19 | 19 |
|
20 |
- %{python} setup.py install %{install-args}
|
|
20 |
+ %{python} %{conf-root}/setup.py install %{install-args}
|
|
21 | 21 |
|
22 | 22 |
|
23 | 23 |
config:
|
... | ... | @@ -28,7 +28,7 @@ variables: |
28 | 28 |
--mandir=%{mandir} \
|
29 | 29 |
--infodir=%{infodir} %{meson-extra} %{meson-global} %{meson-local}
|
30 | 30 |
|
31 |
- meson: meson %{build-dir} %{meson-args}
|
|
31 |
+ meson: meson %{conf-root} %{build-dir} %{meson-args}
|
|
32 | 32 |
|
33 | 33 |
ninja: |
|
34 | 34 |
ninja -j ${NINJAJOBS} -C %{build-dir}
|
... | ... | @@ -14,7 +14,7 @@ config: |
14 | 14 |
#
|
15 | 15 |
install-commands:
|
16 | 16 |
- |
|
17 |
- %{pip} install --no-deps --root=%{install-root} --prefix=%{prefix} .
|
|
17 |
+ %{pip} install --no-deps --root=%{install-root} --prefix=%{prefix} %{conf-root}
|
|
18 | 18 |
|
19 | 19 |
# Commands for stripping debugging information out of
|
20 | 20 |
# installed binaries
|
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 |
|
3 | 3 |
variables:
|
4 | 4 |
|
5 |
- qmake: qmake -makefile
|
|
5 |
+ qmake: qmake -makefile %{conf-root}
|
|
6 | 6 |
make: make
|
7 | 7 |
make-install: make -j1 INSTALL_ROOT="%{install-root}" install
|
8 | 8 |
|
... | ... | @@ -20,6 +20,19 @@ |
20 | 20 |
Source - Base source class
|
21 | 21 |
==========================
|
22 | 22 |
|
23 |
+Built-in functionality
|
|
24 |
+----------------------
|
|
25 |
+ |
|
26 |
+The Source base class provides built in functionality that could be overridden by the
|
|
27 |
+individual plugins.
|
|
28 |
+ |
|
29 |
+* Directory
|
|
30 |
+ |
|
31 |
+ The ``directory`` variable can be set for all sources of a type in project.conf
|
|
32 |
+ or per source within a element.
|
|
33 |
+ |
|
34 |
+ This sets the location with in the build root that the content of the source will be
|
|
35 |
+ loaded in to. If the location dose not exist it will be created.
|
|
23 | 36 |
|
24 | 37 |
.. _core_source_abstract_methods:
|
25 | 38 |
|
... | ... | @@ -22,7 +22,7 @@ DATA_DIR = os.path.join( |
22 | 22 |
"cmake -B_builddir -H\".\" -G\"Unix Makefiles\" " + "-DCMAKE_INSTALL_PREFIX:PATH=\"/usr\" \\\n" +
|
23 | 23 |
"-DCMAKE_INSTALL_LIBDIR=lib "),
|
24 | 24 |
('distutils.bst', 'python-install',
|
25 |
- "python3 setup.py install --prefix \"/usr\" \\\n" +
|
|
25 |
+ "python3 ./setup.py install --prefix \"/usr\" \\\n" +
|
|
26 | 26 |
"--root \"/buildstream-install\""),
|
27 | 27 |
('makemaker.bst', 'configure', "perl Makefile.PL PREFIX=/buildstream-install/usr"),
|
28 | 28 |
('modulebuild.bst', 'configure', "perl Build.PL --prefix \"/buildstream-install/usr\""),
|
... | ... | @@ -48,7 +48,7 @@ def test_defaults(cli, datafiles, tmpdir, target, varname, expected): |
48 | 48 |
"cmake -B_builddir -H\".\" -G\"Ninja\" " + "-DCMAKE_INSTALL_PREFIX:PATH=\"/opt\" \\\n" +
|
49 | 49 |
"-DCMAKE_INSTALL_LIBDIR=lib "),
|
50 | 50 |
('distutils.bst', 'python-install',
|
51 |
- "python3 setup.py install --prefix \"/opt\" \\\n" +
|
|
51 |
+ "python3 ./setup.py install --prefix \"/opt\" \\\n" +
|
|
52 | 52 |
"--root \"/custom/install/root\""),
|
53 | 53 |
('makemaker.bst', 'configure', "perl Makefile.PL PREFIX=/custom/install/root/opt"),
|
54 | 54 |
('modulebuild.bst', 'configure', "perl Build.PL --prefix \"/custom/install/root/opt\""),
|