Skip to content

Commit

Permalink
Update build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Mar 8, 2024
1 parent 67496f4 commit 047e842
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
15 changes: 13 additions & 2 deletions src/scripts/build_vfxplatform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -69,13 +78,15 @@ ${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
SDK=${SDK} \
DISTFILES=${DISTFILES} \
BUILD=${BUILD} \
VERSION=${VERSION} \
PKG_RPM=${BUILD_RPM} \
${BUILD}/build_vfxplatform_package.sh
14 changes: 11 additions & 3 deletions src/scripts/build_vfxplatform_friction.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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} \
Expand All @@ -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 .
Expand Down
10 changes: 8 additions & 2 deletions src/scripts/build_vfxplatform_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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}

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
7 changes: 3 additions & 4 deletions src/scripts/run_vfxplatform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 .)
Expand Down

0 comments on commit 047e842

Please sign in to comment.