WIP: merging wolfssl-lib into this working wolfssl-jni branch

This commit is contained in:
JohnE 2019-02-07 18:22:02 -08:00
parent ea3948164d
commit 565e98f410
10 changed files with 236 additions and 33 deletions

2
.gitignore vendored
View File

@ -9,4 +9,4 @@ libwebp
.DS_Store
wolfssl-git
var/
dist/

View File

@ -1,3 +1,3 @@
//include ':wolfssl-lib'
include ':wolfssl-jni'
//include ':wolfssl-jni'
//include ':ccc-jni'

View File

@ -1,5 +1,17 @@
apply plugin: 'com.android.library'
buildscript {
repositories {
google()
jcenter()
}
dependencies {
// gradle tools 2.2.2+ supports stable ndk
// classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
android {
compileSdkVersion 28
// a default can be used, but it is good practice to explicitly select build tools

71
wolfssl-lib/build.sh Executable file
View File

@ -0,0 +1,71 @@
#!/bin/bash
#
# Building bugs with CMake and the Gradle externalNativeBuild plugin
# The STATIC build is not consistent and stopped compiling. So I found a work around.
# The SHARED build is consistent, and if I do that first, then STATIC will work **once**
# This following process will build repeated, but only release version (don't care to troublshoot)
# build SHARED library
build_shared() {
cp src/main/cpp/wolfssl-oem/CMakeLists_SHARED.txt src/main/cpp/wolfssl-oem/CMakeLists.txt
gradle clean
rm -rf ./externalNativeBuild
gradle build
}
# build STATIC library
build_static() {
cp src/main/cpp/wolfssl-oem/CMakeLists_STATIC.txt src/main/cpp/wolfssl-oem/CMakeLists.txt
gradle build
}
get_key_status() {
echo
echo $1
echo "Press any key to continue..."
read -rsn1
}
make_dirs() {
# gen date stamp
UNIQ_DIR=`date +%Y-%m-%d.%H_%M_%S`
DEST_DIR="dist/wolfssl-lib_${UNIQ_DIR}/"
# release
mkdir -p ${DEST_DIR}/release/arm64-v8a
mkdir -p ${DEST_DIR}/release/armeabi-v7a
mkdir -p ${DEST_DIR}/release/x86
mkdir -p ${DEST_DIR}/release/x86_64
# debug
# mkdir -p ${DEST_DIR}/debug/arm64-v8a
# mkdir -p ${DEST_DIR}/debug/armeabi-v7a
# mkdir -p ${DEST_DIR}/debug/x86
# mkdir -p ${DEST_DIR}/debug/x86_64
}
copy_files() {
cp .externalNativeBuild/cmake/release/arm64-v8a/src/main/cpp/wolfssl-oem/libwolfssl.a ${DEST_DIR}/release/arm64-v8a/
cp .externalNativeBuild/cmake/release/armeabi-v7a/src/main/cpp/wolfssl-oem/libwolfssl.a ${DEST_DIR}/release/armeabi-v7a/
cp .externalNativeBuild/cmake/release/x86/src/main/cpp/wolfssl-oem/libwolfssl.a ${DEST_DIR}/release/x86/
cp .externalNativeBuild/cmake/release/x86_64/src/main/cpp/wolfssl-oem/libwolfssl.a ${DEST_DIR}/release/x86_64/
cp ./build/intermediates/cmake/release/obj/arm64-v8a/libwolfssl.so ${DEST_DIR}/release/arm64-v8a/
cp ./build/intermediates/cmake/release/obj/armeabi-v7a/libwolfssl.so ${DEST_DIR}/release/armeabi-v7a/
cp ./build/intermediates/cmake/release/obj/x86/libwolfssl.so ${DEST_DIR}/release/x86/
cp ./build/intermediates/cmake/release/obj/x86_64/libwolfssl.so ${DEST_DIR}/release/x86_64/
#
# debug not building right now...not sure I care so ignoring to move on...
#
# cp .externalNativeBuild/cmake/debug/arm64-v8a/src/main/cpp/wolfssl-oem/libwolfssl.a ${DEST_DIR}/debug/arm64-v8a/
# cp .externalNativeBuild/cmake/debug/armeabi-v7a/src/main/cpp/wolfssl-oem/libwolfssl.a ${DEST_DIR}/debug/armeabi-v7a/
# cp .externalNativeBuild/cmake/debug/x86/src/main/cpp/wolfssl-oem/libwolfssl.a ${DEST_DIR}/debug/x86/
# cp .externalNativeBuild/cmake/debug/x86_64/src/main/cpp/wolfssl-oem/libwolfssl.a ${DEST_DIR}/debug/x86_64/
}
build_shared
# get_key_status "Finished STATIC lib build."
build_static
# get_key_status "Finished SHARED lib build."
make_dirs
copy_files

View File

@ -1,5 +0,0 @@
DIST README
===========
* This folder is *not* auto generated. As of right now files are copied from the ./bulld/intermediates/cmake/release/obj/... location.

View File

@ -1,17 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/gfan/dev/sdk_current/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -1,2 +0,0 @@
# this CMake file is the root, and is used to create the bin folder
add_subdirectory(wolfssl-oem)

View File

@ -1,7 +1,7 @@
# create a build target of "wolfssl"
# library is a SHARED (not STATIC)
# library is STATIC (.a not .so file)
# add all the source code
add_library(wolfssl STATIC
add_library(wolfssl STATIC
wolfssl-git/src/crl.c
wolfssl-git/src/internal.c
wolfssl-git/src/io.c
@ -65,8 +65,8 @@ add_library(wolfssl STATIC
# therefore give the root of the search path to the find the files
include_directories( wolfssl-git )
set(distribution_DIR ${CMAKE_SOURCE_DIR}/dist)
set_target_properties(wolfssl
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY
"${CMAKE_SOURCE_DIR}/dist/lib/${ANDROID_ABI}")
# set(distribution_DIR ${CMAKE_SOURCE_DIR}/dist)
# set_target_properties(wolfssl
# PROPERTIES
# ARCHIVE_OUTPUT_DIRECTORY
# "${CMAKE_SOURCE_DIR}/dist/lib/${ANDROID_ABI}")

View File

@ -0,0 +1,72 @@
# create a build target of "wolfssl"
# library is SHARED (.so file)
# add all the source code
add_library(wolfssl SHARED
wolfssl-git/src/crl.c
wolfssl-git/src/internal.c
wolfssl-git/src/io.c
wolfssl-git/src/keys.c
wolfssl-git/src/ocsp.c
wolfssl-git/src/sniffer.c
wolfssl-git/src/ssl.c
wolfssl-git/src/tls.c
wolfssl-git/wolfcrypt/src/aes.c
wolfssl-git/wolfcrypt/src/arc4.c
wolfssl-git/wolfcrypt/src/asm.c
wolfssl-git/wolfcrypt/src/asn.c
wolfssl-git/wolfcrypt/src/blake2b.c
wolfssl-git/wolfcrypt/src/camellia.c
wolfssl-git/wolfcrypt/src/chacha.c
wolfssl-git/wolfcrypt/src/chacha20_poly1305.c
wolfssl-git/wolfcrypt/src/coding.c
wolfssl-git/wolfcrypt/src/compress.c
wolfssl-git/wolfcrypt/src/curve25519.c
wolfssl-git/wolfcrypt/src/des3.c
wolfssl-git/wolfcrypt/src/dh.c
wolfssl-git/wolfcrypt/src/dsa.c
wolfssl-git/wolfcrypt/src/ecc.c
wolfssl-git/wolfcrypt/src/ecc_fp.c
wolfssl-git/wolfcrypt/src/ed25519.c
wolfssl-git/wolfcrypt/src/error.c
wolfssl-git/wolfcrypt/src/fe_low_mem.c
wolfssl-git/wolfcrypt/src/fe_operations.c
wolfssl-git/wolfcrypt/src/ge_low_mem.c
wolfssl-git/wolfcrypt/src/ge_operations.c
wolfssl-git/wolfcrypt/src/hash.c
wolfssl-git/wolfcrypt/src/hc128.c
wolfssl-git/wolfcrypt/src/hmac.c
wolfssl-git/wolfcrypt/src/idea.c
wolfssl-git/wolfcrypt/src/integer.c
wolfssl-git/wolfcrypt/src/logging.c
wolfssl-git/wolfcrypt/src/md2.c
wolfssl-git/wolfcrypt/src/md4.c
wolfssl-git/wolfcrypt/src/md5.c
wolfssl-git/wolfcrypt/src/memory.c
wolfssl-git/wolfcrypt/src/misc.c
wolfssl-git/wolfcrypt/src/pkcs7.c
wolfssl-git/wolfcrypt/src/pkcs12.c
wolfssl-git/wolfcrypt/src/poly1305.c
wolfssl-git/wolfcrypt/src/pwdbased.c
wolfssl-git/wolfcrypt/src/rabbit.c
wolfssl-git/wolfcrypt/src/random.c
wolfssl-git/wolfcrypt/src/ripemd.c
wolfssl-git/wolfcrypt/src/rsa.c
wolfssl-git/wolfcrypt/src/sha.c
wolfssl-git/wolfcrypt/src/sha256.c
wolfssl-git/wolfcrypt/src/sha512.c
wolfssl-git/wolfcrypt/src/srp.c
wolfssl-git/wolfcrypt/src/tfm.c
wolfssl-git/wolfcrypt/src/wc_encrypt.c
wolfssl-git/wolfcrypt/src/wc_port.c )
# .h files are located at wolfssl/wolfssl, wolfssl/wolfssl/wolfcrypt
# the source files are looking for wolfssl/wolfcrypt/settings.h
# wolfssl-git/wolfssl/wolfcrypt/settings.h
# therefore give the root of the search path to the find the files
include_directories( wolfssl-git )
# set(distribution_DIR ${CMAKE_SOURCE_DIR}/dist)
# set_target_properties(wolfssl
# PROPERTIES
# ARCHIVE_OUTPUT_DIRECTORY
# "${CMAKE_SOURCE_DIR}/dist/lib/${ANDROID_ABI}")

View File

@ -0,0 +1,72 @@
# create a build target of "wolfssl"
# library is STATIC (.a not .so file)
# add all the source code
add_library(wolfssl STATIC
wolfssl-git/src/crl.c
wolfssl-git/src/internal.c
wolfssl-git/src/io.c
wolfssl-git/src/keys.c
wolfssl-git/src/ocsp.c
wolfssl-git/src/sniffer.c
wolfssl-git/src/ssl.c
wolfssl-git/src/tls.c
wolfssl-git/wolfcrypt/src/aes.c
wolfssl-git/wolfcrypt/src/arc4.c
wolfssl-git/wolfcrypt/src/asm.c
wolfssl-git/wolfcrypt/src/asn.c
wolfssl-git/wolfcrypt/src/blake2b.c
wolfssl-git/wolfcrypt/src/camellia.c
wolfssl-git/wolfcrypt/src/chacha.c
wolfssl-git/wolfcrypt/src/chacha20_poly1305.c
wolfssl-git/wolfcrypt/src/coding.c
wolfssl-git/wolfcrypt/src/compress.c
wolfssl-git/wolfcrypt/src/curve25519.c
wolfssl-git/wolfcrypt/src/des3.c
wolfssl-git/wolfcrypt/src/dh.c
wolfssl-git/wolfcrypt/src/dsa.c
wolfssl-git/wolfcrypt/src/ecc.c
wolfssl-git/wolfcrypt/src/ecc_fp.c
wolfssl-git/wolfcrypt/src/ed25519.c
wolfssl-git/wolfcrypt/src/error.c
wolfssl-git/wolfcrypt/src/fe_low_mem.c
wolfssl-git/wolfcrypt/src/fe_operations.c
wolfssl-git/wolfcrypt/src/ge_low_mem.c
wolfssl-git/wolfcrypt/src/ge_operations.c
wolfssl-git/wolfcrypt/src/hash.c
wolfssl-git/wolfcrypt/src/hc128.c
wolfssl-git/wolfcrypt/src/hmac.c
wolfssl-git/wolfcrypt/src/idea.c
wolfssl-git/wolfcrypt/src/integer.c
wolfssl-git/wolfcrypt/src/logging.c
wolfssl-git/wolfcrypt/src/md2.c
wolfssl-git/wolfcrypt/src/md4.c
wolfssl-git/wolfcrypt/src/md5.c
wolfssl-git/wolfcrypt/src/memory.c
wolfssl-git/wolfcrypt/src/misc.c
wolfssl-git/wolfcrypt/src/pkcs7.c
wolfssl-git/wolfcrypt/src/pkcs12.c
wolfssl-git/wolfcrypt/src/poly1305.c
wolfssl-git/wolfcrypt/src/pwdbased.c
wolfssl-git/wolfcrypt/src/rabbit.c
wolfssl-git/wolfcrypt/src/random.c
wolfssl-git/wolfcrypt/src/ripemd.c
wolfssl-git/wolfcrypt/src/rsa.c
wolfssl-git/wolfcrypt/src/sha.c
wolfssl-git/wolfcrypt/src/sha256.c
wolfssl-git/wolfcrypt/src/sha512.c
wolfssl-git/wolfcrypt/src/srp.c
wolfssl-git/wolfcrypt/src/tfm.c
wolfssl-git/wolfcrypt/src/wc_encrypt.c
wolfssl-git/wolfcrypt/src/wc_port.c )
# .h files are located at wolfssl/wolfssl, wolfssl/wolfssl/wolfcrypt
# the source files are looking for wolfssl/wolfcrypt/settings.h
# wolfssl-git/wolfssl/wolfcrypt/settings.h
# therefore give the root of the search path to the find the files
include_directories( wolfssl-git )
# set(distribution_DIR ${CMAKE_SOURCE_DIR}/dist)
# set_target_properties(wolfssl
# PROPERTIES
# ARCHIVE_OUTPUT_DIRECTORY
# "${CMAKE_SOURCE_DIR}/dist/lib/${ANDROID_ABI}")