summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2019-03-18 21:39:12 -0400
committerMark H Weaver <mhw@netris.org>2019-03-20 18:20:36 -0400
commit8b672b2c48164c78731ae142ae4761d91666bdec (patch)
tree4e5ccad6043e39d50655fe548dbcc2027de39441 /gnu
parent933cc19684327a1cbe7cc45d1bf7bf7b327bf288 (diff)
downloadguix-8b672b2c48164c78731ae142ae4761d91666bdec.tar.gz
gnu: blender: Restore version 2.79b for systems without OpenGL 3.
Fixes <https://bugs.gnu.org/33882>.

* gnu/packages/graphics.scm (blender-2.79): New variable.
(blender)[description]: Remove obsolete claim that the stable
release no longer works in Guix.
* gnu/packages/patches/blender-2.79-newer-ffmpeg.patch,
gnu/packages/patches/blender-2.79-python-3.7-fix.patch: New files.
* gnu/local.mk (dist_patch_DATA): Add them.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk2
-rw-r--r--gnu/packages/graphics.scm93
-rw-r--r--gnu/packages/patches/blender-2.79-newer-ffmpeg.patch80
-rw-r--r--gnu/packages/patches/blender-2.79-python-3.7-fix.patch43
4 files changed, 216 insertions, 2 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index a5a2f11538..c9c7378f02 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -672,6 +672,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/beignet-correct-file-names.patch		\
   %D%/packages/patches/biber-fix-encoding-write.patch		\
   %D%/packages/patches/binutils-loongson-workaround.patch	\
+  %D%/packages/patches/blender-2.79-newer-ffmpeg.patch		\
+  %D%/packages/patches/blender-2.79-python-3.7-fix.patch	\
   %D%/packages/patches/boost-fix-icu-build.patch		\
   %D%/packages/patches/byobu-writable-status.patch		\
   %D%/packages/patches/calibre-no-updates-dialog.patch		\
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index bf4cc89b08..11158bdfd1 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2018 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
+;;; Copyright © 2019 Mark H Weaver <mhw@netris.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -165,10 +166,98 @@ the 3D pipeline—modeling, rigging, animation, simulation, rendering,
 compositing and motion tracking, even video editing and game creation.  The
 application can be customized via its API for Python scripting.
 
-WARNING: This package offers a beta build of Blender, because the stable release
-no longer works in Guix. See @uref{https://issues.guix.info/issue/33882}.")
+WARNING: This is a beta build of Blender.")
     (license license:gpl2+))))
 
+(define-public blender-2.79
+  (package
+    (name "blender")
+    (version "2.79b")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://download.blender.org/source/"
+                                  "blender-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1g4kcdqmf67srzhi3hkdnr4z1ph4h9sza1pahz38mrj998q4r52c"))
+              (patches (search-patches "blender-2.79-newer-ffmpeg.patch"
+                                       "blender-2.79-python-3.7-fix.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+      (let ((python-version (version-major+minor (package-version python))))
+       `(;; Test files are very large and not included in the release tarball.
+         #:tests? #f
+         #:configure-flags
+         (list "-DWITH_CODEC_FFMPEG=ON"
+               "-DWITH_CODEC_SNDFILE=ON"
+               "-DWITH_CYCLES=ON"
+               "-DWITH_DOC_MANPAGE=ON"
+               "-DWITH_FFTW3=ON"
+               "-DWITH_GAMEENGINE=ON"
+               "-DWITH_IMAGE_OPENJPEG=ON"
+               "-DWITH_INPUT_NDOF=ON"
+               "-DWITH_INSTALL_PORTABLE=OFF"
+               "-DWITH_JACK=ON"
+               "-DWITH_MOD_OCEANSIM=ON"
+               "-DWITH_PLAYER=ON"
+               "-DWITH_PYTHON_INSTALL=OFF"
+               "-DWITH_PYTHON_INSTALL=OFF"
+               "-DWITH_SYSTEM_OPENJPEG=ON"
+               (string-append "-DPYTHON_LIBRARY=python" ,python-version "m")
+               (string-append "-DPYTHON_LIBPATH=" (assoc-ref %build-inputs "python")
+                              "/lib")
+               (string-append "-DPYTHON_INCLUDE_DIR=" (assoc-ref %build-inputs "python")
+                              "/include/python" ,python-version "m")
+               (string-append "-DPYTHON_VERSION=" ,python-version))
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'fix-broken-import
+             (lambda _
+               (substitute* "release/scripts/addons/io_scene_fbx/json2fbx.py"
+                 (("import encode_bin") "from . import encode_bin"))
+               #t))
+           (add-after 'set-paths 'add-ilmbase-include-path
+             (lambda* (#:key inputs #:allow-other-keys)
+               ;; OpenEXR propagates ilmbase, but its include files do not appear
+               ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
+               ;; the CPATH to satisfy the dependency on "half.h".
+               (setenv "CPATH"
+                       (string-append (assoc-ref inputs "ilmbase")
+                                      "/include/OpenEXR"
+                                      ":" (or (getenv "CPATH") "")))
+               #t))))))
+    (inputs
+     `(("boost" ,boost)
+       ("jemalloc" ,jemalloc)
+       ("libx11" ,libx11)
+       ("openimageio" ,openimageio)
+       ("openexr" ,openexr)
+       ("ilmbase" ,ilmbase)
+       ("openjpeg" ,openjpeg-1)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libtiff" ,libtiff)
+       ("ffmpeg" ,ffmpeg)
+       ("fftw" ,fftw)
+       ("jack" ,jack-1)
+       ("libsndfile" ,libsndfile)
+       ("freetype" ,freetype)
+       ("glew" ,glew)
+       ("openal" ,openal)
+       ("python" ,python)
+       ("zlib" ,zlib)))
+    (home-page "https://blender.org/")
+    (synopsis "3D graphics creation suite")
+    (description
+     "Blender is a 3D graphics creation suite.  It supports the entirety of
+the 3D pipeline—modeling, rigging, animation, simulation, rendering,
+compositing and motion tracking, even video editing and game creation.  The
+application can be customized via its API for Python scripting.
+
+NOTE: This older version of Blender is the last release that does not require
+OpenGL 3.  It is retained for use with older computers.")
+    (license license:gpl2+)))
+
 (define-public assimp
   (package
     (name "assimp")
diff --git a/gnu/packages/patches/blender-2.79-newer-ffmpeg.patch b/gnu/packages/patches/blender-2.79-newer-ffmpeg.patch
new file mode 100644
index 0000000000..363489bc70
--- /dev/null
+++ b/gnu/packages/patches/blender-2.79-newer-ffmpeg.patch
@@ -0,0 +1,80 @@
+https://sources.debian.org/data/main/b/blender/2.79.b+dfsg0-4/debian/patches/0008-fix_building_with_latest_versions_of_FFmpeg.patch
+
+From: Bastien Montagne <montagne29@wanadoo.fr>
+Date: Tue, 8 May 2018 16:00:52 +0200
+Subject: fix_building_with_latest_versions_of_FFmpeg
+
+Some years-old deprecated stuff has now been removed.
+
+Correct solution is probably to use valid defines etc. in own code, but
+this is more FFMEPG maintainer task (since it also may change how old
+FFMPEG we do support...).
+---
+ intern/ffmpeg/ffmpeg_compat.h                  | 39 ++++++++++++++++++++++++++
+ source/blender/blenkernel/intern/writeffmpeg.c |  3 +-
+ 2 files changed, 41 insertions(+), 1 deletion(-)
+
+diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
+index 9c06c8a..f7f437c 100644
+--- a/intern/ffmpeg/ffmpeg_compat.h
++++ b/intern/ffmpeg/ffmpeg_compat.h
+@@ -109,6 +109,45 @@ int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
+ 
+ #endif
+ 
++/* XXX TODO Probably fix to correct modern flags in code? Not sure how old FFMPEG we want to support though,
++ * so for now this will do. */
++
++#ifndef FF_MIN_BUFFER_SIZE
++#  ifdef AV_INPUT_BUFFER_MIN_SIZE
++#    define FF_MIN_BUFFER_SIZE AV_INPUT_BUFFER_MIN_SIZE
++#  endif
++#endif
++
++#ifndef FF_INPUT_BUFFER_PADDING_SIZE
++#  ifdef AV_INPUT_BUFFER_PADDING_SIZE
++#    define FF_INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE
++#  endif
++#endif
++
++#ifndef CODEC_FLAG_GLOBAL_HEADER
++#  ifdef AV_CODEC_FLAG_GLOBAL_HEADER
++#    define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
++#  endif
++#endif
++
++#ifndef CODEC_FLAG_GLOBAL_HEADER
++#  ifdef AV_CODEC_FLAG_GLOBAL_HEADER
++#    define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
++#  endif
++#endif
++
++#ifndef CODEC_FLAG_INTERLACED_DCT
++#  ifdef AV_CODEC_FLAG_INTERLACED_DCT
++#    define CODEC_FLAG_INTERLACED_DCT AV_CODEC_FLAG_INTERLACED_DCT
++#  endif
++#endif
++
++#ifndef CODEC_FLAG_INTERLACED_ME
++#  ifdef AV_CODEC_FLAG_INTERLACED_ME
++#    define CODEC_FLAG_INTERLACED_ME AV_CODEC_FLAG_INTERLACED_ME
++#  endif
++#endif
++
+ /* FFmpeg upstream 1.0 is the first who added AV_ prefix. */
+ #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 59, 100)
+ #  define AV_CODEC_ID_NONE CODEC_ID_NONE
+diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
+index a19e414..04d508a 100644
+--- a/source/blender/blenkernel/intern/writeffmpeg.c
++++ b/source/blender/blenkernel/intern/writeffmpeg.c
+@@ -605,7 +605,8 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int
+ 	c->rc_buffer_aggressivity = 1.0;
+ #endif
+ 
+-	c->me_method = ME_EPZS;
++	/* Deprecated and not doing anything since July 2015, deleted in recent ffmpeg */
++	//c->me_method = ME_EPZS;
+ 	
+ 	codec = avcodec_find_encoder(c->codec_id);
+ 	if (!codec)
diff --git a/gnu/packages/patches/blender-2.79-python-3.7-fix.patch b/gnu/packages/patches/blender-2.79-python-3.7-fix.patch
new file mode 100644
index 0000000000..fd1d8ba437
--- /dev/null
+++ b/gnu/packages/patches/blender-2.79-python-3.7-fix.patch
@@ -0,0 +1,43 @@
+Copied from https://git.blender.org/gitweb/gitweb.cgi/blender.git/patch/1db47a2ccd1e68994bf8140eba6cc2a26a2bc91f
+Fixes <https://bugs.gnu.org/33608>.
+
+From 1db47a2ccd1e68994bf8140eba6cc2a26a2bc91f Mon Sep 17 00:00:00 2001
+From: Campbell Barton <ideasman42@gmail.com>
+Date: Thu, 12 Jul 2018 08:28:06 +0200
+Subject: [PATCH] Fix PyRNA class registration w/ Python 3.7
+
+In Python3.7 this now raises an error.
+---
+ source/blender/python/intern/bpy_rna.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
+index 9052b6f580a..80b0aa7a51b 100644
+--- a/source/blender/python/intern/bpy_rna.c
++++ b/source/blender/python/intern/bpy_rna.c
+@@ -7577,10 +7577,12 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
+ 		if (!(flag & PROP_REGISTER))
+ 			continue;
+ 
++		/* TODO(campbell): Use Python3.7x _PyObject_LookupAttr(), also in the macro below. */
+ 		identifier = RNA_property_identifier(prop);
+ 		item = PyObject_GetAttrString(py_class, identifier);
+ 
+ 		if (item == NULL) {
++			PyErr_Clear();
+ 			/* Sneaky workaround to use the class name as the bl_idname */
+ 
+ #define     BPY_REPLACEMENT_STRING(rna_attr, py_attr)                         \
+@@ -7596,6 +7598,9 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
+ 					}                                                         \
+ 					Py_DECREF(item);                                          \
+ 				}                                                             \
++				else {                                                        \
++					PyErr_Clear();                                            \
++				}                                                             \
+ 			}  /* intentionally allow else here */
+ 
+ 			if (false) {}  /* needed for macro */
+-- 
+2.20.1
+