#!/bin/hint/bash # Maintainer : bartus # shellcheck disable=SC2034,SC2154 # allow unused/unset variables # shellcheck disable=SC2191 # preserve current _CMAKE_FLAGS initialization. # Configuration. _branch="blender2.7" _fragment=${FRAGMENT:-#branch=${_branch}} [[ -v CUDA_ARCH ]] && _cuda_capability=${CUDA_ARCH} _commit_url="https://git.blender.org/gitweb/gitweb.cgi/blender.git/patch" #some extra, unofficially supported stuff goes here: ((TRAVIS)) && _cuda_capability+=(sm_50 sm_52 sm_60 sm_61 sm_70 sm_75) # Travis memory limit is not enough to build for arch 3.x. ((DISABLE_NINJA)) || makedepends+=('ninja') #shellcheck disable=SC2015 ((DISABLE_CUDA)) && optdepends+=('cuda: CUDA support in Cycles') || makedepends+=('cuda') pkgname=blender-2.7 pkgver=2.79b.r71421.e045fe53f1b pkgrel=3 pkgdesc="Maintnance version of Blenders ${_branch} branch" arch=('i686' 'x86_64') url="https://blender.org/" depends+=('alembic' 'libgl' 'python' 'python-numpy' 'openjpeg2' 'ffmpeg' 'fftw' 'openal' 'freetype2' 'libxi' 'openimageio' 'opencolorio' 'openvdb' 'opencollada' 'opensubdiv' 'openshadinglanguage' 'libtiff' 'libpng') makedepends+=('git' 'cmake' 'boost' 'mesa' 'llvm') provides=('blender-2.7') license=('GPL') # NOTE: the source array has to be kept in sync with .gitmodules # the submodules has to be stored in path ending with git to match # the path in .gitmodules. # More info: # http://wiki.blender.org/index.php/Dev:Doc/Tools/Git source=("git://git.blender.org/blender.git${_fragment}" 'blender-addons.git::git://git.blender.org/blender-addons.git' 'blender-addons-contrib.git::git://git.blender.org/blender-addons-contrib.git' 'blender-translations.git::git://git.blender.org/blender-translations.git' 'blender-dev-tools.git::git://git.blender.org/blender-dev-tools.git' SelectCudaComputeArch.patch stl_export_iter.patch python3.7.patch python3.8.patch 'python3.9.patch' # ::https://git.blender.org/gitweb/gitweb.cgi/blender.git/patch/56d0df51a36fdce7ec2d1fbb7b47b1d95b591b5f 'python3.9_2.patch' # ::https://git.blender.org/gitweb/gitweb.cgi/blender.git/patch/5edba9b42f684bf8b99894bb6988e7f46180e12c openvdb7.patch openvdb8.patch # ::${_commit_url}/37889011070ff2ec52159690f652238d2b325185 cycles.patch ) sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' '28e407e3aefdd9bd76805b6033ada0b5b41dd6183bcf4f58a642c109f10c1876' '649c21a12a1bfc0207078e1e58b4813a3e898c6dbbbb35d21e1de7c9e8f1985a' '47811284f080e38bcfbfb1f7346279245815a064df092989336b0bf3fe4530e9' '229853b98bb62e1dec835aea6b2eab4c3dabbc8be591206573a3c1b85f10be59' 'd106248d55045f5ef913bf6243ad74a76f6282264d9ee4c9b87ec4a3d2e2064b' 'b2a2bc5de8d3b730e49d1f50cb025c1dfdbcb66c58ead573322585b6a887d3a7' 'c4079c4c142516d9cd476f5a3cafddf4068f0950c3c11ea4da9cf999c5ccc1f9' 'edfd784f8497417660c0b9fdc97893fd0d77764d0bc10f4cb92a9082f41bae75' 'd245f02d73bd5b767ffa49d369383d7cd6ae5e57b89c2975a78c1015e1884864') pkgver() { # shellcheck disable=SC2164 cd "$srcdir/blender" printf "2.79b.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" } prepare() { # update the submodules git -C "$srcdir/blender" submodule update --init --recursive --remote if [ ! -v _cuda_capability ] && grep -q nvidia <(lsmod); then git -C "$srcdir/blender" apply -v "${srcdir}"/SelectCudaComputeArch.patch fi git -C "$srcdir/blender" apply -v "${srcdir}"/{python3.7,stl_export_iter,python3.{8,9,9_2},openvdb{7,8},cycles}.patch } build() { _pyver=$(python -c "from sys import version_info; print(\"%d.%d\" % (version_info[0],version_info[1]))") msg "python version detected: ${_pyver}" # determine whether we can precompile CUDA kernels _CUDA_PKG=$(pacman -Qq cuda 2>/dev/null) || true if [ "$_CUDA_PKG" != "" ] && ! ((DISABLE_CUDA)) ; then _CMAKE_FLAGS+=( -DWITH_CYCLES_CUDA_BINARIES=ON -DCUDA_TOOLKIT_ROOT_DIR=/opt/cuda ) if [[ -v _cuda_capability ]]; then _CMAKE_FLAGS+=( -DCYCLES_CUDA_BINARIES_ARCH="$(IFS=';'; echo "${_cuda_capability[*]}";)" ) fi [ -f "/usr/lib/ccache/bin/nvcc-ccache" ] && _CMAKE_FLAGS+=( -DCUDA_NVCC_EXECUTABLE=/usr/lib/ccache/bin/nvcc-ccache ) if _cuda_gcc=$(basename "$(readlink /opt/cuda/bin/gcc)") ; then [ -L "/usr/lib/ccache/bin/$_cuda_gcc" ] && _CMAKE_FLAGS+=( -DCUDA_HOST_COMPILER=/usr/lib/ccache/bin/"$_cuda_gcc" ) fi fi ((DISABLE_NINJA)) && generator="Unix Makefiles" || generator="Ninja" cmake -G "$generator" -S "$srcdir/blender" -B "$srcdir/build" \ -C "${srcdir}/blender/build_files/cmake/config/blender_release.cmake" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_BUILD_TYPE=Release \ -DWITH_INSTALL_PORTABLE=OFF \ -DWITH_GL_PROFILE_CORE=OFF \ -DWITH_GL_PROFILE_ES20=OFF \ -DWITH_SYSTEM_GLEW=ON \ -DWITH_PYTHON_INSTALL=OFF \ -DPYTHON_VERSION="${_pyver}" \ -DWITH_LLVM=ON \ "${_CMAKE_FLAGS[@]}" export NINJA_STATUS="[%p | %f<%r<%u | %cbps ] " # shellcheck disable=SC2086 # allow MAKEFLAGS to split when multiple flags provided. if ((DISABLE_NINJA)); then make -C "$srcdir/build" ; else ninja -C "$srcdir/build" ${MAKEFLAGS:--j1}; fi } package() { _suffix=${pkgname##*-} export DESTDIR="$pkgdir" if ((DISABLE_NINJA)); then make -C "$srcdir/build" install; else ninja -C "$srcdir/build" install; fi msg "add -${_suffix} suffix to desktop shortcut" sed -i "s/=blender/=blender-${_suffix}/g" "${pkgdir}/usr/share/applications/blender.desktop" sed -i "s/=Blender/=Blender-${_suffix}/g" "${pkgdir}/usr/share/applications/blender.desktop" mv "${pkgdir}/usr/share/applications/blender.desktop" "${pkgdir}/usr/share/applications/blender-${_suffix}.desktop" msg "add -${_suffix} suffix to binaries" mv "${pkgdir}/usr/bin/blender" "${pkgdir}/usr/bin/blender-${_suffix}" mv "${pkgdir}/usr/bin/blender-thumbnailer.py" "${pkgdir}/usr/bin/blender-${_suffix}-thumbnailer.py" msg "mv doc/blender to doc/blender-${_suffix}" mv "${pkgdir}/usr/share/doc/blender" "${pkgdir}/usr/share/doc/blender-${_suffix}" msg "add -${_suffix} suffix to man page" mv "${pkgdir}/usr/share/man/man1/blender.1" "${pkgdir}/usr/share/man/man1/blender-${_suffix}.1" msg "add -${_suffix} suffix to all icons" while read -r icon do # ${filename##/*.} extra extenssion from path # ${filename%.*} extract filename form path # look at bash "manipulatin string" mv "$icon" "${icon%.*}-${_suffix}.${icon##/*.}" done < <(find "${pkgdir}/usr/share/icons" -type f) if [[ -e "$pkgdir/usr/share/blender/${_suffix}/scripts/addons/cycles/lib/" ]] ; then # make sure the cuda kernels are not stripped chmod 444 "$pkgdir"/usr/share/blender/${_suffix}/scripts/addons/cycles/lib/* fi } # vim:set sw=2 ts=2 et: