From f16111369f27562ab01dd220dc96afcc8f924f70 Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Mon, 20 Jun 2016 03:42:43 -0500 Subject: [PATCH] Update build script setup_uri_handler.py has moved, update build script to reflect again, setup_uri_handler changed location remove pipe to /dev/null try updating openssl try deep signing another file renamed install a dependency prereqs install requirements install certifi only install requirements on osx thin binaries only if they're actually fat --- .travis.yml | 12 +++-- packaging/osx/lbry-osx-app/build_app.sh | 63 ------------------------- packaging/osx/lbry-osx-app/setup_app.sh | 47 ++++++++++-------- 3 files changed, 35 insertions(+), 87 deletions(-) delete mode 100755 packaging/osx/lbry-osx-app/build_app.sh diff --git a/.travis.yml b/.travis.yml index 6af0a761e..9c3dc638f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,13 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew install python; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sudo pip install --upgrade pip virtualenv; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then virtualenv $HOME/venv && source $HOME/venv/bin/activate; fi - + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew outdated gmp || brew upgrade gmp; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew outdated openssl || brew upgrade openssl; fi + # the default py2app (v0.9) has a bug that is fixed in the head of /metachris/py2app + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip install git+https://github.com/metachris/py2app; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip install jsonrpc; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip install -r requirements.txt; fi + install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./packaging/travis/install_dependencies_and_run_tests.sh; fi @@ -28,10 +34,6 @@ before_script: script: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then bash packaging/ubuntu/ubuntu_package_setup.sh -t; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade gmp; fi - # the default py2app (v0.9) has a bug that is fixed in the head of /metachris/py2app - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip install git+https://github.com/metachris/py2app; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip install jsonrpc; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cd packaging/osx/lbry-osx-app && ./setup_app.sh && cd $TRAVIS_BUILD_DIR; fi # fail the build if this is a build for a tag and we don't have the versions matching - if [[ -n "${TRAVIS_TAG}" ]]; then if [[ "v`python setup.py -V`" = "${TRAVIS_TAG}" ]]; then true; else false; fi; fi diff --git a/packaging/osx/lbry-osx-app/build_app.sh b/packaging/osx/lbry-osx-app/build_app.sh deleted file mode 100755 index 59828f6b4..000000000 --- a/packaging/osx/lbry-osx-app/build_app.sh +++ /dev/null @@ -1,63 +0,0 @@ -dest=`pwd` -tmp="${dest}/build" -id=`cat id.conf` - -rm -rf build dist LBRY.app - -mkdir -p $tmp -cd $tmp - -echo "Updating lbryum" -git clone --depth 1 http://github.com/lbryio/lbryum.git -cd lbryum -python setup.py install &>/dev/null -cd .. -echo "Updating lbrynet" -git clone --depth 1 -b development http://github.com/lbryio/lbry.git -cd lbry -python setup.py install &>/dev/null - -cd $dest -echo "Building URI Handler" -python setup_uri_handler.py py2app &>/dev/null - -echo "Signing URI Handler" -codesign -s "Developer ID Application: LBRY Inc (${id})" -f "dist/LBRYURIHandler.app/Contents/Frameworks/Python.framework/Versions/2.7" -codesign -s "Developer ID Application: LBRY Inc (${id})" -f "dist/LBRYURIHandler.app/Contents/MacOS/python" -codesign -s "Developer ID Application: LBRY Inc (${id})" -f "dist/LBRYURIHandler.app/Contents/MacOS/LBRYURIHandler" -codesign -vvvv "dist/LBRYURIHandler.app" -mv "dist/LBRYURIHandler.app" "LBRYURIHandler.app" -rm -rf build dist - -echo "Building app" -python setup_app.py py2app &>/dev/null - -echo "Moving in correct libgmp" -rm "${dest}/dist/LBRY.app/Contents/Frameworks/libgmp.10.dylib" -cp "${dest}/libgmp.10.dylib" "${dest}/dist/LBRY.app/Contents/Frameworks" - -echo "Removing i386 libraries" - -remove_arch () { - lipo -output build/lipo.tmp -remove "$1" "$2" && mv build/lipo.tmp "$2" -} -for i in dist/LBRY.app/Contents/Resources/lib/python2.7/lib-dynload/* ; do - #remove_arch ppc ${i} - remove_arch i386 ${i} -done - -echo "Moving LBRYURIHandler.app into LBRY.app" -mv "${dest}/LBRYURIHandler.app" "${dest}/dist/LBRY.app/Contents/Resources" - -echo "Signing LBRY.app" -codesign -s "Developer ID Application: LBRY Inc (${id})" -f "${dest}/dist/LBRY.app/Contents/Frameworks/Python.framework/Versions/2.7" -codesign -s "Developer ID Application: LBRY Inc (${id})" -f "${dest}/dist/LBRY.app/Contents/Frameworks/libgmp.10.dylib" -codesign -s "Developer ID Application: LBRY Inc (${id})" -f "${dest}/dist/LBRY.app/Contents/MacOS/python" -codesign -s "Developer ID Application: LBRY Inc (${id})" -f "${dest}/dist/LBRY.app/Contents/MacOS/LBRY" -codesign -vvvv "${dest}/dist/LBRY.app" - -rm -rf $tmp -mv dist/LBRY.app LBRY.app -rm -rf dist - -chown -R ${SUDO_USER} LBRY.app \ No newline at end of file diff --git a/packaging/osx/lbry-osx-app/setup_app.sh b/packaging/osx/lbry-osx-app/setup_app.sh index d4141326a..b8c601522 100755 --- a/packaging/osx/lbry-osx-app/setup_app.sh +++ b/packaging/osx/lbry-osx-app/setup_app.sh @@ -3,8 +3,8 @@ set -o errexit set -o xtrace -dest=`pwd` -tmp="${dest}/build" +DEST=`pwd` +tmp="${DEST}/build" rm -rf build dist LBRY.app @@ -23,41 +23,50 @@ else LBRY=${TRAVIS_BUILD_DIR} fi python setup.py install + echo "Building URI Handler" +cd "${DEST}" rm -rf build dist python setup_uri_handler.py py2app echo "Signing URI Handler" -codesign -s "${LBRY_DEVELOPER_ID}" -f "${LBRY}/dist/LBRYURIHandler.app/Contents/Frameworks/Python.framework/Versions/2.7" -codesign -s "${LBRY_DEVELOPER_ID}" -f "${LBRY}/dist/LBRYURIHandler.app/Contents/MacOS/python" -codesign -s "${LBRY_DEVELOPER_ID}" -f "${LBRY}/dist/LBRYURIHandler.app/Contents/MacOS/LBRYURIHandler" -codesign -vvvv "${LBRY}/dist/LBRYURIHandler.app" +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" -cd $dest -python setup.py py2app &>/dev/null +# why isn't certifi installed automatically by setup_app.py? +pip install certifi +python setup_app.py py2app echo "Moving in correct libgmp" -rm "${dest}/dist/LBRY.app/Contents/Frameworks/libgmp.10.dylib" -cp "${dest}/libgmp.10.dylib" "${dest}/dist/LBRY.app/Contents/Frameworks" +rm "${DEST}/dist/LBRY.app/Contents/Frameworks/libgmp.10.dylib" +cp "${DEST}/libgmp.10.dylib" "${DEST}/dist/LBRY.app/Contents/Frameworks" echo "Removing i386 libraries" remove_arch () { - lipo -output build/lipo.tmp -remove "$1" "$2" && mv build/lipo.tmp "$2" + if [[ `lipo "$2" -verify_arch "$1"` ]]; then + lipo -output build/lipo.tmp -remove "$1" "$2" && mv build/lipo.tmp "$2" + fi } -for i in dist/LBRY.app/Contents/Resources/lib/python2.7/lib-dynload/* ; do - remove_arch i386 ${i} + +for i in `find dist/LBRY.app/Contents/Resources/lib/python2.7/lib-dynload/ -name "*.so"`; do + remove_arch i386 $i done + echo "Moving LBRYURIHandler.app into LBRY.app" -mv "${LBRY}/dist/LBRYURIHandler.app" "${dest}/dist/LBRY.app/Contents/Resources" +mv "${DEST}/dist/LBRYURIHandler.app" "${DEST}/dist/LBRY.app/Contents/Resources" echo "Signing LBRY.app" -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" -codesign -s "${LBRY_DEVELOPER_ID}" -f "${dest}/dist/LBRY.app/Contents/MacOS/LBRY" -codesign -vvvv "${dest}/dist/LBRY.app" +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" rm -rf $tmp mv dist/LBRY.app LBRY.app