Skip to content

Commit f537f87

Browse files
authored
pdisk: Modernise, fix build, 0.9 -> 0.10 (#388480)
2 parents a04f3fc + 1bffa07 commit f537f87

File tree

3 files changed

+36
-27
lines changed

3 files changed

+36
-27
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--- a/cmdline.c 2021-10-05 22:29:41.000000000 -0700
2+
+++ a/cmdline.c 2024-05-30 12:05:29.146787602 -0700
3+
@@ -22,10 +22,8 @@
4+
* @APPLE_LICENSE_HEADER_END@
5+
*/
6+
#include <stdio.h>
7+
-#ifndef __linux__
8+
#include <stdlib.h>
9+
#include <unistd.h>
10+
-#endif
11+
#include <string.h>
12+
#include <errno.h>
13+
#include <fcntl.h>

pkgs/tools/system/pdisk/default.nix renamed to pkgs/by-name/pd/pdisk/package.nix

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@
55
fetchpatch,
66
installShellFiles,
77
libbsd,
8-
CoreFoundation,
9-
IOKit,
108
}:
119

12-
stdenv.mkDerivation rec {
10+
stdenv.mkDerivation (finalAttrs: {
1311
pname = "pdisk";
14-
version = "0.9";
12+
version = "0.10";
1513

1614
src = fetchFromGitHub {
1715
owner = "apple-oss-distributions";
18-
repo = pname;
19-
rev = "${pname}-${lib.versions.minor version}";
16+
repo = "pdisk";
17+
tag = "pdisk-${lib.versions.minor finalAttrs.version}";
2018
hash = "sha256-+gBgnk/1juEHE0nXaz7laUaH7sxrX5SzsLGr0PHsdHs=";
2119
};
2220

@@ -41,30 +39,30 @@ stdenv.mkDerivation rec {
4139
url = "https://aur.archlinux.org/cgit/aur.git/plain/linux_strerror.patch?h=pdisk&id=d0c930ea8bcac008bbd0ade1811133a625caea54";
4240
sha256 = "sha256-HGJIS+vTn6456KtaETutIgTPPBm2C9OHf1anG8yaJPo=";
4341
})
42+
43+
# Fix missing includes on Linux
44+
./cmdline.patch
4445
];
4546

4647
postPatch =
4748
''
4849
substituteInPlace makefile \
49-
--replace 'cc' '${stdenv.cc.targetPrefix}cc'
50+
--replace-fail 'cc' '${stdenv.cc.targetPrefix}cc'
5051
''
5152
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
5253
substituteInPlace makefile \
53-
--replace '-lbsd' '-framework CoreFoundation -framework IOKit'
54+
--replace-fail '-lbsd' '-framework CoreFoundation -framework IOKit'
5455
'';
5556

57+
strictDeps = true;
58+
5659
nativeBuildInputs = [
5760
installShellFiles
5861
];
5962

60-
buildInputs =
61-
lib.optionals (!stdenv.hostPlatform.isDarwin) [
62-
libbsd
63-
]
64-
++ lib.optionals (stdenv.hostPlatform.isDarwin) [
65-
CoreFoundation
66-
IOKit
67-
];
63+
buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [
64+
libbsd
65+
];
6866

6967
env.NIX_CFLAGS_COMPILE = "-D_GNU_SOURCE";
7068

@@ -73,23 +71,25 @@ stdenv.mkDerivation rec {
7371
installPhase = ''
7472
runHook preInstall
7573
76-
install -Dm755 cvt_pt $out/bin/cvt_pt
77-
install -Dm755 pdisk $out/bin/pdisk
74+
for exe in pdisk cvt_pt; do
75+
install -Dm755 -t $out/bin $exe
76+
done
7877
7978
installManPage pdisk.8
8079
install -Dm644 pdisk.html $out/share/doc/pdisk/pdisk.html
8180
8281
runHook postInstall
8382
'';
8483

85-
meta = with lib; {
84+
meta = {
8685
description = "Low-level Apple partition table editor for Linux, OSS Apple version";
8786
homepage = "https://github.com/apple-oss-distributions/pdisk";
88-
license = with licenses; [
87+
license = with lib.licenses; [
8988
hpnd # original license statements seems to match this (in files that are shared with mac-fdisk)
9089
apple-psl10 # new files
9190
];
92-
maintainers = with maintainers; [ OPNA2608 ];
93-
platforms = platforms.unix;
91+
mainProgram = "pdisk";
92+
maintainers = with lib.maintainers; [ OPNA2608 ];
93+
platforms = lib.platforms.unix;
9494
};
95-
}
95+
})

pkgs/top-level/all-packages.nix

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3539,10 +3539,6 @@ with pkgs;
35393539

35403540
gzip = callPackage ../tools/compression/gzip { };
35413541

3542-
pdisk = callPackage ../tools/system/pdisk {
3543-
inherit (darwin.apple_sdk.frameworks) CoreFoundation IOKit;
3544-
};
3545-
35463542
plplot = callPackage ../development/libraries/plplot {
35473543
inherit (darwin.apple_sdk.frameworks) Cocoa;
35483544
};

0 commit comments

Comments
 (0)