PKGBUILD 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. # Maintainer (arch): Sven-Hendrik Haase <svenstaro@archlinux.org>
  2. # Maintainer (arch32): Andreas Baumann <mail@andreasbaumann.cc>
  3. # Maintainer (archarm): Kevin Mihelich <kevin@archlinuxarm.org>
  4. # Contributor: John Sowiak <john@archlinux.org>
  5. # Contributor: tobias <tobias@archlinux.org>
  6. # Contributor: Andreas Grapentin <andreas@grapentin.org>
  7. # Contributor: Márcio Silva <coadde@hyperbola.info>
  8. # Contributor: bill-auger <bill-auger@programmer.net>
  9. # Maintainer: Parabola Hackers <dev@lists.parabola.nu>
  10. # parabola changes and rationale:
  11. # - removed support for non-free CUDA and optix
  12. # - set OS type string to GNU/Linux-libre
  13. # - pin to tightly-coupled dependency versions
  14. # NOTE: This PKGBUILD is kept in-sync, as closely as possible,
  15. # with arch{,arm,32}, for the sake of documentation and cleaner diffs.
  16. # That also helps to identify which changes were made by Parabola vs upstream.
  17. # Therefore, this PKGBUILD may declare blacklisted dependencies, non-free sources,
  18. # or include code for anti-features; but those will be filtered-out subsequently.
  19. # Any code which implements an anti-feature should be commented-out;
  20. # and include an 'anti-feature' comment, for clarity.
  21. # Any blacklisted dependencies and non-free sources should be filtered,
  22. # and include a 'non-free' comment, for clarity.
  23. # Without those over-rides, the resulting program may not be FSDG-fit.
  24. # Do not circumvent those over-rides, if compiling for the Parabola repos.
  25. pkgname=blender
  26. pkgver=3.4.1
  27. [[ "${CARCH}" == 'i686' ]] && pkgver=3.1.2
  28. pkgrel=12
  29. pkgrel+=.parabola1
  30. epoch=17
  31. pkgdesc="A fully integrated 3D graphics creation suite"
  32. arch=('x86_64')
  33. arch+=('armv7h' 'i686')
  34. license=('GPL')
  35. url="https://www.blender.org"
  36. depends=('libpng' 'libtiff' 'openexr' 'python' 'desktop-file-utils' 'python-requests' 'potrace'
  37. 'shared-mime-info' 'hicolor-icon-theme' 'xdg-utils' 'glew' 'openjpeg2' 'python-numpy'
  38. 'freetype2' 'openal' 'ffmpeg' 'fftw' 'boost-libs' 'opencollada' 'alembic' 'openxr'
  39. 'openimageio' 'libsndfile' 'jack' 'opencolorio' 'openshadinglanguage' 'openimagedenoise'
  40. 'jemalloc' 'libspnav' 'ptex' 'opensubdiv' 'openvdb' 'log4cplus' 'sdl2' 'embree' 'libharu'
  41. 'draco' 'openpgl')
  42. [[ "${CARCH}" != x86_64 ]] && depends=( ${depends[*]/openimagedenoise/} ) # unavailable for armv7h and i686
  43. [[ "${CARCH}" == armv7h ]] && depends=( ${depends[*]/embree/} ) # unavailable for armv7h
  44. [[ "${CARCH}" == i686 ]] && depends=( ${depends[*]/jack/pipewire-jack} ) # (arch32) FS32#297: unable to satisfy dependency 'libcelt0.so=2-32' required by jack2
  45. makedepends=('cmake' 'boost' 'mesa' 'git' 'llvm' 'cuda' 'ninja' 'wayland-protocols' 'libxkbcommon'
  46. 'libdecor')
  47. makedepends=( ${makedepends[*]/cuda/} ) # non-free
  48. [[ "${CARCH}" == i686 ]] && makedepends+=( boost178-libs clang13 )
  49. makedepends+=( libepoxy ) # FIXME: Could NOT find Epoxy (missing: Epoxy_LIBRARY Epoxy_INCLUDE_DIR)
  50. optdepends=('libdecor: wayland support')
  51. options=(!strip)
  52. source=("git+https://git.blender.org/blender.git#tag=v$pkgver"
  53. "git+https://git.blender.org/blender-addons.git"
  54. "git+https://git.blender.org/blender-addons-contrib.git"
  55. "git+https://git.blender.org/blender-translations.git"
  56. "git+https://git.blender.org/blender-dev-tools.git"
  57. https://developer.download.nvidia.com/redist/optix/v7.5/OptiX-7.5-Include.zip
  58. force-draco1.patch
  59. force-draco2.patch)
  60. source=( ${source[*]/*optix*/dummy-source} ) # non-free
  61. source_i686=(no-sse2.patch
  62. blender-idprop_create-static-assert-float.patch)
  63. sha512sums=('SKIP'
  64. 'SKIP'
  65. 'SKIP'
  66. 'SKIP'
  67. 'SKIP'
  68. 'SKIP' # dummy-source for non-free optix
  69. 'e239da4f3906f1b54265435181cf770bae3d269c8d915df9a73861e6ee71ec70bf2339426e7c81a91e5a567273b3b3742d7a99feefd3398d821b26e1ff3a56d0'
  70. '527ab66e5eace777de0043c1ca5787a488f6471450ce67fd6d08137ad0ef56177bc0c17696f30a5fca23fa55d8ca9c3f30cb7b17550dba2dbd8e89ca0b361990')
  71. sha512sums_i686=('87da2bedb90af6dee559ef9d1eb83262ba75fb412aba83dcb2b88fe9c0740ff75ad336331033fec7a14ad6ecc3dd70f8f4742f147594e8dc530197dd51922c01'
  72. '36b98ec7e53402909a9e531c30b444b1afc22cc597c5bb3393c73862929dcc6275b00a53de6171a81af3c8804d233359d2e797886d0b776e7a9b29b23ce24e3b')
  73. _version_constraint() # (dep_pkgname [precision])
  74. {
  75. local dep_pkgname=$1
  76. local req_precision=$2
  77. local full_version=$(pacman -S --print-format='%v' ${dep_pkgname} | tail -n 1)
  78. local n_dots=$(tmp=${full_version%-*} ; tmp=${tmp//[^\.]} ; echo "${#tmp}" ;)
  79. local def_precision=$(( n_dots + 1 ))
  80. local is_reqprecision_valid=$( [[ "${req_precision}" =~ ^[1-${def_precision}]$ ]] && echo 1 || echo 0 )
  81. local precision=$( (( is_reqprecision_valid )) && echo ${req_precision} || echo ${def_precision} )
  82. local pkgver_rx='[^-\.\ ]+'
  83. local subver_rx='\.'${pkgver_rx}
  84. local pkgrel_rx='[^-\ ]+'
  85. local capture_rx=${pkgver_rx}
  86. for (( n_dots=1 ; n_dots < precision ; ++n_dots )) ; do capture_rx+=${subver_rx} ; done ;
  87. if [[ "${full_version}" =~ ^(${capture_rx})(${subver_rx})*-(${pkgrel_rx})$ ]]
  88. then local version=${BASH_REMATCH[1]}
  89. local pkgrel=${BASH_REMATCH[3]%%.*}
  90. local subver_inc=$(( ${version##*.} + 1 )) # right-trims from any non-numeric
  91. local pkgrel_inc=$(( pkgrel + 1 ))
  92. local version_min=$( (( ! is_reqprecision_valid )) && echo ${full_version%-*}-${pkgrel} || \
  93. echo ${version} )
  94. local version_max=$( ( (( ! is_reqprecision_valid )) && echo ${full_version%-*}-${pkgrel_inc} ) || \
  95. ( [[ "${version}" =~ \. ]] && echo ${version%.*}.${subver_inc} ) || \
  96. echo ${subver_inc} )
  97. local constraint_string="${dep_pkgname}>=${version_min} ${dep_pkgname}<${version_max}"
  98. echo "applied version constraint: '${constraint_string}'" >&2
  99. else echo "ERROR: _version_constraint() error parsing: dep_pkgname='${dep_pkgname}' full_version='${full_version}'" >&2
  100. exit 1
  101. fi
  102. echo -n "${constraint_string}"
  103. }
  104. prepare() {
  105. cd "$pkgname"
  106. git submodule init
  107. git config submodule."release/scripts/addons".url "${srcdir}/blender-addons"
  108. git config submodule."release/scripts/addons_contrib".url "${srcdir}/blender-addons-contrib"
  109. git config submodule."release/datafiles/locale".url "${srcdir}/blender-translations"
  110. git config submodule."source/tools".url "${srcdir}/blender-dev-tools"
  111. git -c protocol.file.allow=always submodule update
  112. git submodule foreach git checkout v${pkgver}
  113. ## technical patching ##
  114. # fix build with boost 1.81.0
  115. git format-patch -1 --stdout 79837c5ed4b5 | patch -Np1
  116. patch -p1 -i "$srcdir"/force-draco1.patch
  117. patch -p1 -d release/scripts/addons -i "$srcdir"/force-draco2.patch
  118. # arch-specific technical patching
  119. case "${CARCH}" in
  120. armv7h)
  121. ;;
  122. i686)
  123. patch -Np1 -i "$srcdir"/no-sse2.patch
  124. # float_t is a long double on 32-bit, but it's a primitive in all cases anyway
  125. # (seems to be in a part of the blendkernel on i686 only..)
  126. patch -Np1 -i "$srcdir"/blender-idprop_create-static-assert-float.patch
  127. # FIXME: error: implicit declaration of function ‘atomic_add_and_fetch_uint64’;
  128. # did you mean ‘atomic_add_and_fetch_uint32’? [-Werror=implicit-function-declaration]
  129. # this is known upstream
  130. local sed_cmd='s| atomic_add_and_fetch_uint64(| atomic_add_and_fetch_uint32(|'
  131. local target_file=source/blender/blenlib/intern/session_uuid.c
  132. sed -i "${sed_cmd}" ${target_file} ; ! grep ' atomic_add_and_fetch_uint64(|' ${target_file} ;
  133. # FIXME: intern/cycles/kernel/../util/transform_inverse.h:15:9: error: ‘ssef’ does not name a type
  134. # -- SSE2 SIMD instructions enabled
  135. sed_cmd='s|if(NOT DEFINED SUPPORT_SSE2_BUILD|& AND FALSE|'
  136. target_file=build_files/cmake/macros.cmake
  137. sed -i "${sed_cmd}" ${target_file} ; grep 'if(NOT DEFINED SUPPORT_SSE2_BUILD AND FALSE' ${target_file} ;
  138. # the above change corrects 'SSE2 SIMD instructions enabled'; but the original 'ssef' error persists
  139. sed_cmd='s|# set(COMPILER_SSE2_FLAG)| unset(COMPILER_SSE2_FLAG)|'
  140. target_file=CMakeLists.txt
  141. sed -i "${sed_cmd}" ${target_file} ; ! grep '# set(COMPILER_SSE2_FLAG)' ${target_file} ;
  142. # the original 'ssef' error persists - fixed by adding pkgver=3.1.2 and makedepends+=( boost178-libs clang13 )
  143. # but then fails with: /usr/lib/gcc/i686-pc-linux-gnu/12.2.0/include/emmintrin.h:1586:1: error: inlining failed in call to ‘always_inline’ ‘__m128 _mm_castsi128_ps(__m128i)’: target specific option mismatch
  144. # that is the same error as the recent mozilla - the option --disable-webrtc fix that; but that does not apply to blender
  145. ;;
  146. x86_64)
  147. ;;
  148. esac
  149. ## libre patching ##
  150. # set OS type string
  151. sed -i 's|BUILD_PLATFORM;|"GNU/Linux-libre";|' 'source/creator/buildinfo.c'
  152. }
  153. get_pyver() {
  154. python -c 'import sys; print(str(sys.version_info[0]) + "." + str(sys.version_info[1]))'
  155. }
  156. build() {
  157. cd "$pkgname"
  158. local PYTHON_VER="$(get_pyver)"
  159. # libre configuration
  160. local _parabola_opts=( -DWITH_CYCLES_CUDA_BINARIES=OFF \
  161. -DWITH_CYCLES_DEVICE_CUDA=OFF \
  162. -DWITH_CYCLES_DEVICE_OPTIX=OFF )
  163. # arch-specific configuration
  164. case "${CARCH}" in
  165. 'armv7h') _parabola_opts+=( -DWITH_CYCLES_EMBREE=OFF ) ;;
  166. 'i686' ) _parabola_opts+=( -DWITH_RAYOPTIMIZATION=OFF ) ;;
  167. esac
  168. # FIXME: /usr/lib/gcc/i686-pc-linux-gnu/12.2.0/include/emmintrin.h:1586:1: error: inlining failed in call to ‘always_inline’ ‘__m128 _mm_castsi128_ps(__m128i)’: target specific option mismatch
  169. [[ "${CARCH}" == 'i686' ]] && _parabola_opts+=( DWITH_CYCLES=OFF ) # did not help
  170. cmake \
  171. -Bbuild \
  172. -GNinja \
  173. -Cbuild_files/cmake/config/blender_release.cmake \
  174. -C precache \
  175. ${_parabola_opts[@]} \
  176. -DCMAKE_INSTALL_PREFIX=/usr \
  177. -DCMAKE_BUILD_TYPE=Release \
  178. -DWITH_INSTALL_PORTABLE=OFF \
  179. -DWITH_PYTHON_INSTALL=OFF \
  180. -DPYTHON_VERSION="$PYTHON_VER" \
  181. -DPYTHON_LIBPATH=/usr/lib \
  182. -DPYTHON_LIBRARY="python$PYTHON_VER" \
  183. -DPYTHON_INCLUDE_DIRS="/usr/include/python$PYTHON_VER" \
  184. -DCMAKE_CXX_FLAGS="-I /usr/include/python$PYTHON_VER"
  185. cmake --build build
  186. }
  187. package() {
  188. cd "$pkgname"
  189. # pin to tightly-coupled dependency versions
  190. # NOTE: indirect sodeps may still be unsatisfyable:
  191. # libboost_filesystem.so <- openimageio,
  192. # libboost_thread.so <- openshadinglanguage,
  193. # libboost_iostreams.so <- openvdb
  194. depends+=( libboost_locale.so
  195. $(_version_constraint opencolorio 2) # eg: libOpenColorIO.so.2.1
  196. $(_version_constraint openexr 2) # eg: libHalf.so.12
  197. $(_version_constraint openimageio 2) # eg: libOpenImageIO.so.2.0
  198. $(_version_constraint openshadinglanguage 2) # eg: liboslcomp.so.1.10
  199. $(_version_constraint opensubdiv 3) # eg: libosdGPU.so.3.3.3
  200. $(_version_constraint openvdb 2) # eg: libopenvdb.so.6.2
  201. $(_version_constraint python 2) ) # eg: libpython3.6.so.1.0
  202. DESTDIR="${pkgdir}" cmake --install build
  203. install -Dm755 release/bin/blender-softwaregl "${pkgdir}/usr/bin/blender-softwaregl"
  204. python -m compileall "${pkgdir}/usr/share/blender"
  205. python -O -m compileall "${pkgdir}/usr/share/blender"
  206. install -Dm644 release/freedesktop/org.blender.Blender.appdata.xml "${pkgdir}/usr/share/metainfo/org.blender.Blender.appdata.xml"
  207. # Manually install additional scripts (See FS#69351)
  208. cp -r release/scripts/addons_contrib/* "${pkgdir}"/usr/share/blender/3*/scripts/addons_contrib/
  209. # Manually install draco bindings (See FS#73415)
  210. mkdir -p "${pkgdir}/usr/lib/python$(get_pyver)"/
  211. mv "${pkgdir}"/usr/share/blender/3*/python/lib/* "${pkgdir}"/usr/lib/
  212. rm -r "${pkgdir}"/usr/share/blender/3*/python
  213. }