PKGBUILD 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #!/bin/hint/bash
  2. # Maintainer : bartus <arch-user-repoᘓbartus.33mail.com>
  3. # shellcheck disable=SC2034,SC2154 # allow unused/unset variables
  4. # shellcheck disable=SC2191 # preserve current _CMAKE_FLAGS initialization.
  5. # Configuration.
  6. _fragment=${FRAGMENT:-#branch=blender2.7}
  7. [[ -v CUDA_ARCH ]] && _cuda_capability=${CUDA_ARCH}
  8. #some extra, unofficially supported stuff goes here:
  9. ((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.
  10. ((DISABLE_NINJA)) || makedepends+=('ninja')
  11. #shellcheck disable=SC2015
  12. ((DISABLE_CUDA)) && optdepends+=('cuda: CUDA support in Cycles') || makedepends+=('cuda')
  13. pkgname=blender-2.7
  14. pkgver=2.79b.r71421.e045fe53f1b
  15. pkgrel=3
  16. pkgdesc="Blender 2.7 branch"
  17. arch=('i686' 'x86_64')
  18. url="https://blender.org/"
  19. depends+=('alembic' 'libgl' 'python' 'python-numpy' 'openjpeg2'
  20. 'ffmpeg' 'fftw' 'openal' 'freetype2' 'libxi' 'openimageio' 'opencolorio'
  21. 'openvdb' 'opencollada' 'opensubdiv' 'openshadinglanguage' 'libtiff' 'libpng')
  22. makedepends+=('git' 'cmake' 'boost' 'mesa' 'llvm')
  23. provides=('blender-2.7')
  24. license=('GPL')
  25. # NOTE: the source array has to be kept in sync with .gitmodules
  26. # the submodules has to be stored in path ending with git to match
  27. # the path in .gitmodules.
  28. # More info:
  29. # http://wiki.blender.org/index.php/Dev:Doc/Tools/Git
  30. source=("git://git.blender.org/blender.git${_fragment}"
  31. 'blender-addons.git::git://git.blender.org/blender-addons.git'
  32. 'blender-addons-contrib.git::git://git.blender.org/blender-addons-contrib.git'
  33. 'blender-translations.git::git://git.blender.org/blender-translations.git'
  34. 'blender-dev-tools.git::git://git.blender.org/blender-dev-tools.git'
  35. SelectCudaComputeArch.patch
  36. stl_export_iter.patch
  37. python3.7.patch
  38. python3.8.patch
  39. 'python3.9.patch' # ::https://git.blender.org/gitweb/gitweb.cgi/blender.git/patch/56d0df51a36fdce7ec2d1fbb7b47b1d95b591b5f
  40. 'python3.9_2.patch' # ::https://git.blender.org/gitweb/gitweb.cgi/blender.git/patch/5edba9b42f684bf8b99894bb6988e7f46180e12c
  41. openvdb7.patch
  42. openvdb8.patch
  43. cycles.patch
  44. )
  45. sha256sums=('SKIP'
  46. 'SKIP'
  47. 'SKIP'
  48. 'SKIP'
  49. 'SKIP'
  50. '28e407e3aefdd9bd76805b6033ada0b5b41dd6183bcf4f58a642c109f10c1876'
  51. '649c21a12a1bfc0207078e1e58b4813a3e898c6dbbbb35d21e1de7c9e8f1985a'
  52. '47811284f080e38bcfbfb1f7346279245815a064df092989336b0bf3fe4530e9'
  53. '229853b98bb62e1dec835aea6b2eab4c3dabbc8be591206573a3c1b85f10be59'
  54. 'd106248d55045f5ef913bf6243ad74a76f6282264d9ee4c9b87ec4a3d2e2064b'
  55. 'b2a2bc5de8d3b730e49d1f50cb025c1dfdbcb66c58ead573322585b6a887d3a7'
  56. 'c4079c4c142516d9cd476f5a3cafddf4068f0950c3c11ea4da9cf999c5ccc1f9'
  57. 'edfd784f8497417660c0b9fdc97893fd0d77764d0bc10f4cb92a9082f41bae75'
  58. 'd245f02d73bd5b767ffa49d369383d7cd6ae5e57b89c2975a78c1015e1884864')
  59. pkgver() {
  60. # shellcheck disable=SC2164
  61. cd "$srcdir/blender"
  62. printf "2.79b.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  63. }
  64. prepare() {
  65. # update the submodules
  66. git -C "$srcdir/blender" submodule update --init --recursive --remote
  67. if [ ! -v _cuda_capability ] && grep -q nvidia <(lsmod); then
  68. git -C "$srcdir/blender" apply -v "${srcdir}"/SelectCudaComputeArch.patch
  69. fi
  70. git -C "$srcdir/blender" apply -v "${srcdir}"/{python3.7,stl_export_iter,python3.{8,9,9_2},openvdb7,openvdb8,cycles}.patch
  71. }
  72. build() {
  73. _pyver=$(python -c "from sys import version_info; print(\"%d.%d\" % (version_info[0],version_info[1]))")
  74. msg "python version detected: ${_pyver}"
  75. # determine whether we can precompile CUDA kernels
  76. _CUDA_PKG=$(pacman -Qq cuda 2>/dev/null) || true
  77. if [ "$_CUDA_PKG" != "" ] && ! ((DISABLE_CUDA)) ; then
  78. _CMAKE_FLAGS+=( -DWITH_CYCLES_CUDA_BINARIES=ON
  79. -DCUDA_TOOLKIT_ROOT_DIR=/opt/cuda )
  80. if [[ -v _cuda_capability ]]; then
  81. _CMAKE_FLAGS+=( -DCYCLES_CUDA_BINARIES_ARCH="$(IFS=';'; echo "${_cuda_capability[*]}";)" )
  82. fi
  83. [ -f "/usr/lib/ccache/bin/nvcc-ccache" ] && _CMAKE_FLAGS+=( -DCUDA_NVCC_EXECUTABLE=/usr/lib/ccache/bin/nvcc-ccache )
  84. if _cuda_gcc=$(basename "$(readlink /opt/cuda/bin/gcc)") ; then
  85. [ -L "/usr/lib/ccache/bin/$_cuda_gcc" ] && _CMAKE_FLAGS+=( -DCUDA_HOST_COMPILER=/usr/lib/ccache/bin/"$_cuda_gcc" )
  86. fi
  87. fi
  88. ((DISABLE_NINJA)) && generator="Unix Makefiles" || generator="Ninja"
  89. cmake -G "$generator" -S "$srcdir/blender" -B "$srcdir/build" \
  90. -C "${srcdir}/blender/build_files/cmake/config/blender_release.cmake" \
  91. -DCMAKE_INSTALL_PREFIX=/usr \
  92. -DCMAKE_BUILD_TYPE=Release \
  93. -DWITH_INSTALL_PORTABLE=OFF \
  94. -DWITH_GL_PROFILE_CORE=OFF \
  95. -DWITH_GL_PROFILE_ES20=OFF \
  96. -DWITH_SYSTEM_GLEW=ON \
  97. -DWITH_PYTHON_INSTALL=OFF \
  98. -DPYTHON_VERSION="${_pyver}" \
  99. -DWITH_LLVM=ON \
  100. "${_CMAKE_FLAGS[@]}"
  101. export NINJA_STATUS="[%p | %f<%r<%u | %cbps ] "
  102. # shellcheck disable=SC2086 # allow MAKEFLAGS to split when multiple flags provided.
  103. if ((DISABLE_NINJA)); then make -C "$srcdir/build" ; else ninja -C "$srcdir/build" ${MAKEFLAGS:--j1}; fi
  104. }
  105. package() {
  106. _suffix=${pkgname##*-}
  107. export DESTDIR="$pkgdir"
  108. if ((DISABLE_NINJA)); then make -C "$srcdir/build" install; else ninja -C "$srcdir/build" install; fi
  109. msg "add -${_suffix} suffix to desktop shortcut"
  110. sed -i "s/=blender/=blender-${_suffix}/g" "${pkgdir}/usr/share/applications/blender.desktop"
  111. sed -i "s/=Blender/=Blender-${_suffix}/g" "${pkgdir}/usr/share/applications/blender.desktop"
  112. mv "${pkgdir}/usr/share/applications/blender.desktop" "${pkgdir}/usr/share/applications/blender-${_suffix}.desktop"
  113. msg "add -${_suffix} suffix to binaries"
  114. mv "${pkgdir}/usr/bin/blender" "${pkgdir}/usr/bin/blender-${_suffix}"
  115. mv "${pkgdir}/usr/bin/blender-thumbnailer.py" "${pkgdir}/usr/bin/blender-${_suffix}-thumbnailer.py"
  116. msg "mv doc/blender to doc/blender-${_suffix}"
  117. mv "${pkgdir}/usr/share/doc/blender" "${pkgdir}/usr/share/doc/blender-${_suffix}"
  118. msg "add -${_suffix} suffix to man page"
  119. mv "${pkgdir}/usr/share/man/man1/blender.1" "${pkgdir}/usr/share/man/man1/blender-${_suffix}.1"
  120. msg "add -${_suffix} suffix to all icons"
  121. while read -r icon
  122. do
  123. # ${filename##/*.} extra extenssion from path
  124. # ${filename%.*} extract filename form path
  125. # look at bash "manipulatin string"
  126. mv "$icon" "${icon%.*}-${_suffix}.${icon##/*.}"
  127. done < <(find "${pkgdir}/usr/share/icons" -type f)
  128. if [[ -e "$pkgdir/usr/share/blender/${_suffix}/scripts/addons/cycles/lib/" ]] ; then
  129. # make sure the cuda kernels are not stripped
  130. chmod 444 "$pkgdir"/usr/share/blender/${_suffix}/scripts/addons/cycles/lib/*
  131. fi
  132. }
  133. # vim:set sw=2 ts=2 et: