Giter VIP home page Giter VIP logo

cryptobox-jni's Introduction

Wire

This repository is part of the source code of Wire. You can find more information at wire.com or by contacting [email protected].

You can find the published source code at github.com/wireapp.

For licensing information, see the attached LICENSE file and the list of third-party licenses at wire.com/legal/licenses/.

cryptobox-jni

JNI bindings for the cryptobox with support for cross-compilation to Android.

Building

### Host Architecture

Besides common OS-specific development tooling, the following prerequisites are needed to build for the host architecture:

  • A Rust compiler (1.12.1 or newer).
  • A Java compiler (1.6 or later).

With that in place

make dist

will leave a tarball in the dist directory containing all the binaries for your host architecture in the form of shared libraries, as well as a .jar file and the corresponding javadoc output.

### Android

Besides common OS-specific development tooling, the following prerequisites are needed to build for Android:

  • The Android SDK (The Android Studio IDE is not required).

  • The Android NDK (r10d or newer).

  • NDK standalone toolchains for the following architectures:

    • armeabi-v7a
    • arm64-v8a
    • x86
  • A Java compiler (1.6 or later).

  • A Rust compiler (1.12.1 or newer) that can cross-compile to the following targets corresponding to the aforementioned NDK standalone toolchains:

    • armv7-linux-androideabi
    • aarch64-linux-android
    • i686-linux-android

    It is recommended to use rustup to manage multiple Rust compiler toolchains. Using rustup, the following commands will install the necessary target-specific Rust binaries needed for Android:

    rustup target add armv7-linux-androideabi
    rustup target add i686-linux-android
    rustup target add aarch64-linux-android
    

    Alternatively a Rust compiler that supports the necessary targets can be built from source, e.g.:

    ./configure \
        --prefix=/where/to/install \
        --arm-linux-androideabi-ndk=/path/to/android-ndk-toolchain-armeabi-v7a \
        --aarch64-linux-android-ndk=/path/to/android-ndk-toolchain-arm64-v8a \
        --i686-linux-android-ndk=/path/to/android-ndk-toolchain-x86 \
        --target=arm-linux-androideabi,aarch64-linux-android,i686-linux-android
    make -j4
    make install
    
  • The ANDROID_NDK_HOME environment variable must be set and point to the home directory of the NDK installation.

  • The ANDROID_NDK_TOOLCHAIN_ARM environment variable must be set and point to the home directory of the armeabi-v7a standalone toolchain.

  • The ANDROID_NDK_TOOLCHAIN_X86 environment variable must be set and point to the home directory of the x86 standalone toolchain.

  • The ANDROID_NDK_TOOLCHAIN_AARCH64 environment variable must be set and point to the home directory of the arm64-v8a standalone toolchain.

With the prerequisites in place, the Android build can be run with:

cd android && make dist

The distribution artifacts will be in the android/dist directory, which includes an Android Library Archive (.aar).

Windows

You need:

  • MSYS2 with MinGW-w64 toolchains

  • The pkg-config from MinGW-w64 toolchain

    pacman -S mingw-w64-x86_64-pkg-config
    
  • A Java compiler (1.6 or later)

  • A Rust compiler (1.6 or newer) with GNU ABI

  • The JAVA_HOME environment variable must be set correctly for MSYS2

    export JAVA_HOME="/c/Program Files/Java/jdk1.8.0_rev"
    
  • The PATH environment variable must include JDK and Rust for MSYS2

Sample Application

This project has a simple Android sample application that can be installed on a connected Android device or emulator:

cd android-example && make install

Look for an application named CryptoBoxExample.

Tests

Currently this project's tests run only on Android and require a connected Android device or emulator:

cd android-example && make test

The test project is located in the android-example/tests directory.

Contribute

For any problems, comments, or feedback please create an issue here on GitHub.

Licence

This project is released under the GNU General Public License v3.0.

cryptobox-jni's People

Contributors

kim avatar mythsunwind avatar raphaelrobert avatar romanb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.