qt: new qrreader using QtMultimedia; drop CalinsQRReader(mac)
This commit ports the work of EchterAgo and cculianu from Electron-Cash, to implement a new toolchain to scan qr codes. Previously, on Linux and Win, we have been using zbar to access the camera and read qrcodes; and on macOS we used CalinsQRReader (an objective-C project by cculianu). The new toolchain added here can use QtMultimedia to access the camera, and then feed that image into zbar. When used this way, zbar needs fewer dependencies and is easier to compile, in particular it can be compiled for macOS. The new toolchain works on all three platforms, with some caveats (see code comments in related commits) -- so we also keep the end-to-end zbar toolchain; but at least we can drop CalinsQRReader. The related changes in Electron-Cash are spread over 50+ commits (several PRs and direct pushes to master), but see in particular: https://github.com/Electron-Cash/Electron-Cash/pull/1376 some other interesting links:b2b737001c163224cf1f3b31e0fcb1eda015908ehttps://github.com/Electron-Cash/Electron-Cash/pull/1545052aa06c23
This commit is contained in:
@@ -53,6 +53,7 @@ datas += collect_data_files('bitbox02')
|
||||
# We don't put these files in to actually include them in the script but to make the Analysis method scan them for imports
|
||||
a = Analysis([home+'run_electrum',
|
||||
home+'electrum/gui/qt/main_window.py',
|
||||
home+'electrum/gui/qt/qrreader/camera_dialog.py',
|
||||
home+'electrum/gui/text.py',
|
||||
home+'electrum/util.py',
|
||||
home+'electrum/wallet.py',
|
||||
|
||||
Submodule contrib/osx/CalinsQRReader deleted from 59dfc03272
@@ -31,34 +31,7 @@ We currently build the release binaries on macOS 10.14.6, and these seem to run
|
||||
|
||||
Before starting, make sure that the Xcode command line tools are installed (e.g. you have `git`).
|
||||
|
||||
#### 1.a Get Xcode
|
||||
|
||||
Building the QR scanner (CalinsQRReader) requires full Xcode (not just command line tools).
|
||||
|
||||
Get it from [here](https://developer.apple.com/download/more/).
|
||||
Unfortunately, you need an "Apple ID" account.
|
||||
|
||||
(note: the last Xcode that runs on macOS 10.14.6 is Xcode 11.3.1)
|
||||
|
||||
After downloading, uncompress it.
|
||||
|
||||
Make sure it is the "selected" xcode (e.g.):
|
||||
|
||||
sudo xcode-select -s $HOME/Downloads/Xcode.app/Contents/Developer/
|
||||
|
||||
#### 1.b Build QR scanner separately on another Mac
|
||||
|
||||
Alternatively, you can try building just the QR scanner on another Mac.
|
||||
|
||||
On newer Mac, run:
|
||||
|
||||
pushd contrib/osx/CalinsQRReader; xcodebuild; popd
|
||||
cp -r contrib/osx/CalinsQRReader/build prebuilt_qr
|
||||
|
||||
Move `prebuilt_qr` to El Capitan: `contrib/osx/CalinsQRReader/prebuilt_qr`.
|
||||
|
||||
|
||||
#### 2. Build Electrum
|
||||
#### Build Electrum
|
||||
|
||||
cd electrum
|
||||
./contrib/osx/make_osx
|
||||
|
||||
@@ -122,21 +122,16 @@ cp "$BUILDDIR/libusb/1.0.23/lib/libusb-1.0.dylib" contrib/osx
|
||||
echo "caea266f3fc3982adc55d6cb8d9bad10f6e61f0c24ce5901aa1804618e08e14d contrib/osx/libusb-1.0.dylib" | \
|
||||
shasum -a 256 -c || fail "libusb checksum mismatched"
|
||||
|
||||
# install some build-time deps for compilation
|
||||
brew install autoconf automake libtool gettext
|
||||
info "Installing some build-time deps for compilation..."
|
||||
brew install autoconf automake libtool gettext coreutils pkgconfig
|
||||
|
||||
info "Preparing for building libsecp256k1"
|
||||
info "Building libsecp256k1 dylib..."
|
||||
"$CONTRIB"/make_libsecp256k1.sh || fail "Could not build libsecp"
|
||||
cp "$ROOT_FOLDER"/electrum/libsecp256k1.0.dylib contrib/osx
|
||||
cp "$ROOT_FOLDER"/electrum/libsecp256k1.0.dylib "$CONTRIB"/osx
|
||||
|
||||
info "Building CalinsQRReader..."
|
||||
d=contrib/osx/CalinsQRReader
|
||||
pushd "$d"
|
||||
rm -fr build
|
||||
# prefer building using xcode ourselves. otherwise fallback to prebuilt binary
|
||||
xcodebuild || cp -r prebuilt_qr build || fail "Could not build CalinsQRReader"
|
||||
popd
|
||||
DoCodeSignMaybe "CalinsQRReader.app" "${d}/build/Release/CalinsQRReader.app"
|
||||
info "Building ZBar dylib..."
|
||||
"$CONTRIB"/make_zbar.sh || fail "Could not build ZBar dylib"
|
||||
cp "$ROOT_FOLDER"/electrum/libzbar.0.dylib "$CONTRIB"/osx
|
||||
|
||||
|
||||
info "Installing requirements..."
|
||||
|
||||
@@ -85,12 +85,10 @@ datas += collect_data_files('keepkeylib')
|
||||
datas += collect_data_files('ckcc')
|
||||
datas += collect_data_files('bitbox02')
|
||||
|
||||
# Add the QR Scanner helper app
|
||||
datas += [(electrum + "contrib/osx/CalinsQRReader/build/Release/CalinsQRReader.app", "./contrib/osx/CalinsQRReader/build/Release/CalinsQRReader.app")]
|
||||
|
||||
# Add libusb so Trezor and Safe-T mini will work
|
||||
binaries = [(electrum + "contrib/osx/libusb-1.0.dylib", ".")]
|
||||
binaries += [(electrum + "contrib/osx/libsecp256k1.0.dylib", ".")]
|
||||
binaries += [(electrum + "contrib/osx/libzbar.0.dylib", ".")]
|
||||
|
||||
# Workaround for "Retro Look":
|
||||
binaries += [b for b in collect_dynamic_libs('PyQt5') if 'macstyle' in b[0]]
|
||||
@@ -98,6 +96,7 @@ binaries += [b for b in collect_dynamic_libs('PyQt5') if 'macstyle' in b[0]]
|
||||
# We don't put these files in to actually include them in the script but to make the Analysis method scan them for imports
|
||||
a = Analysis([electrum+ MAIN_SCRIPT,
|
||||
electrum+'electrum/gui/qt/main_window.py',
|
||||
electrum+'electrum/gui/qt/qrreader/camera_dialog.py',
|
||||
electrum+'electrum/gui/text.py',
|
||||
electrum+'electrum/util.py',
|
||||
electrum+'electrum/wallet.py',
|
||||
|
||||
Reference in New Issue
Block a user