diff --git a/mac/deploy_mac.sh b/mac/deploy_mac.sh index a0f20f30..80163d4d 100755 --- a/mac/deploy_mac.sh +++ b/mac/deploy_mac.sh @@ -9,56 +9,56 @@ build_path="${root_path}/build" deploy_path="${root_path}/deploy" -cleanup() +cleanup() { - # Clean up previous deployments - rm -rf "${build_path}" - rm -rf "${deploy_path}" - mkdir -p "${build_path}" - mkdir -p "${deploy_path}" + # Clean up previous deployments + rm -rf "${build_path}" + rm -rf "${deploy_path}" + mkdir -p "${build_path}" + mkdir -p "${deploy_path}" } -build_app() +build_app() { # Build Jamulus qmake "${project_path}" -o "${build_path}/Makefile" "CONFIG+=release" ${@:2} - local target_name="$(cat "${build_path}/Makefile" | sed -nE 's/^QMAKE_TARGET *= *(.*)$/\1/p')" - local job_count="$(sysctl -n hw.ncpu)" - + local target_name="$(cat "${build_path}/Makefile" | sed -nE 's/^QMAKE_TARGET *= *(.*)$/\1/p')" + local job_count="$(sysctl -n hw.ncpu)" + make -f "${build_path}/Makefile" -C "${build_path}" -j "${job_count}" # Add Qt deployment dependencies macdeployqt "${build_path}/${target_name}.app" -verbose=2 -always-overwrite mv "${build_path}/${target_name}.app" "${deploy_path}" - - # Cleanup + + # Cleanup make -f "${build_path}/Makefile" -C "${build_path}" distclean - - # Return app name for installer image - eval "$1=${target_name}" + + # Return app name for installer image + eval "$1=${target_name}" } -build_installer_image() +build_installer_image() { - # Install dmgbuild (for the current user), this is required to build the installer image - python -m ensurepip --user --default-pip - python -m pip install --user dmgbuild - local dmgbuild_bin="$(python -c 'import site; print(site.USER_BASE)')/bin/dmgbuild" - - # Get Jamulus version - local app_version="$(cat "${project_path}" | sed -nE 's/^VERSION *= *(.*)$/\1/p')" - - # Build installer image - "${dmgbuild_bin}" -s "${macdeploy_path}/deployment_settings.py" -D background="${resources_path}/installerbackground.png" \ - -D app_path="${deploy_path}/$1.app" -D server_path="${deploy_path}/$2.app" \ - -D license="${root_path}/COPYING" "$1 Installer" "${deploy_path}/$1-${app_version}-installer-mac.dmg" + # Install dmgbuild (for the current user), this is required to build the installer image + python -m ensurepip --user --default-pip + python -m pip install --user dmgbuild + local dmgbuild_bin="$(python -c 'import site; print(site.USER_BASE)')/bin/dmgbuild" + + # Get Jamulus version + local app_version="$(cat "${project_path}" | sed -nE 's/^VERSION *= *(.*)$/\1/p')" + + # Build installer image + "${dmgbuild_bin}" -s "${macdeploy_path}/deployment_settings.py" -D background="${resources_path}/installerbackground.png" \ + -D app_path="${deploy_path}/$1.app" -D server_path="${deploy_path}/$2.app" \ + -D license="${root_path}/COPYING" "$1 Installer" "${deploy_path}/$1-${app_version}-installer-mac.dmg" } # Check that we are running from the correct location -if [ ! -f "${project_path}" ]; +if [ ! -f "${project_path}" ]; then echo Please run this script from the Qt project directory where "$(basename ${project_path})" is located. echo Usage: mac/$(basename $0)