mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 19:49:28 +00:00
Embed Tor executable for static Mac OS builds
This commit is contained in:
parent
18543ad33b
commit
1337c1708d
5 changed files with 36 additions and 3 deletions
|
@ -172,12 +172,23 @@ endif()
|
|||
# Tor/torsocks
|
||||
set(TOR_TAG "tor-0.4.3.5")
|
||||
set(TOR_DIR "${CMAKE_SOURCE_DIR}/contrib/tor")
|
||||
|
||||
if(BUILD_TOR AND APPLE)
|
||||
execute_process(COMMAND bash -c "touch ${CMAKE_SOURCE_DIR}/src/tor/libevent-2.1.7.dylib")
|
||||
ENDIF()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(TOR_LIB "libtorsocks.so")
|
||||
elseif(APPLE)
|
||||
set(TOR_LIB "libtorsocks.dylib")
|
||||
endif()
|
||||
if("$ENV{DRONE}" STREQUAL "true" AND STATIC AND BUILD_TOR)
|
||||
|
||||
if("$ENV{DRONE}" STREQUAL "true" AND APPLE)
|
||||
message(STATUS "We are inside a static compile with Drone CI")
|
||||
# @TODO: taken from Tor Browser official release for now
|
||||
execute_process(COMMAND bash -c "cp ~/tor/libevent-2.1.7.dylib ${CMAKE_SOURCE_DIR}/src/tor/libevent-2.1.7.dylib")
|
||||
execute_process(COMMAND bash -c "cp ~/tor/tor ${CMAKE_SOURCE_DIR}/src/tor/tor")
|
||||
elseif("$ENV{DRONE}" STREQUAL "true" AND BUILD_TOR)
|
||||
message(STATUS "We are inside a static compile with Drone CI")
|
||||
if(MINGW)
|
||||
execute_process(COMMAND bash -c "cp /mxe/usr/x86_64-w64-mingw32.static/bin/tor.exe ${CMAKE_SOURCE_DIR}/src/tor/tor.exe")
|
||||
|
|
|
@ -42,7 +42,7 @@ file(GLOB SOURCE_FILES
|
|||
"dialog/*.cpp"
|
||||
)
|
||||
|
||||
if(APPLE AND BUILD_TOR)
|
||||
if((APPLE AND BUILD_TOR) OR (APPLE AND "$ENV{DRONE}" STREQUAL "true"))
|
||||
set(ASSETS_OS "assets_macos_tor.qrc")
|
||||
elseif(UNIX AND NOT APPLE AND BUILD_TOR)
|
||||
set(ASSETS_OS "assets_linux_tor.qrc")
|
||||
|
@ -138,6 +138,10 @@ if(STATIC)
|
|||
target_compile_definitions(feather PRIVATE STATIC=1)
|
||||
endif()
|
||||
|
||||
if("$ENV{DRONE}" STREQUAL "true")
|
||||
target_compile_definitions(feather PRIVATE DRONE=1)
|
||||
endif()
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
target_compile_definitions(feather PRIVATE QT_NO_DEBUG=1)
|
||||
endif()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/">
|
||||
<file>tor/tor</file>
|
||||
<file>tor/libevent-2.1.7.dylib</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -174,6 +174,22 @@ void Tor::handleProcessError(QProcess::ProcessError error) {
|
|||
|
||||
bool Tor::unpackBins() {
|
||||
QString torFile;
|
||||
|
||||
// @TODO: refactor for Mac OS - should compile Tor statically.
|
||||
#if defined(Q_OS_MAC) && defined(DRONE)
|
||||
// Tor on Mac requires libevent.dylib, borrowed the executable from
|
||||
// the official Tor Browser release for now.
|
||||
QString libEvent = ":/tor/libevent-2.1.7.dylib";
|
||||
if (Utils::fileExists(libEvent)) {
|
||||
QFile e(libEvent);
|
||||
QFileInfo eventInfo(e);
|
||||
auto libEventPath = QDir(this->torDir).filePath(eventInfo.fileName());
|
||||
qDebug() << libEventPath;
|
||||
e.copy(libEventPath);
|
||||
e.close();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_MAC) || defined(Q_OS_LINUX)
|
||||
torFile = ":/tor/tor";
|
||||
#elif defined(Q_OS_WIN)
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
HASH="$1"
|
||||
echo "[+] hash: $HASH"
|
||||
|
||||
export DRONE=true
|
||||
echo "[+] Building"
|
||||
|
||||
rm ~/feather.zip 2>&1 >/dev/null
|
||||
cd ~/feather
|
||||
git fetch
|
||||
git fetch --all
|
||||
git reset --hard "$HASH"
|
||||
git submodule update --init --depth 50 contrib/tor
|
||||
git submodule update --init --depth 50 contrib/torsocks
|
||||
|
|
Loading…
Reference in a new issue