| 1 |
.. _building-a-local-library: |
| 2 |
|
| 3 |
Building the bundled library |
| 4 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 5 |
|
| 6 |
If you you want to avoid a system-wide installation of libsodium's |
| 7 |
development files just for compiling and running the tests, you can |
| 8 |
instead install the library and header files inside PyNaCl's sources. |
| 9 |
|
| 10 |
|
| 11 |
Linux systems |
| 12 |
""""""""""""" |
| 13 |
|
| 14 |
On Linux (and presumably other UNIX-like systems), after entering the |
| 15 |
PyNaCl source directory you must execute the following commands: |
| 16 |
|
| 17 |
.. code-block:: bash |
| 18 |
|
| 19 |
$ mkdir -p build/libsodium |
| 20 |
$ cd build/libsodium |
| 21 |
$ ../../src/libsodium/configure --prefix=$PWD --disable-shared |
| 22 |
$ make |
| 23 |
$ make install |
| 24 |
$ cd ../.. |
| 25 |
|
| 26 |
If all went well, |
| 27 |
|
| 28 |
.. code-block:: bash |
| 29 |
|
| 30 |
$ ls build/libsodium/{lib,include} |
| 31 |
|
| 32 |
should generate something like the following output: |
| 33 |
|
| 34 |
.. code-block:: bash |
| 35 |
|
| 36 |
build/libsodium/include: |
| 37 |
sodium sodium.h |
| 38 |
|
| 39 |
build/libsodium/lib: |
| 40 |
libsodium.a libsodium.la pkgconfig |
| 41 |
|
| 42 |
If you now define and export the |
| 43 |
|
| 44 |
.. code-block:: bash |
| 45 |
|
| 46 |
$ SODIUMINCL="-I${PWD}/build/libsodium/include" |
| 47 |
$ export SODIUMINCL |
| 48 |
$ SODIUMLIB="-L${PWD}/build/libsodium/lib" |
| 49 |
$ export SODIUMLIB |
| 50 |
|
| 51 |
environment variables, you can instruct the compiler to use the |
| 52 |
just-installed library by simply dereferencing the path flags |
| 53 |
on the c compier command line |
| 54 |
|
| 55 |
.. code-block:: bash |
| 56 |
|
| 57 |
$ cc ${SODIUMINCL} ${SODIUMLIB} |
| 58 |
|