|
| 1 | +# Maintainer: Sven-Hendrik Haase <[email protected]> |
| 2 | +# Contributor: Adrià Cabello <adro.cc79 at protonmail dot com> |
| 3 | +# Contributor: Fabio Loli <[email protected]> |
| 4 | + |
| 5 | +pkgname=materialx |
| 6 | +pkgver=1.38.10 |
| 7 | +pkgrel=6 |
| 8 | +pkgdesc="Open standard for representing rich material and look-development content in computer graphics" |
| 9 | +arch=(aarch64) |
| 10 | +url="https://materialx.org/" |
| 11 | +license=('Apache') |
| 12 | +depends=('glibc' 'gcc-libs' 'glfw' 'libglvnd' 'libx11' 'libxt' 'python' |
| 13 | + 'python-setuptools' 'opencolorio' 'dos2unix' 'zenity') |
| 14 | +makedepends=('cmake' 'chrpath' 'libxinerama' 'libxcursor' 'pybind11' 'ninja') |
| 15 | +source=("https://github.com/AcademySoftwareFoundation/MaterialX/releases/download/v${pkgver}/MaterialX-${pkgver}.tar.gz" |
| 16 | + "materialx-grapheditor.desktop" |
| 17 | + "materialx-view.desktop" |
| 18 | + "materialx.xml") |
| 19 | +sha256sums=('f7f2aa7587ae63eb095cef35d202d23df341e3d67c8c458357d2a555d76c69f2' |
| 20 | + '88e5ecafa8088b90f799b49c36af59f8462ca7426cdec58215332ee283556ddb' |
| 21 | + '2f2b675540fea39a749f89083a9c341319c1f7b478fbb049a77bd66c29b2ee01' |
| 22 | + 'd9b9426fb94121da052b796542cc74a0c5d7cef06997be70611c25f345553861') |
| 23 | + |
| 24 | +_pyver=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') |
| 25 | + |
| 26 | +prepare() { |
| 27 | + cd MaterialX-${pkgver} |
| 28 | + |
| 29 | + # Repath |
| 30 | + sed -i 's|CMAKE_INSTALL_PREFIX|CMAKE_BINARY_DIR|g' python/CMakeLists.txt |
| 31 | + |
| 32 | + sed -i 's|resources|/usr/share/materialx/resources|g' source/MaterialXView/{Main.cpp,Viewer.cpp} |
| 33 | + sed -i 's|"libraries"|"/usr/share/materialx/libraries"|g' source/MaterialXView/Main.cpp |
| 34 | + sed -i 's|resources|/usr/share/materialx/resources|g' source/MaterialXGraphEditor/{Main.cpp,Graph.cpp} |
| 35 | + sed -i 's|"libraries"|"/usr/share/materialx/libraries"|g' source/MaterialXGraphEditor/{Main.cpp,Graph.cpp} |
| 36 | + sed -i 's|"libraries"|"/usr/share/materialx/libraries"|g' source/MaterialXGenShader/GenOptions.h |
| 37 | + |
| 38 | + dos2unix python/Scripts/* |
| 39 | +} |
| 40 | + |
| 41 | +build() { |
| 42 | + cmake -S MaterialX-${pkgver} -B build -G Ninja \ |
| 43 | + -DCMAKE_INSTALL_PREFIX=/usr \ |
| 44 | + -DCMAKE_SKIP_INSTALL_RPATH=ON \ |
| 45 | + -DCMAKE_SKIP_RPATH=ON \ |
| 46 | + -Wno-dev \ |
| 47 | + -DMATERIALX_BUILD_SHARED_LIBS=ON \ |
| 48 | + -DMATERIALX_BUILD_PYTHON=ON \ |
| 49 | + -DMATERIALX_BUILD_VIEWER=ON \ |
| 50 | + -DMATERIALX_BUILD_GRAPH_EDITOR=ON \ |
| 51 | + -DNANOGUI_NATIVE_FLAGS="-march=armv8-a" |
| 52 | + |
| 53 | + cmake --build build |
| 54 | +} |
| 55 | + |
| 56 | +package() { |
| 57 | + DESTDIR=${pkgdir} cmake --install build |
| 58 | + |
| 59 | + find ${pkgdir} -type f -name "README.md" -exec rm {} \; |
| 60 | + rm ${pkgdir}/usr/CHANGELOG.md |
| 61 | + |
| 62 | + for file in ${pkgdir}/usr/python/Scripts/*; do |
| 63 | + name="${file%.py}" |
| 64 | + chmod +x "$file" |
| 65 | + mv "$file" $name |
| 66 | + done |
| 67 | + |
| 68 | + mkdir -p ${pkgdir}/usr/share/$pkgname |
| 69 | + mv ${pkgdir}/usr/resources ${pkgdir}/usr/share/$pkgname/resources |
| 70 | + mv ${pkgdir}/usr/libraries ${pkgdir}/usr/share/$pkgname/libraries |
| 71 | + |
| 72 | + cp ${pkgdir}/usr/python/Scripts/* ${pkgdir}/usr/bin |
| 73 | + rm -r ${pkgdir}/usr/python/Scripts |
| 74 | + |
| 75 | + mkdir -p ${pkgdir}/usr/lib/python$_pyver |
| 76 | + mv ${pkgdir}/usr/python $_/site-packages |
| 77 | + |
| 78 | + install -Dm755 ${srcdir}/MaterialX-${pkgver}/documents/Images/MaterialXLogo_200x155.png ${pkgdir}/usr/share/icons/hicolor/256x256/apps/materialx.png |
| 79 | + |
| 80 | + # Fix CMake configs |
| 81 | + sed -i 's|libraries|share/materialx/libraries|g' ${pkgdir}/usr/lib/cmake/MaterialX/MaterialXConfig.cmake |
| 82 | + sed -i 's|python|lib/python'$_pyver'/site-packages/MaterialX|g' ${pkgdir}/usr/lib/cmake/MaterialX/MaterialXConfig.cmake |
| 83 | + sed -i 's|resources|share/materialx/resources|g' ${pkgdir}/usr/lib/cmake/MaterialX/MaterialXConfig.cmake |
| 84 | + |
| 85 | + mkdir -p ${pkgdir}/usr/share/{applications,mime/model,licenses/$pkgname} |
| 86 | + cp ${srcdir}/{materialx-grapheditor.desktop,materialx-view.desktop} ${pkgdir}/usr/share/applications |
| 87 | + install -Dm644 ${srcdir}/materialx.xml ${pkgdir}/usr/share/mime/model/materialx.xml |
| 88 | + mv ${pkgdir}/usr/{LICENSE,THIRD-PARTY.md} ${pkgdir}/usr/share/licenses/materialx/ |
| 89 | + |
| 90 | + # Remove junk |
| 91 | + rm -rf ${pkgdir}/build |
| 92 | + |
| 93 | + # Remove empty dirs |
| 94 | + find ${pkgdir}/usr -empty -type d -delete |
| 95 | +} |
0 commit comments