Receipt for: blender

source stuff/blender stuff/blender.desktop stuff/blender.png
# SliTaz package receipt.

PACKAGE="blender"
VERSION="2.83.20"
CATEGORY="graphics"
TAGS="3D creator editor"
SHORT_DESC="3D content creation suite."
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2 GPL3"
WEB_SITE="https://www.blender.org/"

TARBALL="$PACKAGE-$VERSION.tar.xz"
WGET_URL="https://download.blender.org/source/$TARBALL"

SUGGESTED="nvidia"
DEPENDS="desktop-file-utils ffmpeg freeglut freetype gcc83-lib-base glew
	jpeg lcms libboost-date-time libboost-dev libboost-filesystem 
	libboost-locale libboost-regex libboost-thread libdrm libglu-mesa
	libgomp libpng librsvg libsamplerate libsdl mesa openal openexr
	openjpeg python3 tiff zlib"
BUILD_DEPENDS="cmake3 coreutils-file-format ffmpeg-dev freeglut-dev gcc83 gettext 
	glew-dev ilmbase-dev lcms-dev libboost-dev libboost-filesystem-dev 
	libboost-graph-dev libboost-locale-dev libboost-math-dev libboost-regex-dev
	libboost-thread-dev libboost-tr1-dev libglu-mesa-dev librsvg-dev
	libsamplerate-dev libsdl-dev mesa-dev openal-dev openexr-dev openjpeg-dev
	pkg-config python3-dev python3-numpy tiff-dev xorg-libXmu xorg-libXi-dev
	xorg-libXfixes-dev fftw-dev yasm"

current_version()
{
	wget -O - $(dirname $WGET_URL) 2>/dev/null | \
	sed "/$PACKAGE-[0-9]/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*\".*|\\1|" | sort -Vr | sed q
}

# Rules to configure and make the package.
compile_rules()
{
	# Python 3.8 dropped the pymalloc 'm' ABI suffix, so include/lib are just
	# python3.8 (no 'm'). Detect the highest python3.x dev headers present.
	PY3K_VER=$(ls -d /usr/include/python3.[0-9]* 2>/dev/null | \
		grep -oE '3\.[0-9]+' | sort -V | tail -n1)

	# audaspace's python binding (PySound.cpp) needs the numpy C API headers,
	# which python3-numpy ships under site-packages (not on the default path).
	export	CXXFLAGS="$CXXFLAGS -I/usr/lib/python${PY3K_VER}/site-packages/numpy/core/include"
	export	CC=gcc-83
	export	CXX=g++-83

	# Upstream 2.83 bug: GHOST enables the X11 extensions (XInput, Xfixes,
	# Xrender) and core X11 code but never puts their libs on the exe link
	# line -> undefined references (XOpenDevice, XFixesShowCursor,
	# XRenderFindVisualFormat, XConvertSelection). Our modern ld
	# (--no-copy-dt-needed-entries) won't pull them transitively. Link them
	# explicitly in GHOST's LIB list, after the objects that use them.
	sed -i '/^elseif(WITH_X11)/a\  list(APPEND LIB ${X11_X11_LIB} ${X11_Xfixes_LIB} ${X11_Xi_LIB} ${X11_Xrender_LIB})' \
		intern/ghost/CMakeLists.txt

	mkdir	_build
	cd	_build
	# WITH_GAMEENGINE/WITH_PLAYER dropped upstream in 2.80.
	cmake	$src						\
		-D CMAKE_INSTALL_PREFIX:PATH=/usr		\
		-D CMAKE_BUILD_TYPE:STRING=Release		\
		-D CMAKE_EXE_LINKER_FLAGS:STRING="-Wl,--copy-dt-needed-entries" \
		-D WITH_INSTALL_PORTABLE:BOOL=OFF		\
		-D WITH_PYTHON_INSTALL:BOOL=OFF			\
		-D WITH_PYTHON_INSTALL_NUMPY:BOOL=OFF		\
		-D WITH_OPENCOLLADA:BOOL=OFF			\
		-D WITH_CYCLES:BOOL=OFF				\
		-D WITH_TBB:BOOL=OFF				\
		-D WITH_FFTW3:BOOL=ON				\
		-D WITH_SDL:BOOL=OFF				\
		-D PYTHON_VERSION:STRING=$PY3K_VER		\
		-D PYTHON_LIBPATH:STRING=/usr/lib		\
		-D PYTHON_LIBRARY:STRING=python${PY3K_VER}	\
		-D PYTHON_INCLUDE_DIRS:STRING=/usr/include/python${PY3K_VER} &&

	# build
	make $MAKEFLAGS &&
	make install DESTDIR=$DESTDIR &&
	python3 -m compileall "$DESTDIR/usr/share/blender"
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
#	LOCALE="fr de pt_BR es zh_CN"

	mkdir -p $fs/usr/bin
	mkdir -p $fs/usr/share/pixmaps

	cp -a $install/usr/share/blender	$fs/usr/share
	cp -a $install/usr/bin			$fs/usr
	cp -a $install/usr/share/applications	$fs/usr/share
	cp -a $install/usr/share/icons		$fs/usr/share
	mv -f $fs/usr/bin/blender		$fs/usr/bin/blender-bin
	cp -a $stuff/blender			$fs/usr/bin
}