2016-06-20 10:42:06 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o xtrace
|
|
|
|
|
2016-06-20 10:42:43 +02:00
|
|
|
DEST=`pwd`
|
|
|
|
tmp="${DEST}/build"
|
2016-07-18 21:50:05 +02:00
|
|
|
ON_TRAVIS=false
|
2016-06-20 10:42:06 +02:00
|
|
|
|
|
|
|
rm -rf build dist LBRY.app
|
|
|
|
|
2016-08-16 19:22:14 +02:00
|
|
|
pip install wheel dmgbuild jsonrpc
|
2016-06-23 03:27:18 +02:00
|
|
|
# the default py2app (v0.9) has a bug that is fixed in the head of /metachris/py2app
|
|
|
|
pip install git+https://github.com/metachris/py2app
|
|
|
|
|
2016-06-20 10:42:06 +02:00
|
|
|
mkdir -p $tmp
|
|
|
|
cd $tmp
|
|
|
|
|
|
|
|
echo "Updating lbrynet"
|
|
|
|
if [ -z ${TRAVIS_BUILD_DIR+x} ]; then
|
|
|
|
# building locally
|
|
|
|
git clone --depth 1 http://github.com/lbryio/lbry.git
|
|
|
|
cd lbry
|
|
|
|
LBRY="${tmp}/lbry"
|
|
|
|
else
|
|
|
|
# building on travis
|
2016-07-18 21:50:05 +02:00
|
|
|
ON_TRAVIS=true
|
2016-06-20 10:42:06 +02:00
|
|
|
cd ${TRAVIS_BUILD_DIR}
|
|
|
|
LBRY=${TRAVIS_BUILD_DIR}
|
|
|
|
fi
|
2016-06-21 07:19:40 +02:00
|
|
|
NAME=`python setup.py --name`
|
|
|
|
VERSION=`python setup.py -V`
|
2016-06-23 03:27:18 +02:00
|
|
|
pip install -r requirements.txt
|
2016-06-23 18:58:11 +02:00
|
|
|
# not totally sure if pyOpenSSl is needed (JIE)
|
|
|
|
pip install pyOpenSSL
|
2016-06-20 10:42:06 +02:00
|
|
|
python setup.py install
|
2016-06-20 10:42:43 +02:00
|
|
|
|
2016-06-20 10:42:06 +02:00
|
|
|
echo "Building URI Handler"
|
2016-06-20 10:42:43 +02:00
|
|
|
cd "${DEST}"
|
2016-06-20 10:42:06 +02:00
|
|
|
rm -rf build dist
|
|
|
|
python setup_uri_handler.py py2app
|
|
|
|
|
|
|
|
echo "Signing URI Handler"
|
2016-06-20 10:42:43 +02:00
|
|
|
codesign -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRYURIHandler.app/Contents/Frameworks/Python.framework/Versions/2.7"
|
|
|
|
codesign -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRYURIHandler.app/Contents/MacOS/python"
|
|
|
|
# not sure if --deep is appropriate here, but need to get LBRYURIHandler.app/Contents/Frameworks/libcrypto.1.0.0.dylib signed
|
|
|
|
codesign --deep -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRYURIHandler.app/Contents/MacOS/LBRYURIHandler"
|
|
|
|
codesign -vvvv "${DEST}/dist/LBRYURIHandler.app"
|
2016-06-20 10:42:06 +02:00
|
|
|
|
2016-07-18 21:50:05 +02:00
|
|
|
pip install certifi
|
|
|
|
MODULES="pyobjc-core pyobjc-framework-Cocoa pyobjc-framework-CFNetwork"
|
|
|
|
if [ ${ON_TRAVIS} = true ]; then
|
|
|
|
WHEEL_DIR="${TRAVIS_BUILD_DIR}/cache/wheel"
|
|
|
|
mkdir -p "${WHEEL_DIR}"
|
|
|
|
# mapping from the package name to the
|
|
|
|
# actual built wheel file is surprisingly
|
|
|
|
# hard so instead of checking for the existance
|
|
|
|
# of each wheel, we mark with a file when they've all been
|
|
|
|
# built and skip when that file exists
|
|
|
|
if [ ! -f "${WHEEL_DIR}"/finished ]; then
|
|
|
|
pip wheel -w "${WHEEL_DIR}" ${MODULES}
|
|
|
|
touch "${WHEEL_DIR}"/finished
|
|
|
|
fi
|
|
|
|
pip install "${WHEEL_DIR}"/*.whl
|
|
|
|
else
|
|
|
|
pip install $MODULES
|
|
|
|
fi
|
|
|
|
|
2016-07-04 22:18:08 +02:00
|
|
|
|
|
|
|
# add lbrycrdd as a resource. Following
|
|
|
|
# http://stackoverflow.com/questions/11370012/can-executables-made-with-py2app-include-other-terminal-scripts-and-run-them
|
2016-08-09 17:06:14 +02:00
|
|
|
# LBRYCRDD_URL="$(curl https://api.github.com/repos/lbryio/lbrycrd/releases/latest | grep 'browser_download_url' | grep osx | cut -d'"' -f4)"
|
|
|
|
LBRYCRDD_URL="https://github.com/lbryio/lbrycrd/releases/download/v0.3.15/lbrycrd-osx.zip"
|
|
|
|
wget "${LBRYCRDD_URL}" --output-document lbrycrd-osx.zip
|
2016-08-16 19:22:14 +02:00
|
|
|
unzip -o lbrycrd-osx.zip
|
2016-07-04 22:18:08 +02:00
|
|
|
python setup_app.py py2app --resources lbrycrdd
|
|
|
|
|
|
|
|
chmod +x "${DEST}/dist/LBRY.app/Contents/Resources/lbrycrdd"
|
2016-06-20 10:42:06 +02:00
|
|
|
|
|
|
|
echo "Removing i386 libraries"
|
|
|
|
|
|
|
|
remove_arch () {
|
2016-06-20 10:42:43 +02:00
|
|
|
if [[ `lipo "$2" -verify_arch "$1"` ]]; then
|
|
|
|
lipo -output build/lipo.tmp -remove "$1" "$2" && mv build/lipo.tmp "$2"
|
|
|
|
fi
|
2016-06-20 10:42:06 +02:00
|
|
|
}
|
2016-06-20 10:42:43 +02:00
|
|
|
|
|
|
|
for i in `find dist/LBRY.app/Contents/Resources/lib/python2.7/lib-dynload/ -name "*.so"`; do
|
|
|
|
remove_arch i386 $i
|
2016-06-20 10:42:06 +02:00
|
|
|
done
|
|
|
|
|
2016-06-20 10:42:43 +02:00
|
|
|
|
2016-06-20 10:42:06 +02:00
|
|
|
echo "Moving LBRYURIHandler.app into LBRY.app"
|
2016-06-20 10:42:43 +02:00
|
|
|
mv "${DEST}/dist/LBRYURIHandler.app" "${DEST}/dist/LBRY.app/Contents/Resources"
|
2016-06-20 10:42:06 +02:00
|
|
|
|
|
|
|
echo "Signing LBRY.app"
|
2016-06-20 10:42:43 +02:00
|
|
|
codesign -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRY.app/Contents/Frameworks/Python.framework/Versions/2.7"
|
|
|
|
codesign -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRY.app/Contents/Frameworks/libgmp.10.dylib"
|
|
|
|
codesign -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRY.app/Contents/MacOS/python"
|
|
|
|
# adding deep here as well because of subcomponent issues
|
|
|
|
codesign --deep -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRY.app/Contents/MacOS/LBRY"
|
|
|
|
codesign -vvvv "${DEST}/dist/LBRY.app"
|
2016-06-20 10:42:06 +02:00
|
|
|
|
|
|
|
rm -rf $tmp
|
|
|
|
mv dist/LBRY.app LBRY.app
|
2016-07-04 22:18:08 +02:00
|
|
|
rm -rf dist "${NAME}.${VERSION}.dmg"
|
2016-08-16 19:22:14 +02:00
|
|
|
dmgbuild -s dmg_settings.py "LBRY" "${NAME}.${VERSION}.dmg"
|