Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ jobs:
- os: linux
arch: x64
runner: ubuntu-latest
- os: android
arch: x86_64
runner: ubuntu-latest
- os: android
arch: armeabi-v7a
runner: ubuntu-latest
- os: android
arch: arm64-v8a
runner: ubuntu-latest
- os: macos
arch: arm64
runner: macos-latest
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ dist: dist-cmake

.PHONY: dist-ci
dist-ci: OUTPUT_FILE ?= libfhel-$(OS)-$(ARCH).tar.gz
dist-ci: OUTPUT_PATH ?= $(FHE_RELEASE_DIR)/$(OUTPUT_FILE)
dist-ci: TMP_DIR ?= /tmp/fhel
dist-ci: OUTPUT_PATH ?= $(TMP_DIR)/$(OUTPUT_FILE)
dist-ci: dist-cmake
@ls -d $(FHE_RELEASE_DIR)/libfhel* | grep -o '[^/]*$$' | tar -czvf $(OUTPUT_PATH) -C $(FHE_RELEASE_DIR) --files-from=-
@rm -rf $(TMP_DIR); mkdir -p $(TMP_DIR)
@cp $(FHE_RELEASE_DIR)/libfhel.* $(TMP_DIR)
@cd $(TMP_DIR); tar -czvf $(OUTPUT_PATH) *
@echo "tar_gz_name=$(OUTPUT_FILE)" >> $(GITHUB_OUTPUT)
@echo "tar_gz_path=$(OUTPUT_PATH)" >> $(GITHUB_OUTPUT)

Expand Down
1 change: 0 additions & 1 deletion dart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ dart run fhel:setup <platform> --arch <architecture>

| Platform | Architecture |
|----------|--------------|
| Android | `x86_64` (default) `arm64-v8a` `armeabi-v7a` |
| Linux | `x64` (default) |
| MacOS | `arm64` (default) |

Expand Down
109 changes: 54 additions & 55 deletions dart/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group 'com.example.fhel'
group 'com.android.fhel'
version '1.0'

buildscript {
Expand Down Expand Up @@ -27,72 +27,71 @@ apply plugin: 'com.android.library'

android {
if (project.android.hasProperty("namespace")) {
namespace 'com.example.fhel'
namespace 'com.android.fhel'
}

// Bumping the plugin compileSdkVersion requires all clients of this plugin
// to bump the version in their app.
compileSdkVersion 33

// Bumping the plugin ndkVersion requires all clients of this plugin to bump
// the version in their app and to download a newer version of the NDK.
// ndkVersion "26.1.10909125"
ndkVersion android.ndkVersion

defaultConfig {
minSdkVersion 18
targetSdkVersion 32
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

// Use environment variables or default values
def LIB_NAME = System.getenv('LIB_NAME') ?: 'fhel'
def LIB_URL = System.getenv('LIB_URL') ?: 'https://github.com/jeffmur/fhel/releases/download'
def SRC_DIR = project.buildscript.sourceFile.parentFile.parentFile
def ANDROID_DIR = "${SRC_DIR}/android"
def BIN_VER = new File("${SRC_DIR}/binary.version").text.trim()
def SUPPORT_ARCH = ['x86_64', 'arm64-v8a', 'armeabi-v7a']

def FHEL_DISABLE_AUTO_BUILD = System.getenv('FHEL_DISABLE_AUTO_BUILD') ?: null
if (FHEL_DISABLE_AUTO_BUILD != null) {
println "Found FHEL_DISABLE_AUTO_BUILD, skip auto build"
return
}

task downloadLibs(type: Download) {
println "Downloading ${LIB_NAME} binaries..."
def SRC_URLS = SUPPORT_ARCH.collect { arch ->
"${LIB_URL}/v${BIN_VER}/lib${LIB_NAME}-android-${arch}.tar.gz"
}
src(SRC_URLS)
dest SRC_DIR
overwrite false
}

SUPPORT_ARCH.each { arch ->
def extractTaskName = "${LIB_NAME}_extract_libs_${arch}"
task(extractTaskName, type: Copy) {
from tarTree(resources.gzip("${SRC_DIR}/lib${LIB_NAME}-android-${arch}.tar.gz"))
into "${ANDROID_DIR}/src/main/jniLibs/${arch}"
externalNativeBuild {
cmake {
cppFlags ""
arguments "-DSEAL_BUILD_DEPS=OFF", "-DSEAL_USE_MSGSL=OFF", "-DSEAL_USE_ZLIB=OFF", "-DSEAL_USE_ZSTD=OFF",
// "-DSEAL_USE_INTRIN=1",
// "-DSEAL_BUILD_SEAL_C=1",
// "-DSEAL_USE_ZLIB=OFF",
// "-DBUILD_SHARED_LIBS=ON",
// "-DSEAL_ARM64_EXITCODE=0",
// "-DSEAL_ARM64_EXITCODE__TRYRUN_OUTPUT=''",
"-DSEAL___BUILTIN_CLZLL_FOUND_EXITCODE=0",
"-DSEAL___BUILTIN_CLZLL_FOUND_EXITCODE__TRYRUN_OUTPUT=''",
// For x86_64 Android devices
"-DSEAL__ADDCARRY_U64_FOUND_EXITCODE=0",
"-DSEAL__ADDCARRY_U64_FOUND_EXITCODE__TRYRUN_OUTPUT=''",
"-DSEAL__SUBBORROW_U64_FOUND_EXITCODE=0",
"-DSEAL__SUBBORROW_U64_FOUND_EXITCODE__TRYRUN_OUTPUT=''"
}
}
ndk {
/**
* Specifies the ABI (Application Binary Interface) filters for native libraries.
* The supported options for `abiFilters` are: [arm64-v8a, armeabi-v7a, x86, x86_64]
* Multiple filters can be specified by separating them with commas.
*/
abiFilters 'arm64-v8a'
abiFilters 'armeabi-v7a'
abiFilters 'x86_64'
// abiFilters 'x86' /* libfhel.so won't work on 32-bit Intel devices */
}
}
}

task extractLibs(dependsOn: downloadLibs) {
println "Extracting ${LIB_NAME} binaries..."
SUPPORT_ARCH.each { arch ->
finalizedBy "${LIB_NAME}_extract_libs_${arch}"
// Invoke the shared CMake build with the Android Gradle Plugin.
externalNativeBuild {
cmake {
path file("${projectDir}/../../CMakeLists.txt")

// The default CMake version for the Android Gradle Plugin is 3.10.2.
// https://developer.android.com/studio/projects/install-ndk#vanilla_cmake
//
// The Flutter tooling requires that developers have CMake 3.10 or later
// installed. You should not increase this version, as doing so will cause
// the plugin to fail to compile for some customers of the plugin.
// version "3.22.1"
}
}
}

// Ensure mergeReleaseJniLibFolders depends on extractLibs
tasks.whenTaskAdded { task ->
if (task.name == 'mergeReleaseJniLibFolders') {
task.dependsOn extractLibs
SUPPORT_ARCH.each { arch ->
def extractTaskName = "${LIB_NAME}_extract_libs_${arch}"
task.dependsOn tasks.findByName(extractTaskName)
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

println "FHEL_DISABLE_AUTO_BUILD is not set, running ${LIB_NAME}:setup"
preBuild.dependsOn extractLibs
2 changes: 1 addition & 1 deletion dart/binary.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.8
0.0.10
2 changes: 1 addition & 1 deletion dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: fhel
description: |-
Natively supports Fully Homomorphic Encryption operations on sensitive data without revealing it.
Supports Key Derivation, Encryption, Decryption, and Mathematical operations.
version: 0.0.8
version: 0.0.10
repository: https://github.com/jeffmur/fhel

environment:
Expand Down
Loading