<!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: '1.10.17', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </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="top" title="Botan" href="contents.html" /> <link rel="next" title="Getting Started" href="firststep.html" /> <link rel="prev" title="Recommended Reading" href="reading.html" /> </head> <body role="document"> <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 MS Windows systems. The POSIX oriented descriptions should apply to most common Unix systems (including MacOS 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="http://www.python.org">Python</a> script. Python 2.5 or later is required.</p> <p>For the impatient, this works for most systems:</p> <div class="highlight-cpp"><div class="highlight"><pre><span></span>$ ./configure.py [--prefix=/some/directory] $ make $ make check $ 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-cpp"><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. The script requires at least Python 2.5; any later version of Python 2.x should also work. Python 3.1 will also work but requires an extra step; see <a class="reference internal" href="#configure-with-python3"><span class="std std-ref">Configuring the Build With Python 3.1</span></a> for details.</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-cpp"><div class="highlight"><pre><span></span><span class="nl">INFO</span><span class="p">:</span> <span class="n">Skipping</span><span class="p">,</span> <span class="n">by</span> <span class="n">request</span> <span class="n">only</span> <span class="o">-</span> <span class="n">bzip2</span> <span class="n">gnump</span> <span class="n">openssl</span> <span class="n">qt_mutex</span> <span class="n">zlib</span> <span class="nl">INFO</span><span class="p">:</span> <span class="n">Skipping</span><span class="p">,</span> <span class="n">incompatible</span> <span class="n">CPU</span> <span class="o">-</span> <span class="n">aes_intel</span> <span class="n">aes_ssse3</span> <span class="n">asm_x86_64</span> <span class="n">mp_asm64</span> <span class="n">mp_x86_64</span> <span class="n">sha1_x86_64</span> <span class="nl">INFO</span><span class="p">:</span> <span class="n">Skipping</span><span class="p">,</span> <span class="n">incompatible</span> <span class="n">OS</span> <span class="o">-</span> <span class="n">beos_stats</span> <span class="n">cryptoapi_rng</span> <span class="n">win32_crit_section</span> <span class="n">win32_stats</span> <span class="nl">INFO</span><span class="p">:</span> <span class="n">Skipping</span><span class="p">,</span> <span class="n">incompatible</span> <span class="n">compiler</span> <span class="o">-</span> <span class="n">mp_msvc64</span> <span class="n">mp_x86_32_msvc</span> </pre></div> </div> <p>The ones that are skipped because they are ‘by request only’ 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>.</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">--no-autoload</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-cpp"><div class="highlight"><pre><span></span>$ ./configure.py --no-autoload --enable-modules=rsa,ecdsa,eme1,emsa1,emsa4 </pre></div> </div> <p>will set up a build that only includes RSA, ECDSA, and some padding modes, along with their dependencies. A small subset of core features, including AES, SHA-2, HMAC, and the multiple precision integer library, are always loaded.</p> <p>The script tries to guess what kind of makefile to generate, and it almost always guesses correctly (basically, Visual C++ uses NMAKE with Windows commands, and everything else uses Unix make with POSIX commands). Just in case, you can override it with <code class="docutils literal"><span class="pre">--make-style=somestyle</span></code>. The styles Botan currently knows about are ‘unix’ (normal Unix makefiles), and ‘nmake’, the make variant commonly used by Windows compilers. To add a new variant (eg, a build script for VMS), you will need to create a new template file in <code class="docutils literal"><span class="pre">src/build-data/makefile</span></code>.</p> <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-cpp"><div class="highlight"><pre><span></span>$ ./configure.py [--enable-modules=<list>] [--cc=CC] $ make # You may need to set your LD_LIBRARY_PATH or equivalent for ./check to run $ make check # optional, but a good idea $ 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> <p><code class="docutils literal"><span class="pre">./configure.py</span> <span class="pre">--prefix=/opt</span> <span class="pre"><other</span> <span class="pre">arguments></span></code></p> <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-mac-os-x"> <h3>On Mac OS X<a class="headerlink" href="#on-mac-os-x" title="Permalink to this headline">¶</a></h3> <p>In general the Unix instructions above should apply, however OS X does not support <code class="docutils literal"><span class="pre">LD_LIBRARY_PATH</span></code>. Thomas Keller suggests instead running <code class="docutils literal"><span class="pre">install_name_tool</span></code> between building and running the self-test program:</p> <div class="highlight-cpp"><div class="highlight"><pre><span></span>$ VERSION=1.10.0 # or whatever the current version is $ install_name_tool -change $(otool -X -D libbotan-$VERSION.dylib) \ $PWD/libbotan-$VERSION.dylib check </pre></div> </div> <div class="section" id="building-universal-binaries"> <h4>Building Universal Binaries<a class="headerlink" href="#building-universal-binaries" title="Permalink to this headline">¶</a></h4> <p>To build a universal binary for OS X, some simple modifications are required. First, create a CPU type for the target universalbinary, one that doesn’t specify any special handlers. This is done by creating an empty file in src/build-data/arch:</p> <div class="highlight-cpp"><div class="highlight"><pre><span></span>$ touch src/build-data/arch/universalbinary.txt </pre></div> </div> <p>and then adding a special target for it in gcc, by adding the line:</p> <div class="highlight-cpp"><div class="highlight"><pre><span></span><span class="n">universalbinary</span> <span class="o">-></span> <span class="s">"-force_cpusubtype_ALL -mmacosx-version-min=10.4 -arch i386 -arch ppc"</span> </pre></div> </div> <p>in the section marked <cite><mach_abi_linking></cite> in <cite>src/build-data/cc/gcc.txt</cite>. Then configure with:</p> <div class="highlight-cpp"><div class="highlight"><pre><span></span>$ ./configure.py --cpu=universalbinary [other options here] </pre></div> </div> </div> </div> <div class="section" id="on-ms-windows"> <h3>On MS Windows<a class="headerlink" href="#on-ms-windows" title="Permalink to this headline">¶</a></h3> <p>If you don’t want to deal with building botan on Windows, check the website; commonly prebuilt Windows binaries with installers are available, especially for stable versions.</p> <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-cpp"><div class="highlight"><pre><span></span>> python configure.py --cc=msvc (or --cc=gcc for MinGW) [--cpu=CPU] > nmake > nmake check # optional, but recommended > nmake install </pre></div> </div> <p>For Win95 pre OSR2, the <code class="docutils literal"><span class="pre">cryptoapi_rng</span></code> module will not work, because CryptoAPI didn’t exist. And all versions of NT4 lack the ToolHelp32 interface, which is how <code class="docutils literal"><span class="pre">win32_stats</span></code> does its slow polls, so a version of the library built with that module will not load under NT4. Later versions of Windows support both methods, so this shouldn’t be much of an issue anymore.</p> <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> <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. To do so, run <code class="docutils literal"><span class="pre">configure.py</span></code> with whatever arguments you would ordinarily use, along with the option <code class="docutils literal"><span class="pre">--gen-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>.</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 as normal but using the amalgamation instead of the individual source files using <code class="docutils literal"><span class="pre">--via-amalgamation</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.</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>There are a fairly large number of modules included with Botan. Some of these are extremely useful, while others are only necessary in very unusual circumstances. Most are loaded (or not) automatically as necessary, but some require external libraries are thus must be enabled at build time; these include:</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-gnump</span></code> adds an alternative engine for public key cryptography that uses the GNU MP library. GNU MP 4.1 or later is required.</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 0.9.7 or later is required. Note that OpenSSL’s versions are not always faster than the versions built into botan.</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">--build-dir=<dir></span></code> to set up a build environment in a different directory.</p> </div> <div class="section" id="configuring-the-build-with-python-3-1"> <span id="configure-with-python3"></span><h3>Configuring the Build With Python 3.1<a class="headerlink" href="#configuring-the-build-with-python-3-1" title="Permalink to this headline">¶</a></h3> <p>The versions of Python beginning with 3 are (intentionally) incompatible with the (currently more common) 2.x series. If you want to use Python 3.1 to set up the build, you’ll have to use the <code class="docutils literal"><span class="pre">2to3</span></code> program (included in the Python distribution) on the script; this will convert the script to the Python 3.x dialect:</p> <div class="highlight-cpp"><div class="highlight"><pre><span></span>$ python ./configure.py File "configure.py", line 860 except KeyError, e: ^ SyntaxError: invalid syntax $ # incompatible python version, let's fix it $ 2to3 -w configure.py [...] RefactoringTool: Files that were modified: RefactoringTool: configure.py $ python ./configure.py [...] </pre></div> </div> </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="http://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">config.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_VECTOR_OVER_ALLOCATE</span></code>: The memory container <code class="docutils literal"><span class="pre">SecureVector</span></code> will over-allocate requests by this amount (in elements). In several areas of the library, we grow a vector fairly often. By over-allocating by a small amount, we don’t have to do allocations as often (which is good, because the allocators can be quite slow). If you <em>really</em> want to reduce memory usage, set it to 0. Otherwise, the default should be perfectly fine.</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. A good rule of thumb would be to use the page size of your machine. The default should be fine for most purposes.</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> and <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-config</span></code> script. This basically solves the same problem all the other <code class="docutils literal"><span class="pre">*-config</span></code> scripts solve, and in basically the same manner.</p> <p>There are 4 options:</p> <p><code class="docutils literal"><span class="pre">--prefix[=DIR]</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>). If an argument is specified, other options given with the same command will execute as if Botan as actually installed at <code class="docutils literal"><span class="pre">DIR</span></code> and not where it really is; or at least where <code class="docutils literal"><span class="pre">botan-config</span></code> thinks it really is. I should mention that it</p> <p><code class="docutils literal"><span class="pre">--version</span></code>: Print the Botan version number.</p> <p><code class="docutils literal"><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">--libs</span></code>: Print options for which libraries to link to (this includes <code class="docutils literal"><span class="pre">-lbotan</span></code>).</p> <p>Your <code class="docutils literal"><span class="pre">Makefile</span></code> can run <code class="docutils literal"><span class="pre">botan-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> <p>Botan also by default installs a file for <code class="docutils literal"><span class="pre">pkg-config</span></code>, namespaced by the major and minor versions. So it can be used, for instance, as:</p> <div class="highlight-cpp"><div class="highlight"><pre><span></span>$ pkg-config botan-1.10 --modversion 1.10.0 $ pkg-config botan-1.10 --cflags -I/usr/local/include $ pkg-config botan-1.10 --libs -L/usr/local/lib -lbotan -lm -lbz2 -lpthread -lrt </pre></div> </div> </div> <div class="section" id="ms-windows"> <h3>MS Windows<a class="headerlink" href="#ms-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 Boost.Python, so you must have Boost installed. To build the wrappers, pass the flag <code class="docutils literal"><span class="pre">--with-boost-python</span></code> to <code class="docutils literal"><span class="pre">configure.py</span></code>. This will create a second makefile, <code class="docutils literal"><span class="pre">Makefile.python</span></code>, with instructions for building the Python module. After building the library, execute:</p> <div class="highlight-cpp"><div class="highlight"><pre><span></span>$ make -f Makefile.python </pre></div> </div> <p>to build the module. Currently only Unix systems are supported, and the Makefile assumes that the version of Python you want to build against is the same one you used to run <code class="docutils literal"><span class="pre">configure.py</span></code>.</p> <p>To install the module, use the <code class="docutils literal"><span class="pre">install</span></code> target.</p> <p>See <a class="reference internal" href="python.html"><span class="doc">Python Bindings</span></a> for more information about the binding.</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, change your directory to <code class="docutils literal"><span class="pre">src/wrap/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-cpp"><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">Welcome</a></li> <li class="toctree-l1"><a class="reference internal" href="reading.html">Recommended Reading</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></li> <li class="toctree-l2"><a class="reference internal" href="#other-build-related-tasks">Other Build-Related Tasks</a></li> <li class="toctree-l2"><a class="reference internal" href="#building-applications">Building Applications</a></li> <li class="toctree-l2"><a class="reference internal" href="#language-wrappers">Language Wrappers</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="firststep.html">Getting Started</a></li> <li class="toctree-l1"><a class="reference internal" href="filters.html">Information Flow: Pipes and Filters</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">Certificate Handling</a></li> <li class="toctree-l1"><a class="reference internal" href="ssl.html">SSL and TLS</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="lowlevel.html">The Low-Level Interface</a></li> <li class="toctree-l1"><a class="reference internal" href="secmem.html">Secure Memory Containers</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="passhash.html">Password Hashing</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="fpe.html">Format Preserving Encryption</a></li> <li class="toctree-l1"><a class="reference internal" href="python.html">Python Binding</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="reading.html" title="Recommended Reading" accesskey="P">previous</a> | <a href="firststep.html" title="Getting Started" accesskey="N">next</a> | <a href="genindex.html" title="General Index" accesskey="I">index</a> </div> <div role="note" aria-label="source link"> <br/> <a href="_sources/building.txt" rel="nofollow">Show Source</a> </div> </div> <div class="right"> <div class="footer" role="contentinfo"> © Copyright 2000-2011, Jack Lloyd. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9. </div> </div> <div class="clearer"></div> </div> </div> </body> </html>