/usr/share/doc/libbotan-2-doc/manual/building.html is in libbotan-2-doc 2.4.0-5ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Building The Library — Botan</title>
<link rel="stylesheet" href="_static/agogo.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '2.4.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Versioning" href="versions.html" />
<link rel="prev" title="Support Information" href="support.html" />
</head>
<body>
<div class="header-wrapper">
<div class="header">
<h1>Botan</h1>
</div>
</div>
<div class="content-wrapper">
<div class="content">
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="building-the-library">
<h1>Building The Library<a class="headerlink" href="#building-the-library" title="Permalink to this headline">¶</a></h1>
<p>This document describes how to build Botan on Unix/POSIX and Windows
systems. The POSIX oriented descriptions should apply to most
common Unix systems (including OS X), along with POSIX-ish systems
like BeOS, QNX, and Plan 9. Currently, systems other than Windows and
POSIX (such as VMS, MacOS 9, OS/390, OS/400, …) are not supported by
the build system, primarily due to lack of access. Please contact the
maintainer if you would like to build Botan on such a system.</p>
<p>Botan’s build is controlled by configure.py, which is a <a class="reference external" href="https://www.python.org">Python</a> script. Python 2.6 or later is required.</p>
<p>For the impatient, this works for most systems:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ ./configure.py [--prefix=/some/directory]
$ make
$ make install
</pre></div>
</div>
<p>Or using <code class="docutils literal"><span class="pre">nmake</span></code>, if you’re compiling on Windows with Visual C++. On
platforms that do not understand the ‘#!’ convention for beginning
script files, or that have Python installed in an unusual spot, you
might need to prefix the <code class="docutils literal"><span class="pre">configure.py</span></code> command with <code class="docutils literal"><span class="pre">python</span></code> or
<code class="docutils literal"><span class="pre">/path/to/python</span></code>:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ python ./configure.py [arguments]
</pre></div>
</div>
<div class="section" id="configuring-the-build">
<h2>Configuring the Build<a class="headerlink" href="#configuring-the-build" title="Permalink to this headline">¶</a></h2>
<p>The first step is to run <code class="docutils literal"><span class="pre">configure.py</span></code>, which is a Python script
that creates various directories, config files, and a Makefile for
building everything. This script should run under a vanilla install of
Python 2.6, 2.7, or 3.x.</p>
<p>The script will attempt to guess what kind of system you are trying to
compile for (and will print messages telling you what it guessed).
You can override this process by passing the options <code class="docutils literal"><span class="pre">--cc</span></code>,
<code class="docutils literal"><span class="pre">--os</span></code>, and <code class="docutils literal"><span class="pre">--cpu</span></code>.</p>
<p>You can pass basically anything reasonable with <code class="docutils literal"><span class="pre">--cpu</span></code>: the script
knows about a large number of different architectures, their
sub-models, and common aliases for them. You should only select the
64-bit version of a CPU (such as “sparc64” or “mips64”) if your
operating system knows how to handle 64-bit object code - a 32-bit
kernel on a 64-bit CPU will generally not like 64-bit code.</p>
<p>By default the script tries to figure out what will work on your
system, and use that. It will print a display at the end showing which
algorithms have and have not been enabled. For instance on one system
we might see lines like:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>INFO: Skipping, dependency failure - sessions_sqlite3
INFO: Skipping, incompatible CPU - mp_x86_32 simd_altivec
INFO: Skipping, incompatible OS - beos_stats cryptoapi_rng darwin_secrandom win32_stats
INFO: Skipping, incompatible compiler - mp_x86_32_msvc
INFO: Skipping, loaded only if needed by dependency - dyn_load mp_generic simd_scalar
INFO: Skipping, requires external dependency - boost bzip2 lzma sqlite3 tpm
</pre></div>
</div>
<p>The ones that are skipped because they are require an external
dependency have to be explicitly asked for, because they rely on third
party libraries which your system might not have or that you might not
want the resulting binary to depend on. For instance to enable zlib
support, add <code class="docutils literal"><span class="pre">--with-zlib</span></code> to your invocation of <code class="docutils literal"><span class="pre">configure.py</span></code>.
All available modules can be listed with <code class="docutils literal"><span class="pre">--list-modules</span></code>.</p>
<p>You can control which algorithms and modules are built using the
options <code class="docutils literal"><span class="pre">--enable-modules=MODS</span></code> and <code class="docutils literal"><span class="pre">--disable-modules=MODS</span></code>, for
instance <code class="docutils literal"><span class="pre">--enable-modules=zlib</span></code> and <code class="docutils literal"><span class="pre">--disable-modules=rc5,idea</span></code>.
Modules not listed on the command line will simply be loaded if needed
or if configured to load by default. If you use <code class="docutils literal"><span class="pre">--minimized-build</span></code>,
only the most core modules will be included; you can then explicitly
enable things that you want to use with <code class="docutils literal"><span class="pre">--enable-modules</span></code>. This is
useful for creating a minimal build targeting to a specific
application, especially in conjunction with the amalgamation option;
see <a class="reference internal" href="#amalgamation"><span class="std std-ref">The Amalgamation Build</span></a>.</p>
<p>For instance:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ ./configure.py --minimized-build --enable-modules=rsa,eme_oaep,emsa_pssr
</pre></div>
</div>
<p>will set up a build that only includes RSA, OAEP, PSS along with any
required dependencies. A small subset of core features, including AES,
SHA-2, HMAC, and the multiple precision integer library, are always
loaded. Note that a minimized build does not include any random number
generator, which is needed for example to generate keys, nonces and IVs.
See <a class="reference internal" href="rng.html"><span class="doc">Random Number Generators</span></a> on which random number generators are available.</p>
<p>The option <code class="docutils literal"><span class="pre">--module-policy=POL</span></code> enables modules required by and
disables modules prohibited by a text policy in <code class="docutils literal"><span class="pre">src/build-data/policy</span></code>.
Additional modules can be enabled if not prohibited by the policy.
Currently available policies include <code class="docutils literal"><span class="pre">bsi</span></code>, <code class="docutils literal"><span class="pre">nist</span></code> and <code class="docutils literal"><span class="pre">modern</span></code>:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ ./configure.py --module-policy=bsi --enable-modules=tls,xts
</pre></div>
</div>
<div class="section" id="cross-compiling">
<h3>Cross Compiling<a class="headerlink" href="#cross-compiling" title="Permalink to this headline">¶</a></h3>
<p>Cross compiling refers to building software on one type of host (say Linux
x86-64) but creating a binary for some other type (say MinGW x86-32). This is
completely supported by the build system. To extend the example, we must tell
<cite>configure.py</cite> to use the MinGW tools:</p>
<blockquote>
<div>$ ./configure.py –os=mingw –cpu=x86_32 –cc-bin=i686-w64-mingw32-g++ –ar=i686-w64-mingw32-ar
…
$ make
…
$ file botan.exe
botan.exe: PE32 executable (console) Intel 80386, for MS Windows</div></blockquote>
<p>You can also specify the alternate tools by setting the <cite>CXX</cite> and <cite>AR</cite>
environment variables (instead of the <cite>–cc-bin</cite> and <cite>–ar-command</cite> options), as
is commonly done with autoconf builds.</p>
</div>
<div class="section" id="on-unix">
<h3>On Unix<a class="headerlink" href="#on-unix" title="Permalink to this headline">¶</a></h3>
<p>The basic build procedure on Unix and Unix-like systems is:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ ./configure.py [--enable-modules=<list>] [--cc=CC]
$ make
$ ./botan-test
</pre></div>
</div>
<p>If that fails with an error about not being able to find libbotan.so,
you may need to set <code class="docutils literal"><span class="pre">LD_LIBRARY_PATH</span></code>:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ LD_LIBRARY_PATH=. ./botan-test
</pre></div>
</div>
<p>If the tests look OK, install:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ make install
</pre></div>
</div>
<p>On Unix systems the script will default to using GCC; use <code class="docutils literal"><span class="pre">--cc</span></code> if
you want something else. For instance use <code class="docutils literal"><span class="pre">--cc=icc</span></code> for Intel C++
and <code class="docutils literal"><span class="pre">--cc=clang</span></code> for Clang.</p>
<p>The <code class="docutils literal"><span class="pre">make</span> <span class="pre">install</span></code> target has a default directory in which it will
install Botan (typically <code class="docutils literal"><span class="pre">/usr/local</span></code>). You can override this by
using the <code class="docutils literal"><span class="pre">--prefix</span></code> argument to <code class="docutils literal"><span class="pre">configure.py</span></code>, like so:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ ./configure.py --prefix=/opt <other arguments>
</pre></div>
</div>
<p>On some systems shared libraries might not be immediately visible to
the runtime linker. For example, on Linux you may have to edit
<code class="docutils literal"><span class="pre">/etc/ld.so.conf</span></code> and run <code class="docutils literal"><span class="pre">ldconfig</span></code> (as root) in order for new
shared libraries to be picked up by the linker. An alternative is to
set your <code class="docutils literal"><span class="pre">LD_LIBRARY_PATH</span></code> shell variable to include the directory
that the Botan libraries were installed into.</p>
</div>
<div class="section" id="on-macos">
<h3>On macOS<a class="headerlink" href="#on-macos" title="Permalink to this headline">¶</a></h3>
<p>A build on macOS works much like that on any other Unix-like system.</p>
<p>To build a universal binary for macOS, you need to set some additional
build flags. Do this with the <cite>configure.py</cite> flag <cite>–cc-abi-flags</cite>:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>--cc-abi-flags="-force_cpusubtype_ALL -mmacosx-version-min=10.4 -arch i386 -arch ppc"
</pre></div>
</div>
</div>
<div class="section" id="on-windows">
<h3>On Windows<a class="headerlink" href="#on-windows" title="Permalink to this headline">¶</a></h3>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The earliest versions of Windows supported are Windows 7 and Windows 2008 R2</p>
</div>
<p>You need to have a copy of Python installed, and have both Python and
your chosen compiler in your path. Open a command shell (or the SDK
shell), and run:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ python configure.py --cc=msvc --os=windows
$ nmake
$ botan-test.exe
$ nmake install
</pre></div>
</div>
<p>Botan supports the nmake replacement <a class="reference external" href="https://wiki.qt.io/Jom">Jom</a>
which enables you to run multiple build jobs in parallel.</p>
<p>For MinGW, use:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ python configure.py --cc=gcc --os=mingw
$ make
</pre></div>
</div>
<p>By default the install target will be <code class="docutils literal"><span class="pre">C:\botan</span></code>; you can modify
this with the <code class="docutils literal"><span class="pre">--prefix</span></code> option.</p>
<p>When building your applications, all you have to do is tell the
compiler to look for both include files and library files in
<code class="docutils literal"><span class="pre">C:\botan</span></code>, and it will find both. Or you can move them to a
place where they will be in the default compiler search paths (consult
your documentation and/or local expert for details).</p>
</div>
<div class="section" id="for-ios-using-xcode">
<h3>For iOS using XCode<a class="headerlink" href="#for-ios-using-xcode" title="Permalink to this headline">¶</a></h3>
<p>For iOS, you typically build for 3 architectures: armv7 (32 bit, older
iOS devices), armv8-a (64 bit, recent iOS devices) and x86_64 for
the iPhone simulator. You can build for these 3 architectures and then
create a universal binary containing code for all of these
architectures, so you can link to Botan for the simulator as well as
for an iOS device.</p>
<p>To cross compile for armv7, configure and make with:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ ./configure.py --os=ios --prefix="iphone-32" --cpu=armv7 --cc=clang \
--cc-abi-flags="-arch armv7"
xcrun --sdk iphoneos make install
</pre></div>
</div>
<p>To cross compile for armv8-a, configure and make with:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ ./configure.py --os=ios --prefix="iphone-64" --cpu=armv8-a --cc=clang \
--cc-abi-flags="-arch arm64"
xcrun --sdk iphoneos make install
</pre></div>
</div>
<p>To compile for the iPhone Simulator, configure and make with:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ ./configure.py --os=ios --prefix="iphone-simulator" --cpu=x86_64 --cc=clang \
--cc-abi-flags="-arch x86_64"
xcrun --sdk iphonesimulator make install
</pre></div>
</div>
<p>Now create the universal binary and confirm the library is compiled
for all three architectures:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ xcrun --sdk iphoneos lipo -create -output libbotan-2.a \
iphone-32/lib/libbotan-2.a \
iphone-64/lib/libbotan-2.a \
iphone-simulator/lib/libbotan-2.a
$ xcrun --sdk iphoneos lipo -info libbotan-2.a
Architectures in the fat file: libbotan-2.a are: armv7 x86_64 armv64
</pre></div>
</div>
<p>The resulting static library can be linked to your app in Xcode.</p>
</div>
<div class="section" id="for-android">
<h3>For Android<a class="headerlink" href="#for-android" title="Permalink to this headline">¶</a></h3>
<p>Instructions for building the library on Android can be found
<a class="reference external" href="https://www.danielseither.de/blog/2013/03/building-the-botan-library-for-android/">here</a>.</p>
</div>
</div>
<div class="section" id="other-build-related-tasks">
<h2>Other Build-Related Tasks<a class="headerlink" href="#other-build-related-tasks" title="Permalink to this headline">¶</a></h2>
<div class="section" id="building-the-documentation">
<span id="building-docs"></span><h3>Building The Documentation<a class="headerlink" href="#building-the-documentation" title="Permalink to this headline">¶</a></h3>
<p>There are two documentation options available, Sphinx and Doxygen.
Sphinx will be used if <code class="docutils literal"><span class="pre">sphinx-build</span></code> is detected in the PATH, or if
<code class="docutils literal"><span class="pre">--with-sphinx</span></code> is used at configure time. Doxygen is only enabled
if <code class="docutils literal"><span class="pre">--with-doxygen</span></code> is used. Both are generated by the makefile
target <code class="docutils literal"><span class="pre">docs</span></code>.</p>
</div>
<div class="section" id="the-amalgamation-build">
<span id="amalgamation"></span><h3>The Amalgamation Build<a class="headerlink" href="#the-amalgamation-build" title="Permalink to this headline">¶</a></h3>
<p>You can also configure Botan to be built using only a single source file; this
is quite convenient if you plan to embed the library into another application.</p>
<p>To generate the amalgamation, run <code class="docutils literal"><span class="pre">configure.py</span></code> with whatever
options you would ordinarily use, along with the option
<code class="docutils literal"><span class="pre">--amalgamation</span></code>. This will create two (rather large) files,
<code class="docutils literal"><span class="pre">botan_all.h</span></code> and <code class="docutils literal"><span class="pre">botan_all.cpp</span></code>, plus (unless the option
<code class="docutils literal"><span class="pre">--single-amalgamation-file</span></code> is used) also some number of files like
<code class="docutils literal"><span class="pre">botan_all_aesni.cpp</span></code> and <code class="docutils literal"><span class="pre">botan_all_sse2.cpp</span></code> which need to be
compiled with the appropriate compiler flags to enable that
instruction set. The ISA specific files are only generated if there is
code that requires them, so you can simplify your build. The
<code class="docutils literal"><span class="pre">--minimized-build</span></code> option (described elsewhere in this documentation)
is also quite useful with the amalgamation.</p>
<p>Whenever you would have included a botan header, you can then include
<code class="docutils literal"><span class="pre">botan_all.h</span></code>, and include <code class="docutils literal"><span class="pre">botan_all.cpp</span></code> along with the rest of
the source files in your build. If you want to be able to easily
switch between amalgamated and non-amalgamated versions (for instance
to take advantage of prepackaged versions of botan on operating
systems that support it), you can instead ignore <code class="docutils literal"><span class="pre">botan_all.h</span></code> and
use the headers from <code class="docutils literal"><span class="pre">build/include</span></code> as normal.</p>
<p>You can also build the library using Botan’s build system (as normal)
but utilizing the amalgamation instead of the individual source files
by running something like <code class="docutils literal"><span class="pre">./configure.py</span> <span class="pre">--amalgamation</span> <span class="pre">&&</span> <span class="pre">make</span></code>.
This is essentially a very simple form of link time optimization;
because the entire library source is visible to the compiler, it has
more opportunities for interprocedural optimizations.
Additionally, amalgamation builds usually have significantly shorter
compile times for full rebuilds.</p>
</div>
<div class="section" id="modules-relying-on-third-party-libraries">
<h3>Modules Relying on Third Party Libraries<a class="headerlink" href="#modules-relying-on-third-party-libraries" title="Permalink to this headline">¶</a></h3>
<p>Currently <code class="docutils literal"><span class="pre">configure.py</span></code> cannot detect if external libraries are
available, so using them is controlled explicitly at build time
by the user using</p>
<blockquote>
<div><ul class="simple">
<li><code class="docutils literal"><span class="pre">--with-bzip2</span></code> enables the filters providing bzip2 compression
and decompression. Requires the bzip2 development libraries to be
installed.</li>
<li><code class="docutils literal"><span class="pre">--with-zlib</span></code> enables the filters providing zlib compression
and decompression. Requires the zlib development libraries to be
installed.</li>
<li><code class="docutils literal"><span class="pre">--with-lzma</span></code> enables the filters providing lzma compression and
decompression. Requires the lzma development libraries to be
installed.</li>
<li><code class="docutils literal"><span class="pre">--with-sqlite3</span></code> enables storing TLS session information to an
encrypted SQLite database.</li>
<li><code class="docutils literal"><span class="pre">--with-openssl</span></code> adds an engine that uses OpenSSL for some public
key operations and ciphers/hashes. OpenSSL 1.0.1 or later is supported.
LibreSSL is API compatible with OpenSSL 1.0 and can be used instead.</li>
</ul>
</div></blockquote>
</div>
<div class="section" id="multiple-builds">
<h3>Multiple Builds<a class="headerlink" href="#multiple-builds" title="Permalink to this headline">¶</a></h3>
<p>It may be useful to run multiple builds with different configurations.
Specify <code class="docutils literal"><span class="pre">--with-build-dir=<dir></span></code> to set up a build environment in a
different directory.</p>
</div>
<div class="section" id="setting-distribution-info">
<h3>Setting Distribution Info<a class="headerlink" href="#setting-distribution-info" title="Permalink to this headline">¶</a></h3>
<p>The build allows you to set some information about what distribution
this build of the library comes from. It is particularly relevant to
people packaging the library for wider distribution, to signify what
distribution this build is from. Applications can test this value by
checking the string value of the macro <code class="docutils literal"><span class="pre">BOTAN_DISTRIBUTION_INFO</span></code>. It
can be set using the <code class="docutils literal"><span class="pre">--distribution-info</span></code> flag to <code class="docutils literal"><span class="pre">configure.py</span></code>,
and otherwise defaults to “unspecified”. For instance, a <a class="reference external" href="https://www.gentoo.org">Gentoo</a> ebuild might set it with
<code class="docutils literal"><span class="pre">--distribution-info="Gentoo</span> <span class="pre">${PVR}"</span></code> where <code class="docutils literal"><span class="pre">${PVR}</span></code> is an ebuild
variable automatically set to a combination of the library and ebuild
versions.</p>
</div>
<div class="section" id="local-configuration-settings">
<h3>Local Configuration Settings<a class="headerlink" href="#local-configuration-settings" title="Permalink to this headline">¶</a></h3>
<p>You may want to do something peculiar with the configuration; to
support this there is a flag to <code class="docutils literal"><span class="pre">configure.py</span></code> called
<code class="docutils literal"><span class="pre">--with-local-config=<file></span></code>. The contents of the file are
inserted into <code class="docutils literal"><span class="pre">build/build.h</span></code> which is (indirectly) included
into every Botan header and source file.</p>
</div>
<div class="section" id="configuration-parameters">
<h3>Configuration Parameters<a class="headerlink" href="#configuration-parameters" title="Permalink to this headline">¶</a></h3>
<p>There are some configuration parameters which you may want to tweak
before building the library. These can be found in <code class="docutils literal"><span class="pre">build.h</span></code>. This
file is overwritten every time the configure script is run (and does
not exist until after you run the script for the first time).</p>
<p>Also included in <code class="docutils literal"><span class="pre">build/build.h</span></code> are macros which let applications
check which features are included in the current version of the
library. All of them begin with <code class="docutils literal"><span class="pre">BOTAN_HAS_</span></code>. For example, if
<code class="docutils literal"><span class="pre">BOTAN_HAS_BLOWFISH</span></code> is defined, then an application can include
<code class="docutils literal"><span class="pre"><botan/blowfish.h></span></code> and use the Blowfish class.</p>
<p><code class="docutils literal"><span class="pre">BOTAN_MP_WORD_BITS</span></code>: This macro controls the size of the words used
for calculations with the MPI implementation in Botan. You can choose
8, 16, 32, or 64. Normally this defaults to either 32 or 64, depending
on the processor. Unless you are building for a 8 or 16-bit CPU, this
isn’t worth messing with.</p>
<p><code class="docutils literal"><span class="pre">BOTAN_DEFAULT_BUFFER_SIZE</span></code>: This constant is used as the size of
buffers throughout Botan. The default should be fine for most
purposes, reduce if you are very concerned about runtime memory usage.</p>
</div>
</div>
<div class="section" id="building-applications">
<h2>Building Applications<a class="headerlink" href="#building-applications" title="Permalink to this headline">¶</a></h2>
<div class="section" id="unix">
<h3>Unix<a class="headerlink" href="#unix" title="Permalink to this headline">¶</a></h3>
<p>Botan usually links in several different system libraries (such as
<code class="docutils literal"><span class="pre">librt</span></code> or <code class="docutils literal"><span class="pre">libz</span></code>), depending on which modules are configured at
compile time. In many environments, particularly ones using static
libraries, an application has to link against the same libraries as
Botan for the linking step to succeed. But how does it figure out what
libraries it <em>is</em> linked against?</p>
<p>The answer is to ask the <code class="docutils literal"><span class="pre">botan</span></code> command line tool using
the <code class="docutils literal"><span class="pre">config</span></code> and <code class="docutils literal"><span class="pre">version</span></code> commands.</p>
<p><code class="docutils literal"><span class="pre">botan</span> <span class="pre">version</span></code>: Print the Botan version number.</p>
<p><code class="docutils literal"><span class="pre">botan</span> <span class="pre">config</span> <span class="pre">prefix</span></code>: If no argument, print the prefix where Botan is
installed (such as <code class="docutils literal"><span class="pre">/opt</span></code> or <code class="docutils literal"><span class="pre">/usr/local</span></code>).</p>
<p><code class="docutils literal"><span class="pre">botan</span> <span class="pre">config</span> <span class="pre">cflags</span></code>: Print options that should be passed to the
compiler whenever a C++ file is compiled. Typically this is used for
setting include paths.</p>
<p><code class="docutils literal"><span class="pre">botan</span> <span class="pre">config</span> <span class="pre">libs</span></code>: Print options for which libraries to link to
(this will include a reference to the botan library iself).</p>
<p>Your <code class="docutils literal"><span class="pre">Makefile</span></code> can run <code class="docutils literal"><span class="pre">botan</span> <span class="pre">config</span></code> and get the options
necessary for getting your application to compile and link, regardless
of whatever crazy libraries Botan might be linked against.</p>
</div>
<div class="section" id="windows">
<h3>Windows<a class="headerlink" href="#windows" title="Permalink to this headline">¶</a></h3>
<p>No special help exists for building applications on Windows. However,
given that typically Windows software is distributed as binaries, this
is less of a problem - only the developer needs to worry about it. As
long as they can remember where they installed Botan, they just have
to set the appropriate flags in their Makefile/project file.</p>
</div>
</div>
<div class="section" id="language-wrappers">
<h2>Language Wrappers<a class="headerlink" href="#language-wrappers" title="Permalink to this headline">¶</a></h2>
<div class="section" id="building-the-python-wrappers">
<h3>Building the Python wrappers<a class="headerlink" href="#building-the-python-wrappers" title="Permalink to this headline">¶</a></h3>
<p>The Python wrappers for Botan use ctypes and the C89 API so no special
build step is required, just import botan2.py</p>
<p>See <a class="reference internal" href="python.html"><span class="doc">Python Bindings</span></a> for more information about the
Python bindings.</p>
</div>
<div class="section" id="building-the-perl-xs-wrappers">
<h3>Building the Perl XS wrappers<a class="headerlink" href="#building-the-perl-xs-wrappers" title="Permalink to this headline">¶</a></h3>
<p>To build the Perl XS wrappers, after building the main library change
your directory to <code class="docutils literal"><span class="pre">src/contrib/perl-xs</span></code> and run <code class="docutils literal"><span class="pre">perl</span> <span class="pre">Makefile.PL</span></code>,
then run <code class="docutils literal"><span class="pre">make</span></code> to build the module and <code class="docutils literal"><span class="pre">make</span> <span class="pre">test</span></code> to run the
test suite:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Botan
$ make
cp Botan.pm blib/lib/Botan.pm
AutoSplitting blib/lib/Botan.pm (blib/lib/auto/Botan)
/usr/bin/perl5.8.8 /usr/lib64/perl5/5.8.8/ExtUtils/xsubpp [...]
g++ -c -Wno-write-strings -fexceptions -g [...]
Running Mkbootstrap for Botan ()
chmod 644 Botan.bs
rm -f blib/arch/auto/Botan/Botan.so
g++ -shared Botan.o -o blib/arch/auto/Botan/Botan.so \
-lbotan -lbz2 -lpthread -lrt -lz \
chmod 755 blib/arch/auto/Botan/Botan.so
cp Botan.bs blib/arch/auto/Botan/Botan.bs
chmod 644 blib/arch/auto/Botan/Botan.bs
Manifying blib/man3/Botan.3pm
$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl5.8.8 [...]
t/base64......ok
t/filt........ok
t/hex.........ok
t/oid.........ok
t/pipe........ok
t/x509cert....ok
All tests successful.
Files=6, Tests=83, 0 wallclock secs ( 0.08 cusr + 0.02 csys = 0.10 CPU)
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sidebar">
<h3>Table Of Contents</h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="index.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="goals.html">Project Goals</a></li>
<li class="toctree-l1"><a class="reference internal" href="support.html">Support Information</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Building The Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#configuring-the-build">Configuring the Build</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cross-compiling">Cross Compiling</a></li>
<li class="toctree-l3"><a class="reference internal" href="#on-unix">On Unix</a></li>
<li class="toctree-l3"><a class="reference internal" href="#on-macos">On macOS</a></li>
<li class="toctree-l3"><a class="reference internal" href="#on-windows">On Windows</a></li>
<li class="toctree-l3"><a class="reference internal" href="#for-ios-using-xcode">For iOS using XCode</a></li>
<li class="toctree-l3"><a class="reference internal" href="#for-android">For Android</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#other-build-related-tasks">Other Build-Related Tasks</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#building-the-documentation">Building The Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="#the-amalgamation-build">The Amalgamation Build</a></li>
<li class="toctree-l3"><a class="reference internal" href="#modules-relying-on-third-party-libraries">Modules Relying on Third Party Libraries</a></li>
<li class="toctree-l3"><a class="reference internal" href="#multiple-builds">Multiple Builds</a></li>
<li class="toctree-l3"><a class="reference internal" href="#setting-distribution-info">Setting Distribution Info</a></li>
<li class="toctree-l3"><a class="reference internal" href="#local-configuration-settings">Local Configuration Settings</a></li>
<li class="toctree-l3"><a class="reference internal" href="#configuration-parameters">Configuration Parameters</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#building-applications">Building Applications</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#unix">Unix</a></li>
<li class="toctree-l3"><a class="reference internal" href="#windows">Windows</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#language-wrappers">Language Wrappers</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#building-the-python-wrappers">Building the Python wrappers</a></li>
<li class="toctree-l3"><a class="reference internal" href="#building-the-perl-xs-wrappers">Building the Perl XS wrappers</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="versions.html">Versioning</a></li>
<li class="toctree-l1"><a class="reference internal" href="secmem.html">Memory container</a></li>
<li class="toctree-l1"><a class="reference internal" href="rng.html">Random Number Generators</a></li>
<li class="toctree-l1"><a class="reference internal" href="hash.html">Hash Functions and Checksums</a></li>
<li class="toctree-l1"><a class="reference internal" href="block_cipher.html">Block Ciphers</a></li>
<li class="toctree-l1"><a class="reference internal" href="stream_ciphers.html">Stream Ciphers</a></li>
<li class="toctree-l1"><a class="reference internal" href="message_auth_codes.html">Message Authentication Codes (MAC)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cipher_modes.html">Cipher Modes</a></li>
<li class="toctree-l1"><a class="reference internal" href="pubkey.html">Public Key Cryptography</a></li>
<li class="toctree-l1"><a class="reference internal" href="x509.html">X.509 Certificates and CRLs</a></li>
<li class="toctree-l1"><a class="reference internal" href="tls.html">Transport Layer Security (TLS)</a></li>
<li class="toctree-l1"><a class="reference internal" href="credentials_manager.html">Credentials Manager</a></li>
<li class="toctree-l1"><a class="reference internal" href="bigint.html">BigInt</a></li>
<li class="toctree-l1"><a class="reference internal" href="kdf.html">Key Derivation Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="pbkdf.html">PBKDF Algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="keywrap.html">AES Key Wrapping</a></li>
<li class="toctree-l1"><a class="reference internal" href="passhash.html">Password Hashing</a></li>
<li class="toctree-l1"><a class="reference internal" href="cryptobox.html">Cryptobox</a></li>
<li class="toctree-l1"><a class="reference internal" href="srp.html">Secure Remote Password</a></li>
<li class="toctree-l1"><a class="reference internal" href="psk_db.html">PSK Database</a></li>
<li class="toctree-l1"><a class="reference internal" href="filters.html">Pipe/Filter Message Processing</a></li>
<li class="toctree-l1"><a class="reference internal" href="fpe.html">Format Preserving Encryption</a></li>
<li class="toctree-l1"><a class="reference internal" href="compression.html">Lossless Data Compression</a></li>
<li class="toctree-l1"><a class="reference internal" href="pkcs11.html">PKCS#11</a></li>
<li class="toctree-l1"><a class="reference internal" href="tpm.html">Trusted Platform Module (TPM)</a></li>
<li class="toctree-l1"><a class="reference internal" href="otp.html">One Time Passwords</a></li>
<li class="toctree-l1"><a class="reference internal" href="ffi.html">FFI (C89) Interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="python.html">Python Binding</a></li>
<li class="toctree-l1"><a class="reference internal" href="cli.html">botan</a></li>
<li class="toctree-l1"><a class="reference internal" href="side_channels.html">Side Channels</a></li>
<li class="toctree-l1"><a class="reference internal" href="packaging.html">Notes for Distributors</a></li>
<li class="toctree-l1"><a class="reference internal" href="fuzzing.html">Fuzzing The Library</a></li>
<li class="toctree-l1"><a class="reference internal" href="deprecated.html">Deprecated Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="abi.html">ABI Stability</a></li>
</ul>
<div role="search">
<h3 style="margin-top: 1.5em;">Search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
<div class="footer-wrapper">
<div class="footer">
<div class="left">
<div role="navigation" aria-label="related navigaton">
<a href="support.html" title="Support Information"
accesskey="P">previous</a> |
<a href="versions.html" title="Versioning"
accesskey="N">next</a> |
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |
<a href="genindex.html" title="General Index"
accesskey="I">index</a>
</div>
<div role="note" aria-label="source link">
</div>
</div>
<div class="right">
<div class="footer" role="contentinfo">
Last updated on 2018-04-08.
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</body>
</html>
|