Merge pull request #150763 from malob/add-signalbackup-tools

This commit is contained in:
Sandro 2022-01-19 16:30:14 +01:00 committed by GitHub
commit 5dcd3d078d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 81 additions and 0 deletions

View file

@ -0,0 +1,34 @@
diff --git a/signalbackup/setfiletimestamp.cc b/signalbackup/setfiletimestamp.cc
index f53a168..d2d1c5e 100644
--- a/signalbackup/setfiletimestamp.cc
+++ b/signalbackup/setfiletimestamp.cc
@@ -21,24 +21,23 @@
#if !defined(_WIN32) && !defined(__MINGW64__)
-#include <fcntl.h>
-#include <sys/stat.h>
+#include <sys/time.h>
bool SignalBackup::setFileTimeStamp(std::string const &file, long long int time_usec) const
{
- struct timespec ntimes[] =
+ struct timeval ntimes[] =
{
{ // ntimes[0] =
time_usec / 1000, // tv_sec, seconds
- (time_usec % 1000) * 1000 // tv_usec, nanoseconds
+ static_cast<int>(time_usec) // tv_usec, nanoseconds
},
{ // ntimes[1] =
time_usec / 1000, // tv_sec, seconds
- (time_usec % 1000) * 1000 // tv_usec, nanoseconds
+ static_cast<int>(time_usec) // tv_usec, nanoseconds
}
};
- return (utimensat(AT_FDCWD, file.c_str(), ntimes, 0) == 0);
+ return (utimes(file.c_str(), ntimes) == 0);
}
#else // this is poorly tested, I don't have windows

View file

@ -0,0 +1,45 @@
{ lib, stdenv, fetchFromGitHub, openssl, sqlite }:
stdenv.mkDerivation rec {
pname = "signalbackup-tools";
version = "20220107";
src = fetchFromGitHub {
owner = "bepaald";
repo = pname;
rev = version;
sha256 = "sha256-sB8/xQgSORtwupcwSejKUhHoz04exdYS0ymefw9wXDQ=";
};
# Remove when Apple SDK is >= 10.13
patches = lib.optional (stdenv.system == "x86_64-darwin") ./apple-sdk-missing-utimensat.patch;
buildInputs = [ openssl sqlite ];
buildFlags = [
"-Wall"
"-Wextra"
"-Wshadow"
"-Wold-style-cast"
"-Woverloaded-virtual"
"-pedantic"
"-std=c++2a"
"-O3"
"-march=native"
];
buildPhase = ''
$CXX $buildFlags */*.cc *.cc -lcrypto -lsqlite3 -o signalbackup-tools
'';
installPhase = ''
mkdir -p $out/bin
cp signalbackup-tools $out/bin/
'';
meta = with lib; {
description = "Tool to work with Signal Backup files";
homepage = "https://github.com/bepaald/signalbackup-tools";
license = licenses.gpl3Only;
maintainers = [ maintainers.malo ];
platforms = platforms.all;
};
}

View file

@ -9590,6 +9590,8 @@ with pkgs;
sigil = libsForQt5.callPackage ../applications/editors/sigil { };
signalbackup-tools = callPackage ../applications/networking/instant-messengers/signalbackup-tools { };
signald = callPackage ../applications/networking/instant-messengers/signald { };
signal-cli = callPackage ../applications/networking/instant-messengers/signal-cli { };