From 7775a1869084d8ffdd3497b7ebfc88f9af128ccc Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 16 Nov 2015 18:34:30 +0100 Subject: [PATCH] gnu: Add Synfig. * gnu/packages/animation.scm (synfig): New variable. * gnu/packages/patches/synfig-build-fix.patch: New file. * gnu-system.am (dist_patch_DATA): Add it. --- gnu-system.am | 1 + gnu/packages/animation.scm | 85 ++++++++++++++++++++- gnu/packages/patches/synfig-build-fix.patch | 61 +++++++++++++++ 3 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/synfig-build-fix.patch diff --git a/gnu-system.am b/gnu-system.am index 186f84b8b7..2bd340a6ed 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -687,6 +687,7 @@ dist_patch_DATA = \ gnu/packages/patches/slim-sigusr1.patch \ gnu/packages/patches/soprano-find-clucene.patch \ gnu/packages/patches/superlu-dist-scotchmetis.patch \ + gnu/packages/patches/synfig-build-fix.patch \ gnu/packages/patches/tar-d_ino_in_dirent-fix.patch \ gnu/packages/patches/tar-skip-unreliable-tests.patch \ gnu/packages/patches/tcsh-fix-autotest.patch \ diff --git a/gnu/packages/animation.scm b/gnu/packages/animation.scm index 9718123a75..1c00ec1660 100644 --- a/gnu/packages/animation.scm +++ b/gnu/packages/animation.scm @@ -22,7 +22,18 @@ #:use-module (guix utils) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system gnu) - #:use-module (gnu packages)) + #:use-module (gnu packages) + #:use-module (gnu packages boost) + #:use-module (gnu packages compression) + #:use-module (gnu packages fontutils) + #:use-module (gnu packages glib) + #:use-module (gnu packages gnome) + #:use-module (gnu packages graphics) + #:use-module (gnu packages gtk) + #:use-module (gnu packages image) + #:use-module (gnu packages imagemagick) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages video)) (define-public etl (package @@ -45,3 +56,75 @@ functions which combine well with the existing types and functions from the C++ @dfn{Standard Template Library} (STL).") (license license:gpl3+))) +(define-public synfig + (package + (name "synfig") + (version "1.0.2") + (source (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/synfig/releases/" + version "/source/synfig-" version + ".tar.gz")) + (sha256 + (base32 + "1d3z2r78j3rkff47q3wl0ami69y3l4nyi5r9zclymb8ar7mgkk9l")) + (patches (list (search-patch "synfig-build-fix.patch"))))) + (build-system gnu-build-system) + (arguments + `(#:configure-flags + ;; The Boost library path is taken from the value of BOOST_LDFLAGS. + (list (string-append "BOOST_LDFLAGS=-L" + (assoc-ref %build-inputs "boost") + "/lib")) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'adapt-to-libxml++-changes + (lambda _ + (substitute* "configure" + (("libxml\\+\\+-2\\.6") "libxml++-3.0")) + (substitute* (append (find-files "src/modules/" "\\.cpp$") + (find-files "src/synfig/" "\\.(cpp|h)$")) + (("add_child\\(") "add_child_element(") + (("get_child_text\\(") "get_first_child_text(") + (("set_child_text\\(") "set_first_child_text(") + (("remove_child\\(") "remove_node(")) + (substitute* "src/modules/mod_svg/svg_parser.cpp" + (("xmlpp::Node::NodeList") "xmlpp::Node::const_NodeList")) + #t)) + (add-before 'configure 'set-flags + (lambda _ + ;; Compile with C++11, required by libsigc++. + (setenv "CXXFLAGS" "-D__STDC_CONSTANT_MACROS -std=gnu++11") + #t))))) + (inputs + `(("boost" ,boost) + ("ffmpeg" ,ffmpeg) + ("libdv" ,libdv) + ("libjpeg" ,libjpeg) + ("libpng" ,libpng) + ("libmng" ,libmng) + ("zlib" ,zlib))) + ;; synfig.pc lists the following as required: Magick++ freetype2 + ;; fontconfig OpenEXR ETL glibmm-2.4 giomm-2.4 libxml++-3.0 sigc++-2.0 + ;; cairo pango pangocairo mlt++ + (propagated-inputs + `(("cairo" ,cairo) + ("etl" ,etl) + ("fontconfig" ,fontconfig) + ("freetype" ,freetype) + ("glibmm" ,glibmm) + ("imagemagick" ,imagemagick) + ("libxml++" ,libxml++) + ("libsigc++" ,libsigc++) + ("mlt" ,mlt) + ("openexr" ,openexr) + ("pango" ,pango))) + (native-inputs + `(("pkg-config" ,pkg-config))) + (home-page "http://www.synfig.org") + (synopsis "Vector-based 2D animation renderer") + (description + "Synfig is a vector-based 2D animation package. It is designed to be +capable of producing feature-film quality animation. It eliminates the need +for tweening, preventing the need to hand-draw each frame.") + (license license:gpl3+))) diff --git a/gnu/packages/patches/synfig-build-fix.patch b/gnu/packages/patches/synfig-build-fix.patch new file mode 100644 index 0000000000..3f6168e0fb --- /dev/null +++ b/gnu/packages/patches/synfig-build-fix.patch @@ -0,0 +1,61 @@ +Allow Synfig to build in C++11 mode. + +Taken from here: +https://projects.archlinux.org/svntogit/community.git/plain/trunk/build-fix.patch?h=packages/synfig + +diff -wbBur synfig-1.0-RC5/src/modules/mod_libavcodec/mptr.cpp synfig-1.0-RC5.my/src/modules/mod_libavcodec/mptr.cpp +--- synfig-1.0-RC5/src/modules/mod_libavcodec/mptr.cpp 2015-03-28 13:15:00.000000000 +0300 ++++ synfig-1.0-RC5.my/src/modules/mod_libavcodec/mptr.cpp 2015-04-28 16:56:11.568749053 +0300 +@@ -56,8 +56,8 @@ + /* === M E T H O D S ======================================================= */ + + +-Importer_LibAVCodec::Importer_LibAVCodec(const char *file): +- filename(file) ++Importer_LibAVCodec::Importer_LibAVCodec(const synfig::FileSystem::Identifier &identifier): ++ Importer(identifier) + { + } + +diff -wbBur synfig-1.0-RC5/src/modules/mod_libavcodec/mptr.h synfig-1.0-RC5.my/src/modules/mod_libavcodec/mptr.h +--- synfig-1.0-RC5/src/modules/mod_libavcodec/mptr.h 2015-03-28 13:15:00.000000000 +0300 ++++ synfig-1.0-RC5.my/src/modules/mod_libavcodec/mptr.h 2015-04-28 16:55:18.699192946 +0300 +@@ -46,7 +46,7 @@ + synfig::String filename; + + public: +- Importer_LibAVCodec(const char *filename); ++ Importer_LibAVCodec(const synfig::FileSystem::Identifier &identifier); + ~Importer_LibAVCodec(); + + virtual bool get_frame(synfig::Surface &surface, const synfig::RendDesc &renddesc, synfig::Time time, synfig::ProgressCallback *callback); +diff -wbBur synfig-1.0-RC5/src/modules/mod_libavcodec/trgt_av.cpp synfig-1.0-RC5.my/src/modules/mod_libavcodec/trgt_av.cpp +--- synfig-1.0-RC5/src/modules/mod_libavcodec/trgt_av.cpp 2015-03-28 13:15:00.000000000 +0300 ++++ synfig-1.0-RC5.my/src/modules/mod_libavcodec/trgt_av.cpp 2015-04-28 16:46:54.720091106 +0300 +@@ -121,14 +121,14 @@ + picture = avcodec_alloc_frame(); + if (!picture) + return NULL; +- size = avpicture_get_size(pix_fmt, width, height); ++ size = avpicture_get_size((::PixelFormat)pix_fmt, width, height); + picture_buf = (uint8_t *)malloc(size); + if (!picture_buf) { + av_free(picture); + return NULL; + } + avpicture_fill((AVPicture *)picture, picture_buf, +- pix_fmt, width, height); ++ (::PixelFormat)pix_fmt, width, height); + return picture; + } + +diff -wbBur synfig-1.0.2/src/synfig/time.cpp synfig-1.0.2.my/src/synfig/time.cpp +--- synfig-1.0.2/src/synfig/time.cpp 2015-07-09 10:33:03.000000000 +0300 ++++ synfig-1.0.2.my/src/synfig/time.cpp 2015-10-12 13:54:58.382313903 +0300 +@@ -319,5 +319,5 @@ + bool + Time::is_valid()const + { +- return !isnan(value_); ++ return !::isnan(value_); + }