From 047e8423ac63b3f53a3bd22be4f1c2a49cce9b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Fri, 8 Mar 2024 21:04:08 +0100 Subject: [PATCH] Update build scripts --- src/scripts/build_vfxplatform.sh | 15 +++++++++++++-- src/scripts/build_vfxplatform_friction.sh | 14 +++++++++++--- src/scripts/build_vfxplatform_package.sh | 10 ++++++++-- src/scripts/run_vfxplatform.sh | 7 +++---- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/scripts/build_vfxplatform.sh b/src/scripts/build_vfxplatform.sh index e1d0e6e83..33b990540 100755 --- a/src/scripts/build_vfxplatform.sh +++ b/src/scripts/build_vfxplatform.sh @@ -32,6 +32,15 @@ MKJOBS=${MKJOBS:-4} SDK_VERSION=${SDK_VERSION:-""} ONLY_SDK=${ONLY_SDK:-0} SDK_TAR="${DISTFILES}/friction-vfxplatform-sdk-${SDK_VERSION}.tar" +BUILD_RPM=${REL} +DOWNLOAD_SDK=${DOWNLOAD_SDK:-0} + +# Download SDK +if [ "${DOWNLOAD_SDK}" = 1 ] && [ ! -f "${SDK_TAR}.xz" ]; then + (cd ${DISTFILES} ; + wget https://download.friction.graphics/distfiles/vfxplatform/friction-vfxplatform-sdk-${SDK_VERSION}.tar.xz + ) +fi # Build SDK if [ ! -d "${SDK}" ]; then @@ -69,8 +78,9 @@ ${BUILD}/build_vfxplatform_friction.sh # Get Friction version VERSION=`cat ${BUILD}/friction/build-vfxplatform/version.txt` if [ "${REL}" != 1 ]; then - GIT=`(cd ${BUILD}/friction ; git rev-parse --short HEAD)` - VERSION="${VERSION}-dev-${GIT}" + GIT_COMMIT=`(cd ${BUILD}/friction ; git rev-parse --short HEAD)` + GIT_BRANCH=`(cd ${BUILD}/friction ; git rev-parse --abbrev-ref HEAD)` + VERSION="${VERSION}-${GIT_BRANCH}-${GIT_COMMIT}" fi # Package Friction @@ -78,4 +88,5 @@ SDK=${SDK} \ DISTFILES=${DISTFILES} \ BUILD=${BUILD} \ VERSION=${VERSION} \ +PKG_RPM=${BUILD_RPM} \ ${BUILD}/build_vfxplatform_package.sh diff --git a/src/scripts/build_vfxplatform_friction.sh b/src/scripts/build_vfxplatform_friction.sh index 98c962458..5813f864c 100755 --- a/src/scripts/build_vfxplatform_friction.sh +++ b/src/scripts/build_vfxplatform_friction.sh @@ -76,6 +76,15 @@ fi cp -a ${SDK}/include/libunw* /usr/include/ cp -a ${SDK}/lib/libunw* /usr/lib64/ +CMAKE_EXTRA="" + +GIT_COMMIT=`git rev-parse --short HEAD` +GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` + +if [ "${REL}" != 1 ]; then + CMAKE_EXTRA="-DGIT_COMMIT=${GIT_COMMIT} -DGIT_BRANCH=${GIT_BRANCH}" +fi + cmake -GNinja \ -DCMAKE_INSTALL_PREFIX=${SDK} \ -DCMAKE_PREFIX_PATH=${SDK} \ @@ -88,12 +97,11 @@ cmake -GNinja \ -DQSCINTILLA_LIBRARIES=qscintilla2_friction_qt5 \ -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_C_COMPILER=clang \ -.. +${CMAKE_EXTRA} .. VERSION=`cat version.txt` if [ "${REL}" != 1 ]; then - GIT=`git rev-parse --short HEAD` - VERSION="${VERSION}-dev-${GIT}" + VERSION="${VERSION}-${GIT_BRANCH}-${GIT_COMMIT}" fi cmake --build . diff --git a/src/scripts/build_vfxplatform_package.sh b/src/scripts/build_vfxplatform_package.sh index fe30f884a..ba7ac87fd 100755 --- a/src/scripts/build_vfxplatform_package.sh +++ b/src/scripts/build_vfxplatform_package.sh @@ -26,6 +26,8 @@ BUILD=${BUILD:-"${HOME}"} VERSION=${VERSION:-""} APPID="graphics.friction.Friction" FRICTION_PKG=friction-${VERSION} +PKG_RPM=${PKG_RPM:-1} +PKG_APP=${PKG_APP:-1} if [ "${VERSION}" = "" ]; then echo "Missing version" @@ -132,6 +134,8 @@ strip -s ${BUILD}/${FRICTION_PKG}/opt/friction/bin/friction strip -s ${BUILD}/${FRICTION_PKG}/opt/friction/lib/*so* strip -s ${BUILD}/${FRICTION_PKG}/opt/friction/plugins/*/*.so +# RPM +if [ "${PKG_RPM}" = 1 ]; then cd ${BUILD} tar cvf ${FRICTION_PKG}.tar ${FRICTION_PKG} @@ -142,9 +146,9 @@ fi mv ${FRICTION_PKG}.tar ${HOME}/rpmbuild/SOURCES/ cat ${BUILD}/friction/src/scripts/vfxplatform.spec | sed 's/__FRICTION_PKG_VERSION__/'${PKG_VERSION}'/g;s/__FRICTION_VERSION__/'${VERSION}'/g;s/__APPID__/'${APPID}'/g' > rpm.spec -# RPM rpmbuild -bb rpm.spec cp -a ${HOME}/rpmbuild/RPMS/*/*.rpm ${DISTFILES}/builds/ +fi # Portable FRICTION_PORTABLE=${FRICTION_PKG}-linux-X11-x86_64 @@ -187,6 +191,7 @@ xz -9 ${FRICTION_PORTABLE}.tar cp -a ${FRICTION_PORTABLE}.tar.xz ${DISTFILES}/builds/ # AppImage +if [ "${PKG_APP}" = 1 ]; then (cd ${FRICTION_PORTABLE_DIR} ; rm -f friction mkdir usr @@ -199,5 +204,6 @@ ln -sf usr/share/icons/hicolor/256x256/apps/${APPID}.png .DirIcon tar xf ${DISTFILES}/appimagetool.tar.xz ARCH=x86_64 ./appimagetool/AppRun ${FRICTION_PORTABLE} cp -a *.AppImage ${DISTFILES}/builds/ +fi -echo "PKG DONE" +echo "FRICTION PACKAGE DONE" diff --git a/src/scripts/run_vfxplatform.sh b/src/scripts/run_vfxplatform.sh index bfe4dc2ae..eb2fcf73d 100755 --- a/src/scripts/run_vfxplatform.sh +++ b/src/scripts/run_vfxplatform.sh @@ -8,16 +8,15 @@ COMMIT=${COMMIT:-""} TAG=${TAG:-""} MKJOBS=${JOBS:-4} ONLY_SDK=${ONLY_SDK:-0} - +DOWNLOAD_SDK=${DOWNLOAD_SDK:-0} SDK_VERSION="20240123" DOCKER="docker run" -DOCKER="${DOCKER} -e REL=${REL} -e MKJOBS=${JOBS} -e SDK_VERSION=${SDK_VERSION} -e ONLY_SDK=${ONLY_SDK} -e BRANCH=${BRANCH} -e COMMIT=${COMMIT} -e TAG=${TAG}" +DOCKER="${DOCKER} -e REL=${REL} -e MKJOBS=${JOBS} -e SDK_VERSION=${SDK_VERSION} -e ONLY_SDK=${ONLY_SDK} -e DOWNLOAD_SDK=${DOWNLOAD_SDK} -e BRANCH=${BRANCH} -e COMMIT=${COMMIT} -e TAG=${TAG}" DOCKER="${DOCKER} -t --mount type=bind,source=${CWD}/distfiles,target=/mnt" if [ ! -d "${CWD}/distfiles" ]; then - echo "No distfiles!" - exit 1 + mkdir -p ${CWD}/distfiles fi (cd src/scripts; docker build -t friction-vfxplatform -f Dockerfile.vfxplatform .)