File: bundled_library_build.rst

package info (click to toggle)
python-nacl 1.5.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,776 kB
  • sloc: ansic: 45,889; python: 7,249; sh: 6,752; asm: 2,974; makefile: 1,011; cs: 35; xml: 30; pascal: 11
file content (58 lines) | stat: -rw-r--r-- 1,347 bytes parent folder | download | duplicates (4)
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
.. _building-a-local-library:

Building the bundled library
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you you want to avoid a system-wide installation of libsodium's
development files just for compiling and running the tests, you can
instead install the library and header files inside PyNaCl's sources.


Linux systems
"""""""""""""

On Linux (and presumably other UNIX-like systems), after entering the
PyNaCl source directory you must execute the following commands:

.. code-block:: bash

    $ mkdir -p build/libsodium
    $ cd build/libsodium
    $ ../../src/libsodium/configure --prefix=$PWD --disable-shared
    $ make
    $ make install
    $ cd ../..

If all went well,

.. code-block:: bash

    $ ls build/libsodium/{lib,include}

should generate something like the following output:

.. code-block:: bash

    build/libsodium/include:
    sodium  sodium.h

    build/libsodium/lib:
    libsodium.a  libsodium.la  pkgconfig

If you now define and export the

.. code-block:: bash

    $ SODIUMINCL="-I${PWD}/build/libsodium/include"
    $ export SODIUMINCL
    $ SODIUMLIB="-L${PWD}/build/libsodium/lib"
    $ export SODIUMLIB

environment variables, you can instruct the compiler to use the
just-installed library by simply dereferencing the path flags
on the c compier command line

.. code-block:: bash

    $ cc ${SODIUMINCL} ${SODIUMLIB}