This commit is contained in:
Ali 2020-01-06 22:19:25 +04:00
parent da291cf637
commit 81ae5e6a66
14 changed files with 105 additions and 33 deletions

2
.bazelrc Normal file
View File

@ -0,0 +1,2 @@
build --strategy=Genrule=local
build --apple_platform_type=ios

View File

@ -25,7 +25,7 @@ objc_module = rule(
attrs = {
"module_name": attr.string(mandatory = True),
"headers": attr.label_list(
allow_files = [".h", ".hpp"],
allow_files = [".h"],
),
},
)

View File

@ -18,6 +18,8 @@ WALLET_BUCK_OPTIONS=\
--config custom.appStoreId="${APPSTORE_ID}" \
--config custom.appSpecificUrlScheme="${APP_SPECIFIC_URL_SCHEME}"
BAZEL=$(shell which bazel)
wallet_deps: check_env
$(BUCK) query "deps(//Wallet:AppPackage)" --output-attribute buck.type \
${WALLET_BUCK_OPTIONS} ${BUCK_RELEASE_OPTIONS}
@ -48,3 +50,5 @@ wallet_package:
wallet_app: build_wallet wallet_package
tulsi_project:
${HOME}/Applications/Tulsi.app/Contents/MacOS/Tulsi -- --genconfig Wallet/Wallet.tulsiproj:Default --bazel "${BAZEL}"

View File

@ -46,6 +46,7 @@ swift_library(
"//submodules/ActivityIndicator:ActivityIndicator",
"//submodules/OverlayStatusController:OverlayStatusController",
"//submodules/openssl:openssl",
"//submodules/OpenSSLEncryptionProvider:OpenSSLEncryptionProvider",
],
)

View File

@ -9,7 +9,7 @@
],
"optionSet" : {
"BazelBuildOptionsDebug" : {
"p" : "$(inherited) -k --features=swift.use_global_module_cache --features=swift.swift.no_generated_header --spawn_strategy=standalone --strategy=SwiftCompile=standalone -s"
"p" : "$(inherited) --features=swift.use_global_module_cache --features=swift.swift.no_generated_header --spawn_strategy=standalone --strategy=SwiftCompile=standalone"
},
"BazelBuildOptionsRelease" : {
"p" : "$(inherited)"

@ -1 +1 @@
Subproject commit 9605c3da1c5bcdddc20d1704b52415a6f3a5f422
Subproject commit 501b4afb27745c4813a88ffa28acd901408014e4

@ -1 +1 @@
Subproject commit f6a95e8d0c2bd6fa9f0a6280ef3c4d34c9594513
Subproject commit 8dc8e519df3ab06c9842a9e6396edf592104c46b

@ -1 +1 @@
Subproject commit e7ce2d13936a1fe234317f228ef7194f27f8520a
Subproject commit 46d309a56e638830a9844e65d5531262a8afab99

View File

@ -0,0 +1,15 @@
objc_library(
name = "EncryptionProvider",
srcs = glob([
"Sources/**/*.m",
]),
hdrs = glob([
"Sources/**/*.h",
]),
includes = [
"Sources/Public",
],
deps = [
],
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,14 @@
objc_library(
name = "OpenSSLEncryptionProvider",
srcs = glob([
"Sources/**/*.m",
]),
hdrs = glob([
"Sources/**/*.h",
]),
deps = [
"//submodules/EncryptionProvider:EncryptionProvider",
"//submodules/openssl:openssl",
],
visibility = ["//visibility:public"],
)

View File

@ -1,3 +1,7 @@
load(
"//Config/objc_module_provider.bzl",
"objc_module",
)
openssl_headers = [
"aes.h",
@ -106,9 +110,11 @@ openssl_headers = [
"x509v3err.h",
]
openssl_header_paths = ["openssl/" + header for header in openssl_headers]
openssl_libs = [
"libcrypto.a",
]
archs = ["arm64"]#, "armv7", "x86_64"]
archs = ["arm64", "armv7", "x86_64"]
rules = [
genrule(
@ -119,36 +125,58 @@ rules = [
"patch-conf.patch",
"patch-include.patch",
],
cmd_bash = "cp $(SRCS) $(RULEDIR)/ && sh $(RULEDIR)/build-openssl.sh $(RULEDIR) $(RULEDIR) " + arch,
outs = openssl_headers,
cmd_bash =
"mkdir -p $(RULEDIR)/{} && cp $(SRCS) $(RULEDIR)/{}/ && sh $(RULEDIR)/{}/build-openssl.sh $(RULEDIR)/{} $(RULEDIR)/{} ".format(arch, arch, arch, arch, arch) + arch + "\n" +
("\n".join(["cp \"$(RULEDIR)/{}/build/arm64/include/openssl/{}\" \"$(location :{})\"\n".format(arch, x, x) for x in openssl_headers]) if arch == "arm64" else "") +
"\n".join([
"cp \"$(RULEDIR)/{}/build/{}/lib/{}\" \"$(location :{})\"\n".format(arch, arch, x, arch + "_" + x) for x in openssl_libs
]),
outs =
(openssl_headers if arch == "arm64" else []) +
[arch + "_" + x for x in openssl_libs],
visibility = [
"//visibility:public",
]
) for arch in archs
]
'''
genrule(
name = "openssl_build_merged",
srcs = [
"pack-openssl.sh",
],
bash = "sh $SRCDIR/pack-openssl.sh $OUT $(location :openssl_build_arm64)/out/include " + " ".join(["$(location :openssl_build_" + arch + ")/out/lib/libcrypto.a" for arch in archs]),
out = "openssl",
name = "openssl_fat_libraries",
srcs = [":" + arch + "_" + openssl_libs[0] for arch in archs],
cmd_bash = "xcrun lipo {} -output {} -create".format(" ".join(["$(location :" + arch + "_" + openssl_libs[0] + ")" for arch in archs]), "$(location " + openssl_libs[0] + ")"),
outs = openssl_libs,
visibility = [
"PUBLIC",
]
"//visibility:public",
],
)
'''
#openssl_header_targets = gen_header_targets(openssl_header_paths, "openssl_header_", "", "openssl_build_arm64", "out/include")
genrule(
name = "openssl_include",
srcs = [":" + x for x in openssl_headers],
outs = ["Public/openssl/" + x for x in openssl_headers],
cmd_bash = " && ".join(["cp $(location :{}) $(location Public/openssl/{})".format(x, x) for x in openssl_headers]),
visibility = [
"//visibility:public",
],
)
cc_library(
name = "openssl_lib",
srcs = [":" + x for x in openssl_libs],
)
objc_library(
name = "openssl",
module_name = "openssl",
enable_modules = True,
hdrs = [":" + x for x in openssl_headers],
deps = [],
hdrs = ["Public/openssl/" + x for x in openssl_headers],
includes = [
"Public/openssl",
],
deps = [
":openssl_lib",
],
,
visibility = [
"//visibility:public",
]

View File

@ -1,5 +1,8 @@
#!/bin/bash
set -x
set -e
OUT_DIR="$1"
SRC_DIR="$2"
ARCH="$3"
@ -26,7 +29,9 @@ fi
mkdir -p "$OUT_DIR"
TMP_DIR="$OUT_DIR/build"
TMP_DIR_NAME="build"
TMP_DIR="$OUT_DIR/$TMP_DIR_NAME"
ABS_TMP_DIR="$(pwd)/$TMP_DIR"
rm -rf "$TMP_DIR"
mkdir -p "$TMP_DIR"
@ -61,6 +66,7 @@ function build_for ()
export CROSS_SDK="${!CROSS_SDK_ENV}"
MINIMAL_FLAGS=(\
"no-shared" \
"no-afalgeng" \
"no-aria" \
"no-asan" \
@ -151,17 +157,17 @@ function build_for ()
)
DEFAULT_FLAGS=(\
"no-shared" \
"no-asm" \
"no-ssl3" \
"no-comp" \
"no-hw" \
"no-engine" \
"no-async" \
"no-tests" \
)
ADDITIONAL_FLAGS=$DEFAULT_FLAGS
./Configure $PLATFORM "-arch $ARCH" ${ADDITIONAL_FLAGS[@]} --prefix="$(pwd)/${TMP_DIR}/${ARCH}" || exit 1
./Configure $PLATFORM "-arch $ARCH" ${DEFAULT_FLAGS[@]} --prefix="${ABS_TMP_DIR}/${ARCH}" || exit 1
make && make install_sw || exit 2
unset CROSS_TOP
@ -184,7 +190,9 @@ else
fi
cp -r "${TMP_DIR}/$ARCH/include" "${TMP_DIR}/"
if [ "$ARCH" == "arm64" ]; then
patch -p3 "${TMP_DIR}/include/openssl/opensslconf.h" < "$SRC_DIR/patch-include.patch" || exit 1
fi
DFT_DIST_DIR="$OUT_DIR/out"
rm -rf "$DFT_DIST_DIR"

View File

@ -1,19 +1,19 @@
--- armv7s/include/openssl/opensslconf.h 2017-01-08 02:25:43.000000000 -0800
+++ arm64/include/openssl/opensslconf.h 2017-01-08 03:44:44.000000000 -0800
@@ -158,11 +158,21 @@
--- opensslconf.h 2020-01-06 02:41:46.000000000 +0400
+++ opensslconf_updated.h 2020-01-06 02:51:12.000000000 +0400
@@ -205,11 +205,21 @@
* The following are cipher-specific, but are part of the public API.
*/
#if !defined(OPENSSL_SYS_UEFI)
-# define BN_LLONG
-# undef BN_LLONG
+# ifdef __LP64__
+# undef BN_LLONG
+# else
+# define BN_LLONG
+# endif
/* Only one for the following should be defined */
-# undef SIXTY_FOUR_BIT_LONG
-# define SIXTY_FOUR_BIT_LONG
-# undef SIXTY_FOUR_BIT
-# define THIRTY_TWO_BIT
-# undef THIRTY_TWO_BIT
+# ifdef __LP64__
+# define SIXTY_FOUR_BIT_LONG
+# undef SIXTY_FOUR_BIT