diff options
author | D3vil0p3r <vozaanthony@gmail.com> | 2024-02-18 15:24:58 +0100 |
---|---|---|
committer | annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com> | 2024-02-20 19:41:31 +0000 |
commit | af53c6ff2561e1673ca3a96408ffdacbcaa3fc75 (patch) | |
tree | e21bda9bb7db1bebdd98cde1e01cfe207d74aa13 /pkgs | |
parent | 4839cbc6df01ca18a3cc1aaa32cd7b927c4f02b7 (diff) |
recoverdm: init at 0.20
(cherry picked from commit f29636e5c20b73a809b25dc575caaa170a6054b0)
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/by-name/re/recoverdm/0001-darwin-build-fixes.patch | 121 | ||||
-rw-r--r-- | pkgs/by-name/re/recoverdm/package.nix | 53 |
2 files changed, 174 insertions, 0 deletions
diff --git a/pkgs/by-name/re/recoverdm/0001-darwin-build-fixes.patch b/pkgs/by-name/re/recoverdm/0001-darwin-build-fixes.patch new file mode 100644 index 0000000000000..9a06ffd4ab65d --- /dev/null +++ b/pkgs/by-name/re/recoverdm/0001-darwin-build-fixes.patch @@ -0,0 +1,121 @@ +From 9b46e151b9fdaf5684618482e69ef4a307c0d47c Mon Sep 17 00:00:00 2001 +From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com> +Date: Sun, 18 Feb 2024 19:54:21 +0000 +Subject: [PATCH] darwin build fixes + +--- + compat.h | 14 ++++++++++++++ + dev.c | 1 + + error.c | 1 + + io.c | 1 + + mergebad.c | 1 + + recoverdm.c | 1 + + utils.c | 1 + + utils.h | 1 + + 8 files changed, 21 insertions(+) + create mode 100644 src/compat.h + +diff --git a/compat.h b/compat.h +new file mode 100644 +index 0000000..181c8ea +--- /dev/null ++++ b/compat.h +@@ -0,0 +1,14 @@ ++#pragma once ++#ifdef __APPLE__ ++#include <unistd.h> ++_Static_assert(sizeof(off_t) == 8, "off_t must be 8 bytes"); ++typedef off_t off64_t; ++#define stat64 stat ++#define lseek64 lseek ++#define open64 open ++#define POSIX_FADV_SEQUENTIAL 1 ++static inline int posix_fadvise(int fd, off_t offset, off_t len, int advice) ++{ ++ return 0; ++} ++#endif +diff --git a/dev.c b/dev.c +index c1ce748..ae3ce2c 100644 +--- a/dev.c ++++ b/dev.c +@@ -18,6 +18,7 @@ + #include <scsi/scsi_ioctl.h> + #include <linux/cdrom.h> + #endif ++#include "compat.h" + + #include "dev.h" + +diff --git a/error.c b/error.c +index d2f8acf..550e1af 100644 +--- a/error.c ++++ b/error.c +@@ -4,6 +4,7 @@ + #include <stdlib.h> + #include <sys/types.h> + #include <signal.h> ++#include "compat.h" + + void error_exit(char *format, ...) + { +diff --git a/io.c b/io.c +index 9d66534..e784d75 100644 +--- a/io.c ++++ b/io.c +@@ -7,6 +7,7 @@ + #include <unistd.h> + #include <sys/types.h> + #include <sys/stat.h> ++#include "compat.h" + + #include "io.h" + #include "error.h" +diff --git a/mergebad.c b/mergebad.c +index 34a6ef7..580c3bc 100644 +--- a/mergebad.c ++++ b/mergebad.c +@@ -7,6 +7,7 @@ + #include <stdio.h> + #include <stdlib.h> + #include <unistd.h> ++#include "compat.h" + + #include "io.h" + #include "dev.h" +diff --git a/recoverdm.c b/recoverdm.c +index 8b71ae1..5dddeb3 100644 +--- a/recoverdm.c ++++ b/recoverdm.c +@@ -7,6 +7,7 @@ + #include <stdio.h> + #include <stdlib.h> + #include <unistd.h> ++#include "compat.h" + + #include "io.h" + #include "dev.h" +diff --git a/utils.c b/utils.c +index 5791404..ee42a0a 100644 +--- a/utils.c ++++ b/utils.c +@@ -7,6 +7,7 @@ + #include <stdio.h> + #include <stdlib.h> + #include <unistd.h> ++#include "compat.h" + + #include "io.h" + #include "dev.h" +diff --git a/utils.h b/utils.h +index c749c2e..acb0888 100644 +--- a/utils.h ++++ b/utils.h +@@ -1,3 +1,4 @@ ++#include "compat.h" + void * mymalloc(size_t size, char *what); + void * myrealloc(void *oldp, size_t newsize, char *what); + off64_t get_filesize(char *filename); +-- +2.43.0 + diff --git a/pkgs/by-name/re/recoverdm/package.nix b/pkgs/by-name/re/recoverdm/package.nix new file mode 100644 index 0000000000000..b9afeb42d8c2c --- /dev/null +++ b/pkgs/by-name/re/recoverdm/package.nix @@ -0,0 +1,53 @@ +{ lib +, stdenv +, fetchFromGitLab +, fetchpatch +, installShellFiles +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "recoverdm"; + version = "0.20-8"; + + src = fetchFromGitLab { + domain = "salsa.debian.org"; + owner = "pkg-security-team"; + repo = "recoverdm"; + rev = "debian/${finalAttrs.version}"; + hash = "sha256-1iW3Ug85ZLGpvG29N5zJt8oooSQGnLsr+8XIcp4aSSM="; + }; + + patches = let patch = name: "./debian/patches/${name}"; in [ + (patch "10_fix-makefile.patch") + (patch "20_fix-typo-binary.patch") + (patch "30-fix-BTS-mergebad-crash.patch") + (patch "40_dev-c.patch") + ./0001-darwin-build-fixes.patch + ]; + + postPatch = '' + substituteInPlace Makefile \ + --replace '$(DESTDIR)/usr/bin' $out/bin + ''; + + nativeBuildInputs = [ + installShellFiles + ]; + + preInstall = '' + mkdir -p $out/bin + ''; + + postInstall = '' + installManPage recoverdm.1 + ''; + + meta = with lib; { + description = "Recover damaged CD DVD and disks with bad sectors"; + mainProgram = "recoverdm"; + homepage = "https://salsa.debian.org/pkg-security-team/recoverdm"; + maintainers = with maintainers; [ d3vil0p3r ]; + platforms = platforms.unix; + license = licenses.gpl1Only; + }; +}) |