diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d5e71b..4f6e605 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,6 @@ option(WITH_SCANNER "Enable webcam QR scanner" OFF) list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake") include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) -include(CheckLinkerFlag) include(FetchContent) include(FindCcache) include(CheckIncludeFile) @@ -103,11 +102,9 @@ set(HIDAPI_FOUND OFF) find_package(QREncode REQUIRED) # Qr scanner -if (WITH_SCANNER) - find_package(ZBAR REQUIRED) - message(STATUS "libzbar: include dir at ${ZBAR_INCLUDE_DIR}") - message(STATUS "libzbar: libraries at ${ZBAR_LIBRARIES}") -endif() +find_package(ZBAR REQUIRED) +message(STATUS "libzbar: include dir at ${ZBAR_INCLUDE_DIR}") +message(STATUS "libzbar: libraries at ${ZBAR_LIBRARIES}") # Tevador 14 word Monero seed find_package(monero-seed CONFIG) @@ -181,11 +178,6 @@ if(TOR_BIN) execute_process(COMMAND bash -c "touch ${CMAKE_CURRENT_SOURCE_DIR}/src/tor/libevent-2.1.7.dylib") endif() - execute_process(COMMAND bash -c "${TOR_BIN} --version --quiet" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE out RESULT_VARIABLE ret) - if (ret EQUAL "0") - string(REGEX MATCH "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]" version ${out}) - set(TOR_VERSION "${version}") - endif() message(STATUS "Embedded Tor version: ${TOR_VERSION}") configure_file("cmake/config-feather.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-feather.h") diff --git a/Dockerfile b/Dockerfile index c24034c..793cda0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive # Feather build flags ENV CHECK_UPDATES=ON ENV WITH_SCANNER=ON +ENV TOR_VERSION=0.4.6.6 COPY --from=featherwallet/feather-deps:linux-beta-8 /deps /deps COPY --from=featherwallet/feather-deps:linux-beta-8 /var/cache/apt/archives /archives @@ -230,7 +231,7 @@ RUN git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib && \ # Tor: Optional for Feather (-DTOR_BIN) # Binary can be embedded in Feather ENV TOR_BIN=/usr/local/tor/bin/tor -RUN git clone -b tor-0.4.6.6 --depth 1 https://git.torproject.org/tor.git && \ +RUN git clone -b tor-$TOR_VERSION --depth 1 https://git.torproject.org/tor.git && \ cd tor && \ git reset --hard 60d1fb3d37274e29e9e88620d77e1636ef922561 && \ ./autogen.sh && \ diff --git a/Dockerfile.windows b/Dockerfile.windows index fedc93d..8ee9992 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -11,6 +11,7 @@ ENV WITH_SCANNER=ON ENV OPENSSL_ROOT_DIR=/usr/local/openssl/ ENV TOR_BIN=/usr/local/tor/bin/tor.exe +ENV TOR_VERSION=0.4.6.6 RUN apt update && \ apt install -y \ @@ -154,7 +155,7 @@ RUN wget https://github.com/libevent/libevent/releases/download/release-2.1.11-s make -j$THREADS install && \ rm -rf $(pwd) -RUN git clone -b tor-0.4.6.6 --depth 1 https://git.torproject.org/tor.git && \ +RUN git clone -b tor-$TOR_VERSION --depth 1 https://git.torproject.org/tor.git && \ cd tor && \ git reset --hard 60d1fb3d37274e29e9e88620d77e1636ef922561 && \ ./autogen.sh && \ @@ -197,7 +198,8 @@ RUN git clone https://github.com/nih-at/libzip.git && \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_PREFIX_PATH=/usr/x86_64-w64-mingw32 && \ make -j$THREADS && \ - make -j$THREADS install + make -j$THREADS install && \ + rm -rf $(pwd) RUN git clone -b 0.23.92 --depth 1 --recursive https://github.com/mchehab/zbar.git && \ cd zbar && \ @@ -205,4 +207,5 @@ RUN git clone -b 0.23.92 --depth 1 --recursive https://github.com/mchehab/zbar.g autoreconf -vfi && \ ./configure --enable-static --disable-shared --without-imagemagick --disable-video --without-xv --with-gtk=no --with-python=no --enable-doc=no --host=x86_64-w64-mingw32 && \ make -j$THREADS && \ - make install \ No newline at end of file + make install && \ + rm -rf $(pwd) \ No newline at end of file diff --git a/Makefile b/Makefile index c17ab0e..10a28ae 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,5 @@ -# Copyright (c) 2014-2021, The Monero Project -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, are -# permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other -# materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be -# used to endorse or promote products derived from this software without specific -# prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2020-2021, The Monero Project. CMAKEFLAGS = \ -DARCH=x86_64 \ @@ -43,21 +18,23 @@ CMAKEFLAGS = \ $(CMAKEFLAGS_EXTRA) release-static: CMAKEFLAGS += -DBUILD_TAG="linux-x64" -release-static: CMAKEFLAGS += -DTOR_BIN=$(or ${TOR_BIN},OFF) +release-static: CMAKEFLAGS += -DTOR_BIN=$(or ${TOR_BIN}, Off) +release-static: CMAKEFLAGS += -DTOR_VERSION=$(or ${TOR_VERSION}, Off) release-static: CMAKEFLAGS += -DCHECK_UPDATES=$(or ${CHECK_UPDATES}, Off) release-static: CMAKEFLAGS += -DWITH_SCANNER=$(or ${WITH_SCANNER}, Off) release-static: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Release -release-static: CMAKEFLAGS += -DREPRODUCIBLE=$(or ${SOURCE_DATE_EPOCH},OFF) +release-static: CMAKEFLAGS += -DREPRODUCIBLE=$(or ${SOURCE_DATE_EPOCH}, Off) release-static: cmake -Bbuild $(CMAKEFLAGS) $(MAKE) -Cbuild depends: mkdir -p build/$(target)/release - cd build/$(target)/release && cmake -D STATIC=ON -DREPRODUCIBLE=$(or ${SOURCE_DATE_EPOCH},OFF) -DTOR_VERSION=$(or ${TOR_VERSION}, OFF) -DTOR_BIN=$(or ${TOR_BIN},OFF) -DCHECK_UPDATES=$(or ${CHECK_UPDATES}, OFF) -D DEV_MODE=$(or ${DEV_MODE},OFF) -D BUILD_TAG=$(tag) -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$(root)/$(target)/share/toolchain.cmake ../../.. && $(MAKE) + cd build/$(target)/release && cmake -D STATIC=ON -DREPRODUCIBLE=$(or ${SOURCE_DATE_EPOCH},OFF) -DTOR_VERSION=$(or ${TOR_VERSION}, OFF) -DTOR_BIN=$(or ${TOR_BIN},OFF) -DCHECK_UPDATES=$(or ${CHECK_UPDATES}, OFF) -DWITH_SCANNER=$(or ${WITH_SCANNER}, Off) -D DEV_MODE=$(or ${DEV_MODE},OFF) -D BUILD_TAG=$(tag) -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$(root)/$(target)/share/toolchain.cmake ../../.. && $(MAKE) mac-release: CMAKEFLAGS += -DSTATIC=Off -mac-release: CMAKEFLAGS += -DTOR_BIN=$(or ${TOR_BIN},OFF) +mac-release: CMAKEFLAGS += -DTOR_BIN=$(or ${TOR_BIN}, Off) +mac-release: CMAKEFLAGS += -DTOR_VERSION=$(or ${TOR_VERSION}, Off) mac-release: CMAKEFLAGS += -DCHECK_UPDATES=$(or ${CHECK_UPDATES}, Off) mac-release: CMAKEFLAGS += -DWITH_SCANNER=$(or ${WITH_SCANNER}, On) mac-release: CMAKEFLAGS += -DBUILD_TAG="mac-x64" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4c369d8..bb4e6aa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -57,6 +57,8 @@ file(GLOB SOURCE_FILES "qrcode/*.cpp" "dialog/*.h" "dialog/*.cpp" + "qrcode_scanner/QrCodeUtils.cpp" + "qrcode_scanner/QrCodeUtils.h" ) if (WITH_SCANNER) @@ -141,11 +143,11 @@ target_include_directories(feather PUBLIC ${Qt5WebSockets_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${LIBZIP_INCLUDE_DIRS} + ${ZBAR_INCLUDE_DIR} ) if(WITH_SCANNER) target_include_directories(feather PUBLIC - ${ZBAR_INCLUDE_DIR} ${Qt5Multimedia_INCLUDE_DIRS} ${Qt5MultimediaWidgets_INCLUDE_DIRS} ) @@ -248,6 +250,7 @@ target_link_libraries(feather ${QRENCODE_LIBRARY} ${ZLIB_LIBRARIES} ${LIBZIP_LIBRARIES} + ${ZBAR_LIBRARIES} ) if(DEVICE_TREZOR_READY) @@ -258,7 +261,6 @@ if (WITH_SCANNER) target_link_libraries(feather Qt5::Multimedia Qt5::MultimediaWidgets - ${ZBAR_LIBRARIES} ) endif()