diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index cb58e1fd8..b0c865083 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -215,7 +215,7 @@ pipeline { /* Create source tarball. */ try { retry(10) { - node('Linux') { + node('Linux || macOS') { /* Run git clone. */ gitClone(repository[buildBranch], branch[buildBranch]) diff --git a/.ci/build.sh b/.ci/build.sh index eeb22c9c2..da4169516 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -52,8 +52,20 @@ make_tar() { # Install dependencies. if ! which tar xz > /dev/null 2>&1 then - which apt-get > /dev/null 2>&1 && DEBIAN_FRONTEND=noninteractive sudo apt-get install -y tar xz-utils + if which apt-get > /dev/null 2>&1 + then + sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get install -y tar xz-utils + sudo apt-get clean + elif which port > /dev/null 2>&1 + then + sudo port install gnutar xz + fi fi + + # Prefer gnutar on macOS. + local tar_cmd=tar + which gnutar > /dev/null 2>&1 && tar_cmd=gnutar # Determine the best supported compression type. local compression_flag= @@ -80,7 +92,7 @@ make_tar() { # --uid/gid (bsdtar) or even none at all (MSYS2 bsdtar). Account for such # flag differences by checking if they're mentioned on the help text. local ownership_flags= - local tar_help=$(tar --help 2>&1) + local tar_help=$("$tar_cmd" --help 2>&1) if echo $tar_help | grep -q -- --owner then local ownership_flags="--owner=0 --group=0" @@ -90,7 +102,7 @@ make_tar() { fi # Run tar. - tar -c $compression_flag -f "$1$compression_ext" $ownership_flags * + "$tar_cmd" -c $compression_flag -f "$1$compression_ext" $ownership_flags * return $? }