Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goo-engine-4 #1

Merged
merged 4 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add goo-engine project
  • Loading branch information
mkromis committed Jan 31, 2024
commit 4c1ddd9b5ae4588d625f2664f374d57a84f6b0a8
9 changes: 9 additions & 0 deletions goo-engine-git/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.pkg.tar.xz
src/
pkg/
*.git/

# repos
blender-addons
blender-addons-contrib
goo-engine
25 changes: 25 additions & 0 deletions goo-engine-git/0001-Use-github.com-for-make-update-git.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 290e1e73342b5704a9a6a017ad1f208d9d00316f Mon Sep 17 00:00:00 2001
From: Fredrick Brennan <copypaste@kittens.ph>
Date: Tue, 21 Mar 2023 07:25:32 -0400
Subject: [PATCH] Use github.com for `make update` git

---
build_files/utils/make_update.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py
index f4c16ead87a..5a56212bd03 100755
--- a/build_files/utils/make_update.py
+++ b/build_files/utils/make_update.py
@@ -325,7 +325,7 @@ def external_script_initialize_if_needed(args: argparse.Namespace,
# When running `make update` from a freshly cloned fork check whether the fork of the submodule is
# available, If not, switch to the submodule relative to the main blender repository.
if origin_name == "origin" and not make_utils.git_is_remote_repository(args.git_command, external_url):
- external_url = resolve_external_url("https://projects.blender.org/blender/blender", repo_name)
+ external_url = resolve_external_url("https://github.com/dillongoostudios/goo-engine", repo_name)

call((args.git_command, "clone", "--origin", origin_name, external_url, str(external_dir)))

--
2.40.0

27 changes: 27 additions & 0 deletions goo-engine-git/0003-usd_python.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index 787d0f87002..659938a45b2 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -329,6 +329,10 @@ if(WITH_OPENVDB)
endif()
add_bundled_libraries(openvdb/lib)

+if(WITH_USD)
+ list(APPEND __boost_packages python)
+endif()
+
if(WITH_NANOVDB)
find_package_wrapper(NanoVDB)
set_and_warn_library_found("NanoVDB" NANOVDB_FOUND WITH_NANOVDB)
diff --git a/source/blender/io/usd/CMakeLists.txt b/source/blender/io/usd/CMakeLists.txt
index ebd292782c0..02486e72461 100644
--- a/source/blender/io/usd/CMakeLists.txt
+++ b/source/blender/io/usd/CMakeLists.txt
@@ -55,6 +55,7 @@ set(INC
set(INC_SYS
${USD_INCLUDE_DIRS}
${BOOST_INCLUDE_DIR}
+ ${PYTHON_INCLUDE_DIRS}
${TBB_INCLUDE_DIR}
${PYTHON_INCLUDE_DIR}
)
31 changes: 31 additions & 0 deletions goo-engine-git/0004-fix-opencollada-pcre.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From fee2839ca94373cc482e12d7d2916a7dbf0972ea Mon Sep 17 00:00:00 2001
From: Fredrick Brennan <copypaste@kittens.ph>
Date: Thu, 11 May 2023 06:31:19 -0400
Subject: [PATCH] fix opencollada pcre

---
build_files/cmake/platform/platform_unix.cmake | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index ce6ce02622c..0bd92fa7b16 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -264,13 +264,7 @@ endif()
if(WITH_OPENCOLLADA)
find_package_wrapper(OpenCOLLADA)
if(OPENCOLLADA_FOUND)
- if(WITH_STATIC_LIBS)
- # PCRE is bundled with OpenCollada without headers, so can't use
- # find_package reliably to detect it.
- set(PCRE_LIBRARIES ${LIBDIR}/opencollada/lib/libpcre.a)
- else()
- find_package_wrapper(PCRE)
- endif()
+ find_package_wrapper(PCRE)
find_package_wrapper(XML2)
else()
set_and_warn_library_found("OpenCollada" OPENCOLLADA_FOUND WITH_OPENCOLLADA)
--
2.40.1

13 changes: 13 additions & 0 deletions goo-engine-git/0005-usd_python_install.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 66943111380..a0452d8a2b7 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -816,7 +816,7 @@ if(UNIX AND NOT APPLE)
set(_suffix "dist-packages")
endif()
install(
- DIRECTORY ${USD_LIBRARY_DIR}/python/
+ DIRECTORY ${USD_LIBRARY_DIR}/python${PYTHON_VERSION}
DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
PATTERN ".svn" EXCLUDE
PATTERN "__pycache__" EXCLUDE # * any cache *
242 changes: 242 additions & 0 deletions goo-engine-git/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
#!/bin/bash
# Maintainer: Fredrick Brennan <copypaste@kittens.ph>
# Submitter: Lukas Jirkovsky <l.jirkovsky@gmail.com>
# Co-maintainer : bartus <arch-user-repoᘓbartus.33mail.com>
# Goo-Engine tweaks: Mark Kromis

#Configuration:
#Use: makepkg VAR1=0 VAR2=1 to enable(1) disable(0) a feature
#Use: {yay,paru} --mflags=VAR1=0,VAR2=1
#Use: aurutils --margs=VAR1=0,VAR2=1
#Use: VAR1=0 VAR2=1 pamac

# Use FRAGMENT=#{commit,tag,brach}=xxx for bisect build
_fragment="${FRAGMENT:-#branch=goo-engine-v4.0-release}"

# Use CUDA_ARCH to build for specific GPU architecture
# Supports: single arch (sm_52) and list of archs (sm_52;sm_60)
[[ -v CUDA_ARCH ]] && _CMAKE_FLAGS+=(-DCYCLES_CUDA_BINARIES_ARCH="${CUDA_ARCH}")

pkgname=goo-engine-git
pkgver=4.0.r130012.g8f3de0d6b63
pkgrel=1
pkgdesc="A fully integrated 3D graphics creation suite (development)"
arch=('i686' 'x86_64')
url="https://www.dillongoostudios.com/"
depends+=('alembic' 'embree' 'libgl' 'python' 'python-numpy' 'openjpeg2' 'libharu' 'potrace' 'openxr'
'ffmpeg' 'fftw' 'openal' 'freetype2' 'libxi' 'openimageio' 'opencolorio'
'openvdb' 'opencollada' 'opensubdiv' 'libtiff' 'libpng'
'python' 'python-zstandard' 'ccache')
# 'openshadinglanguage'
depends+=('libdecor' 'libepoxy')
optdepends=('cuda: CUDA support in Cycles'
'optix>=7.4.0: OptiX support in Cycles'
'usd>=21.05: USD export Scene'
'openpgl: Intel Path Guiding library in Cycles'
'openimagedenoise: Intel Open Image Denoise support in compositing'
'materialx: MaterialX materials'
'level-zero-headers: Intel OpenCL FPGA kernels (all four needed)'
'intel-compute-runtime: Intel OpenCL FPGA kernels (all four needed)'
'intel-graphics-compiler: Intel OpenCL FPGA kernels (all four needed)'
'intel-oneapi-basekit: Intel OpenCL FPGA kernels (all four needed)'
'gcc11: Compile CUDA support in Cycles'
'makepkg-cg: Control resources during compilation')
makedepends+=('git' 'cmake' 'boost' 'mesa' 'llvm' 'clang' 'subversion')
makedepends+=('wayland-protocols')
makedepends+=('cython')
provides=('blender')
conflicts=('blender' 'blender-4.0-bin')
license=('GPL')
source=("goo-engine::git+https://github.com/dillongoostudios/goo-engine${_fragment}"
'blender-addons::git+https://github.com/blender/blender-addons'
'goo-engine/translations::git+https://github.com/blender/blender-translations'
'blender-addons-contrib::git+https://github.com/blender/blender-addons-contrib'
'goo-engine/dev_tools::git+https://github.com/blender/blender-dev-tools'
'goo-engine/assets::svn+https://svn.blender.org/svnroot/bf-blender/trunk/lib/assets'
# Patches...
'0001-Use-github.com-for-make-update-git.patch'
'0003-usd_python.patch' #add missing python headers when building against python enabled usd.
'0004-fix-opencollada-pcre.patch' #fix broken search for opencollada pcre
'0005-usd_python_install.patch' #fix bad /usr/lib/python missing version
)
sha256sums=('SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'775dc575aa0df37e2567276da146215678b6bfc0788bea97cc5bb964bd8f7928'
'c2db51a83a8d573aa76c760f10e541c84b108d64d05c9647681c4e633b3d0397'
'6beedc541e33288a282f57cd2bd09860f333154027b6175e9f61cce49b8db5df'
'77e6007a05493e56118458260cba765f01ec0b08548828c0be812b650986d2e6')

pkgver() {
blender_version=$(grep -Po "BLENDER_VERSION \K[0-9]{3}" "$srcdir"/goo-engine/source/blender/blenkernel/BKE_blender_version.h)
printf "%d.%d.r%s.g%s" \
$((blender_version/100)) \
$((blender_version%100)) \
"$(git -C "$srcdir/goo-engine" rev-list --count HEAD)" \
"$(git -C "$srcdir/goo-engine" rev-parse --short HEAD)"
}

prepare() {
cd "$srcdir"
mkdir -p goo-engine/scripts/addons
rm -rf goo-engine/scripts/addons{,/contrib}
mv blender-addons goo-engine/scripts/addons
mv blender-addons-contrib goo-engine/scripts/addons/contrib
cd "goo-engine"
# update the submodules
git -c protocol.file.allow=always submodule update --init --recursive --remote
git apply -v "${srcdir}"/*.patch
}

build() {
export PATH="/opt/lib:/opt/bin:$PATH"
_pyver=$(python -c "from sys import version_info; print(\"%d.%d\" % (version_info[0],version_info[1]))")
msg "python version detected: ${_pyver}"

declare -a -g _CMAKE_FLAGS
# determine whether we can install python modules
if [[ -n "$_pyver" ]]; then
export PYTHON_LIBRARY=/usr/lib/libpython${_pyver}.so
export PYTHON_VERSION=${_pyver}
_CMAKE_FLAGS+=( -DPYTHON_VERSION=$_pyver \
-DPYTHON_LIBRARY=/usr/lib/libpython${_pyver}.so \
-DWITH_PYTHON_INSTALL=ON \
-DWITH_PYTHON_SAFETY=OFF )
fi

export CUDAHOSTCXX="$CC"

_CMAKE_FLAGS+=( -DWITH_CLANG=ON \
-DWITH_CYCLES=ON )

# check for oneapi
export _ONEAPI_CLANG=/opt/intel/oneapi/compiler/latest/linux/bin-llvm/clang
export _ONEAPI_CLANGXX=/opt/intel/oneapi/compiler/latest/linux/bin-llvm/clang++
[[ -f "$_ONEAPI_CLANG" ]] && (
_CMAKE_FLAGS+=( -DWITH_CYCLES_DEVICE_ONEAPI=ON \
-DWITH_CYCLES_ONEAPI_BINARIES=ON \
-DWITH_CLANG=ON )
)
[[ -f /opt/bin/clang ]] && _CMAKE_FLAGS+=( -DLLVM_ROOT_DIR=/opt/lib )

# determine whether we can precompile CUDA kernels
_CUDA_PKG=$(pacman -Qq cuda 2>/dev/null) || true
if [ "$_CUDA_PKG" != "" ]; then
CUDAHOSTCXX=`which gcc-11`
PATH="/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/:$PATH"
# https://wiki.blender.org/wiki/Building_Blender/GPU_Binaries
_CMAKE_FLAGS+=( -DWITH_CYCLES_CUDA_BINARIES=ON \
-DWITH_COMPILER_ASAN=OFF \
-DCMAKE_CUDA_HOST_COMPILER=`which gcc-11` )
fi

# check for materialx
_MX_PKG=$(pacman -Qq materialx 2>/dev/null) || true
if [ "$_MX_PKG" != "" ]; then
_CMAKE_FLAGS+=( -DWITH_MATERIALX=ON )
PATH="/usr/materialx:$PATH"
fi

_USD_PKG=$(pacman -Qq usd 2>/dev/null) || true
if [ "$_USD_PKG" != "" ]; then
_CMAKE_FLAGS+=( -DWITH_USD=ON )
PATH="/usr/share/usd:$PATH"
fi

# check for optix
_OPTIX_PKG=$(pacman -Qq optix 2>/dev/null) || true
if [ "$_OPTIX_PKG" != "" ]; then
_CMAKE_FLAGS+=( -DWITH_CYCLES_DEVICE_OPTIX=ON \
-DOPTIX_ROOT_DIR=/opt/optix )
fi

# check for open image denoise
_OIDN_PKG=$(pacman -Qq openimagedenoise 2>/dev/null) || true
if [ "$_OIDN_PKG" != "" ]; then
_CMAKE_FLAGS+=( -DWITH_OPENIMAGEDENOISE=ON )
fi

if [ -d /opt/rocm/bin ]; then
_CMAKE_FLAGS+=( -DWITH_CYCLES_HIP_BINARIES=ON
-DWITH_CYCLES_HYDRA_RENDER_DELEGATE:BOOL=FALSE
)
fi

if [[ -f "$srcdir/blender/CMakeCache.txt" && -z "$KEEP_CMAKE_CACHE" ]]; then
rm "$srcdir/blender/CMakeCache.txt"
fi

NUMPY_PY_INCLUDE=/usr/lib/python${_pyver}/site-packages/numpy/core/include/
[[ -d "$NUMPY_PY_INCLUDE" ]] && (
_CMAKE_FLAGS+=( -DNUMPY_INCLUDE_DIR="$NUMPY_PY_INCLUDE" );
__CFLAGS="$CFLAGS -I$NUMPY_PY_INCLUDE"
__CXXFLAGS="$CXXFLAGS -I$NUMPY_PY_INCLUDE"
export CFLAGS="$__CFLAGS"
export CXXFLAGS="$__CXXFLAGS"
)

export CFLAGS="$CFLAGS -fno-lto"
export CXXFLAGS="$CXXFLAGS -fno-lto"
# Who even knows why this is needed
export CFLAGS="$CFLAGS -lSPIRV -lSPIRV-Tools -lSPIRV-Tools-opt -lSPIRV-Tools-link -lSPIRV-Tools-reduce -lSPIRV-Tools-shared -lglslang"
export CXXFLAGS="$CXXFLAGS -lSPIRV -lSPIRV-Tools -lSPIRV-Tools-opt -lSPIRV-Tools-link -lSPIRV-Tools-reduce -lSPIRV-Tools-shared -lglslang"
_CMAKE_FLAGS+=( -DCMAKE_C_FLAGS="$CFLAGS" );
_CMAKE_FLAGS+=( -DCMAKE_CXX_FLAGS="$CXXFLAGS" );

CMAKE_CMD=(CUDAHOSTCXX="$CUDAHOSTCXX" cmake -B "$srcdir/build" --fresh
-C "${srcdir}/goo-engine/build_files/cmake/config/blender_release.cmake"
-GNinja
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_INSTALL_PREFIX_WITH_CONFIG="${pkgdir}/usr"
-DCMAKE_SKIP_INSTALL_RPATH=ON
-DCMAKE_SKIP_BUILD_RPATH=ON
-DCMAKE_BUILD_TYPE=Release
-DWITH_CYCLES_OSL=OFF
-DWITH_INSTALL_PORTABLE=OFF
-DWITH_LIBS_PRECOMPILED=OFF
-DWITH_STATIC_LIBS=OFF
-DXR_OPENXR_SDK_ROOT_DIR=/usr
-DPYTHON_VERSION="${_pyver}"
"${_CMAKE_FLAGS[@]}"
) #> "$srcdir/../cmake_out"
#--trace-expand \

#-GUnix\ Makefiles

#MAKE_CMD="make ${MAKEFLAGS:--j`nproc`} blender"
MAKE_CMD="ninja ${MAKEFLAGS:--j`nproc`} blender"

USING_MAKEPKG_CG="$(systemctl --user -t slice | grep -o makepkg-cg-`id -u`-'[[:digit:]]\+'.slice'[[:space:]]\+'loaded'[[:space:]]\+'active)" || true
MAKEPKG_CG_WARNING=$(
cat << 'EOF'
If you use systemd, consider trying `makepkg-cg`.
This build is otherwise very likely to use more RAM than
the system has, especially with a high `-j`!
EOF
)
[[ -z "$USING_MAKEPKG_CG" ]] && warning "$MAKEPKG_CG_WARNING"

cd goo-engine
env "${CMAKE_CMD[@]}"
cd ../build
env CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" $MAKE_CMD
}

package() {
_suffix=${pkgver%%.r*}
cd "$srcdir/build"
#sed -ie 's/\(file(INSTALL\)\(.*blender\.1"\))/#\1\2)/' source/creator/cmake_install.cmake
BLENDER_SYSTEM_RESOURCES="${pkgdir}/usr/share/blender/${_suffix}" DESTDIR="$pkgdir" ninja install
#find . -name 'cmake_install.cmake' -exec sed -i -e 's|/usr/lib64/|'"$pkgdir"'/usr/lib/|g' {} \;
#cmake --install . --prefix "$pkgdir/usr"

if [[ -e "$pkgdir/usr/share/blender/${_suffix}/scripts/addons/cycles/lib/" ]] ; then
# make sure the cuda kernels are not stripped
chmod 444 "$pkgdir"/usr/share/blender/${_suffix}/scripts/addons/cycles/lib/*
fi
}

# vim: syntax=bash:et:ts=2:sw=2