2017-01-18 22:39:21 +01:00
|
|
|
#!/bin/bash
|
2017-01-16 20:06:53 +01:00
|
|
|
|
|
|
|
set -o xtrace
|
|
|
|
set -eu
|
|
|
|
|
2017-01-18 17:37:44 +01:00
|
|
|
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2017-01-25 07:24:04 +01:00
|
|
|
if [ "$(uname)" == "Darwin" ]; then
|
|
|
|
ICON="$ROOT/package/osx/app.icns"
|
|
|
|
else
|
|
|
|
ICON="$ROOT/package/icons/lbry48.png"
|
|
|
|
fi
|
|
|
|
|
2017-01-18 17:37:44 +01:00
|
|
|
|
2017-01-18 20:43:35 +01:00
|
|
|
if [ -n "${TEAMCITY_VERSION:-}" ]; then
|
|
|
|
# install dependencies
|
|
|
|
$ROOT/prebuild.sh
|
|
|
|
|
2017-01-19 10:51:54 +01:00
|
|
|
VENV="$ROOT/build_venv"
|
|
|
|
if [ -d "$VENV" ]; then
|
|
|
|
rm -rf "$VENV"
|
|
|
|
fi
|
|
|
|
virtualenv "$VENV"
|
|
|
|
set +u
|
|
|
|
source "$VENV/bin/activate"
|
|
|
|
set -u
|
2017-01-25 07:24:04 +01:00
|
|
|
pip install -U pip setuptools
|
2017-01-18 22:35:06 +01:00
|
|
|
fi
|
2017-01-18 22:33:27 +01:00
|
|
|
|
|
|
|
|
2017-01-18 17:37:44 +01:00
|
|
|
(
|
|
|
|
cd "$ROOT/electron"
|
|
|
|
npm install
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
cd "$ROOT/lbry"
|
|
|
|
pip install -r requirements.txt
|
|
|
|
pip install .
|
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
cd "$ROOT/lbrynet"
|
2017-01-25 07:24:04 +01:00
|
|
|
pyinstaller lbry.py -y --windowed --onefile --icon="${ICON}"
|
2017-01-18 17:37:44 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
cd "$ROOT/lbry-web-ui"
|
|
|
|
npm install
|
|
|
|
node_modules/.bin/node-sass --output dist/css --sourcemap=none scss/
|
|
|
|
node_modules/.bin/webpack
|
|
|
|
)
|
|
|
|
|
2017-01-18 17:48:51 +01:00
|
|
|
cp -R "$ROOT/lbry-web-ui/dist" "$ROOT/electron/"
|
2017-01-18 17:37:44 +01:00
|
|
|
|
|
|
|
mv "$ROOT/lbrynet/dist/lbry" "$ROOT/electron/dist"
|
2017-01-16 20:06:53 +01:00
|
|
|
|
2017-01-18 18:05:46 +01:00
|
|
|
if [ -n "${TEAMCITY_VERSION:-}" ]; then
|
2017-01-25 07:24:04 +01:00
|
|
|
electron-packager --electron-version=1.4.14 --overwrite "$ROOT/electron" LBRY --icon="${ICON}"
|
|
|
|
# TODO: sign the app
|
2017-01-18 19:03:10 +01:00
|
|
|
|
|
|
|
(
|
2017-01-25 07:24:04 +01:00
|
|
|
cd "$ROOT/lbry"
|
|
|
|
VERSION=$(python setup.py -V)
|
2017-01-18 19:03:10 +01:00
|
|
|
cd "$ROOT"
|
2017-01-18 20:43:35 +01:00
|
|
|
if [ "$(uname)" == "Darwin" ]; then
|
|
|
|
PLATFORM="darwin"
|
2017-01-25 07:35:28 +01:00
|
|
|
mv "LBRY-${PLATFORM}-x64/LBRY.app" "$ROOT/package/osx/LBRY.app"
|
|
|
|
cd "$ROOT/package/osx/"
|
2017-01-25 07:24:04 +01:00
|
|
|
dmgbuild -s dmg_settings.py "LBRY" "lbry-${VERSION}.dmg"
|
2017-01-18 20:43:35 +01:00
|
|
|
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
|
|
|
|
OS="linux"
|
|
|
|
PLATFORM="linux"
|
2017-01-25 07:24:04 +01:00
|
|
|
tar cvzf "lbry-${OS}.tgz" "LBRY-${PLATFORM}-x64/"
|
2017-01-18 20:43:35 +01:00
|
|
|
else
|
|
|
|
OS="unknown"
|
|
|
|
fi
|
|
|
|
)
|
2017-01-18 19:03:10 +01:00
|
|
|
|
2017-01-18 18:05:46 +01:00
|
|
|
echo 'Build and packaging complete.'
|
|
|
|
else
|
|
|
|
echo 'Build complete. Run `electron electron` to launch the app'
|
|
|
|
fi
|
2017-01-18 22:33:27 +01:00
|
|
|
|
2017-01-19 10:51:54 +01:00
|
|
|
if [ -n "${TEAMCITY_VERSION:-}" ]; then
|
|
|
|
deactivate
|
|
|
|
fi
|