Skip to content

Commit

Permalink
More build updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Oct 8, 2023
1 parent 936db1b commit a2bc876
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/scripts/Dockerfile.vfxplatform
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ FROM centos:centos7.9.2009
RUN yum -y update
RUN yum -y install centos-release-scl
RUN yum -y group install "Development Tools"
RUN yum -y install pulseaudio-libs-devel wget git yasm python3 fontconfig-devel zlib-devel autoconf automake xz devtoolset-7 llvm-toolset-7.0 tree curl libICE-devel libSM-devel libX11-devel libXau-devel libXdamage-devel libXext-devel libXfixes-devel libXi-devel libXxf86vm-devel libdrm-devel libxcb-devel mesa-libGL-devel xorg-x11-proto-devel
RUN yum -y install pulseaudio-libs-devel wget rpmdevtools git yasm python3 fontconfig-devel zlib-devel autoconf automake xz devtoolset-7 llvm-toolset-7.0 tree curl libICE-devel libSM-devel libX11-devel libXau-devel libXdamage-devel libXext-devel libXfixes-devel libXi-devel libXxf86vm-devel libdrm-devel libxcb-devel mesa-libGL-devel xorg-x11-proto-devel
RUN yum -y install epel-release
RUN yum -y install fakeroot dpkg dpkg-dev rpmdevtools
RUN yum -y install fakeroot dpkg alien
RUN ln -sf /usr/bin/python3 /usr/bin/python
RUN rm -f /usr/lib64/pkgconfig/libpng.pc
RUN rm -f /usr/lib64/pkgconfig/libpng15.pc
Expand Down
40 changes: 40 additions & 0 deletions src/scripts/build_vfxplatform.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
#
# Friction - https://friction.graphics
#
# Copyright (c) Friction contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

set -e -x

CWD=${CWD:-`pwd`}
SDK=${SDK:-"/opt/friction"}
DISTFILES=${DISTFILES:-"/mnt"}
BUILD=${BUILD:-"${HOME}"}

# Build SDK
# CWD=${CWD} SDK=${SDK} DISTFILES=${DISTFILES} ${CWD}/build_vfxplatform_skia.sh
# CWD=${CWD} SDK=${SDK} DISTFILES=${DISTFILES} ${CWD}/build_vfxplatform_sdk.sh
# CWD=${CWD} SDK=${SDK} DISTFILES=${DISTFILES} ${CWD}/build_vfxplatform_ffmpeg.sh

# Build friction
CWD=${CWD} SDK=${SDK} BUILD=${BUILD} ${CWD}/build_vfxplatform_friction.sh

# Get Friction version
VERSION=`cat ${BUILD}/friction/build-vfxplatform/version.txt`

# Package Friction (TAR)
CWD=${CWD} SDK=${SDK} BUILD=${BUILD} VERSION=${VERSION} ${CWD}/build_vfxplatform_package_tar.sh
3 changes: 0 additions & 3 deletions src/scripts/build_vfxplatform_ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ SHARED_CONFIGURE="${COMMON_CONFIGURE} --enable-shared --disable-static"
STATIC_CONFIGURE="${COMMON_CONFIGURE} --disable-shared --enable-static"
DEFAULT_CONFIGURE="${SHARED_CONFIGURE}"

# REMOVE
# libpng.pc libpng15.pc png.h pngconf.h pnglibconf.h

# nasm
if [ ! -f "${SDK}/bin/nasm" ]; then
cd ${SRC}
Expand Down
23 changes: 12 additions & 11 deletions src/scripts/build_vfxplatform_friction.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ set -e -x
source /opt/rh/devtoolset-7/enable
gcc -v

CWD=`pwd`
CWD=${CWD:-`pwd`}
SDK=${SDK:-"/opt/friction"}
SRC=${SDK}/src
BUILD=${BUILD:-"${HOME}"}
CHECKOUT=${CHECKOUT:-"main"}

export PATH="${SDK}/bin:${PATH}"
export PKG_CONFIG_PATH="${SDK}/lib/pkgconfig"
Expand All @@ -36,17 +37,17 @@ if [ ! -d "${SDK}" ]; then
exit 1
fi

if [ ! -d "${SRC}" ]; then
mkdir -p ${SRC}
if [ ! -d "${BUILD}" ]; then
mkdir -p ${BUILD}
fi

if [ ! -d "${SRC}/friction" ]; then
(cd ${SRC} ; git clone https://github.com/friction2d/friction)
if [ ! -d "${BUILD}/friction" ]; then
(cd ${BUILD} ; git clone https://github.com/friction2d/friction)
fi

cd ${SRC}/friction
cd ${BUILD}/friction
git fetch --all
git checkout main
git checkout ${CHECKOUT}
git pull
git submodule update -i docs

Expand Down Expand Up @@ -78,6 +79,6 @@ FRICTION_VERSION=`cat version.txt`
cmake --build .

FRICTION_INSTALL_DIR=friction-${FRICTION_VERSION}
mkdir -p ${CWD}/${FRICTION_INSTALL_DIR}/opt/friction/{bin,lib,share} || true
mkdir -p ${CWD}/${FRICTION_INSTALL_DIR}/opt/friction/plugins/{audio,generic,imageformats,platforminputcontexts,platforms,xcbglintegrations} || true
DESTDIR=${CWD}/${FRICTION_INSTALL_DIR} cmake --build . --target install
mkdir -p ${BUILD}/${FRICTION_INSTALL_DIR}/opt/friction/{bin,lib,share} || true
mkdir -p ${BUILD}/${FRICTION_INSTALL_DIR}/opt/friction/plugins/{audio,generic,imageformats,platforminputcontexts,platforms,xcbglintegrations} || true
DESTDIR=${BUILD}/${FRICTION_INSTALL_DIR} cmake --build . --target install
97 changes: 80 additions & 17 deletions src/scripts/build_vfxplatform_package_tar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@

set -e -x

CWD=`pwd`
CWD=${CWD:-`pwd`}
SDK=${SDK:-"/opt/friction"}
FRICTION_PKG=${FRICTION_PKG:-friction-0.9.5}
BUILD=${BUILD:-"${HOME}"}
VERSION=${VERSION:-""}
FRICTION_PKG=friction-${VERSION}

if [ ! -d "${CWD}/${FRICTION_PKG}" ]; then
if [ "${VERSION}" = "" ]; then
echo "Missing version"
exit 1
fi

if [ ! -d "${BUILD}/${FRICTION_PKG}" ]; then
echo "Missing Friction build"
exit 1
fi
Expand All @@ -33,9 +40,9 @@ export PATH="${SDK}/bin:${PATH}"
export PKG_CONFIG_PATH="${SDK}/lib/pkgconfig"
export LD_LIBRARY_PATH="${SDK}/lib:${LD_LIBRARY_PATH}"

BIN_DIR=${CWD}/${FRICTION_PKG}/opt/friction/bin
LIB_DIR=${CWD}/${FRICTION_PKG}/opt/friction/lib
PLUG_DIR=${CWD}/${FRICTION_PKG}/opt/friction/plugins
BIN_DIR=${BUILD}/${FRICTION_PKG}/opt/friction/bin
LIB_DIR=${BUILD}/${FRICTION_PKG}/opt/friction/lib
PLUG_DIR=${BUILD}/${FRICTION_PKG}/opt/friction/plugins

APP_DEPENDS=`(cd ${BIN_DIR} ; ldd friction | awk '{print $3}' | grep ${SDK})`

Expand Down Expand Up @@ -95,27 +102,83 @@ HICOLOR="
scalable
"

mkdir -p ${CWD}/${FRICTION_PKG}/usr/bin
mkdir -p ${CWD}/${FRICTION_PKG}/usr/share/mime/packages
mkdir -p ${CWD}/${FRICTION_PKG}/usr/share/applications
mkdir -p ${BUILD}/${FRICTION_PKG}/usr/bin
mkdir -p ${BUILD}/${FRICTION_PKG}/usr/share/mime/packages
mkdir -p ${BUILD}/${FRICTION_PKG}/usr/share/applications

(cd ${CWD}/${FRICTION_PKG}/usr/bin; ln -sf ../../opt/friction/bin/friction .)
(cd ${CWD}/${FRICTION_PKG}/usr/share/mime/packages ; ln -sf ../../../../opt/friction/share/mime/packages/friction.xml .)
(cd ${CWD}/${FRICTION_PKG}/usr/share/applications; ln -sf ../../../opt/friction/share/applications/friction.desktop .)
(cd ${BUILD}/${FRICTION_PKG}/usr/bin; ln -sf ../../opt/friction/bin/friction .)
(cd ${BUILD}/${FRICTION_PKG}/usr/share/mime/packages ; ln -sf ../../../../opt/friction/share/mime/packages/friction.xml .)
(cd ${BUILD}/${FRICTION_PKG}/usr/share/applications; ln -sf ../../../opt/friction/share/applications/friction.desktop .)

for icon in ${HICOLOR}; do
ICON_SUFFIX=png
if [ "${icon}" = "scalable" ]; then
ICON_SUFFIX=svg
fi
mkdir -p ${CWD}/${FRICTION_PKG}/usr/share/icons/hicolor/${icon}/{apps,mimetypes}
ICON_APP_DIR=${CWD}/${FRICTION_PKG}/usr/share/icons/hicolor/${icon}/apps
ICON_MIME_DIR=${CWD}/${FRICTION_PKG}/usr/share/icons/hicolor/${icon}/mimetypes
mkdir -p ${BUILD}/${FRICTION_PKG}/usr/share/icons/hicolor/${icon}/{apps,mimetypes}
ICON_APP_DIR=${BUILD}/${FRICTION_PKG}/usr/share/icons/hicolor/${icon}/apps
ICON_MIME_DIR=${BUILD}/${FRICTION_PKG}/usr/share/icons/hicolor/${icon}/mimetypes
(cd ${ICON_APP_DIR} ; ln -sf ../../../../../../opt/friction/share/icons/hicolor/${icon}/apps/friction.${ICON_SUFFIX} .)
(cd ${ICON_MIME_DIR} ; ln -sf ../../../../../../opt/friction/share/icons/hicolor/${icon}/mimetypes/application-x-friction.${ICON_SUFFIX} .)
done

cd ${CWD}
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

cd ${BUILD}
tar cvf ${FRICTION_PKG}.tar ${FRICTION_PKG}

echo "PKG TAR DONE"
if [ ! -d "${HOME}/rpmbuild/SOURCES" ]; then
mkdir -p ${HOME}/rpmbuild/SOURCES
fi

mv ${FRICTION_PKG}.tar ${HOME}/rpmbuild/SOURCES/
cat ${CWD}/vfxplatform.spec | sed 's/__FRICTION_VERSION__/'${VERSION}'/g' > rpm.spec
RPM_PKG=friction-${VERSION}-1.x86_64.rpm
DEB_PKG=friction_${VERSION}-1_amd64.deb

rpmbuild -bb rpm.spec
rm -rf deb || true
mkdir deb
(cd deb; fakeroot alien -k --to-deb --scripts ${HOME}/rpmbuild/RPMS/x86_64/${RPM_PKG})

FRICTION_PORTABLE=${FRICTION_PKG}-portable-x86_64
FRICTION_PORTABLE_DIR=${BUILD}/${FRICTION_PORTABLE}
cd ${BUILD}
mv ${BUILD}/${FRICTION_PKG} ${FRICTION_PORTABLE_DIR}
(cd ${FRICTION_PORTABLE_DIR} ;
rm -rf usr
mv opt/friction/* .
rm -rf opt share/doc
ln -sf bin/friction .
echo "[Paths]" > bin/qt.conf
echo "Prefix = .." >> bin/qt.conf
echo "Plugins = plugins" >> bin/qt.conf
)
(cd ${FRICTION_PORTABLE_DIR}/bin ; patchelf --set-rpath '$ORIGIN/../lib' friction)
(cd ${FRICTION_PORTABLE_DIR}/lib ;
for so in *.so*; do
patchelf --set-rpath '$ORIGIN' ${so}
done
)

PLUGS="
audio
generic
imageformats
platforminputcontexts
platforms
xcbglintegrations
"
for pdir in ${PLUGS}; do
for so in ${FRICTION_PORTABLE_DIR}/plugins/${pdir}/*.so; do
patchelf --set-rpath '$ORIGIN/../../lib' ${so}
done
done

cd ${BUILD}
tar cvf ${FRICTION_PORTABLE}.tar ${FRICTION_PORTABLE}
xz -9 ${FRICTION_PORTABLE}.tar

echo "PKGS DONE"
1 change: 1 addition & 0 deletions src/scripts/vfxplatform.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Source0: friction-%{version}.tar

AutoReq: no
%global debug_package %{nil}
%global __provides_exclude_from /opt

%description
Friction is an open-source, vector-based application designed for creating web animations and videos.
Expand Down

0 comments on commit a2bc876

Please sign in to comment.