openssl build scripts -- pending bridge to new C++ impls, incl bulletproofs

pull/41/head
Paul Shapiro 6 years ago
parent 5ebcc30499
commit e58ff678d3

1
.gitignore vendored

@ -13,3 +13,4 @@ contrib/boost-sdk/b2
contrib/boost-sdk/project-config.jam
contrib/boost-sdk/bootstrap.log
contrib/boost-sdk/bin.v2

@ -7,6 +7,7 @@ project(MyMoneroCoreCpp)
include_directories("build/boost/include") # must exist already - run bin/build-boost-emscripten.sh
include_directories("build/openssl/include") # must exist already - run bin/build-openssl-emscripten.sh
include_directories("src")
include_directories("src/submodules/monero-core-custom/crypto")
include_directories("src/submodules/monero-core-custom/epee/include")
@ -23,6 +24,7 @@ set(
)
set(boost_DIR ${CMAKE_SOURCE_DIR}/build/boost)
set(openssl_DIR ${CMAKE_SOURCE_DIR}/build/openssl)
add_library(boost_atomic STATIC IMPORTED)
set_target_properties(
@ -101,9 +103,23 @@ set_target_properties(
boost_wserialization PROPERTIES IMPORTED_LOCATION
${boost_DIR}/lib/libboost_wserialization.a
)
#
#
#
add_library(crypto STATIC IMPORTED)
set_target_properties(
crypto PROPERTIES IMPORTED_LOCATION
${openssl_DIR}/lib/libcrypto.a
)
#
add_library(ssl STATIC IMPORTED)
set_target_properties(
ssl PROPERTIES IMPORTED_LOCATION
${openssl_DIR}/lib/libssl.a
)
#
#
#
set(
EMCC_LINKER_FLAGS
#unsure if the -I...boost..include is necessary here due to include above
@ -143,5 +159,9 @@ target_link_libraries(
boost_thread
boost_timer
boost_wserialization
#
crypto
ssl
#
${log-lib}
)

@ -64,9 +64,19 @@ Download a copy of the contents of the Boost source into `./contrib/boost-sdk/`.
* Execute `bin/build-boost-emscripten.sh`
### OpenSSL for Emscripten
*Depends upon:* Emscripten SDK
Download a copy of the contents of the OpenSSL source into `./contrib/openssl/`.
* Execute `bin/build-openssl-emscripten.sh`
### Emscripten Module
*Depends upon:* Emscripten SDK, Boost for Emscripten
*Depends upon:* Emscripten SDK, Boost for Emscripten, OpenSSL for Emscripten
* Execute `bin/build-emcpp.sh`

@ -0,0 +1,62 @@
#!/bin/sh
PLATFORM="emscripten"
SRC_DIR="contrib/openssl"
INSTALL_DIR="build/openssl"
SRC_PATH="$(pwd)/$SRC_DIR"
INSTALL_PATH="$(pwd)/$INSTALL_DIR"
if [ ! -d "$SRC_PATH" ]; then
echo "SOURCE NOT FOUND!"
exit 1
fi
# ---
cd "$SRC_PATH"
#linux-generic32 \
emconfigure ./Configure \
linux-generic32 \
-no-asm no-ssl2 no-ssl3 no-comp no-engine no-deprecated shared no-dso \
--prefix="$INSTALL_PATH" \
--openssldir="$INSTALL_PATH" \
2>&1
if [ $? != 0 ]; then
echo "ERROR: OpenSSL Configure FAILED!"
exit 1
fi
# now must manually tweak the Makefile as I'm not sure how to do this via ./Configure
to_cross_compile_line='CROSS_COMPILE='
sed -iMakefile.bak 's/^CROSS_COMPILE=\/.*$/'"$to_cross_compile_line"'/' Makefile #must match whole line with start char or we might do it repeatedly .. though this particular one would be idempotent anyway
# ^-- not 'g' b/c we only expect one
to_defined_atomics_line='\&\& !defined(__STDC_NO_ATOMICS__) \&\& !defined(__EMSCRIPTEN__)'
sed -irefcount_h.bak 's/\&\&\ !defined(__STDC_NO_ATOMICS__)$/'"$to_defined_atomics_line"'/' include/internal/refcount.h #the pattern is relying here on the fact the "ATOMICS__)" comes at the end of the line
# ^-- not 'g' b/c we only expect one
# ---
# Clean
rm -rf "$INSTALL_PATH"
mkdir "$INSTALL_PATH"
emmake make \
2>&1
if [ $? != 0 ]; then
echo "ERROR: emmake OpenSSL FAILED!"
exit 1
fi
# now we must move build products by manually calling make install
make install \
2>&1
Loading…
Cancel
Save