From 2b94c14c9e7bbd2f582e6b5df89424dd089fc78f Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Tue, 19 Jun 2018 21:37:41 +0300 Subject: gnu: x265: Fix building on armhf-linux and aarch64-linux. * gnu/packages/video.scm (x265)[source]: Add patch. [arguments]: Enable PIC on armhf-linux. * gnu/packages/patches/x265-fix-ppc64le-build.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. --- gnu/local.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index bf79b8f3c4..6560944d1b 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1194,6 +1194,7 @@ dist_patch_DATA = \ %D%/packages/patches/wpa-supplicant-fix-nonce-reuse.patch \ %D%/packages/patches/wpa-supplicant-krack-followups.patch \ %D%/packages/patches/wxmaxima-do-not-use-old-gnuplot-parameters.patch \ + %D%/packages/patches/x265-fix-ppc64le-build.patch \ %D%/packages/patches/xboing-CVE-2004-0149.patch \ %D%/packages/patches/xdotool-fix-makefile.patch \ %D%/packages/patches/xf86-video-ark-remove-mibstore.patch \ -- cgit 1.4.1 From 8893218a7d9c750e657cde17e3a670621ec3ea2e Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Tue, 19 Jun 2018 04:49:33 +0200 Subject: gnu: mrrescue: Work on Löve 11. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/games.scm (mrrescue)[arguments]: Extract & patch the game data, and point ‘love’ to this modified copy. Minor cosmetic tweaks. [native-inputs]: Add unzip, patch, and the love-11.patch which is... * gnu/packages/patches/mrrescue-support-love-11.patch: ...a new file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/games.scm | 47 +++-- .../patches/mrrescue-support-love-11.patch | 213 +++++++++++++++++++++ 3 files changed, 248 insertions(+), 13 deletions(-) create mode 100644 gnu/packages/patches/mrrescue-support-love-11.patch (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index 6560944d1b..cdb1edbfb7 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -940,6 +940,7 @@ dist_patch_DATA = \ %D%/packages/patches/mozjs38-shell-version.patch \ %D%/packages/patches/mozjs38-tracelogger.patch \ %D%/packages/patches/mozjs38-version-detection.patch \ + %D%/packages/patches/mrrescue-support-love-11.patch \ %D%/packages/patches/mumble-1.2.19-abs.patch \ %D%/packages/patches/mumps-build-parallelism.patch \ %D%/packages/patches/mupen64plus-ui-console-notice.patch \ diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index e5d5765ff3..ff9adbbd57 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -3267,25 +3267,46 @@ colors, pictures, and sounds.") "0jwzbwkgp1l5ia6c7s760gmdirbsncp6nfqp7vqdqsfb63la9gl2")))) (build-system trivial-build-system) (arguments - '(#:modules ((guix build utils)) + `(#:modules ((guix build utils)) #:builder (begin (use-modules (guix build utils)) - (let* ((out (assoc-ref %outputs "out")) - (bindir (string-append out "/bin")) - (prog (string-append bindir "/mrrescue")) - (source (assoc-ref %build-inputs "source")) - (bash (string-append (assoc-ref %build-inputs "bash") - "/bin/bash")) - (love (string-append (assoc-ref %build-inputs "love") - "/bin/love"))) - (mkdir-p bindir) - (with-output-to-file prog + (let* ((out (assoc-ref %outputs "out")) + (script (string-append out "/bin/" ,name)) + (data (string-append out "/share/" ,name)) + (source (assoc-ref %build-inputs "source")) + (unzip (string-append (assoc-ref %build-inputs "unzip") + "/bin/unzip")) + (patch (string-append (assoc-ref %build-inputs "patch") + "/bin/patch")) + (bash (string-append (assoc-ref %build-inputs "bash") + "/bin/bash")) + (love (string-append (assoc-ref %build-inputs "love") + "/bin/love"))) + + (mkdir-p (dirname script)) + (with-output-to-file script (lambda () (format #t "#!~a~%" bash) - (format #t "exec -a mrrescue \"~a\" \"~a\"~%" love source))) - (chmod prog #o755) + (format #t "exec -a ~a \"~a\" \"~a\"~%" ,name love data))) + (chmod script #o755) + + ;; The better way to package this game would be to install *only* the + ;; script above, pointing to the unextracted .love file in the store. + ;; However, mrrescue 1.02e needs to be patched to work with Love 11. + ;; Instead of extracting the .love file, patching it, and re-zipping + ;; it to the store, simply point the script to the extracted patched + ;; data directory directly. + (mkdir-p data) + (with-directory-excursion data + (invoke unzip source) + (invoke patch "-p1" "-i" + (assoc-ref %build-inputs "love-11.patch"))) #t)))) + (native-inputs + `(("unzip" ,unzip) + ("patch" ,patch) + ("love-11.patch" ,(search-patch "mrrescue-support-love-11.patch")))) (inputs `(("bash" ,bash) ("love" ,love))) diff --git a/gnu/packages/patches/mrrescue-support-love-11.patch b/gnu/packages/patches/mrrescue-support-love-11.patch new file mode 100644 index 0000000000..2786a6b01b --- /dev/null +++ b/gnu/packages/patches/mrrescue-support-love-11.patch @@ -0,0 +1,213 @@ +From: Tobias Geerinckx-Rice +Date: Tue, 19 Jun 2018 04:37:46 +0200 +Subject: gnu: mrrescue: Support Love 11. + +The patch below was copied verbatim from an as-yet-unmerged PR[0] to +make Mr. Rescue run on a newer version of the Löve engine. + +[0]: https://github.com/SimonLarsen/mrrescue/pull/17 +--- +From ab23031e0c2faecb77fde1be8a41d6f8ea4e6eda Mon Sep 17 00:00:00 2001 +From: Mystro256 +Date: Sun, 10 Jun 2018 21:19:23 -0400 +Subject: [PATCH] Love 11 support + +--- + conf.lua | 2 +- + config.lua | 6 +++--- + highscore_entry.lua | 4 ++-- + highscore_list.lua | 4 ++-- + ingame.lua | 6 +++--- + ingame_menu.lua | 4 ++-- + joystick.lua | 4 ++-- + main.lua | 2 +- + resources.lua | 4 ++-- + util.lua | 4 ++-- + 10 files changed, 20 insertions(+), 20 deletions(-) + +diff --git a/conf.lua b/conf.lua +index 8776da4..f00b216 100644 +--- a/conf.lua ++++ b/conf.lua +@@ -1,6 +1,6 @@ + function love.conf(t) + t.identity = "mrrescue" +- t.version = "0.10.0" ++ t.version = "11.0" + t.console = false + t.accelerometerjoystick = true + t.gammacorrect = false +diff --git a/config.lua b/config.lua +index 63eeb04..71c2b66 100644 +--- a/config.lua ++++ b/config.lua +@@ -38,7 +38,7 @@ function loadConfig() + config[i] = v + end + end +- if love.filesystem.exists("settings") then ++ if love.filesystem.getInfo("settings")~= nil then + local data = love.filesystem.read("settings") + local file = TSerial.unpack(data) + for i,v in pairs(file) do +@@ -52,7 +52,7 @@ function loadConfig() + end + + function loadHighscores() +- if love.filesystem.exists("highscores") then ++ if love.filesystem.getInfo("highscores")~= nil then + local data = love.filesystem.read("highscores") + local file = TSerial.unpack(data) + for i=1,3 do +@@ -64,7 +64,7 @@ function loadHighscores() + end + + function loadStats() +- if love.filesystem.exists("stats") then ++ if love.filesystem.getInfo("stats")~= nil then + local data = love.filesystem.read("stats") + stats = TSerial.unpack(data) + end +diff --git a/highscore_entry.lua b/highscore_entry.lua +index 2f763af..3b3bb73 100644 +--- a/highscore_entry.lua ++++ b/highscore_entry.lua +@@ -45,9 +45,9 @@ function highscore_entry.draw() + for ix = 1,10 do + if highscore_entry.selection == char then + lg.rectangle("fill", 33+ix*16, 66+iy*16, 14, 14) +- lg.setColor(0,0,0,255) ++ lg.setColor(0,0,0,1) + lg.print(KEYBOARD:sub(char,char), 37+ix*16, 70+iy*16) +- lg.setColor(255,255,255,255) ++ lg.setColor(1,1,1,1) + else + lg.print(KEYBOARD:sub(char,char), 37+ix*16, 70+iy*16) + end +diff --git a/highscore_list.lua b/highscore_list.lua +index 6a17973..b66d0e2 100644 +--- a/highscore_list.lua ++++ b/highscore_list.lua +@@ -31,10 +31,10 @@ function highscore_list.draw() + if scores[i] then + if highscore_list.level == highscore_list.hllevel + and highscore_list.hlpos == i then +- lg.setColor(25,118,115,255) ++ lg.setColor(25/255,118/255,115/255,1) + lg.print(scores[i].name, 48, 14+i*16) + lg.print(scores[i].score, 105, 14+i*16) +- lg.setColor(255,255,255,255) ++ lg.setColor(1,1,1,1) + else + lg.print(scores[i].name, 48, 14+i*16) + lg.print(scores[i].score, 105, 14+i*16) +diff --git a/ingame.lua b/ingame.lua +index 52004f1..f5c6f7c 100644 +--- a/ingame.lua ++++ b/ingame.lua +@@ -189,16 +189,16 @@ function ingame.draw() + lg.pop() + + if map.type == MT_NORMAL then +- lg.setBlendMode("multiply") ++ lg.setBlendMode("multiply", "premultiplied") + lg.draw(canvas, 0,0) + lg.setBlendMode("alpha") + end + + -- Draw red screen if hit + if player.heat > 0 then +- lg.setColor(255,255,255,cap(player.heat*255, 16, 255)) ++ lg.setColor(1,1,1,cap(player.heat*255, 16, 255)/255) + lg.draw(img.red_screen, quad.red_screen, 0,0) +- lg.setColor(255,255,255,255) ++ lg.setColor(1,1,1,1) + end + + -- Draw hud +diff --git a/ingame_menu.lua b/ingame_menu.lua +index 9fcf768..82a8459 100644 +--- a/ingame_menu.lua ++++ b/ingame_menu.lua +@@ -18,10 +18,10 @@ function ingame_menu.draw() + lg.pop() + + lg.scale(config.scale) +- lg.setColor(0,0,0,238) ++ lg.setColor(0,0,0,238/255) + lg.rectangle("fill", 0, 0, WIDTH, HEIGHT) + +- lg.setColor(255,255,255,255) ++ lg.setColor(1,1,1,1) + lg.printf("PAUSED", 0, 46, WIDTH, "center") + lg.print("RESUME", 103, 92) + lg.print("QUIT", 103, 106) +diff --git a/joystick.lua b/joystick.lua +index 50ccadb..72d545e 100644 +--- a/joystick.lua ++++ b/joystick.lua +@@ -22,11 +22,11 @@ function joystick.draw() + lg.printf("SET JOYSTICK", 0, 39, WIDTH, "center") + for i=1,4 do + if joystick.waiting == true and joystick.selection == i then +- lg.setColor(195,52,41) ++ lg.setColor(195/255,52/255,41/255) + end + lg.print(string.upper(joykeynames[i]), 65, 53+i*13) + lg.print(config.joykeys[joykeynames[i]], 165, 53+i*13) +- lg.setColor(255,255,255) ++ lg.setColor(1,1,1) + end + lg.print("DEFAULT", 65, 118) + lg.print("BACK", 65, 131) +diff --git a/main.lua b/main.lua +index 9433e42..56096fa 100644 +--- a/main.lua ++++ b/main.lua +@@ -273,7 +273,7 @@ function love.releaseerrhand(msg) + local font = love.graphics.newFont(14) + love.graphics.setFont(font) + +- love.graphics.setColor(255, 255, 255, 255) ++ love.graphics.setColor(1, 1, 1, 1) + + love.graphics.clear() + +diff --git a/resources.lua b/resources.lua +index e5aa70d..1bab520 100644 +--- a/resources.lua ++++ b/resources.lua +@@ -7,7 +7,7 @@ local snd = {} -- sound Sources + + local IMAGE_FILES = { + "splash", "tangram", "lovesplashpixel", "howto", +- "tiles", "door", "boldfont", "captain_dialog", "captain_dialog_sad", ++ "tiles", "door", "captain_dialog", "captain_dialog_sad", + "boss_health", "highscore_panes", "exclamation", "stats_screen", + "awards", "hud", "hud2", "hud_people", "item_slots", "water_bar", + "reserve_bar", "overloaded_bar", "temperature_bar", "temperature_bar_blink", +@@ -147,7 +147,7 @@ function loadResources() + img.stream:setWrap("repeat", "clamp") + + -- Create fonts +- font.bold = lg.newImageFont(img.boldfont, " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!'-:*@<>+/_$&?", 2) ++ font.bold = lg.newImageFont("data/boldfont.png", " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!'-:*@<>+/_$&?", 2) + lg.setFont(font.bold) + + -- Create quads +diff --git a/util.lua b/util.lua +index b9976da..656600a 100644 +--- a/util.lua ++++ b/util.lua +@@ -105,9 +105,9 @@ end + + + function drawBox(x,y,w,h) +- lg.setColor(30,23,18) ++ lg.setColor(30/255,23/255,18/255) + lg.rectangle("fill",x+1,y+1,w-2,h-2) +- lg.setColor(255,255,255) ++ lg.setColor(1,1,1) + -- Draw sides + lg.draw(img.menu_box, quad.box_left, x, y+1, 0, 1, (h-2)) + lg.draw(img.menu_box, quad.box_left, x+w, y+1, 0, -1, (h-2)) -- cgit 1.4.1 From ab5fc6a98274f2e4e618535565e05a8b4afe8496 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Tue, 19 Jun 2018 15:12:30 +0200 Subject: gnu: libyaml: Update to 0.1.7. * gnu/packages/web.scm (libyaml): Update to 0.1.7. [source]: Remove patch. * gnu/packages/patches/libyaml-CVE-2014-9130.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. --- gnu/local.mk | 1 - gnu/packages/patches/libyaml-CVE-2014-9130.patch | 30 ------------------------ gnu/packages/web.scm | 5 ++-- 3 files changed, 2 insertions(+), 34 deletions(-) delete mode 100644 gnu/packages/patches/libyaml-CVE-2014-9130.patch (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index cdb1edbfb7..dfd25c7088 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1211,7 +1211,6 @@ dist_patch_DATA = \ %D%/packages/patches/xinetd-fix-fd-leak.patch \ %D%/packages/patches/xinetd-CVE-2013-4342.patch \ %D%/packages/patches/xmodmap-asprintf.patch \ - %D%/packages/patches/libyaml-CVE-2014-9130.patch \ %D%/packages/patches/zathura-plugindir-environment-variable.patch MISC_DISTRO_FILES = \ diff --git a/gnu/packages/patches/libyaml-CVE-2014-9130.patch b/gnu/packages/patches/libyaml-CVE-2014-9130.patch deleted file mode 100644 index 800358c0d6..0000000000 --- a/gnu/packages/patches/libyaml-CVE-2014-9130.patch +++ /dev/null @@ -1,30 +0,0 @@ -Fixes CVE-2014-9130 -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-9130 - -Upstream source: -https://bitbucket.org/xi/libyaml/commits/2b9156756423e967cfd09a61d125d883fca6f4f2 - -# HG changeset patch -# User Kirill Simonov -# Date 1417197312 21600 -# Node ID 2b9156756423e967cfd09a61d125d883fca6f4f2 -# Parent 053f53a381ff6adbbc93a31ab7fdee06a16c8a33 -Removed invalid simple key assertion (thank to Jonathan Gray). - -diff --git a/src/scanner.c b/src/scanner.c ---- a/src/scanner.c -+++ b/src/scanner.c -@@ -1106,13 +1106,6 @@ - && parser->indent == (ptrdiff_t)parser->mark.column); - - /* -- * A simple key is required only when it is the first token in the current -- * line. Therefore it is always allowed. But we add a check anyway. -- */ -- -- assert(parser->simple_key_allowed || !required); /* Impossible. */ -- -- /* - * If the current position may start a simple key, save it. - */ - diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm index 19058de2d3..aaf8505ef4 100644 --- a/gnu/packages/web.scm +++ b/gnu/packages/web.scm @@ -1025,17 +1025,16 @@ hash/signatures.") (define-public libyaml (package (name "libyaml") - (version "0.1.6") + (version "0.1.7") (source (origin (method url-fetch) (uri (string-append "http://pyyaml.org/download/libyaml/yaml-" version ".tar.gz")) - (patches (search-patches "libyaml-CVE-2014-9130.patch")) (sha256 (base32 - "0j9731s5zjb8mjx7wzf6vh7bsqi38ay564x6s9nri2nh9cdrg9kx")))) + "0a87931cx5m14a1x8rbjix3nz7agrcgndf4h392vm62a4rby9240")))) (build-system gnu-build-system) (home-page "http://pyyaml.org/wiki/LibYAML") (synopsis "YAML 1.1 parser and emitter written in C") -- cgit 1.4.1 From 6a8d3381588ad335d14ad8e7d68bcd8530a68252 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Wed, 20 Jun 2018 20:33:31 +0200 Subject: gnu: ocaml: Build reproducibly. * gnu/packages/patches/ocaml-enable-ocamldoc-reproducibility.patch: New file. * gnu/packages/ocaml.scm (ocaml)[origin]: Use it. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/ocaml.scm | 3 +- .../ocaml-enable-ocamldoc-reproducibility.patch | 149 +++++++++++++++++++++ 3 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/ocaml-enable-ocamldoc-reproducibility.patch (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index dfd25c7088..9057826770 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -964,6 +964,7 @@ dist_patch_DATA = \ %D%/packages/patches/ocaml-bitstring-fix-configure.patch \ %D%/packages/patches/ocaml-CVE-2015-8869.patch \ %D%/packages/patches/ocaml-Add-a-.file-directive.patch \ + %D%/packages/patches/ocaml-enable-ocamldoc-reproducibility.patch \ %D%/packages/patches/ocaml-findlib-make-install.patch \ %D%/packages/patches/ocaml-graph-honor-source-date-epoch.patch \ %D%/packages/patches/omake-fix-non-determinism.patch \ diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm index 864038fe99..f21c2b2610 100644 --- a/gnu/packages/ocaml.scm +++ b/gnu/packages/ocaml.scm @@ -135,7 +135,8 @@ (patches (search-patches "ocaml-CVE-2015-8869.patch" - "ocaml-Add-a-.file-directive.patch")))) + "ocaml-Add-a-.file-directive.patch" + "ocaml-enable-ocamldoc-reproducibility.patch")))) (build-system gnu-build-system) (native-search-paths (list (search-path-specification diff --git a/gnu/packages/patches/ocaml-enable-ocamldoc-reproducibility.patch b/gnu/packages/patches/ocaml-enable-ocamldoc-reproducibility.patch new file mode 100644 index 0000000000..39fb7aa226 --- /dev/null +++ b/gnu/packages/patches/ocaml-enable-ocamldoc-reproducibility.patch @@ -0,0 +1,149 @@ +From a87c3f20e846c00e53d695497dba7038edbd12f0 Mon Sep 17 00:00:00 2001 +From: Valentin Lorentz +Date: Thu, 13 Aug 2015 11:59:04 +0200 +Subject: [PATCH] Enable ocamldoc to build reproducible manpages + +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=794586 +Signed-off-by: Stephane Glondu +--- + ocamldoc/odoc_man.ml | 15 +++++---------- + ocamldoc/odoc_misc.ml | 12 ++++++++++-- + ocamldoc/odoc_misc.mli | 7 ++++++- + 3 files changed, 21 insertions(+), 13 deletions(-) + +diff --git a/ocamldoc/odoc_man.ml b/ocamldoc/odoc_man.ml +index 615c5e172..3c85aa32a 100644 +--- a/ocamldoc/odoc_man.ml ++++ b/ocamldoc/odoc_man.ml +@@ -864,14 +864,13 @@ class man = + (** Generate the man page for the given class.*) + method generate_for_class cl = + Odoc_info.reset_type_names () ; +- let date = Unix.time () in + let file = self#file_name cl.cl_name in + try + let chanout = self#open_out file in + let b = new_buf () in + bs b (".TH \""^cl.cl_name^"\" "); + bs b !man_section ; +- bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" "); ++ bs b (" source: "^Odoc_misc.current_date^" "); + bs b "OCamldoc "; + bs b ("\""^(match !Global.title with Some t -> t | None -> "")^"\"\n"); + +@@ -923,14 +922,13 @@ class man = + (** Generate the man page for the given class type.*) + method generate_for_class_type ct = + Odoc_info.reset_type_names () ; +- let date = Unix.time () in + let file = self#file_name ct.clt_name in + try + let chanout = self#open_out file in + let b = new_buf () in + bs b (".TH \""^ct.clt_name^"\" "); + bs b !man_section ; +- bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" "); ++ bs b (" source: "^Odoc_misc.current_date^" "); + bs b "OCamldoc "; + bs b ("\""^(match !Global.title with Some t -> t | None -> "")^"\"\n"); + +@@ -1016,14 +1014,13 @@ class man = + (** Generate the man file for the given module type. + @raise Failure if an error occurs.*) + method generate_for_module_type mt = +- let date = Unix.time () in + let file = self#file_name mt.mt_name in + try + let chanout = self#open_out file in + let b = new_buf () in + bs b (".TH \""^mt.mt_name^"\" "); + bs b !man_section ; +- bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" "); ++ bs b (" source: "^Odoc_misc.current_date^" "); + bs b "OCamldoc "; + bs b ("\""^(match !Global.title with Some t -> t | None -> "")^"\"\n"); + +@@ -1099,14 +1096,13 @@ class man = + (** Generate the man file for the given module. + @raise Failure if an error occurs.*) + method generate_for_module m = +- let date = Unix.time () in + let file = self#file_name m.m_name in + try + let chanout = self#open_out file in + let b = new_buf () in + bs b (".TH \""^m.m_name^"\" "); + bs b !man_section ; +- bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" "); ++ bs b (" source: "^Odoc_misc.current_date^" "); + bs b "OCamldoc "; + bs b ("\""^(match !Global.title with Some t -> t | None -> "")^"\"\n"); + +@@ -1206,14 +1202,13 @@ class man = + | Res_const (_,f) -> f.vc_name + ) + in +- let date = Unix.time () in + let file = self#file_name name in + try + let chanout = self#open_out file in + let b = new_buf () in + bs b (".TH \""^name^"\" "); + bs b !man_section ; +- bs b (" "^(Odoc_misc.string_of_date ~hour: false date)^" "); ++ bs b (" source: "^Odoc_misc.current_date^" "); + bs b "OCamldoc "; + bs b ("\""^(match !Global.title with Some t -> t | None -> "")^"\"\n"); + bs b ".SH NAME\n"; +diff --git a/ocamldoc/odoc_misc.ml b/ocamldoc/odoc_misc.ml +index 4c74476da..456225f62 100644 +--- a/ocamldoc/odoc_misc.ml ++++ b/ocamldoc/odoc_misc.ml +@@ -223,9 +223,9 @@ let apply_opt f v_opt = + None -> None + | Some v -> Some (f v) + +-let string_of_date ?(hour=true) d = ++let string_of_date ?(absolute=false) ?(hour=true) d = + let add_0 s = if String.length s < 2 then "0"^s else s in +- let t = Unix.localtime d in ++ let t = (if absolute then Unix.gmtime else Unix.localtime) d in + (string_of_int (t.Unix.tm_year + 1900))^"-"^ + (add_0 (string_of_int (t.Unix.tm_mon + 1)))^"-"^ + (add_0 (string_of_int t.Unix.tm_mday))^ +@@ -238,6 +238,14 @@ let string_of_date ?(hour=true) d = + "" + ) + ++let current_date = ++ let time = ++ try ++ float_of_string (Sys.getenv "SOURCE_DATE_EPOCH") ++ with ++ Not_found -> Unix.time () ++ in string_of_date ~absolute: true ~hour: false time ++ + + let rec text_list_concat sep l = + match l with +diff --git a/ocamldoc/odoc_misc.mli b/ocamldoc/odoc_misc.mli +index dd5a7fcb9..38ff0612b 100644 +--- a/ocamldoc/odoc_misc.mli ++++ b/ocamldoc/odoc_misc.mli +@@ -62,7 +62,12 @@ val apply_opt : ('a -> 'b) -> 'a option -> 'b option + + (** Return a string representing a date given as a number of seconds + since 1970. The hour is optionnaly displayed. *) +-val string_of_date : ?hour:bool -> float -> string ++val string_of_date : ?absolute:bool -> ?hour:bool -> float -> string ++ ++(* Value returned by string_of_date for current time. ++ * Uses environment variable SOURCE_DATE_EPOCH if set; falls back to ++ * current timestamp otherwise. *) ++val current_date : string + + (** Return the first sentence (until the first dot) of a text. + Don't stop in the middle of [Code], [Verbatim], [List], [Lnum], +-- +2.17.1 + -- cgit 1.4.1