From 5c0b7b55771fe4b40d3f4b7a8069b1c71022490e Mon Sep 17 00:00:00 2001 From: SeekingMeaning Date: Mon, 13 Jan 2020 15:31:57 -0800 Subject: [PATCH] [tfhe] Fix Mac support (#9649) * [tfhe] Fix Mac support Co-authored-by: Nicole Mazzuca --- ports/tfhe/CONTROL | 4 ++-- ports/tfhe/mac-fix.patch | 13 +++++++++++++ ports/tfhe/portfile.cmake | 4 +++- scripts/ci.baseline.txt | 1 - 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 ports/tfhe/mac-fix.patch diff --git a/ports/tfhe/CONTROL b/ports/tfhe/CONTROL index 434694396e..514e5fbee9 100644 --- a/ports/tfhe/CONTROL +++ b/ports/tfhe/CONTROL @@ -1,4 +1,4 @@ Source: tfhe -Version: 1.0.1 +Version: 1.0.1-1 Homepage: https://github.com/tfhe/tfhe -Description: TFHE is open-source software distributed under the terms of the Apache 2.0 license. \ No newline at end of file +Description: TFHE is open-source software distributed under the terms of the Apache 2.0 license. diff --git a/ports/tfhe/mac-fix.patch b/ports/tfhe/mac-fix.patch new file mode 100644 index 0000000000..20161feb5b --- /dev/null +++ b/ports/tfhe/mac-fix.patch @@ -0,0 +1,13 @@ +diff --git a/src/libtfhe/fft_processors/nayuki/fft_processor_nayuki.cpp b/src/libtfhe/fft_processors/nayuki/fft_processor_nayuki.cpp +index 26de3f0..422c7f6 100644 +--- a/src/libtfhe/fft_processors/nayuki/fft_processor_nayuki.cpp ++++ b/src/libtfhe/fft_processors/nayuki/fft_processor_nayuki.cpp +@@ -12,7 +12,7 @@ FFT_Processor_nayuki::FFT_Processor_nayuki(const int N): _2N(2*N),N(N),Ns2(N/2) + tables_reverse = fft_init_reverse(_2N); + omegaxminus1 = (cplx*) malloc(sizeof(cplx) * _2N); + for (int x=0; x<_2N; x++) { +- omegaxminus1[x]=cos(x*M_PI/N)-1. + sin(x*M_PI/N) * 1i; ++ omegaxminus1[x]=cplx(cos(x*M_PI/N)-1., sin(x*M_PI/N)); // instead of cos(x*M_PI/N)-1. + sin(x*M_PI/N) * 1i + //exp(i.x.pi/N)-1 + } + } diff --git a/ports/tfhe/portfile.cmake b/ports/tfhe/portfile.cmake index 7a40d0ace9..aa98703ebc 100644 --- a/ports/tfhe/portfile.cmake +++ b/ports/tfhe/portfile.cmake @@ -1,4 +1,4 @@ -vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Linux" ON_TARGET "Windows" "osx") +vcpkg_fail_port_install(MESSAGE "${PORT} currently only supports Unix" ON_TARGET "Windows") vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH @@ -6,6 +6,8 @@ vcpkg_from_github( REF v1.0.1 SHA512 1d625eb00bf6a36fd86cfad8e1763d7030dd73d68f2422d1678f51352708e9275f0ce69c23fb0d9fec30fba00e1ca4a3df29fb4fc6dfe3b7f16e0d350aa7f170 HEAD_REF master + PATCHES + mac-fix.patch ) vcpkg_configure_cmake( diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index c0386b7016..28981aeddb 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1636,7 +1636,6 @@ tfhe:x64-windows-static=fail tfhe:x64-uwp=fail tfhe:arm64-windows=fail tfhe:arm-uwp=fail -tfhe:x64-osx=fail theia:arm64-windows = skip theia:arm-uwp = skip theia:x64-uwp = skip