Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signalbackup-tools: init at 20220107 #150763

Merged
merged 1 commit into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it do harm to apply it also on aarch64-darwin? If not we can remove the conditional.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the package does build on aarch64-darwin with the patch applied. However I think it's probably best to only apply the patch when it's needed so that, if the patch has some unintended consequence, it doesn't affect platforms that don't require the patch in the first place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but then it will most likely be forgotten when the package is updated from someone not being on x86_64-darwin.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do my best to keep and eye on it, and remove the patch once #101229 lands.


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;
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9594,6 +9594,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 { };
Expand Down