PKGBUILD 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. # Maintainer (arch): Sven-Hendrik Haase <svenstaro@gmail.com>
  2. # Contributor: John Sowiak <john@archlinux.org>
  3. # Contributor: tobias <tobias@archlinux.org>
  4. # Contributor: Andreas Grapentin <andreas@grapentin.org>
  5. # Contributor: Márcio Silva <coadde@hyperbola.info>
  6. # Contributor: bill-auger <bill-auger@programmer.net>
  7. # parabola changes and rationale:
  8. # - removed support for non-free CUDA and optix
  9. # - set OS type string to GNU/Linux-libre
  10. # - pin to tightly-coupled dependency versions
  11. pkgname=blender
  12. pkgver=2.93.1
  13. pkgrel=1
  14. pkgrel+=.parabola1
  15. epoch=17
  16. _pythonver_x86_64=3.9
  17. _pythonver_i686=3.9
  18. _pythonver_armv7h=3.9
  19. eval "_python_ver=\$_pythonver_${CARCH}"
  20. pkgdesc="A fully integrated 3D graphics creation suite"
  21. pkgdesc+=", without non-free CUDA or optix support"
  22. arch=('x86_64')
  23. arch+=('i686' 'armv7h')
  24. license=('GPL')
  25. url="https://www.blender.org"
  26. depends=('libpng' 'libtiff' 'openexr' 'python' 'desktop-file-utils' 'python-requests' 'potrace'
  27. 'shared-mime-info' 'hicolor-icon-theme' 'xdg-utils' 'glew' 'openjpeg2' 'python-numpy'
  28. 'freetype2' 'openal' 'ffmpeg' 'fftw' 'boost-libs' 'opencollada' 'alembic' 'openxr'
  29. 'openimageio' 'libsndfile' 'jack' 'opencolorio' 'openshadinglanguage' 'openimagedenoise'
  30. 'jemalloc' 'libspnav' 'ptex' 'opensubdiv' 'openvdb' 'log4cplus' 'sdl2' 'embree')
  31. [[ "${CARCH}" != 'x86_64' ]] && depends=( ${depends[*]/openimagedenoise/} )
  32. [[ "${CARCH}" == 'armv7h' ]] && depends=( ${depends[*]/embree/} )
  33. makedepends=('cmake' 'boost' 'mesa' 'git' 'llvm' 'cuda' 'ninja')
  34. makedepends=( ${makedepends[*]/cuda/} )
  35. options=(!strip)
  36. source=("git+https://git.blender.org/blender.git#tag=v$pkgver"
  37. "git+https://git.blender.org/blender-addons.git"
  38. "git+https://git.blender.org/blender-addons-contrib.git"
  39. "git+https://git.blender.org/blender-translations.git"
  40. "git+https://git.blender.org/blender-dev-tools.git"
  41. blender-openexr3.patch)
  42. sha512sums=('SKIP'
  43. 'SKIP'
  44. 'SKIP'
  45. 'SKIP'
  46. 'SKIP'
  47. 'e2dd7210d26b70445e9ae8e33dea35111ad0b0aca9d3b4ded3df560d0fcc8dc044868f729e0f090a04b6f316f083b5505a7056ce088e8702065add87b9b457e5')
  48. _version_constraint() # (dep_pkgname [precision])
  49. {
  50. local dep_pkgname=$1
  51. local full_version=$(pacman -S --print-format='%v' ${dep_pkgname} | tail -n 1)
  52. local n_dots=$(tmp=${full_version%-*} ; tmp=${tmp//[^\.]} ; echo "${#tmp}" ;)
  53. local def_precision=$(( n_dots + 1 ))
  54. local precision=$( [[ "$2" =~ ^[1-${def_precision}]$ ]] && echo $2 || echo ${def_precision} )
  55. local pkgver_rx='[^-\.\ ]+'
  56. local subver_rx='\.'${pkgver_rx}
  57. local pkgrel_rx='[^-\ ]+'
  58. local capture_rx=${pkgver_rx}
  59. for (( n_dots=1 ; n_dots < precision ; n_dots++ )) ; do capture_rx+=${subver_rx} ; done ;
  60. if [[ "${full_version}" =~ ^(${capture_rx})(${subver_rx})*-${pkgrel_rx}$ ]]
  61. then local version=${BASH_REMATCH[1]}
  62. local subver_inc=$(( ${version##*.} + 1 ))
  63. local version_inc=$( [[ "${version}" =~ \. ]] && echo ${version%.*}.${subver_inc} || \
  64. echo ${subver_inc} )
  65. local constraint_string="${dep_pkgname}>=${version} ${dep_pkgname}<${version_inc}"
  66. echo "applied version constraint: ${constraint_string}" >&2
  67. echo -n "${constraint_string}"
  68. else echo "ERROR: _version_constraint() error parsing: dep_pkgname='${dep_pkgname}' full_version='${full_version}'" >&2
  69. exit 1
  70. fi
  71. }
  72. prepare() {
  73. cd "$pkgname"
  74. git submodule init
  75. git config submodule."release/scripts/addons".url "${srcdir}/blender-addons"
  76. git config submodule."release/scripts/addons_contrib".url "${srcdir}/blender-addons-contrib"
  77. git config submodule."release/datafiles/locale".url "${srcdir}/blender-translations"
  78. git config submodule."source/tools".url "${srcdir}/blender-dev-tools"
  79. git submodule update
  80. git submodule foreach git checkout v${pkgver}
  81. patch -p1 < "$srcdir"/blender-openexr3.patch # Fix build with OpenEXR 3
  82. # set OS type string
  83. sed -i 's|BUILD_PLATFORM;|"GNU/Linux-libre";|' 'source/creator/buildinfo.c'
  84. # FIXME: error: implicit declaration of function ‘atomic_add_and_fetch_uint64’;
  85. # did you mean ‘atomic_add_and_fetch_uint32’? [-Werror=implicit-function-declaration]
  86. if [[ "${CARCH}" == 'armv7h' ]] || [[ "${CARCH}" == 'i686' ]]
  87. then local sed_cmd='s| atomic_add_and_fetch_uint64(| atomic_add_and_fetch_uint32(|'
  88. sed -i "${sed_cmd}" source/blender/blenlib/intern/session_uuid.c
  89. fi
  90. }
  91. build() {
  92. cd "$pkgname"
  93. # libre changes
  94. local _extra_opts=( -DWITH_CYCLES_CUDA_BINARIES=OFF \
  95. -DWITH_CYCLES_DEVICE_CUDA=OFF \
  96. -DWITH_CYCLES_DEVICE_OPTIX=OFF )
  97. # arch-specific options
  98. case "${CARCH}" in
  99. 'i686' ) _extra_opts+=( -DWITH_RAYOPTIMIZATION=OFF \
  100. -DWITH_CYCLES_EMBREE=ON ) ;;
  101. 'x86_64') _extra_opts+=( -DWITH_CYCLES_EMBREE=ON ) ;;
  102. esac
  103. local PYTHON_VER=${_python_ver}
  104. cmake . \
  105. -Bbuild \
  106. -GNinja \
  107. -Cbuild_files/cmake/config/blender_release.cmake \
  108. ${_extra_opts[@]} \
  109. -DCMAKE_INSTALL_PREFIX=/usr \
  110. -DCMAKE_BUILD_TYPE=Release \
  111. -DWITH_INSTALL_PORTABLE=OFF \
  112. -DWITH_PYTHON_INSTALL=OFF \
  113. -DPYTHON_VERSION=$PYTHON_VER \
  114. -DPYTHON_LIBPATH=/usr/lib \
  115. -DPYTHON_LIBRARY=python$PYTHON_VER \
  116. -DPYTHON_INCLUDE_DIRS=/usr/include/python$PYTHON_VER \
  117. -DCMAKE_CXX_FLAGS="-I /usr/include/python$PYTHON_VER"
  118. ninja -C build
  119. }
  120. package() {
  121. cd "$pkgname"
  122. # pin to tightly-coupled dependency versions
  123. # NOTE: indirect sodeps may still be unsatisfyable:
  124. # libboost_filesystem.so <- openimageio,
  125. # libboost_thread.so <- openshadinglanguage,
  126. # libboost_iostreams.so <- openvdb
  127. depends+=( libboost_locale.so
  128. $(_version_constraint openexr 2) # eg: libHalf.so.12
  129. $(_version_constraint openimageio 2) # eg: libOpenImageIO.so.2.0
  130. $(_version_constraint openshadinglanguage 2) # eg: liboslcomp.so.1.10
  131. $(_version_constraint opensubdiv 3) # eg: libosdGPU.so.3.3.3
  132. $(_version_constraint openvdb 2) # eg: libopenvdb.so.6.2
  133. $(_version_constraint python 2) ) # eg: libpython3.6.so.1.0
  134. DESTDIR="${pkgdir}" ninja -C build install
  135. install -Dm755 release/bin/blender-softwaregl "${pkgdir}/usr/bin/blender-softwaregl"
  136. python -m compileall "${pkgdir}/usr/share/blender"
  137. python -O -m compileall "${pkgdir}/usr/share/blender"
  138. install -Dm644 release/freedesktop/org.blender.Blender.appdata.xml "${pkgdir}/usr/share/metainfo/org.blender.Blender.appdata.xml"
  139. # Manually install additional scripts (See FS#69351)
  140. cp -r release/scripts/addons_contrib/* "${pkgdir}"/usr/share/blender/2*/scripts/addons_contrib/
  141. }