diff options
author | Björn Persson <bjorn@rombobjörn.se> | 2016-01-18 11:59:31 +0100 |
---|---|---|
committer | Björn Persson <bjorn@rombobjörn.se> | 2016-01-18 11:59:31 +0100 |
commit | dae4f47f2b80c7ea7b1df0f713efe79a8a50c69f (patch) | |
tree | 9e92367d9bbca2a61b4b9f2f0240fab0fe2cbd70 /manual.en.html | |
parent | c108be85bf27d40d9b1c45d4de14185dc902b763 (diff) |
Added Library_Type to help with building libraries as shared or static.
Diffstat (limited to 'manual.en.html')
-rwxr-xr-x | manual.en.html | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/manual.en.html b/manual.en.html index 3d25fc2..9910afb 100755 --- a/manual.en.html +++ b/manual.en.html @@ -112,7 +112,7 @@ and is also <p>The following applies to all of Comfignat including this document:</p> -<p>Copyright 2013 - 2015 Björn Persson, Bjorn@Rombobjörn.se</p> +<p>Copyright 2013 - 2016 Björn Persson, Bjorn@Rombobjörn.se</p> <p>This material is provided as is, with absolutely no warranty expressed or implied. Any use is at your own risk.</p> @@ -456,6 +456,43 @@ project will therefore automatically adapt to the current target architecture, so that 32-bit and 64-bit instances of the library can be installed in parallel and the right library will be used in every build.</p> +<h3 id="library_type">Shared and Static Libraries</h3> + +<p>Many libraries can be built either as a shared library or as a static +library. To enable this, use the variable <var>Comfignat.Library_Type</var> for +<var>Library_Kind</var> in the build-controlling project file, and the +preprocessor symbol <var>Library_Type</var> in the usage project file. The +default will then be to build a shared library, but installing users and +distributions can build a static library instead by setting +<var>library_type</var> to “<samp>static</samp>” on the Make command line. +The possible values of <var>Library_Type</var> are the same as for +<var>Library_Kind</var>: “<samp>dynamic</samp>”, “<samp>static</samp>”, and +“<samp>relocatable</samp>” which is an alias for “<samp>dynamic</samp>”.</p> + +<p>It may be necessary to also use <var>Comfignat.Library_Type</var> in a case +construction to set certain attributes only for one kind of library. It may for +example be desirable to set <var>Library_Interface</var> for a shared library +but not for a static library, to get the best automatic elaboration in both +cases. Here's a project file fragment that sets <var>Library_Version</var> and +<var>Library_Interface</var> only when building a shared library:</p> + +<pre class="example gpr"> for Library_Kind use Comfignat.Library_Type; + case Comfignat.Library_Type is + when "dynamic" | "relocatable" => + for Library_Version use "libexample.so.1"; + for Library_Interface use ("Example"); + when "static" => + null; + end case;</pre> + +<p>It is also possible to build both a shared and a static library in the same +Make invocation by overriding <var>LIBRARY_TYPE</var> on the builder command +line:</p> + +<pre class="example make">base: build_example.gpr + ${build_GPR} -margs -XLIBRARY_TYPE=dynamic + ${build_GPR} -margs -XLIBRARY_TYPE=static</pre> + <h3 id="options">Options</h3> <p>Your software may have optional features or properties that can be enabled @@ -510,7 +547,8 @@ have its own <var>runstatedir</var>.</p> <p>There are several options variables that let installing users and distributions control which arguments the build tools are invoked with. They have names that end with “<var>FLAGS</var>”, and are documented in -<var>INSTALL</var>. The value of <var>GNATFLAGS</var> is a combination of the +<a href="INSTALL"><var>INSTALL</var></a>. +The value of <var>GNATFLAGS</var> is a combination of the other options variables and must not be modified in a way that disregards the other variables. Apart from that restriction you can assign default values to optional arguments in these variables, but be sure to do the assignments with |