flitter: unstable-2020-10-05 -> 1.0.0 (#341162)

This commit is contained in:
Peder Bergebakken Sundt 2024-09-12 23:45:05 +02:00 committed by GitHub
commit 08c4d04200
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 81 deletions

View File

@ -1,55 +1,32 @@
{ lib
, ocamlPackages
, stdenv
, rustPlatform
, fetchFromGitHub
, makeWrapper
, python3
, pkg-config
, xorg
}:
ocamlPackages.buildDunePackage {
rustPlatform.buildRustPackage rec {
pname = "flitter";
# request to tag releases: https://github.com/alexozer/flitter/issues/34
version = "unstable-2020-10-05";
duneVersion = "3";
version = "1.0.0";
src = fetchFromGitHub {
owner = "alexozer";
repo = "flitter";
rev = "666c5483bc93efa6d01e0b7a927461269f8e14de";
sha256 = "1k3m7bjq5yrrq7vhnbdykni65dsqhq6knnv9wvwq3svb3n07z4w3";
rev = "v${version}";
sha256 = "sha256-XyHUUuENnGmIUlfYl7+NuSP115+sZfjXtd4bEIZQpf8=";
};
# compatibility with core >= 0.15
patches = [ ./flitter.patch ];
# https://github.com/alexozer/flitter/issues/28
postPatch = ''
for f in src/*.ml; do
substituteInPlace "$f" \
--replace 'Unix.gettimeofday' 'Caml_unix.gettimeofday' \
--replace 'Core_kernel' 'Core' \
--replace 'sexp_option' 'option[@sexp.option]' \
--replace 'sexp_list' 'list[@sexp.list]'
done
'';
cargoHash = "sha256-ydYBHC/LxdYGA1+eYLTSZdkOhAgkw99J9JVT5micgdg=";
nativeBuildInputs = [
makeWrapper
pkg-config
];
buildInputs = with ocamlPackages; [
core_unix
lwt_ppx
sexp_pretty
color
notty
buildInputs = [
xorg.libX11
];
postInstall = ''
wrapProgram $out/bin/flitter \
--prefix PATH : "${python3.withPackages (pp: [ pp.pynput ])}/bin"
'';
meta = with lib; {
description = "Livesplit-inspired speedrunning split timer for Linux/macOS terminal";
license = licenses.mit;
@ -57,5 +34,6 @@ ocamlPackages.buildDunePackage {
homepage = "https://github.com/alexozer/flitter";
platforms = platforms.unix;
mainProgram = "flitter";
broken = stdenv.isDarwin;
};
}

View File

@ -1,46 +0,0 @@
diff --git a/src/big.ml b/src/big.ml
index 7cd327f..f84bc10 100644
--- a/src/big.ml
+++ b/src/big.ml
@@ -11,7 +11,7 @@ let big_font_map =
] in
let uchar_of_char =
- let open Caml.Uchar in
+ let open Stdlib.Uchar in
function
| '[' -> of_int 0x258C
| ']' -> of_int 0x2590
@@ -48,4 +48,4 @@ let image_of_string attr str =
List.map (String.to_list str) ~f:(fun ch ->
List.map (Map.find_exn big_font_map ch) ~f:(I.uchars attr)
|> I.vcat
- ) |> I.hcat
\ No newline at end of file
+ ) |> I.hcat
diff --git a/src/display.ml b/src/display.ml
index bd6f7e4..44d7f6d 100644
--- a/src/display.ml
+++ b/src/display.ml
@@ -41,7 +41,7 @@ let splits_header timer width =
let joined = I.hcat cell_padded in
let padded = left_pad width joined in
- let br = I.uchar Colors.label (Caml.Uchar.of_int 0x2500) width 1 in
+ let br = I.uchar Colors.label (Stdlib.Uchar.of_int 0x2500) width 1 in
I.(padded <-> br)
type time_status = Ahead_gain | Ahead_loss | Behind_gain | Behind_loss | Gold
diff --git a/src/dune b/src/dune
index a50b09a..2b00ee2 100644
--- a/src/dune
+++ b/src/dune
@@ -1,7 +1,7 @@
(library
(name flitter)
(wrapped false)
- (libraries core lwt.unix notty notty.unix re color sexp_pretty)
+ (libraries core core_kernel.caml_unix lwt.unix notty notty.unix re color sexp_pretty)
(preprocess (pps lwt_ppx ppx_sexp_conv))
)