diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 16475a613..18f4a577c 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -894,10 +894,14 @@ jobs: working-directory: build shell: bash run: make install - #- name: Create DMG - # working-directory: build - # shell: bash - # run: make dmg + - name: Create DMG + working-directory: build + shell: bash + run: make dmg + - uses: actions/upload-artifact@v2 + with: + name: upload-macos + path: build/strawberry-*.dmg build-windows: @@ -1045,3 +1049,27 @@ jobs: - name: Build Windows installer working-directory: build run: makensis strawberry.nsi + + + upload-macos: + name: Upload macOS DMG + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/macos' + needs: + - build-macos + steps: + - uses: actions/checkout@v1.2.0 + - uses: actions/download-artifact@v2 + with: + path: uploads + - name: Install SSH keys + uses: shimataro/ssh-key-action@v2 + with: + known_hosts: ${{ secrets.KNOWN_HOSTS2 }} + key: ${{ secrets.SSH_KEY }} + - name: rsync + run: | + set -x + for i in $(find uploads -type f -name '*.dmg'); do + rsync -e "ssh -p 50220 -o StrictHostKeyChecking=no" -va $i travis@echoes.jkvinge.net:/home/travis/builds/macos/catalina/ + done diff --git a/.travis.yml b/.travis.yml index 3f87fb1a6..351915e10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,6 @@ sudo: required language: C++ os: - osx -services: - - docker compiler: - gcc @@ -27,8 +25,6 @@ before_install: - sudo ln -s /usr/local/Caskroom/sparkle/$(ls /usr/local/Caskroom/sparkle | head -n1)/Sparkle.framework.dSYM /Library/Frameworks/Sparkle.framework.dSYM - export Qt5_DIR=/usr/local/opt/qt5/lib/cmake - export Qt5LinguistTools_DIR=/usr/local/opt/qt5/lib/cmake/Qt5LinguistTools - - export PATH="/usr/local/opt/gettext/bin:$PATH" - - export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig/:/usr/local/opt/zlib/lib/pkgconfig:$PKG_CONFIG_PATH" - ls /usr/local/lib/gstreamer-1.0 before_script: - mkdir build @@ -42,9 +38,9 @@ after_success: - ls -lh strawberry*.dmg - if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ "$CC_FOR_BUILD" == "gcc" ]] && [ -f ~/.ssh/id_rsa ]; then if [[ "$TRAVIS_BRANCH" == "master" ]]; then - rsync -e "ssh -o StrictHostKeyChecking=no" -va strawberry*.dmg travis@echoes.jkvinge.net:/home/travis/builds/macos; + rsync -e "ssh -o StrictHostKeyChecking=no" -va strawberry*.dmg travis@echoes.jkvinge.net:/home/travis/builds/macos/highsierra/; elif [[ "$TRAVIS_BRANCH" == "macos" ]]; then - rsync -e "ssh -o StrictHostKeyChecking=no" -va strawberry*.dmg travis@echoes.jkvinge.net:/home/travis/builds/macos; + rsync -e "ssh -o StrictHostKeyChecking=no" -va strawberry*.dmg travis@echoes.jkvinge.net:/home/travis/builds/macos/highsierra/; fi fi diff --git a/cmake/Dmg.cmake b/cmake/Dmg.cmake index a4feaab19..309e9fea2 100644 --- a/cmake/Dmg.cmake +++ b/cmake/Dmg.cmake @@ -1,6 +1,8 @@ +execute_process(COMMAND ${CMAKE_SOURCE_DIR}/dist/macos/macversion.sh OUTPUT_VARIABLE MACOS_VERSION_PACKAGE OUTPUT_STRIP_TRAILING_WHITESPACE) + add_custom_target(dmg COMMAND /usr/local/opt/qt5/bin/macdeployqt strawberry.app COMMAND ${CMAKE_SOURCE_DIR}/dist/macos/macdeploy.py strawberry.app - COMMAND create-dmg --volname strawberry --background "${CMAKE_SOURCE_DIR}/dist/macos/dmg_background.png" --app-drop-link 450 218 --icon strawberry.app 150 218 --window-size 600 450 strawberry-${STRAWBERRY_VERSION_PACKAGE}.dmg strawberry.app + COMMAND create-dmg --volname strawberry --background "${CMAKE_SOURCE_DIR}/dist/macos/dmg_background.png" --app-drop-link 450 218 --icon strawberry.app 150 218 --window-size 600 450 strawberry-${STRAWBERRY_VERSION_PACKAGE}-${MACOS_VERSION_PACKAGE}.dmg strawberry.app WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) diff --git a/dist/macos/macdeploy.py b/dist/macos/macdeploy.py index 1a2ee2976..f387106ad 100755 --- a/dist/macos/macdeploy.py +++ b/dist/macos/macdeploy.py @@ -21,7 +21,6 @@ import logging import os import re import subprocess -import commands import sys import traceback @@ -156,7 +155,7 @@ class CouldNotFindGstreamerPluginError(Error): pass if len(sys.argv) < 2: - print 'Usage: %s ' % sys.argv[0] + print('Usage: %s ' % sys.argv[0]) bundle_dir = sys.argv[1] @@ -176,20 +175,21 @@ fixed_frameworks = set() def GetBrokenLibraries(binary): - #print "Checking libs for binary: %s" % binary - output = subprocess.Popen([OTOOL, '-L', binary], stdout=subprocess.PIPE).communicate()[0] + #print("Checking libs for binary: %s" % binary) + output = subprocess.Popen([OTOOL, '-L', binary], stdout=subprocess.PIPE).communicate()[0].decode('utf-8') broken_libs = {'frameworks': [], 'libs': []} for line in [x.split(' ')[0].lstrip() for x in output.split('\n')[1:]]: - #print "Checking line: %s" % line + #print("Checking line: %s" % line) if not line: # skip empty lines continue if os.path.basename(binary) == os.path.basename(line): - #print "mnope %s-%s" % (os.path.basename(binary), os.path.basename(line)) + #print("mnope %s-%s" % (os.path.basename(binary), os.path.basename(line))) continue if re.match(r'^\s*/System/', line): + #print("system framework: %s" % line) continue # System framework elif re.match(r'^\s*/usr/lib/', line): - #print "unix style system lib" + #print("unix style system lib: %s" % line) continue # unix style system library elif re.match(r'^\s*@executable_path', line) or re.match(r'^\s*@rpath', line) or re.match(r'^\s*@loader_path', line): # Potentially already fixed library @@ -206,8 +206,9 @@ def GetBrokenLibraries(binary): if not os.path.exists(os.path.join(frameworks_dir, relative_path)): broken_libs['frameworks'].append(relative_path) else: - print "GetBrokenLibraries Error: %s" % line + print("GetBrokenLibraries Error: %s" % line) elif re.search(r'\w+\.framework', line): + #print("framework: %s" % line) broken_libs['frameworks'].append(line) else: broken_libs['libs'].append(line) @@ -279,7 +280,7 @@ def FixLibrary(path): abs_path = FindLibrary(path) if abs_path == "": - print "Could not resolve %s, not fixing!" % path + print("Could not resolve %s, not fixing!" % path) return broken_libs = GetBrokenLibraries(abs_path) @@ -482,7 +483,7 @@ def main(): try: FixPlugin('strawberry-tagreader', '.') except: - print 'Failed to find blob: %s' % traceback.format_exc() + print('Failed to find blob: %s' % traceback.format_exc()) for plugin in GSTREAMER_PLUGINS: FixPlugin(FindGstreamerPlugin(plugin), 'gstreamer') @@ -495,11 +496,11 @@ def main(): #FixPlugin(FindQtPlugin(plugin), os.path.dirname(plugin)) if len(sys.argv) <= 2: - print 'Would run %d commands:' % len(commands) + print('Would run %d commands:' % len(commands)) for command in commands: - print ' '.join(command) + print(' '.join(command)) - #print 'OK?' + #print('OK?') #raw_input() for command in commands: diff --git a/dist/macos/macversion.sh b/dist/macos/macversion.sh new file mode 100755 index 000000000..96f985214 --- /dev/null +++ b/dist/macos/macversion.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +macos_version=$(sw_vers -productVersion| awk -F '[.]' '{print $2}') +macos_codenames=( +["13"]="highsierra" +["14"]="mojave" +["15"]="catalina" +) + +if [[ -n "${macos_codenames[$macos_version]}" ]]; then + echo "${macos_codenames[$macos_version]}" +else + echo "unknown" +fi