Skip to content
This repository was archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
remove libsodium-ffi and time dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Whitehead <[email protected]>
  • Loading branch information
andrewwhitehead authored and mikelodder7 committed Jan 10, 2022
1 parent 34ef392 commit d2d574c
Show file tree
Hide file tree
Showing 20 changed files with 89 additions and 564 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ found in Libursa.
Ursa uses the following external dependencies:

- [openssl 1.1.0j or greater](https://www.openssl.org/source/openssl-1.1.0j.tar.gz) (Written in C)
- [libsodium 1.0.18 or greater](https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz) (Written in C)
- [libsecp256k1](https://github.com/bitcoin-core/secp256k1) (Written in C)

These dependencies are used when building in the default secure mode. These
Expand All @@ -104,9 +103,7 @@ when using portable mode for their applications.

# Building from Source

Libursa and Libzmix rely on libsodium for the default
secure mode. Please see the following document for specific platform
installations [here](docs/build-environment.md).
Please see the following document for platform-specific installations [here](docs/build-environment.md).

## Libursa

Expand Down
12 changes: 2 additions & 10 deletions docker/centos/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,10 @@ FROM centos:7
LABEL maintainer="Michael Lodder <[email protected]>"

ENV PATH /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV SODIUM_LIB_DIR /usr/local/lib
ENV LD_LIBRARY_PATH /usr/local/lib

WORKDIR /root

RUN yum -y update && yum -y install sudo make autoconf libtool curl python3 pkg-config openssl-devel 2>&1 > /dev/null \
&& curl -fsSL https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz | tar -xz \
&& cd libsodium-1.0.18 \
&& ./autogen.sh \
&& ./configure --disable-dependency-tracking \
&& make \
&& make install \
&& cd .. \
&& rm -rf libsodium-1.0.18 \
RUN yum -y update \
&& yum -y install sudo make autoconf libtool curl python3 pkg-config openssl-devel 2>&1 > /dev/null \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y
12 changes: 2 additions & 10 deletions docker/fedora/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,10 @@ FROM fedora:29
LABEL maintainer="Michael Lodder <[email protected]>"

ENV PATH /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV SODIUM_LIB_DIR /usr/local/lib
ENV LD_LIBRARY_PATH /usr/local/lib

WORKDIR /root

RUN yum -y update && yum -y install sudo make autoconf libtool curl python3 pkg-config openssl-devel 2>&1 > /dev/null \
&& curl -fsSL https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz | tar -xz \
&& cd libsodium-1.0.18 \
&& ./autogen.sh \
&& ./configure --disable-dependency-tracking \
&& make \
&& make install \
&& cd .. \
&& rm -rf libsodium-1.0.18 \
RUN yum -y update \
&& yum -y install sudo make autoconf libtool curl python3 pkg-config openssl-devel 2>&1 > /dev/null \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y
12 changes: 2 additions & 10 deletions docker/suse/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,10 @@ FROM opensuse:leap
LABEL maintainer="Michael Lodder <[email protected]>"

ENV PATH /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV SODIUM_LIB_DIR /usr/local/lib
ENV LD_LIBRARY_PATH /usr/local/lib

WORKDIR /root

RUN zypper --non-interactive update && zypper --non-interactive install sudo make gcc autoconf libtool curl python3 pkg-config openssl-devel 2>&1 > /dev/null \
&& curl -fsSL https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz | tar -xz \
&& cd libsodium-1.0.18 \
&& ./autogen.sh \
&& ./configure \
&& make \
&& make install \
&& cd .. \
&& rm -rf libsodium-1.0.18 \
RUN zypper --non-interactive update \
&& zypper --non-interactive install sudo make gcc autoconf libtool curl python3 pkg-config openssl-devel 2>&1 > /dev/null \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y
10 changes: 0 additions & 10 deletions docker/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
FROM ubuntu:18.04

ENV PATH /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV SODIUM_LIB_DIR /usr/local/lib
ENV SODIUM_INCLUDE_DIR /usr/local/include
ENV LD_LIBRARY_PATH /usr/local/lib
ARG DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -33,13 +31,5 @@ WORKDIR /root
RUN cd /usr/lib/x86_64-linux-gnu \
&& ln -s libssl.so.1.0.0 libssl.so.10 \
&& ln -s libcrypto.so.1.0.0 libcrypto.so.10 \
&& curl -fsSL https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz | tar -xz \
&& cd libsodium-1.0.18 \
&& ./autogen.sh \
&& ./configure \
&& make install \
&& cd .. \
&& rm -rf libsodium-1.0.18 \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& cargo install cargo-deb

10 changes: 0 additions & 10 deletions docker/ubuntu/ursa-bionic.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
FROM ubuntu:18.04

ENV PATH /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV SODIUM_LIB_DIR /usr/local/lib
ENV SODIUM_INCLUDE_DIR /usr/local/include
ENV LD_LIBRARY_PATH /usr/local/lib
ARG DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -33,13 +31,5 @@ WORKDIR /root
RUN cd /usr/lib/x86_64-linux-gnu \
&& ln -s libssl.so.1.0.0 libssl.so.10 \
&& ln -s libcrypto.so.1.0.0 libcrypto.so.10 \
&& curl -fsSL https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz | tar -xz \
&& cd libsodium-1.0.18 \
&& ./autogen.sh \
&& ./configure \
&& make install \
&& cd .. \
&& rm -rf libsodium-1.0.18 \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& cargo install cargo-deb

10 changes: 0 additions & 10 deletions docker/ubuntu/ursa-fossa.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
FROM ubuntu:20.04

ENV PATH /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV SODIUM_LIB_DIR /usr/local/lib
ENV SODIUM_INCLUDE_DIR /usr/local/include
ENV LD_LIBRARY_PATH /usr/local/lib
ARG DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -33,13 +31,5 @@ WORKDIR /root
RUN cd /usr/lib/x86_64-linux-gnu \
&& ln -s libssl.so.1.0.0 libssl.so.10 \
&& ln -s libcrypto.so.1.0.0 libcrypto.so.10 \
&& curl -fsSL https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz | tar -xz \
&& cd libsodium-1.0.18 \
&& ./autogen.sh \
&& ./configure \
&& make install \
&& cd .. \
&& rm -rf libsodium-1.0.18 \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& cargo install cargo-deb

10 changes: 0 additions & 10 deletions docker/ubuntu/ursa-xenial.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
FROM ubuntu:16.04

ENV PATH /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV SODIUM_LIB_DIR /usr/local/lib
ENV SODIUM_INCLUDE_DIR /usr/local/include
ENV LD_LIBRARY_PATH /usr/local/lib
ARG DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -33,13 +31,5 @@ WORKDIR /root
RUN cd /usr/lib/x86_64-linux-gnu \
&& ln -s libssl.so.1.0.0 libssl.so.10 \
&& ln -s libcrypto.so.1.0.0 libcrypto.so.10 \
&& curl -fsSL https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz | tar -xz \
&& cd libsodium-1.0.18 \
&& ./autogen.sh \
&& ./configure \
&& make install \
&& cd .. \
&& rm -rf libsodium-1.0.18 \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& cargo install cargo-deb

129 changes: 50 additions & 79 deletions docs/build-environment.md
Original file line number Diff line number Diff line change
@@ -1,154 +1,125 @@
# Setup your build environment
Libursa relies on libsodium for the default secure mode. The instructions below show the necessary steps to configure the environment to build all modes of libursa. There are convienance docker images in the **docker** folder that can be used.

The instructions below show the necessary steps to configure the environment to build all modes of libursa. There are convienance docker images in the **docker** folder that can be used.

## Fedora, RedHat, CentOS

1. Install build tools

```bash
yum -y install make autoconf libtool curl python3 pkg-config openssl-devel
```

2. Install rust

```bash
curl -sSf https://sh.rustup.rs | sh -s -- -y
```

3. Initialize rust environment

```bash
source ~/.cargo/env
```
4. Compile and install libsodium 1.0.18
```bash
curl -fsSL https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz | tar -xz
cd libsodium-1.0.18
./autogen.sh
./configure --disable-dependency-tracking
make
sudo make install
```
5. Add the libsodium environment variable
```bash
export SODIUM_LIB_DIR=/usr/local/lib
export LD_LIBRARY_PATH=/usr/local/lib
```

## OpenSUSE

1. Install build tools

```bash
zypper --non-interactive install make gcc autoconf libtool curl python3 pkg-config openssl-devel
```

2. Install rust

```bash
curl -sSf https://sh.rustup.rs | sh -s -- -y
```

3. Initialize rust environment

```bash
source ~/.cargo/env
```
4. Compile and install libsodium 1.0.18
```bash
curl -fsSL https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz | tar -xz
cd libsodium-1.0.18
./autogen.sh
./configure
make
sudo make install
```
5. Add the libsodium environment variable
```bash
export SODIUM_LIB_DIR=/usr/local/lib
export LD_LIBRARY_PATH=/usr/local/lib
```

## Debian, Ubuntu

1. Install build tools

```bash
apt-get install -y cmake autoconf libtool curl python3 pkg-config libssl-dev
```

2. Install rust

```bash
curl -sSf https://sh.rustup.rs | sh -s -- -y
```

3. Initialize rust environment

```bash
source ~/.cargo/env
```
4. Compile and install libsodium 1.0.18
```bash
curl -fsSL https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz | tar -xz
cd libsodium-1.0.18
./autogen.sh
./configure
make
sudo make install
```
5. Add the libsodium environment variable
```bash
export SODIUM_LIB_DIR=/usr/local/lib
export LD_LIBRARY_PATH=/usr/local/lib
```

## Mac OS X
1. Install xcode command line tools

1. Install xcode command line tools

```bash
xcode-select --install
```

2. Install rust

```bash
curl -sSf https://sh.rustup.rs | sh -s -- -y
```

3. Install brew

```bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```

4. Install build tools

```bash
brew install pkg-config
brew install automake
brew install autoconf
brew install cmake
brew install libtool
```

5. Initialize rust environment

```bash
source ~/.cargo/env
```
6. Compile and install libsodium 1.0.18
```bash
curl -fsSL https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz | tar -xz
cd libsodium-1.0.18
./autogen.sh
./configure --prefix=/usr/local
make
sudo make install
```
7. Add the libsodium environment variables
```bash
export SODIUM_LIB_DIR=/usr/local/lib
export SODIUM_INCLUDE_DIR=/usr/local/include
```

## Windows 10

1. Download the most recent Visual Studio Community Edition [here](https://visualstudio.microsoft.com/vs/). This is currently the 2019 version.
- Check the box for *Desktop development with C++*
- In the small menu on the right hand side also check the box for *C++/CLI support*
1. Download the most recent Visual Studio Community Edition [here](https://visualstudio.microsoft.com/vs/). This is currently the 2019 version.
- Check the box for _Desktop development with C++_
- In the small menu on the right hand side also check the box for _C++/CLI support_
1. Download git-scm for windows [here](https://git-scm.com/download/win)
- Install git for windows using:
- *Use Git from Git Bash Only* so it doesn't change any path settings of the command prompt
- *Checkout as is, commit Unix-style line endings*
- *Use MinTTY*
- Check all the boxes for:
1. Enable file system caching
1. Enable Git Credential Manager
1. Enable symbolic links
- Install git for windows using:
- _Use Git from Git Bash Only_ so it doesn't change any path settings of the command prompt
- _Checkout as is, commit Unix-style line endings_
- _Use MinTTY_
- Check all the boxes for:
1. Enable file system caching
1. Enable Git Credential Manager
1. Enable symbolic links
1. Download rust for windows [here](https://rustup.rs)
- Choose option 1: proceed with installation (default)
- Note: if you have antivirus software on your computer, you will likely have to disable it for Rust to correctly install. In addition, it is advisable to install in a terminal that is "run as an administrator."
- Choose option 1: proceed with installation (default)
- Note: if you have antivirus software on your computer, you will likely have to disable it for Rust to correctly install. In addition, it is advisable to install in a terminal that is "run as an administrator."
1. Download the most recent OpenSSL for windows [here](https://slproweb.com/products/Win32OpenSSL.html)
- Choose for "Copy OpenSSL DLLs to:" *The OpenSSL binaries (/bin) directory*
- Choose for "Copy OpenSSL DLLs to:" _The OpenSSL binaries (/bin) directory_
1. Set the environment variables
- Note that these may vary. If your Ursa build fails because it cannot find OpenSSL, check your environment variables!
- Windows command prompt:
1. set OPENSSL_DIR "C:\Program Files\OpenSSL-Win64"
1. set SODIUM_BUILD_STATIC "1"
- Git Bash
1. export OPENSSL_DIR=/c/Program Files/OpenSSL-Win64
1. export SODIUM_BUILD_STATIC=1
- Note that these may vary. If your Ursa build fails because it cannot find OpenSSL, check your environment variables!
- Windows command prompt:
`set OPENSSL_DIR "C:\Program Files\OpenSSL-Win64"`
- Git Bash
`export OPENSSL_DIR=/c/Program Files/OpenSSL-Win64`
Loading

0 comments on commit d2d574c

Please sign in to comment.