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 20:24:38 +02:00
|
|
|
echo "Updating lbrynet"
|
|
|
|
if [ -z ${TRAVIS_BUILD_DIR+x} ]; then
|
|
|
|
# building locally
|
2016-08-16 22:16:55 +02:00
|
|
|
mkdir -p $tmp
|
|
|
|
cd $tmp
|
2016-08-16 20:24:38 +02:00
|
|
|
git clone --depth 1 http://github.com/lbryio/lbry.git
|
|
|
|
cd lbry
|
|
|
|
LBRY="${tmp}/lbry"
|
|
|
|
else
|
|
|
|
# building on travis
|
|
|
|
ON_TRAVIS=true
|
|
|
|
cd ${TRAVIS_BUILD_DIR}
|
|
|
|
LBRY=${TRAVIS_BUILD_DIR}
|
|
|
|
fi
|
|
|
|
|
2016-08-16 20:41:04 +02:00
|
|
|
pip install wheel
|
2016-12-16 20:02:52 +01:00
|
|
|
MODULES="pyobjc-core==3.1.1 pyobjc-framework-Cocoa==3.1.1 pyobjc-framework-CFNetwork==3.1.1 pyobjc-framework-Quartz==3.1.1"
|
2016-08-16 20:16:25 +02:00
|
|
|
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
|
|
|
|
for MODULE in ${MODULES}; do
|
|
|
|
if [ ! -f "${WHEEL_DIR}"/${MODULE}.finished ]; then
|
|
|
|
pip wheel -w "${WHEEL_DIR}" ${MODULE}
|
|
|
|
touch "${WHEEL_DIR}"/${MODULE}.finished
|
2016-12-16 20:02:52 +01:00
|
|
|
pip install ${MODULE}
|
2016-08-16 20:16:25 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2016-12-16 20:02:52 +01:00
|
|
|
pip install $MODULES
|
|
|
|
|
2016-08-16 20:16:25 +02:00
|
|
|
|
pin dmgbuild version
When run with v1.2.0 the build fails with:
dmgbuild -s dmg_settings.py LBRY lbrynet.0.7.7.dmg
Traceback (most recent call last):
File "[..]/2.7/bin/dmgbuild", line 36, in <module>
dmgbuild.build_dmg(args.filename, args.volume_name, args.settings, defines=defines, lookForHiDPI=args.lookForHiDPI)
File "[..]/2.7/lib/python2.7/site-packages/dmgbuild/core.py", line 440, in build_dmg
d['.']['pBBk'] = background_bmk
File "[..]/2.7/lib/python2.7/site-packages/ds_store/store.py", line 1183, in __setitem__
entry_type = value[0]
File "[..]/2.7/lib/python2.7/site-packages/mac_alias/bookmark.py", line 365, in __getitem__
raise KeyError('Key not found')
KeyError: u'Key not found'
2016-12-02 23:28:06 +01:00
|
|
|
pip install dmgbuild==1.1.0
|
2016-08-16 22:03:41 +02:00
|
|
|
export PATH=${PATH}:/Library/Frameworks/Python.framework/Versions/2.7/bin
|
2016-08-16 19:52:55 +02:00
|
|
|
|
2016-12-17 02:01:53 +01:00
|
|
|
# pyopenssl is needed because OSX ships an old version of openssl by default
|
|
|
|
# and python will use it without pyopenssl
|
|
|
|
pip install PyOpenSSL jsonrpc certifi
|
2016-06-23 03:27:18 +02:00
|
|
|
|
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-11-01 19:26:03 +01:00
|
|
|
|
2016-12-17 02:00:25 +01:00
|
|
|
|
|
|
|
if [ -z ${SKIP_PYLINT+x} ]; then
|
|
|
|
pip install pylint
|
|
|
|
./run_pylint.sh packaging/osx/lbry-osx-app/lbrygui/
|
|
|
|
fi
|
2016-11-01 19:26:03 +01:00
|
|
|
|
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-12-17 02:00:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
if [ ! -d "py2app" ]; then
|
|
|
|
hg clone https://bitbucket.org/ronaldoussoren/py2app
|
|
|
|
cd py2app
|
|
|
|
hg checkout py2app-0.10
|
|
|
|
# this commit fixes a bug that should have been fixed as part of 0.10
|
|
|
|
hg graft 149c25c413420120d3f383a9e854a17bc10d96fd
|
|
|
|
pip install .
|
|
|
|
cd ..
|
|
|
|
rm -rf py2app
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
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-12-17 02:01:53 +01:00
|
|
|
# py2app will skip _cffi_backend without explicitly including it
|
|
|
|
# and without this, we will get SSL handshake errors when connecting
|
|
|
|
# to bittrex
|
|
|
|
python setup_app.py py2app -i _cffi_backend
|
2016-12-06 21:16:41 +01:00
|
|
|
|
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-12-17 02:00:25 +01:00
|
|
|
|
2016-12-21 22:00:10 +01:00
|
|
|
if [ -z ${SKIP_DMG+x} ]; then
|
2016-12-17 02:00:25 +01:00
|
|
|
rm -rf dist "${NAME}.${VERSION}.dmg"
|
|
|
|
dmgbuild -s dmg_settings.py "LBRY" "${NAME}.${VERSION}.dmg"
|
|
|
|
fi
|