summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-04-18 15:39:43 +0200
committerLudovic Courtès <ludo@gnu.org>2016-04-18 15:39:43 +0200
commitcd76fbde6f70a6c0087f9330c266d51e334a0679 (patch)
treef8ba593fffcb4dc39e531a71dc5d03b941e55891 /gnu
parent4ef2721b52c4929aac15db4f8b39702cd37955a1 (diff)
downloadguix-cd76fbde6f70a6c0087f9330c266d51e334a0679.tar.gz
gnu: vlc: Make 'plugins.dat' generation reproducible.
Fixes <http://bugs.gnu.org/23307>.

* gnu/packages/video.scm (vlc)[arguments]: Add #:phases.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/video.scm25
1 files changed, 24 insertions, 1 deletions
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 0e80dd459c..a227c8b39f 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -619,7 +619,30 @@ audio/video codec library.")
        `("--disable-a52" ; FIXME: reenable once available
          ,(string-append "LDFLAGS=-Wl,-rpath -Wl,"
                          (assoc-ref %build-inputs "ffmpeg")
-                         "/lib")))) ; needed for the tests
+                         "/lib"))                 ;needed for the tests
+
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'regenerate-plugin-cache
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; The 'install-exec-hook' rule in the top-level Makefile.am
+             ;; generates 'lib/vlc/plugins/plugins.dat', a plugin cache, using
+             ;; 'vlc-cache-gen'.  This file includes the mtime of the plugins
+             ;; it references.  Thus, we first reset the timestamps of all
+             ;; these files, and then regenerate the cache such that the
+             ;; mtimes it includes are always zero instead of being dependent
+             ;; on the build time.
+             (let* ((out       (assoc-ref outputs "out"))
+                    (pkglibdir (string-append out "/lib/vlc"))
+                    (plugindir (string-append pkglibdir "/plugins"))
+                    (cachegen  (string-append pkglibdir "/vlc-cache-gen")))
+               ;; TODO: Factorize 'reset-timestamps'.
+               (for-each (lambda (file)
+                           (let ((s (lstat file)))
+                             (unless (eq? (stat:type s) 'symlink)
+                               (utime file 0 0 0 0))))
+                         (find-files plugindir))
+               (zero? (system* cachegen plugindir))))))))
     (home-page "https://www.videolan.org/")
     (synopsis "Audio and video framework")
     (description "VLC is a cross-platform multimedia player and framework