Merge pull request #61 from VerusCoin/dave-dev

Switching to curl from wget on Mac fetch-params.sh
This commit is contained in:
Asher Dawes
2018-06-16 23:55:53 -07:00
committed by GitHub
6 changed files with 140 additions and 166 deletions

View File

@@ -2,6 +2,9 @@ stages:
- build
- test
variables:
VERSION: "0.3.6"
build:linux:
image: asherd/veruscoin-cross-compiler:linux
variables:
@@ -22,10 +25,13 @@ build:linux:
script:
- "./zcutil/fetch-params.sh"
- "./zcutil/build.sh"
- "cp src/komodod src/komodo-cli kmd/linux/verus-cli && chmod -R +x kmd/linux/verus-cli/"
- "./makeReleaseLinux.sh"
- "cd kmd/linux/"
- "tar -czvf verus-cli-linux-v$VERSION-beta.tar.gz verus-cli"
- "mv verus-cli-linux-v$VERSION-beta.tar.gz ../.."
artifacts:
paths:
- kmd/linux/verus-cli
- verus-cli-linux-v$VERSION-beta.tar.gz
expire_in: 1 week
build:windows:
@@ -50,10 +56,13 @@ build:windows:
script:
- "./zcutil/fetch-params.sh"
- "./zcutil/build-win.sh"
- "cp src/komodod.exe src/komodo-cli.exe src/komodo-tx.exe kmd/windows/verus-cli"
- "./makeReleaseLinux.sh"
- "cd kmd/windows/"
- "zip verus-cli-windows-v$VERSION-beta.zip verus-cli"
- "mv verus-cli-windows-v$VERSION-beta.zip ../.."
artifacts:
paths:
- kmd/windows/verus-cli
- verus-cli-windows-v$VERSION-beta.zip
expire_in: 1 week
build:mac:
@@ -67,10 +76,13 @@ build:mac:
script:
- "./zcutil/fetch-params.sh"
- "./zcutil/build-mac.sh | xcpretty"
- "./makeRelease.sh"
- "./makeReleaseMac.sh"
- "cd kmd/mac/"
- "tar -czvf verus-cli-mac-v$VERSION-beta.tar.gz verus-cli"
- "mv verus-cli-mac-v$VERSION-beta.tar.gz ../.."
artifacts:
paths:
- kmd/mac/verus-cli
- verus-cli-mac-v$VERSION-beta.tar.gz
expire_in: 1 week
code_quality:

View File

@@ -1,165 +1,7 @@
#!/bin/bash
set -eu
curl "https://z.cash/downloads/sprout-proving.key" -o "$HOME/Library/Application Support/ZcashParams/sprout-proving.key"
curl "https://z.cash/downloads/sprout-verifying.key" -o "$HOME/Library/Application Support/ZcashParams/sprout-verifying.key"
PARAMS_DIR="$HOME/Library/Application Support/ZcashParams"
SPROUT_PKEY_NAME='sprout-proving.key'
SPROUT_VKEY_NAME='sprout-verifying.key'
SPROUT_URL="https://z.cash/downloads"
SPROUT_IPFS="/ipfs/QmZKKx7Xup7LiAtFRhYsE1M7waXcv9ir9eCECyXAFGxhEo"
SHA256CMD="$(command -v sha256sum || echo shasum)"
SHA256ARGS="$(command -v sha256sum >/dev/null || echo '-a 256')"
WGETCMD="$(command -v wget || echo '')"
IPFSCMD="$(command -v ipfs || echo '')"
# fetch methods can be disabled with ZC_DISABLE_SOMETHING=1
ZC_DISABLE_WGET="${ZC_DISABLE_WGET:-}"
ZC_DISABLE_IPFS="${ZC_DISABLE_IPFS:-}"
function fetch_wget {
if [ -z "$WGETCMD" ] || ! [ -z "$ZC_DISABLE_WGET" ]; then
return 1
fi
local filename="$1"
local dlname="$2"
cat <<EOF
Retrieving (wget): $SPROUT_URL/$filename
EOF
wget \
--progress=dot:giga \
--output-document="$dlname" \
--continue \
--retry-connrefused --waitretry=3 --timeout=30 \
"$SPROUT_URL/$filename"
}
function fetch_ipfs {
if [ -z "$IPFSCMD" ] || ! [ -z "$ZC_DISABLE_IPFS" ]; then
return 1
fi
local filename="$1"
local dlname="$2"
cat <<EOF
Retrieving (ipfs): $SPROUT_IPFS/$filename
EOF
ipfs get --output "$dlname" "$SPROUT_IPFS/$filename"
}
function fetch_failure {
cat >&2 <<EOF
Failed to fetch the Zcash zkSNARK parameters!
Try installing one of the following programs and make sure you're online:
* ipfs
* wget
EOF
exit 1
}
function fetch_params {
local filename="$1"
local output="$2"
local dlname="${output}.dl"
local expectedhash="$3"
if ! [ -f "$output" ]
then
for method in wget ipfs failure; do
if "fetch_$method" "$filename" "$dlname"; then
echo "Download successful!"
break
fi
done
"$SHA256CMD" $SHA256ARGS -c <<EOF
$expectedhash $dlname
EOF
# Check the exit code of the shasum command:
CHECKSUM_RESULT=$?
if [ $CHECKSUM_RESULT -eq 0 ]; then
mv -v "$dlname" "$output"
else
echo "Failed to verify parameter checksums!" >&2
exit 1
fi
fi
}
# Use flock to prevent parallel execution.
function lock() {
local lockfile=/tmp/fetch_params.lock
# create lock file
eval "exec 200>/$lockfile"
# acquire the lock
flock -n 200 \
&& return 0 \
|| return 1
}
function exit_locked_error {
echo "Only one instance of fetch-params.sh can be run at a time." >&2
exit 1
}
function main() {
lock fetch-params.sh \
|| exit_locked_error
cat <<EOF
Zcash - fetch-params.sh
This script will fetch the Zcash zkSNARK parameters and verify their
integrity with sha256sum.
If they already exist locally, it will exit now and do nothing else.
EOF
# Now create PARAMS_DIR and insert a README if necessary:
if ! [ -d "$PARAMS_DIR" ]
then
mkdir -p "$PARAMS_DIR"
README_PATH="$PARAMS_DIR/README"
cat >> "$README_PATH" <<EOF
This directory stores common Zcash zkSNARK parameters. Note that it is
distinct from the daemon's -datadir argument because the parameters are
large and may be shared across multiple distinct -datadir's such as when
setting up test networks.
EOF
# This may be the first time the user's run this script, so give
# them some info, especially about bandwidth usage:
cat <<EOF
The parameters are currently just under 911MB in size, so plan accordingly
for your bandwidth constraints. If the files are already present and
have the correct sha256sum, no networking is used.
Creating params directory. For details about this directory, see:
$README_PATH
EOF
fi
cd "$PARAMS_DIR"
fetch_params "$SPROUT_PKEY_NAME" "$PARAMS_DIR/$SPROUT_PKEY_NAME" "8bc20a7f013b2b58970cddd2e7ea028975c88ae7ceb9259a5344a16bc2c0eef7"
fetch_params "$SPROUT_VKEY_NAME" "$PARAMS_DIR/$SPROUT_VKEY_NAME" "4bd498dae0aacfd8e98dc306338d017d9c08dd0918ead18172bd0aec2fc5df82"
}
main
rm -f /tmp/fetch_params.lock
exit 0

5
makeReleaseLinux.sh Normal file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
cp src/komodod src/komodo-cli kmd/linux/verus-cli
chmod +x kmd/linux/verus-cli/komodo*
chmod +x kmd/linux/verus-cli/veru*

94
makeReleaseMac.sh Normal file
View File

@@ -0,0 +1,94 @@
#!/bin/sh
KMD_DIR=kmd/mac/verus-cli
binaries=("komodo-cli" "komodod")
alllibs=()
for binary in "${binaries[@]}";
do
# do the work in the destination directory
cp src/$binary $KMD_DIR
# find the dylibs to copy for komodod
DYLIBS=`otool -L $KMD_DIR/$binary | grep "/usr/local" | awk -F' ' '{ print $1 }'`
echo "copying $DYLIBS to $KMD_DIR"
# copy the dylibs to the srcdir
for dylib in $DYLIBS; do cp -rf $dylib $KMD_DIR; done
#DYLIBS=`otool -L $KMD_DIR/$binary | grep "/usr/lib" | awk -F' ' '{ print $1 }'`
# copy the other dylibs to the srcdir
#for dylib in $DYLIBS; do cp -rf $dylib $KMD_DIR; alllibs+=($dylib); done
done
libraries=("libgcc_s.1.dylib" "libgomp.1.dylib" "libidn2.0.dylib" "libstdc++.6.dylib")
for binary in "${libraries[@]}";
do
# Need to undo this for the dylibs when we are done
chmod 755 $KMD_DIR/$binary
# find the dylibs to copy for komodod
DYLIBS=`otool -L $KMD_DIR/$binary | grep "/usr/local" | awk -F' ' '{ print $1 }'`
echo "copying $DYLIBS to $KMD_DIR"
# copy the dylibs to the srcdir
for dylib in $DYLIBS; do cp -rf $dylib $KMD_DIR; alllibs+=($dylib); done
#DYLIBS=`otool -L $KMD_DIR/$binary | grep "/usr/lib" | awk -F' ' '{ print $1 }'`
# copy the other dylibs to the srcdir
#for dylib in $DYLIBS; do cp -rf $dylib $KMD_DIR; alllibs+=($dylib); newlibs+=(`basename $dylib`); done
done
indirectlibraries=("libintl.8.dylib" "libunistring.2.dylib")
newlibs=()
for binary in "${indirectlibraries[@]}"
do
# Need to undo this for the dylibs when we are done
chmod 755 src/$binary
# find the dylibs to copy for komodod
DYLIBS=`otool -L $KMD_DIR/$binary | grep "/usr/local" | awk -F' ' '{ print $1 }'`
echo "copying indirect $DYLIBS to $KMD_DIR"
# copy the dylibs to the dest dir
for dylib in $DYLIBS; do cp -rf $dylib $KMD_DIR; alllibs+=($dylib); done
#DYLIBS=`otool -L $KMD_DIR/$binary | grep "/usr/lib" | awk -F' ' '{ print $1 }'`
# copy the other dylibs to the srcdir
#for dylib in $DYLIBS; do cp -rf $dylib $KMD_DIR; alllibs+=($dylib); newlibs+=(`basename $dylib`); done
done
# now process all the new libs we found indirectly
for binary in "${newlibs[@]}";
do
# Need to undo this for the dylibs when we are done
chmod 755 src/$binary
# find the dylibs to copy for komodod
DYLIBS=`otool -L $KMD_DIR/$binary | grep "/usr/local" | awk -F' ' '{ print $1 }'`
echo "copying indirect $DYLIBS to $KMD_DIR"
# copy the dylibs to the dest dir
for dylib in $DYLIBS; do cp -rf $dylib $KMD_DIR; alllibs+=($dylib); done
#DYLIBS=`otool -L $KMD_DIR/$binary | grep "/usr/lib" | awk -F' ' '{ print $1 }'`
# copy the other dylibs to the srcdir
#for dylib in $DYLIBS; do cp -rf $dylib $KMD_DIR; alllibs+=($dylib); done
done
for binary in "${binaries[@]}";
do
# modify komododi or komodo-cli to point to dylibs
echo "modifying $binary to use local libraries"
for dylib in "${alllibs[@]}"
do
echo "Next lib is $dylib "
install_name_tool -change $dylib @executable_path/`basename $dylib` $KMD_DIR/$binary
done
chmod +x $KMD_DIR/$binary
done
libs=("${libraries[@]}" "${indirectlibraries[@]}" "${newlibs[@]}")
for binary in "${libs[@]}";
do
# modify dylibs to point to dylibs
echo "modifying $binary to use local libraries"
for dylib in "${alllibs[@]}"
do
echo "Next lib is $dylib "
chmod 755 $KMD_DIR/$binary
install_name_tool -change $dylib @executable_path/`basename $dylib` $KMD_DIR/$binary
done
chmod +x $KMD_DIR/$binary
done

3
makeReleaseWindows.sh Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
cp src/komodod.exe src/komodo-cli.exe src/komodo-tx.exe kmd/windows/verus-cli

18
requirements-debian.txt Normal file
View File

@@ -0,0 +1,18 @@
autoconf
automake
bsdmainutils
build-essential
curl
g++-multilib
git
libc6-dev
libcurl4-openssl-dev
libtool
ncurses-dev
pkg-config
python
python-zmq
m4
unzip
wget
zlib1g-dev