|
1 | 1 | #!/bin/bash |
2 | 2 | set -eu -o pipefail |
3 | 3 |
|
| 4 | +# Dependency versions |
| 5 | +CREATEDMG_VERSION="1.2.2" |
| 6 | + |
4 | 7 | root_path=$(pwd) |
5 | 8 | project_path="${root_path}/Jamulus.pro" |
6 | 9 | resources_path="${root_path}/src/res" |
@@ -138,12 +141,8 @@ build_installer_image() { |
138 | 141 | local client_target_name="${1}" |
139 | 142 | local server_target_name="${2}" |
140 | 143 |
|
141 | | - # Install create-dmg via brew. brew needs to be installed first. |
142 | | - # Download and later install. This is done to make caching possible |
143 | | - # brew_install_pinned "create-dmg" "1.1.0" |
144 | | - |
145 | | - # FIXME: Currently caching is disabled due to an error in the extract step |
146 | | - brew install create-dmg |
| 144 | + # Install create-dmg |
| 145 | + github_install_dependency "create-dmg/create-dmg" "v${CREATEDMG_VERSION}" |
147 | 146 |
|
148 | 147 | # Build installer image |
149 | 148 |
|
@@ -193,26 +192,24 @@ build_storesign_pkg() { |
193 | 192 | # productbuild --sign "${macinst_cert_name}" --keychain build.keychain --component "${macapp_deploy_path}/${server_target_name}.app" /Applications "${deploy_path}/${server_target_name}_${JAMULUS_BUILD_VERSION}.pkg" |
194 | 193 | } |
195 | 194 |
|
196 | | -brew_install_pinned() { |
197 | | - local pkg="$1" |
198 | | - local version="$2" |
199 | | - local pkg_version="${pkg}@${version}" |
200 | | - local brew_bottle_dir="${HOME}/Library/Cache/jamulus-homebrew-bottles" |
201 | | - local formula="/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Formula/${pkg_version}.rb" |
202 | | - echo "Installing ${pkg_version}" |
203 | | - mkdir -p "${brew_bottle_dir}" |
204 | | - pushd "${brew_bottle_dir}" |
205 | | - if ! find . | grep -qF "${pkg_version}--"; then |
206 | | - echo "Building fresh ${pkg_version} package" |
207 | | - brew developer on # avoids a warning |
208 | | - brew extract --version="${version}" "${pkg}" homebrew/cask |
209 | | - brew install --build-bottle --formula "${formula}" |
210 | | - brew bottle "${formula}" |
211 | | - # In order to keep the result the same, we uninstall and re-install without --build-bottle later |
212 | | - # (--build-bottle is documented to change behavior, e.g. by not running postinst scripts). |
213 | | - brew uninstall "${pkg_version}" |
| 195 | +github_install_dependency() { |
| 196 | + local repository="${1}" |
| 197 | + local version="${2}" |
| 198 | + dependency_root_folder="${HOME}/Library/Cache/jamulus-dependencies/${repository}/${version}" |
| 199 | + if [[ ! -d "${dependency_root_folder}" ]]; then |
| 200 | + TMPDOWNLOADDIR=$(mktemp -d '/tmp/ghdep.XXXXXX') |
| 201 | + # Download release |
| 202 | + mkdir -p "${dependency_root_folder}" |
| 203 | + wget "https://github.com/${repository}/archive/refs/tags/${version}.tar.gz" -O "${TMPDOWNLOADDIR}/dep.tar.gz" |
| 204 | + |
| 205 | + # Unpack release and clean up |
| 206 | + tar -xvzf "${TMPDOWNLOADDIR}/dep.tar.gz" -C "${TMPDOWNLOADDIR}/" |
| 207 | + rm "${TMPDOWNLOADDIR}/dep.tar.gz" |
| 208 | + # Since github creates a folder with the version number in the tar, copy all contents from this folder into ${dependency_root_folder} |
| 209 | + mv "${TMPDOWNLOADDIR}"/*/* "${dependency_root_folder}/" |
214 | 210 | fi |
215 | | - brew install "${pkg_version}--"* |
| 211 | + pushd "${dependency_root_folder}" |
| 212 | + sudo make install |
216 | 213 | popd |
217 | 214 | } |
218 | 215 |
|
|
0 commit comments