Updates to build systems tutorial (#6273)
* Get rid of period in command * formatting * fix header * Change GNU Make to Make * Add variants
This commit is contained in:
parent
2f1cbb5caa
commit
24d636eb30
2 changed files with 36 additions and 12 deletions
|
@ -34,11 +34,18 @@ class Mpileaks(AutoToolsPackage):
|
||||||
|
|
||||||
version('1.0', '8838c574b39202a57d7c2d68692718aa')
|
version('1.0', '8838c574b39202a57d7c2d68692718aa')
|
||||||
|
|
||||||
|
variant("stackstart", values=int, default=0,
|
||||||
|
description="Specify the number of stack frames to truncate")
|
||||||
|
|
||||||
depends_on("mpi")
|
depends_on("mpi")
|
||||||
depends_on("adept-utils")
|
depends_on("adept-utils")
|
||||||
depends_on("callpath")
|
depends_on("callpath")
|
||||||
|
|
||||||
def configure_args(self):
|
def configure_args(self):
|
||||||
|
stackstart = int(self.spec.variants['stackstart'].value)
|
||||||
args = ["--with-adept-utils=" + spec['adept-utils'].prefix,
|
args = ["--with-adept-utils=" + spec['adept-utils'].prefix,
|
||||||
"--with-callpath=" + spec['callpath'].prefix]
|
"--with-callpath=" + spec['callpath'].prefix]
|
||||||
|
if stackstart:
|
||||||
|
args.extend(['--with-stack-start-c=%s' % stackstart,
|
||||||
|
'--with-stack-start-fortran=%s' % stackstart])
|
||||||
return args
|
return args
|
||||||
|
|
|
@ -8,20 +8,33 @@ You may begin to notice after writing a couple of package template files a
|
||||||
pattern emerge for some packages. For example, you may find yourself writing
|
pattern emerge for some packages. For example, you may find yourself writing
|
||||||
an :code:`install()` method that invokes: :code:`configure`, :code:`cmake`,
|
an :code:`install()` method that invokes: :code:`configure`, :code:`cmake`,
|
||||||
:code:`make`, :code:`make install`. You may also find yourself writing
|
:code:`make`, :code:`make install`. You may also find yourself writing
|
||||||
:code:`"prefix=" + prefix` as an argument to configure or cmake. Rather than
|
:code:`"prefix=" + prefix` as an argument to :code:`configure` or :code:`cmake`.
|
||||||
having you repeat these lines for all packages, Spack has classes that can
|
Rather than having you repeat these lines for all packages, Spack has
|
||||||
take care of these patterns. In addition, these package files allow for finer
|
classes that can take care of these patterns. In addition,
|
||||||
grained control of these build systems. In this section, we will describe
|
these package files allow for finer grained control of these build systems.
|
||||||
each build system and give examples on how these can be manipulated to
|
In this section, we will describe each build system and give examples on
|
||||||
install a package.
|
how these can be manipulated to install a package.
|
||||||
|
|
||||||
-----------------------
|
-----------------------
|
||||||
Package class Hierarchy
|
Package Class Hierarchy
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
.. graphviz::
|
.. graphviz::
|
||||||
|
|
||||||
digraph {
|
digraph G {
|
||||||
{Package, MakefilePackage, AutotoolsPackage, CMakePackage, PythonPackage, RPackage} -> PackageBaseClass
|
|
||||||
|
node [
|
||||||
|
shape = "record"
|
||||||
|
]
|
||||||
|
edge [
|
||||||
|
arrowhead = "empty"
|
||||||
|
]
|
||||||
|
|
||||||
|
PackageBase -> Package [dir=back]
|
||||||
|
PackageBase -> MakefilePackage [dir=back]
|
||||||
|
PackageBase -> AutotoolsPackage [dir=back]
|
||||||
|
PackageBase -> CMakePackage [dir=back]
|
||||||
|
PackageBase -> PythonPackage [dir=back]
|
||||||
}
|
}
|
||||||
|
|
||||||
The above diagram gives a high level view of the class hierarchy and how each
|
The above diagram gives a high level view of the class hierarchy and how each
|
||||||
|
@ -122,6 +135,10 @@ override :code:`configure_args()`, which will then return it's output to
|
||||||
to :code:`configure()`. Then, :code:`configure()` will append the common
|
to :code:`configure()`. Then, :code:`configure()` will append the common
|
||||||
arguments
|
arguments
|
||||||
|
|
||||||
|
Packagers also have the option to run :code:`autoreconf` in case a package
|
||||||
|
needs to update the build system and generate a new :code:`configure`. Though,
|
||||||
|
for the most part this will be unnecessary.
|
||||||
|
|
||||||
Let's look at the :code:`mpileaks` package.py file that we worked on earlier:
|
Let's look at the :code:`mpileaks` package.py file that we worked on earlier:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
@ -162,7 +179,7 @@ package file.
|
||||||
Makefile
|
Makefile
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Packages that utilize :code:`GNU Make` or a :code:`Makefile` usually require you
|
Packages that utilize :code:`Make` or a :code:`Makefile` usually require you
|
||||||
to edit a :code:`Makefile` to set up platform and compiler specific variables.
|
to edit a :code:`Makefile` to set up platform and compiler specific variables.
|
||||||
These packages are handled by the :code:`Makefile` subclass which provides
|
These packages are handled by the :code:`Makefile` subclass which provides
|
||||||
convenience methods to help write these types of packages.
|
convenience methods to help write these types of packages.
|
||||||
|
@ -225,7 +242,7 @@ usual fashion and create a template of a :code:`MakefilePackage` package.py.
|
||||||
:language: python
|
:language: python
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
Spack was successfully able to detect that :code:`Bowtie` uses :code:`GNU Make`.
|
Spack was successfully able to detect that :code:`Bowtie` uses :code:`Make`.
|
||||||
Let's add in the rest of our details for our package:
|
Let's add in the rest of our details for our package:
|
||||||
|
|
||||||
.. literalinclude:: tutorial/examples/Makefile/1.package.py
|
.. literalinclude:: tutorial/examples/Makefile/1.package.py
|
||||||
|
@ -573,7 +590,7 @@ different location is found in :code:`spades`.
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ spack edit spade.
|
$ spack edit spade
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue