diff options
author | Alex Hirzel | 2020-11-25 19:29:34 -0500 |
---|---|---|
committer | Alex Hirzel | 2020-11-26 08:29:36 -0500 |
commit | 2a622f6486430cfa6286822b44b4e112415ed1bb (patch) | |
tree | f73898fd9c20725c44abf3c2aa4db2ae8e9ae634 | |
download | aur-2a622f6486430cfa6286822b44b4e112415ed1bb.tar.gz |
initial version
-rw-r--r-- | .SRCINFO | 46 | ||||
-rw-r--r-- | PKGBUILD | 101 | ||||
-rw-r--r-- | swap_pugixml.patch | 42 | ||||
-rw-r--r-- | swap_pybind.patch | 57 | ||||
-rw-r--r-- | swap_pybind_enoki.patch | 18 | ||||
-rw-r--r-- | swap_tbb.patch | 75 |
6 files changed, 339 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..0ea80c4b8a08 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,46 @@ +pkgbase = mitsuba2-git + pkgdesc = A Retargetable Forward and Inverse Renderer + pkgver = r2078.76445e90 + pkgrel = 1 + url = https://www.mitsuba-renderer.org/ + arch = x86_64 + license = custom + checkdepends = python-pytest + checkdepends = python-pytest-xdist + checkdepends = python-numpy + makedepends = clang + makedepends = git + makedepends = cmake + makedepends = ninja + makedepends = python + makedepends = python-sphinx + makedepends = python-guzzle-sphinx-theme + makedepends = python-sphinxcontrib-bibtex + depends = libpng + depends = libjpeg-turbo + depends = libc++ + depends = pugixml + depends = tbb + source = swap_pybind.patch + source = swap_pugixml.patch + source = swap_tbb.patch + source = swap_pybind_enoki.patch + source = git+https://github.com/mitsuba-renderer/mitsuba2.git + source = git+https://github.com/mitsuba-renderer/asmjit.git + source = git+https://github.com/mitsuba-renderer/enoki.git + source = git+https://github.com/mitsuba-renderer/tinyformat.git + source = git+https://github.com/mitsuba-renderer/mitsuba-data.git + source = git+https://github.com/mitsuba-renderer/openexr.git + md5sums = e40fe4bf313d60b1eb7c3da60fb6d434 + md5sums = 617bd32eecbebd8c7036f738b8275e5f + md5sums = 3d896789646b5de546668d9f158697d1 + md5sums = eee8327568bbe7e0fa0a8d873eb2dea0 + md5sums = SKIP + md5sums = SKIP + md5sums = SKIP + md5sums = SKIP + md5sums = SKIP + md5sums = SKIP + +pkgname = mitsuba2-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..2f898a5a0c57 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,101 @@ +# Maintainer: Alex Hirzel <alex at hirzel period us> +pkgname=mitsuba2-git +pkgver=r2078.76445e90 +pkgrel=1 +pkgdesc="A Retargetable Forward and Inverse Renderer" +arch=('x86_64') +url="https://www.mitsuba-renderer.org/" +license=('custom') +groups=() +depends=('libpng' 'libjpeg-turbo' 'libc++' 'pugixml' 'tbb') +makedepends=('clang' 'git' 'cmake' 'ninja' 'python' 'python-sphinx' 'python-guzzle-sphinx-theme' 'python-sphinxcontrib-bibtex') +checkdepends=('python-pytest' 'python-pytest-xdist' 'python-numpy') +install= +source=('swap_pybind.patch' + 'swap_pugixml.patch' + 'swap_tbb.patch' + 'swap_pybind_enoki.patch' + 'git+https://github.com/mitsuba-renderer/mitsuba2.git' + 'git+https://github.com/mitsuba-renderer/asmjit.git' + 'git+https://github.com/mitsuba-renderer/enoki.git' + 'git+https://github.com/mitsuba-renderer/tinyformat.git' + 'git+https://github.com/mitsuba-renderer/mitsuba-data.git' + 'git+https://github.com/mitsuba-renderer/openexr.git') +md5sums=('e40fe4bf313d60b1eb7c3da60fb6d434' + '617bd32eecbebd8c7036f738b8275e5f' + '3d896789646b5de546668d9f158697d1' + 'eee8327568bbe7e0fa0a8d873eb2dea0' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP') + +pkgver() { + cd "$srcdir/${pkgname%-git}" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +build() { + cd "$srcdir/${pkgname%-git}" + + # submodules, some of which need to be compiled with the same compiler as + # mitsuba itself so that ABIs line up + git config submodule.ext/asmjit.url $srcdir/asmjit + git config submodule.ext/enoki.url $srcdir/enoki + git config submodule.ext/tinyformat.url $srcdir/tinyformat + git config submodule.ext/openexr.url $srcdir/openexr + git config submodule.resources/data.url $srcdir/mitsuba-data + git submodule update --init ext/asmjit ext/enoki ext/tinyformat ext/openexr resources/data + + # system versions of these modules are used + rmdir ext/zlib ext/libpng ext/libjpeg + + # patch the build system to use system versions + rmdir ext/pugixml ext/pybind11 + patch -p1 < ../../swap_pybind.patch + patch -p1 < ../../swap_pugixml.patch + patch -p1 < ../../swap_tbb.patch + patch -p1 -d ext/enoki < ../../swap_pybind_enoki.patch + + # not used with the current build options + rmdir ext/embree ext/nanogui + + local site_packages=$(python -c "import site; print(site.getsitepackages()[0])") + CC=clang CXX=clang++ cmake -DCMAKE_MODULE_PATH=$site_packages/pybind11/share/cmake/pybind11/ -DMTS_ENABLE_PYTHON=yes -DMTS_ENABLE_GUI=no -DMTS_ENABLE_EMBREE=no -DCMAKE_INSTALL_PREFIX=$pkgdir -GNinja -B "$srcdir/build" + + ninja -C "$srcdir/build" mkdoc +} + +package() { + cd "$srcdir/${pkgname%-git}" + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + ninja -C "$srcdir/build" install + cd "$srcdir/build" + + # adapt rpath to where libraries will be installed (so they do not conflict + # with other installed libraries) + patchelf --remove-rpath dist/mitsuba dist/python/mitsuba/*.so dist/libIlmImf.so dist/libIlmThread.so dist/libImath.so + patchelf --set-rpath '/usr/lib/mitsuba2' dist/mitsuba dist/python/mitsuba/*.so + + install -Dm755 dist/mitsuba "$pkgdir/usr/bin/mitsuba2" + install -Dm644 dist/*.so -t "$pkgdir/usr/lib/mitsuba2" + install -Dm644 dist/plugins/*.so -t "$pkgdir/usr/lib/mitsuba2/plugins" + + # install data + mkdir -p "$pkgdir/usr/share/mitsuba2" + cp -R dist/data "$pkgdir/usr/share/mitsuba2/data" + + # install python module + local site_packages=$(python -c "import site; print(site.getsitepackages()[0])") + mkdir -p "$pkgdir$site_packages" + cp -R dist/python/* "$pkgdir$site_packages" + + # install documentation + mkdir -p "$pkgdir/usr/share/doc/mitsuba2" + cp -R $srcdir/build/html "$pkgdir/usr/share/doc/mitsuba2" + + # folders which are not used/should not be shipped + rm -rf "$pkgdir/include" "$pkgdir/lib" +} diff --git a/swap_pugixml.patch b/swap_pugixml.patch new file mode 100644 index 000000000000..19e16e0e9cb1 --- /dev/null +++ b/swap_pugixml.patch @@ -0,0 +1,42 @@ +diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt +index 337813dc..a353ee20 100644 +--- a/ext/CMakeLists.txt ++++ b/ext/CMakeLists.txt +@@ -200,13 +200,7 @@ if (MTS_ENABLE_GUI) + endif() + + # Build the pugixml parser +-add_library(pugixml SHARED pugixml/src/pugixml.cpp) +-set_property(TARGET pugixml PROPERTY +- LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/pugixml") +-set_property(TARGET pugixml PROPERTY FOLDER "dependencies") +-set(PUGIXML_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/pugixml/src PARENT_SCOPE) +-set_property(SOURCE pugixml/src/pugixml.cpp +- APPEND PROPERTY COMPILE_DEFINITIONS PUGIXML_BUILD_DLL) ++find_package(pugixml CONFIG) + + # Build ZeroMQ + # set(WITH_SODIUM OFF CACHE BOOL " " FORCE) +diff --git a/src/libcore/CMakeLists.txt b/src/libcore/CMakeLists.txt +index b8b2d88c..d04a4e04 100644 +--- a/src/libcore/CMakeLists.txt ++++ b/src/libcore/CMakeLists.txt +@@ -89,8 +89,7 @@ target_link_libraries(mitsuba-core PRIVATE + # + if (UNIX AND NOT APPLE) + target_link_libraries(mitsuba-core PUBLIC +- -Wl,-rpath-link=$<TARGET_FILE_DIR:tbb> +- -Wl,-rpath-link=$<TARGET_FILE_DIR:pugixml>) ++ -Wl,-rpath-link=$<TARGET_FILE_DIR:tbb>) + endif() + + if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|AMD64") +@@ -103,7 +102,7 @@ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|AMD64") + endif() + + # Copy to 'dist' directory +-add_dist(mitsuba-core pugixml IlmThread Half Half Imath IlmImf Iex tbb) ++add_dist(mitsuba-core IlmThread Half Half Imath IlmImf Iex tbb) + + if (CMAKE_CXX_COMPILER_ID MATCHES "^(GNU)$") + target_link_libraries(mitsuba-core PRIVATE -Wl,--no-undefined) diff --git a/swap_pybind.patch b/swap_pybind.patch new file mode 100644 index 000000000000..8af7ff3b5dab --- /dev/null +++ b/swap_pybind.patch @@ -0,0 +1,57 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 549a3a22..6615d760 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,7 +22,7 @@ endif() + + # ---------- Detect Python ---------- + +-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/ext/pybind11/tools") ++find_package(pybind11 REQUIRED CONFIG) + set(Python_ADDITIONAL_VERSIONS 3.9 3.8 3.7 3.6 3.5) + find_package(PythonLibsNew REQUIRED) + +diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt +index 06ae06b2..337813dc 100644 +--- a/ext/CMakeLists.txt ++++ b/ext/CMakeLists.txt +@@ -3,7 +3,7 @@ set(MTS_PYTHON_VERSION "" CACHE STRING "Python version to use for compiling the + + # Try to autodetect Python (can be overridden manually if needed) + if (MTS_ENABLE_PYTHON) +- list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pybind11/tools") ++ find_package(pybind11 REQUIRED CONFIG) + set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6 3.7 3.8) + find_package(PythonLibsNew ${MTS_PYTHON_VERSION} REQUIRED) + +-Subproject commit 7f4528dda0e59f2600025b7979812b464dbb6e96 +diff --git a/src/libcore/python/CMakeLists.txt b/src/libcore/python/CMakeLists.txt +index 1cd1bad3..d5c1b11f 100644 +--- a/src/libcore/python/CMakeLists.txt ++++ b/src/libcore/python/CMakeLists.txt +@@ -40,6 +40,10 @@ foreach (MTS_VARIANT ${MTS_VARIANTS}) + xml_v.cpp + ) + ++ target_include_directories(${TARGET_NAME} ++ PUBLIC ${PYTHON_INCLUDE_DIRS} ++ ) ++ + target_compile_definitions(${TARGET_NAME}-obj PRIVATE + "-DMTS_VARIANT_NAME=${MTS_VARIANT_NAME}" + "-DMTS_VARIANT_FLOAT=${MTS_VARIANT_FLOAT}" +diff --git a/src/librender/python/CMakeLists.txt b/src/librender/python/CMakeLists.txt +index 2b931909..002da547 100644 +--- a/src/librender/python/CMakeLists.txt ++++ b/src/librender/python/CMakeLists.txt +@@ -34,6 +34,10 @@ foreach (MTS_VARIANT ${MTS_VARIANTS}) + texture_v.cpp + ) + ++ target_include_directories(${TARGET_NAME} ++ PUBLIC ${PYTHON_INCLUDE_DIRS} ++ ) ++ + target_compile_definitions(${TARGET_NAME}-obj PRIVATE + "-DMTS_VARIANT_NAME=${MTS_VARIANT_NAME}" + "-DMTS_VARIANT_FLOAT=${MTS_VARIANT_FLOAT}" diff --git a/swap_pybind_enoki.patch b/swap_pybind_enoki.patch new file mode 100644 index 000000000000..8e2a26fff778 --- /dev/null +++ b/swap_pybind_enoki.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c886fa5..91213f0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -337,12 +337,10 @@ if (ENOKI_AUTODIFF) + endif() + + if (ENOKI_PYTHON) +- set(ENOKI_PYBIND11_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext/pybind11" +- CACHE STRING "Path containing the 'pybind11' library used to compile Enoki.") + message(STATUS "Enoki: building the Python plugin.") + + set(CMAKE_CXX_STANDARD 17) +- add_subdirectory(${ENOKI_PYBIND11_DIR} pybind11) ++ find_package(pybind11 CONFIG) + + pybind11_add_module( + enoki-python-core diff --git a/swap_tbb.patch b/swap_tbb.patch new file mode 100644 index 000000000000..7241236215fb --- /dev/null +++ b/swap_tbb.patch @@ -0,0 +1,75 @@ +diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt +index 68bdee95..f97146d4 100644 +--- a/ext/CMakeLists.txt ++++ b/ext/CMakeLists.txt +@@ -175,15 +175,7 @@ set(OPENEXR_INCLUDE_DIRS + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + + # Build Thread Building Blocks (main shared libraries only) +-set(TBB_BUILD_SHARED ON CACHE BOOL " " FORCE) +-set(TBB_BUILD_STATIC OFF CACHE BOOL " " FORCE) +-set(TBB_BUILD_TESTS OFF CACHE BOOL " " FORCE) +-set(TBB_BUILD_TBBMALLOC OFF CACHE BOOL " " FORCE) +-set(TBB_BUILD_TBBMALLOC_PROXY OFF CACHE BOOL " " FORCE) +-add_subdirectory(tbb) +-set_property(TARGET tbb tbb_def_files PROPERTY FOLDER "dependencies") +-set(TBB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/tbb/include) +-set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIRS} PARENT_SCOPE) ++find_package(TBB CONFIG) + + if (MTS_ENABLE_GUI) + set_property(TARGET glfw glfw_objects nanogui nanogui-obj PROPERTY FOLDER "dependencies") +diff --git a/src/libcore/CMakeLists.txt b/src/libcore/CMakeLists.txt +index 40e461f5..b3fd8383 100644 +--- a/src/libcore/CMakeLists.txt ++++ b/src/libcore/CMakeLists.txt +@@ -86,11 +86,6 @@ target_link_libraries(mitsuba-core PRIVATE + # Image libraries: link to libjpeg, libpng, OpenEXR + ${PNG_LIBRARIES} ${JPEG_LIBRARIES} IlmImf + ) +-# +-if (UNIX AND NOT APPLE) +- target_link_libraries(mitsuba-core PUBLIC +- -Wl,-rpath-link=$<TARGET_FILE_DIR:tbb>) +-endif() + + if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|AMD64") + target_link_libraries(mitsuba-core PRIVATE asmjit) +@@ -102,7 +97,7 @@ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|AMD64") + endif() + + # Copy to 'dist' directory +-add_dist(mitsuba-core IlmThread Half Half Imath IlmImf Iex tbb) ++add_dist(mitsuba-core IlmThread Half Half Imath IlmImf Iex) + + if (CMAKE_CXX_COMPILER_ID MATCHES "^(GNU)$") + target_link_libraries(mitsuba-core PRIVATE -Wl,--no-undefined) +diff --git a/ext/rgb2spec/CMakeLists.txt b/ext/rgb2spec/CMakeLists.txt +index 601af55f..e9fe41b7 100644 +--- a/ext/rgb2spec/CMakeLists.txt ++++ b/ext/rgb2spec/CMakeLists.txt +@@ -18,7 +18,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Intel") + endif() + + +-if (TARGET tbb) ++if (TBB_FOUND) + add_definitions(-DRGB2SPEC_USE_TBB=1) + include_directories(${TBB_INCLUDE_DIRS}) + else () +@@ -34,14 +34,8 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) + add_executable(rgb2spec_opt rgb2spec_opt.cpp) + add_library(rgb2spec STATIC rgb2spec.c) + +-if (TARGET tbb) ++if (TBB_FOUND) + target_link_libraries(rgb2spec_opt PRIVATE tbb) +- +- add_custom_command(TARGET rgb2spec_opt POST_BUILD +- COMMAND ${CMAKE_COMMAND} -E copy_if_different +- $<TARGET_FILE:tbb> +- $<TARGET_FILE_DIR:rgb2spec_opt> +- ) + endif() + + add_custom_command( |