Skip to content

Commit

Permalink
Fix Mac M1 build
Browse files Browse the repository at this point in the history
  • Loading branch information
devernay committed Dec 8, 2022
1 parent efbf350 commit cc7e15c
Show file tree
Hide file tree
Showing 9 changed files with 450 additions and 172 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,7 @@ xcshareddata/
# QTCreator
*QtCreator.*
moc_predefs.h

# shiboken-generated files
Engine/Qt5
Gui/Qt5
553 changes: 388 additions & 165 deletions tools/jenkins/build-OSX-installer.sh

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion tools/jenkins/build-natron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,8 @@ elif [ "$PKGOS" = "OSX" ]; then
$TIMEOUT -s KILL 1800 Tests/Tests || true
fi
else
$TIMEOUT -s KILL 1800 Tests/Tests
# Tests exit with a segfault on Qt5
$TIMEOUT -s KILL 1800 Tests/Tests || [ "$QT_VERSION_MAJOR" = 5 ]
fi
fi
set +x
Expand Down
12 changes: 8 additions & 4 deletions tools/jenkins/checkout-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,22 @@ function checkoutRepository() {
branch="$REPO_COMMIT"
fi
echo branch=$branch BRANCH=$REPO_BRANCH COMMIT=$REPO_COMMIT
deep=false
if [ ! -d "$REPO_LOCAL_DIRNAME" ]; then
# slow version:
#$TIMEOUT 1800 $GIT clone "$REPO_URL" "$REPO_LOCAL_DIRNAME"
# fast version (depth=1):
$TIMEOUT 1800 $GIT clone --depth 1 -b "${branch#tags/}" "$REPO_URL" "$REPO_LOCAL_DIRNAME"
if "$deep" && [ -z "$REPO_COMMIT" ]; then
$TIMEOUT 1800 $GIT clone "$REPO_URL" -b "${REPO_BRANCH}" "$REPO_LOCAL_DIRNAME"
else
# fast version (depth=1):
$TIMEOUT 1800 $GIT clone --depth 1 -b "${branch#tags/}" "$REPO_URL" "$REPO_LOCAL_DIRNAME"
fi
fi

cd "$REPO_LOCAL_DIRNAME"

if [ -z "$REPO_COMMIT" ]; then
$GIT checkout "$REPO_BRANCH"
REPO_COMMIT=$(git rev-parse HEAD)
echo "done, got commit $REPO_COMMIT"
else
$GIT checkout "$REPO_COMMIT"
fi
Expand Down
7 changes: 7 additions & 0 deletions tools/jenkins/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ fi


QT_VERSION_MAJOR=${QT_VERSION_MAJOR:-4}
if version_gt "${RELEASE_TAG:-0}" 2.5; then
QT_VERSION_MAJOR=5
fi
case "${GIT_BRANCH:-}" in
RB-2.[6789])
QT_VERSION_MAJOR=5
esac

unset LD_LIBRARY_PATH LD_RUN_PATH DYLD_LIBRARY_PATH LIBRARY_PATH CPATH PKG_CONFIG_PATH
# save the default PATH to avoid growing it each time we source this file
Expand Down
4 changes: 2 additions & 2 deletions tools/jenkins/compiler-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ if [ "$PKGOS" = "OSX" ]; then
exit 1
fi
if [ "$COMPILER" = "clang" ]; then
case "$osxver" in
9.*|10.*|11.*|12.*)
case "$macosx" in
9|10|11|12)
# GXX should be an openmp-capable compiler (to compile CImg.ofx)

# older version, using clang-3.4
Expand Down
32 changes: 32 additions & 0 deletions tools/jenkins/fixMacPortsDeps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -e # Exit immediately if a command exits with a non-zero status
set -u # Treat unset variables as an error when substituting.
#set -x # Print commands and their arguments as they are executed.
#set -v # Prints shell input lines as they are read.

if [ $# != 1 ]; then
echo "Usage: $0 /path/to/Application.app/Contents/MacOS/executable_to_fix"
echo "Move MacPorts dependencies of an app binary to Application.app/Contents/Frameworks"
exit 1
fi
exe=$1
pkglib="$(dirname $exe)/../Frameworks"
SDK_HOME="${SDK_HOME:-/opt/local}"

MPLIBS0="$(otool -L "$exe" | grep -F "${SDK_HOME}/lib" | grep -F -v ':' |sort|uniq |awk '{print $1}')"
# also add first-level and second-level dependencies
MPLIBS1="$(for i in $MPLIBS0; do echo "$i"; otool -L "$i" | grep -F "${SDK_HOME}/lib" | grep -F -v ':'; done |sort|uniq |awk '{print $1}')"
MPLIBS="$(for i in $MPLIBS1; do echo "$i"; otool -L "$i" | grep -F "${SDK_HOME}/lib" | grep -F -v ':'; done |sort|uniq |awk '{print $1}')"
for mplib in $MPLIBS; do
if [ ! -f "$mplib" ]; then
echo "missing $exe depend $mplib"
exit 1
fi
lib="$(echo "$mplib" | awk -F / '{print $NF}')"
if [ ! -f "$pkglib/${lib}" ]; then
echo "copying missing lib ${lib}"
cp "$mplib" "$pkglib/${lib}"
chmod +w "$pkglib/${lib}"
fi
install_name_tool -change "$mplib" "@executable_path/../Frameworks/$lib" "$exe"
done
3 changes: 3 additions & 0 deletions tools/jenkins/include/natron/NatronDyLd.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ setup_spawnattr(posix_spawnattr_t* spawnattr)

// Darwin version to OS X release:

// 22.x.x macOS 13.x Ventura
// 21.x.x macOS 12.x Monterey
// 20.x.x macOS 11.x Big Sur
// 19.x.x macOS 10.15.x Catalina
// 18.x.x macOS 10.14.x Mojave
// 17.x.x. macOS 10.13.x High Sierra
Expand Down
4 changes: 4 additions & 0 deletions tools/jenkins/launchBuildMain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ else
BUILD_6=false
fi

if [ -n "${BUILD_FROM:+z}" ] || [ -n "${BUILD_TO:+z}" ]; then
DEBUG_SCRIPTS=${DEBUG_SCRIPTS:-1}
fi

echo "-----------------------------------------------------------------------"
echo "NATRON JENKINS BUILDMASTER"
echo "-----------------------------------------------------------------------"
Expand Down

0 comments on commit cc7e15c

Please sign in to comment.