summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2018-11-27 19:10:44 +0200
committerEfraim Flashner <efraim@flashner.co.il>2018-11-27 19:57:56 +0200
commitbd606fb2ce9ce9ec94fa7e9b078c87790723675c (patch)
tree74b57c897cd606e2068bf90772f75a0646e25ca0 /gnu/packages
parentdb08ea40873ae20507bc40d34a56dea1b8ce8f0e (diff)
downloadguix-bd606fb2ce9ce9ec94fa7e9b078c87790723675c.tar.gz
gnu: x265: Build 10-bit and 12-bit libraries.
* gnu/packages/video.scm (x265)[arguments]: Add configure-flag to set
%output for the other builds. Add custom 'build-12-bit and 'build-10-bit
phases to build their respective versions. Add a custom phase to install
the 10-bit and 12-bit libraries.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/video.scm50
1 files changed, 46 insertions, 4 deletions
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index bf1f6d36fa..9d3bd3c159 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -412,15 +412,57 @@ and creating Matroska files from other media files (@code{mkvmerge}).")
     (build-system cmake-build-system)
     (arguments
      `(#:tests? #f ; tests are skipped if cpu-optimized code isn't built
-       ;; Ensure position independent code for everyone.
-       #:configure-flags '("-DENABLE_PIC=TRUE")
+       #:configure-flags
+         ;; Ensure position independent code for everyone.
+         (list "-DENABLE_PIC=TRUE"
+               (string-append "-DCMAKE_INSTALL_PREFIX="
+                              (assoc-ref %outputs "out")))
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'prepare-build
+         (add-after 'unpack 'prepare-build
            (lambda _
              (delete-file-recursively "build")
              (chdir "source")
-             #t)))))
+             #t))
+         (add-before 'configure 'build-12-bit
+           (lambda* (#:key (configure-flags '()) #:allow-other-keys)
+             (mkdir "../build-12bit")
+             (with-directory-excursion "../build-12bit"
+               (apply invoke
+                 "cmake" "../source"
+                 "-DHIGH_BIT_DEPTH=ON"
+                 "-DEXPORT_C_API=OFF"
+                 "-DENABLE_CLI=OFF"
+                 "-DMAIN12=ON"
+                 configure-flags)
+               (substitute* (cons "cmake_install.cmake"
+                                  (append
+                                    (find-files "CMakeFiles/x265-shared.dir" ".")
+                                    (find-files "CMakeFiles/x265-static.dir" ".")))
+                 (("libx265") "libx265_main12"))
+               (invoke "make"))))
+         (add-before 'configure 'build-10-bit
+           (lambda* (#:key (configure-flags '()) #:allow-other-keys)
+             (mkdir "../build-10bit")
+             (with-directory-excursion "../build-10bit"
+               (apply invoke
+                 "cmake" "../source"
+                 "-DHIGH_BIT_DEPTH=ON"
+                 "-DEXPORT_C_API=OFF"
+                 "-DENABLE_CLI=OFF"
+                 configure-flags)
+               (substitute* (cons "cmake_install.cmake"
+                                  (append
+                                    (find-files "CMakeFiles/x265-shared.dir" ".")
+                                    (find-files "CMakeFiles/x265-static.dir" ".")))
+                 (("libx265") "libx265_main10"))
+               (invoke "make"))))
+         (add-after 'install 'install-more-libs
+           (lambda _
+             (with-directory-excursion "../build-12bit"
+               (invoke "make" "install"))
+             (with-directory-excursion "../build-10bit"
+               (invoke "make" "install")))))))
     (home-page "http://x265.org/")
     (synopsis "Library for encoding h.265/HEVC video streams")
     (description "x265 is a H.265 / HEVC video encoder application library,