Stopped support for Mac OS as I lack the resources to deal with the various problems that come up during release engineering and/or testing. Qt + wownero + Mac OS is not a happy combination.

master
dsc 8 months ago
parent a8861c62ea
commit e93488af9b

@ -30,11 +30,6 @@ set(BUILD_GUI_DEPS ON)
set(BUILD_64 ON CACHE BOOL "Build 64-bit binaries")
set(INSTALL_VENDORED_LIBUNBOUND ${STATIC})
set(USE_SINGLE_BUILDDIR ON)
if(UNIX AND NOT APPLE)
set(LINUX_ACTIVATION ON)
else()
set(LINUX_ACTIVATION OFF)
endif()
# Are we in debug mode?
set(_CMAKE_BUILD_TYPE "")
@ -101,9 +96,6 @@ include_directories(${EASYLOGGING_INCLUDE})
link_directories(${EASYLOGGING_LIBRARY_DIRS})
# OpenSSL
if(APPLE AND NOT OPENSSL_ROOT_DIR)
execute_process(COMMAND brew --prefix openssl OUTPUT_VARIABLE OPENSSL_ROOT_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
find_package(OpenSSL REQUIRED)
message(STATUS "OpenSSL: Version ${OPENSSL_VERSION}")
message(STATUS "OpenSSL: include dir at ${OPENSSL_INCLUDE_DIR}")
@ -129,20 +121,15 @@ find_package(wownero-seed CONFIG REQUIRED)
if(DEBUG)
set(Boost_DEBUG ON)
endif()
if(APPLE AND NOT BOOST_ROOT)
execute_process(COMMAND brew --prefix boost OUTPUT_VARIABLE BOOST_ROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if(MINGW)
set(Boost_THREADAPI win32)
endif()
set(_BOOST_COMPONENTS system filesystem thread date_time chrono regex serialization program_options locale)
if(APPLE)
# atomic is only present/needed on Apple
list(APPEND _BOOST_COMPONENTS atomic)
endif()
find_package(Boost 1.58 REQUIRED COMPONENTS ${_BOOST_COMPONENTS})
if(UNIX AND NOT APPLE AND NOT ANDROID)
if(UNIX AND NOT ANDROID)
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
# https://github.com/monero-project/monero-gui/issues/3142#issuecomment-705940446
set(CMAKE_SKIP_RPATH ON)
@ -184,38 +171,17 @@ if(TOR_BIN)
# on the buildbot(s) Tor is baked into the image
# - linux: See `Dockerfile`
# - windows: See `Dockerfile.windows`
#
# ## MacOS:
# we assume the following files are already present in src/assets/exec:
# - tor
# - libevent-2.1.7.dylib
# so copy them beforehand and set TOR_BIN to something random.
# MacOS, check if required files are present
if(APPLE)
foreach(fn libevent-2.1.7.dylib tor)
set(tor_path "${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/${fn}")
if (EXISTS "${tor_path}")
message(STATUS "Tor found: ${tor_path}")
else()
message(FATAL_ERROR "TOR_BIN is set, so the following file needs to be present: '${tor_path}'")
endif()
set(TOR_BIN "${tor_path}")
endforeach()
else()
if(NOT EXISTS "${TOR_BIN}")
message(FATAL_ERROR "TOR_BIN is set, but file does not exist: '${TOR_BIN}'")
endif()
# copy the Tor executable over
set(TOR_COPY_CMD "cp ${TOR_BIN} ${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/tor")
message(STATUS "Tor cmd: ${TOR_COPY_CMD}")
if(NOT EXISTS "${TOR_BIN}")
message(FATAL_ERROR "TOR_BIN is set, but file does not exist: '${TOR_BIN}'")
endif()
execute_process(COMMAND bash -c "${TOR_COPY_CMD}" RESULT_VARIABLE ret)
if(ret EQUAL "1")
message(FATAL_ERROR "Tor copy failure: ${TOR_COPY_CMD}")
endif()
# copy the Tor executable over
set(TOR_COPY_CMD "cp ${TOR_BIN} ${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/tor")
message(STATUS "Tor cmd: ${TOR_COPY_CMD}")
execute_process(COMMAND bash -c "${TOR_COPY_CMD}" RESULT_VARIABLE ret)
if(ret EQUAL "1")
message(FATAL_ERROR "Tor copy failure: ${TOR_COPY_CMD}")
endif()
# get Tor version while we're at it
@ -260,8 +226,6 @@ if(MINGW)
else()
set(ICU_LIBRARIES icuio icuin icuuc icudt icutu iconv)
endif()
elseif(APPLE)
set(EXTRA_LIBRARIES "-framework AppKit")
elseif(OPENBSD)
set(EXTRA_LIBRARIES "")
elseif(FREEBSD)
@ -278,14 +242,6 @@ endif()
list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS})
if(APPLE)
include_directories(SYSTEM /usr/include/malloc)
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -std=c++11 -DGTEST_HAS_TR1_TUPLE=0")
endif()
# warnings
# @TODO: enable these 2 for migration to Qt 6
#add_c_flag_if_supported(-Werror C_SECURITY_FLAGS)
@ -320,12 +276,7 @@ if (NOT (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VER
endif()
# linker
if (APPLE)
add_linker_flag_if_supported(-Wl,-bind_at_load LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,-dead_strip LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,-dead_strip_dylibs LD_SECURITY_FLAGS)
endif()
if (NOT APPLE AND NOT (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU"))
if (NOT (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU"))
# Windows binaries die on startup with PIE when compiled with GCC
add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS)
endif()
@ -376,10 +327,6 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${C_SECURITY_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${CXX_SECURITY_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${STATIC_FLAGS}")
if(APPLE)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/contrib/KDMacTouchBar")
endif()
if(OPENVR)
# Add contrib/openvr as library
add_definitions(-DVR_API_PUBLIC)

@ -1,13 +0,0 @@
# this image is used internally for the buildbot
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt clean && apt update
RUN apt install -y git build-essential wget curl ngrep unzip file ssh zip
RUN cat /dev/zero | ssh-keygen -q -N ""
RUN cat ~/.ssh/id_rsa.pub
RUN printf "Host *\n StrictHostKeyChecking no" > ~/.ssh/config

@ -73,29 +73,3 @@ windows-mxe-debug: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Debug
windows-mxe-debug:
cmake -Bbuild $(CMAKEFLAGS)
$(MAKE) -Cbuild
mac: CMAKEFLAGS += -DSTATIC=Off
mac: CMAKEFLAGS += -DTOR_BIN=$(or ${TOR_BIN},OFF)
mac: CMAKEFLAGS += -DBUILD_TAG="mac-x64"
mac: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Release
mac:
cmake -Bbuild $(CMAKEFLAGS)
$(MAKE) -Cbuild
$(MAKE) -Cbuild deploy
# used for release, covers both intel and M1
# 1) assumes a *static* BOOST has been compiled at BOOST_ROOT, see docs/BUILDING.md
# 2) assumes a *static* Tor and libevent at src/assets/exec, see docs/BUILDING.md
mac-release: CMAKEFLAGS += -DARCH=default
mac-release: CMAKEFLAGS += -DCMAKE_OSX_ARCHITECTURES="x86_64"
mac-release: CMAKEFLAGS += -DSTATIC=Off
mac-release: CMAKEFLAGS += -DTOR_BIN="foo"
mac-release: CMAKEFLAGS += -DBUILD_TAG="mac-x64"
mac-release: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Release
mac-release: CMAKEFLAGS += -DBoost_USE_STATIC_RUNTIME=ON
mac-release: CMAKEFLAGS += -DBoost_USE_STATIC_LIBS=ON
mac-release: CMAKEFLAGS += -DBOOST_ROOT=/Users/${USER}/build/boost
mac-release:
cmake -Bbuild $(CMAKEFLAGS)
$(MAKE) -Cbuild
$(MAKE) -Cbuild deploy

@ -2,23 +2,4 @@ if(APPLE OR (WIN32 AND NOT STATIC))
add_custom_target(deploy)
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
if(APPLE AND NOT IOS)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
add_custom_command(TARGET deploy
POST_BUILD
COMMAND "${MACDEPLOYQT_EXECUTABLE}" "$<TARGET_FILE_DIR:wowlet>/../.." -always-overwrite -qmldir="${CMAKE_SOURCE_DIR}"
COMMENT "Running macdeployqt..."
)
# workaround for a Qt bug that requires manually adding libqsvg.dylib to bundle
find_file(_qt_svg_dylib "libqsvg.dylib" PATHS "${CMAKE_PREFIX_PATH}/plugins/imageformats" NO_DEFAULT_PATH)
if(_qt_svg_dylib)
add_custom_command(TARGET deploy
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${_qt_svg_dylib} $<TARGET_FILE_DIR:wowlet>/../PlugIns/imageformats/
COMMENT "Copying libqsvg.dylib"
)
endif()
endif()
endif()

@ -69,123 +69,3 @@ docker run --rm -it -v $PWD:/wowlet -w /wowlet wowlet:win sh -c 'make windows ro
If you're re-running a build make sure to `rm -rf build/` first.
The resulting binary can be found in `build/x86_64-w64-mingw32/release/bin/wowlet.exe`.
# Mac OS
## method 1 (easiest)
### 1. Get homebrew
Get [brew](https://brew.sh) to install the required dependencies.
```bash
HOMEBREW_OPTFLAGS="-march=core2" HOMEBREW_OPTIMIZATION_LEVEL="O0" \
brew install boost zmq openssl libpgm miniupnpc libsodium expat libunwind-headers protobuf libgcrypt qrencode ccache cmake pkgconfig git
```
### 2. Compile WOWlet
```bash
CMAKE_PREFIX_PATH=/usr/local/opt/qt5/ make -j4 mac
```
The resulting Mac OS application can be found `build/bin/wowlet.app` and will **not** have Tor embedded.
Since WOWlet needs Tor, install it, start it, and start at Mac OS boot:
```bash
brew install tor
brew services start tor
```
## method 2 (advanced, intel/m1 release binaries)
This assumes you have homebrew installed with the packages defined in the previous step ("Get homebrew").
### 1. Get Qt
Install Qt `5.15.2` from [the open-source Qt installer](https://www.qt.io/download).
### 2. Get static Boost
We'll install boost under `/Users/$USER/build/boost/`
```bash
mkdir -p "/Users/$USER/build/boost"
wget https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.gz && \
echo "9995e192e68528793755692917f9eb6422f3052a53c5e13ba278a228af6c7acf boost_1_73_0.tar.gz" | sha256sum -c && \
tar -xzf boost_1_73_0.tar.gz && \
rm boost_1_73_0.tar.gz && \
cd boost_1_73_0
./bootstrap.sh --without-icu
./b2 --disable-icu --with-atomic --with-system --with-filesystem --with-thread \
--with-date_time --with-chrono --with-regex --with-serialization \
--with-program_options --with-locale variant=release link=static \
runtime-link=static cxxflags='-std=c++11' install -a --prefix="/Users/$USER/build/boost/"
```
### 3. Get static Tor
1. Download the official Tor Browser `.dmg`
2. Steal `tor.real` and `libevent-2.1.7.dylib` from the `.dmg`
3. Place them both in `src/assets/exec/`
- `src/assets/exec/tor`
- `src/assets/exec/libevent-2.1.7.dylib`
### 4. Get static Tor
```bash
CMAKE_PREFIX_PATH=/Users/dsc/Qt5.15.2/5.15.2/clang_64 TOR_BIN="foo" make -j10 mac-release
```
Resulting *static* Mac OS package: `build/bin/wowlet.app`
## method 3 (from source, WIP, does not work yet)
Download Qt `https://download.qt.io/archive/qt/5.15/5.15.3/single/`, unpack it somewhere.
Patch Qt 5.15.3 source.
- Context: [#1](https://github.com/microsoft/vcpkg/pull/21056) [#2](https://code.qt.io/cgit/qt/qtbase.git/diff/?id=dece6f5840463ae2ddf927d65eb1b3680e34a547)
```
diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
index 5d4b6d6a71..cc7193d8b7 100644
--- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
+++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
@@ -43,6 +43,7 @@
#include <qpa/qplatformgraphicsbuffer.h>
#include <private/qcore_mac_p.h>
+#include <CoreGraphics/CGColorSpace.h>
#include <IOSurface/IOSurface.h>
QT_BEGIN_NAMESPACE
```
Build Qt:
```bash
./configure -prefix $PWD/qtbase -release -opensource -confirm-license -ccache \
-no-dbus -no-sql-sqlite -no-use-gold-linker -no-kms \
-qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \
-skip qt3d -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d \
-skip qtdoc -skip qtquickcontrols -skip qtquickcontrols2 -skip qtspeech -skip qtgamepad \
-skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing -optimize-size \
-skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttools \
-skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebview \
-skip qtwinextras -skip qtx11extras -skip gamepad -skip serialbus -skip location -skip webengine -skip qtdeclarative \
-no-feature-cups -no-feature-ftp -no-feature-pdf -no-feature-animation -nomake examples -nomake tests -nomake tools
./configure -prefix $PWD/qtbase -release -nomake examples -nomake tests -skip qtwebchannel -skip qtpurchasing -skip webengine -skip qtwebview
make -j 4
```
Problem: QtQuick does not seem to be compiled, `Qt5QuickConfig.cmake` missing.
Build:
```bash
CMAKE_PREFIX_PATH=/Users/$USER/Downloads/qt-everywhere-src-5.15.3/qtbase/ make -j4 mac
```

@ -33,13 +33,6 @@ libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev
libprotobuf-dev protobuf-compiler libgcrypt20-dev libpng-dev
```
## Mac OS
```bash
brew install boost zmq openssl libpgm miniupnpc libsodium expat libunwind-headers \
protobuf libgcrypt qrencode ccache cmake pkgconfig git
```
## CMake
After installing Qt you might have a folder called `/home/$USER/Qt/`. You need to pass this to CMake
@ -87,13 +80,6 @@ apt install -y tor
sudo service tor start
```
#### Mac OS
```bash
brew install tor
brew services start tor
```
To skip the wizards and open a wallet directly use `--wallet-file`:
```bash

@ -70,11 +70,7 @@ endif()
qt5_add_resources(RESOURCES assets.qrc)
if(TOR_BIN)
if(APPLE)
set(ASSETS_TOR "assets_tor_macos.qrc")
else()
set(ASSETS_TOR "assets_tor.qrc")
endif()
set(ASSETS_TOR "assets_tor.qrc")
endif()
set(EXECUTABLE_FLAG)
@ -222,12 +218,10 @@ target_compile_definitions(wowlet
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
if(UNIX AND NOT APPLE)
if(UNIX)
# https://stackoverflow.com/questions/57766620/cmake-add-library-doesnt-initialize-static-global-variable
# so that contrib/monero-seed/src/gf_elem.cpp properly initializes. A better solution is welcome.
target_link_libraries(wowlet PUBLIC -Wl,--whole-archive wownero-seed::wownero-seed -Wl,--no-whole-archive)
else()
target_link_libraries(wowlet PUBLIC wownero-seed::wownero-seed)
endif()
if(ANDROID)
@ -332,26 +326,16 @@ if(OPENVR)
endif()
endif()
if(APPLE)
target_link_libraries(wowlet PUBLIC
KDMacTouchBar
)
target_include_directories(wowlet
PUBLIC ../contrib/KDMacTouchBar)
endif()
if(NOT APPLE)
target_link_libraries(wowlet PUBLIC
Qt5::QSvgIconPlugin
Qt5::QSvgPlugin
)
endif()
target_link_libraries(wowlet PUBLIC
Qt5::QSvgIconPlugin
Qt5::QSvgPlugin
)
if(STATIC)
target_link_libraries(wowlet PUBLIC
Qt5::QSvgIconPlugin
Qt5::QSvgPlugin)
if(UNIX AND NOT APPLE)
if(UNIX)
target_link_libraries(wowlet PUBLIC
Qt5::QXcbIntegrationPlugin)
endif()
@ -361,10 +345,6 @@ if(X11_FOUND)
target_link_libraries(wowlet PUBLIC ${X11_LIBRARIES})
endif()
if(APPLE)
include(Deploy)
endif()
install(TARGETS wowlet
DESTINATION ${CMAKE_INSTALL_PREFIX}
)

Loading…
Cancel
Save