From f4d27d56d4c5abe6008ea385c75a084f27f850b7 Mon Sep 17 00:00:00 2001 From: twiddle Date: Sat, 24 Aug 2024 09:37:30 -0400 Subject: [PATCH] v1.0 Refactor libarchive linking and add to guix manifest Fix toolchain Patch 2 Patch 3 Patch 4 Patch 5 Patch 6 patch 7 Patch 8 Patch 9 Patch 11 --- CMakeLists.txt | 4 ++-- contrib/depends/packages/libarchive.mk | 25 +++++++++++++++++++++++ contrib/depends/packages/packages.mk | 8 ++++---- contrib/depends/toolchain.cmake.in | 3 +++ contrib/guix/manifest.scm | 3 +++ src/CMakeLists.txt | 4 ++-- src/plugins/atomic/AtomicConfigDialog.cpp | 17 +++++++++------ src/plugins/atomic/AtomicSwap.cpp | 2 +- src/plugins/atomic/AtomicWidget.cpp | 1 - 9 files changed, 51 insertions(+), 16 deletions(-) create mode 100644 contrib/depends/packages/libarchive.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index 297ead2..9ba6b1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,14 +16,14 @@ set(COPYRIGHT_YEAR "2024") set(COPYRIGHT_HOLDERS "The Monero Project") # Configurable options -option(STATIC "Link libraries statically, requires static Qt" OFF) +option(STATIC "Link libraries statically, requires static Qt" ON) option(SELF_CONTAINED "Disable when building Feather for packages" OFF) option(TOR_DIR "Directory containing Tor binaries to embed inside Feather" OFF) option(CHECK_UPDATES "Enable checking for application updates" ON) option(PLATFORM_INSTALLER "Built-in updater fetches installer (windows-only)" OFF) option(USE_DEVICE_TREZOR "Trezor support compilation" ON) option(DONATE_BEG "Prompt donation window every once in a while" OFF) -option(WITH_SCANNER "Enable webcam QR scanner" ON) +option(WITH_SCANNER "Enable webcam QR scanner" OFF) option(STACK_TRACE "Dump stack trace on crash (Linux only)" OFF) # diff --git a/contrib/depends/packages/libarchive.mk b/contrib/depends/packages/libarchive.mk new file mode 100644 index 0000000..2508478 --- /dev/null +++ b/contrib/depends/packages/libarchive.mk @@ -0,0 +1,25 @@ +package=libarchive +$(package)_version=3.7.4 +$(package)_download_path=https://github.com/libarchive/libarchive/releases/download/v$($(package)_version)/ +$(package)_file_name=$(package)-$($(package)_version).tar.xz +$(package)_sha256_hash=f887755c434a736a609cbd28d87ddbfbe9d6a3bb5b703c22c02f6af80a802735 + +define $(package)_config_cmds + CC="$($(package)_cc)" \ + CXX="$($(package)_cxx)" \ + AR="$($(package)_ar)" \ + RANLIB="$($(package)_ranlib)" \ + LIBTOOL="$($(package)_libtool)" \ + LDLAGS="$($(package)_ldflags)" \ + CFLAGS="-fPIE" \ + CXXFLAGS="-fPIE" \ + ./configure --host=$(host) --enable-static --prefix=$(host_prefix) --without-iconv +endef + +define $(package)_build_cmds + $(MAKE) +endef + +define $(package)_stage_cmds + $(MAKE) DESTDIR=$($(package)_staging_dir) install +endef diff --git a/contrib/depends/packages/packages.mk b/contrib/depends/packages/packages.mk index b8e4330..2d590a8 100644 --- a/contrib/depends/packages/packages.mk +++ b/contrib/depends/packages/packages.mk @@ -1,12 +1,12 @@ -packages := boost openssl libiconv unbound qrencode libsodium polyseed hidapi protobuf libusb zlib libgpg-error libgcrypt expat libzip zxing-cpp +packages := boost openssl libiconv unbound qrencode libsodium polyseed hidapi protobuf libusb zlib libgpg-error libgcrypt expat libzip zxing-cpp libarchive native_packages := native_qt native_protobuf -linux_packages := eudev libfuse libsquashfuse zstd appimage_runtime +linux_packages := eudev libfuse libsquashfuse zstd appimage_runtime linux_native_packages = x86_64_linux_packages := flatstart -darwin_packages := +darwin_packages := darwin_native_packages = darwin_sdk native_cctools native_libtapi mingw32_packages = @@ -18,4 +18,4 @@ qt_mingw32_packages := qt tor_linux_packages := libevent tor_linux tor_darwin_packages := tor_darwin -tor_mingw32_packages := tor_mingw32 \ No newline at end of file +tor_mingw32_packages := tor_mingw32 diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in index 267b056..2b5d84f 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in @@ -29,6 +29,9 @@ SET(ENV{PKG_CONFIG_PATH} @prefix@/lib/pkgconfig) SET(TOR_DIR @prefix@/Tor CACHE STRING "Tor dir") SET(TOR_VERSION @tor_version@ CACHE STRING "Tor version") +SET(LibArchive_LIBRARIES @prefix@/lib/libarchive.a) +SET(LibArchive_INCLUDE_DIR @prefix@/include/) + SET(Readline_ROOT_DIR @prefix@) SET(Readline_INCLUDE_DIR @prefix@/include) SET(Readline_LIBRARY @prefix@/lib/libreadline.a) diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index db968ac..990a687 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -15,6 +15,7 @@ ((gnu packages gettext) #:select (gettext-minimal)) (gnu packages gperf) ((gnu packages installers) #:select (nsis-x86_64)) + (gnu packages backup) ((gnu packages libusb) #:select (libplist)) ((gnu packages linux) #:select (linux-libre-headers-6.1 util-linux)) (gnu packages llvm) @@ -296,6 +297,8 @@ chain for " target " development.")) python-minimal ;; Git git-minimal + ;; Libarchive + libarchive ;; Xcb xcb-util xcb-util-cursor diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8a9410c..df13768 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -302,7 +302,7 @@ if (WITH_SCANNER) endif() if (WITH_PLUGIN_ATOMIC) - FIND_PACKAGE(LibArchive REQUIRED) + #FIND_PACKAGE(LibArchive REQUIRED) INCLUDE_DIRECTORIES(${LibArchive_INCLUDE_DIR}) target_link_libraries(feather PRIVATE ${LibArchive_LIBRARIES}) endif() @@ -357,4 +357,4 @@ if(APPLE) file(COPY "${CMAKE_SOURCE_DIR}/src/assets/images/appicons/appicon.icns" DESTINATION "${CMAKE_SOURCE_DIR}/installed/feather.app/Contents/Resources/" ) endif() -qt_finalize_executable(feather) \ No newline at end of file +qt_finalize_executable(feather) diff --git a/src/plugins/atomic/AtomicConfigDialog.cpp b/src/plugins/atomic/AtomicConfigDialog.cpp index b627074..8780eb7 100644 --- a/src/plugins/atomic/AtomicConfigDialog.cpp +++ b/src/plugins/atomic/AtomicConfigDialog.cpp @@ -7,10 +7,12 @@ #include #include #include -#include +#ifdef Q_OS_WIN #include - +#else +#include #include +#endif #include #include "utils/config.h" @@ -89,9 +91,10 @@ void AtomicConfigDialog::extract() { swapPath.append("/swapTool"); QFile binaryFile(swapPath); binaryFile.open(QIODevice::WriteOnly); - auto operatingSystem = conf()->get(Config::operatingSystem).toString().toStdString(); - if(strcmp("WIN",operatingSystem.c_str()) == 0) { + //auto operatingSystem = conf()->get(Config::operatingSystem).toString().toStdString(); + //if(strcmp("WIN",operatingSystem.c_str()) == 0) { // UNZIP +#ifdef Q_OS_WIN zip *z = zip_open(tempFile.toStdString().c_str(), 0, 0); //Search for the file of given name @@ -114,7 +117,8 @@ void AtomicConfigDialog::extract() { //And close the archive zip_close(z); conf()->set(Config::swapPath,swapPath); - } else { +#else + //} else { struct archive *a; struct archive *ext; @@ -145,7 +149,8 @@ void AtomicConfigDialog::extract() { archive_write_close(ext); archive_write_free(ext); conf()->set(Config::swapPath, QString(savePath.c_str())); - } +#endif + //} qDebug() << "Finished"; binaryFile.close(); ui->downloadLabel->setText("Swap tool installation complete, Atomic swaps are ready !"); diff --git a/src/plugins/atomic/AtomicSwap.cpp b/src/plugins/atomic/AtomicSwap.cpp index 23ce35a..5862ee8 100644 --- a/src/plugins/atomic/AtomicSwap.cpp +++ b/src/plugins/atomic/AtomicSwap.cpp @@ -7,7 +7,7 @@ #include "AtomicSwap.h" #include -#include +#include #include "ui_AtomicSwap.h" #include "AtomicWidget.h" #include "constants.h" diff --git a/src/plugins/atomic/AtomicWidget.cpp b/src/plugins/atomic/AtomicWidget.cpp index 7604c41..63c86e4 100644 --- a/src/plugins/atomic/AtomicWidget.cpp +++ b/src/plugins/atomic/AtomicWidget.cpp @@ -96,7 +96,6 @@ AtomicWidget::AtomicWidget(QWidget *parent) } } - sleep(1); runSwap(seller,btcChange, xmrReceive); } });