build: create a standalone build script for libsecp256k1
heavily based on Electron-Cash/Electron-Cash@eda015908e
This commit is contained in:
@@ -6,7 +6,6 @@ NAME_ROOT=electrum
|
||||
export WINEPREFIX=/opt/wine64
|
||||
export WINEDEBUG=-all
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
export PYTHONHASHSEED=22
|
||||
|
||||
PYHOME=c:/python3
|
||||
PYTHON="wine $PYHOME/python.exe -OO -B"
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/bin/bash
|
||||
# heavily based on https://github.com/ofek/coincurve/blob/417e726f553460f88d7edfa5dc67bfda397c4e4a/.travis/build_windows_wheels.sh
|
||||
|
||||
set -e
|
||||
|
||||
here="$(dirname "$(readlink -e "$0")")"
|
||||
LIBSECP_VERSION="b408c6a8b287003d1ade5709e6f7bc3c7f1d5be7"
|
||||
|
||||
. "$CONTRIB"/build_tools_util.sh
|
||||
|
||||
info "building libsecp256k1..."
|
||||
|
||||
|
||||
build_dll() {
|
||||
#sudo apt-get install -y mingw-w64
|
||||
export SOURCE_DATE_EPOCH=1530212462
|
||||
echo "LDFLAGS = -no-undefined" >> Makefile.am
|
||||
./autogen.sh
|
||||
# Note: set both --build and --host when running configure
|
||||
# Otherwise weird voodoo magic happens with Docker and Wine.
|
||||
# https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Hosts-and-Cross_002dCompilation.html
|
||||
LDFLAGS="-Wl,--no-insert-timestamp" ./configure \
|
||||
--host=$1 \
|
||||
--build=x86_64-pc-linux-gnu \
|
||||
--enable-module-recovery \
|
||||
--enable-experimental \
|
||||
--enable-module-ecdh \
|
||||
--disable-jni
|
||||
make -j4
|
||||
${1}-strip .libs/libsecp256k1-0.dll
|
||||
}
|
||||
|
||||
|
||||
cd "$CACHEDIR"
|
||||
|
||||
if [ -f "secp256k1/libsecp256k1.dll" ]; then
|
||||
info "libsecp256k1.dll already built, skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d secp256k1 ]; then
|
||||
git clone https://github.com/bitcoin-core/secp256k1.git
|
||||
fi
|
||||
|
||||
cd secp256k1
|
||||
git reset --hard
|
||||
git clean -f -x -q
|
||||
git checkout $LIBSECP_VERSION
|
||||
|
||||
build_dll i686-w64-mingw32 # 64-bit would be: x86_64-w64-mingw32
|
||||
mv .libs/libsecp256k1-0.dll libsecp256k1.dll
|
||||
|
||||
find -exec touch -d '2000-11-11T11:11:11+00:00' {} +
|
||||
|
||||
info "building libsecp256k1 finished"
|
||||
@@ -2,16 +2,19 @@
|
||||
|
||||
set -e
|
||||
|
||||
# Lucky number
|
||||
export PYTHONHASHSEED=22
|
||||
|
||||
here="$(dirname "$(readlink -e "$0")")"
|
||||
test -n "$here" -a -d "$here" || exit
|
||||
|
||||
export CONTRIB="$here/.."
|
||||
export PROJECT_ROOT="$CONTRIB/.."
|
||||
export CACHEDIR="$here/.cache"
|
||||
export PIP_CACHE_DIR="$CACHEDIR/pip_cache"
|
||||
|
||||
export BUILD_TYPE="wine"
|
||||
export GCC_TRIPLET_HOST="i686-w64-mingw32"
|
||||
export GCC_TRIPLET_BUILD="x86_64-pc-linux-gnu"
|
||||
export GCC_STRIP_BINARIES="1"
|
||||
|
||||
. "$CONTRIB"/build_tools_util.sh
|
||||
|
||||
info "Clearing $here/build and $here/dist..."
|
||||
@@ -20,7 +23,11 @@ rm "$here"/dist/* -rf
|
||||
|
||||
mkdir -p "$CACHEDIR" "$PIP_CACHE_DIR"
|
||||
|
||||
$here/build-secp256k1.sh || fail "build-secp256k1 failed"
|
||||
if [ -f "$PROJECT_ROOT/electrum/libsecp256k1-0.dll" ]; then
|
||||
info "libsecp256k1 already built, skipping"
|
||||
else
|
||||
"$CONTRIB"/make_libsecp256k1.sh || fail "Could not build libsecp"
|
||||
fi
|
||||
|
||||
$here/prepare-wine.sh || fail "prepare-wine failed"
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ binaries = []
|
||||
# Workaround for "Retro Look":
|
||||
binaries += [b for b in collect_dynamic_libs('PyQt5') if 'qwindowsvista' in b[0]]
|
||||
|
||||
binaries += [('C:/tmp/libsecp256k1.dll', '.')]
|
||||
binaries += [('C:/tmp/libsecp256k1-0.dll', '.')]
|
||||
binaries += [('C:/tmp/libusb-1.0.dll', '.')]
|
||||
|
||||
datas = [
|
||||
|
||||
@@ -89,7 +89,6 @@ info "Compiling libusb..."
|
||||
git remote add origin $LIBUSB_REPO
|
||||
git fetch --depth 1 origin $LIBUSB_COMMIT
|
||||
git checkout -b pinned FETCH_HEAD
|
||||
export SOURCE_DATE_EPOCH=1530212462
|
||||
echo "libusb_1_0_la_LDFLAGS += -Wc,-static" >> libusb/Makefile.am
|
||||
./bootstrap.sh || fail "Could not bootstrap libusb"
|
||||
host="i686-w64-mingw32"
|
||||
@@ -102,8 +101,8 @@ info "Compiling libusb..."
|
||||
cp "$CACHEDIR/libusb/libusb/.libs/libusb-1.0.dll" $WINEPREFIX/drive_c/tmp/ || fail "Could not copy libusb to its destination"
|
||||
|
||||
|
||||
# copy libsecp dll (already built by build-secp256k1.sh)
|
||||
cp "$CACHEDIR/secp256k1/libsecp256k1.dll" $WINEPREFIX/drive_c/tmp/ || fail "Could not copy libsecp to its destination"
|
||||
# copy libsecp dll (already built)
|
||||
cp "$PROJECT_ROOT/electrum/libsecp256k1-0.dll" $WINEPREFIX/drive_c/tmp/ || fail "Could not copy libsecp to its destination"
|
||||
|
||||
|
||||
info "Building PyInstaller."
|
||||
|
||||
Reference in New Issue
Block a user