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

pdisk: Modernise, fix build, 0.9 -> 0.10 #388480

Merged
merged 3 commits into from
Mar 22, 2025
Merged
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
13 changes: 13 additions & 0 deletions pkgs/by-name/pd/pdisk/cmdline.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/cmdline.c 2021-10-05 22:29:41.000000000 -0700
+++ a/cmdline.c 2024-05-30 12:05:29.146787602 -0700
@@ -22,10 +22,8 @@
* @APPLE_LICENSE_HEADER_END@
*/
#include <stdio.h>
-#ifndef __linux__
#include <stdlib.h>
#include <unistd.h>
-#endif
#include <string.h>
#include <errno.h>
#include <fcntl.h>
Original file line number Diff line number Diff line change
@@ -5,18 +5,16 @@
fetchpatch,
installShellFiles,
libbsd,
CoreFoundation,
IOKit,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "pdisk";
version = "0.9";
version = "0.10";

src = fetchFromGitHub {
owner = "apple-oss-distributions";
repo = pname;
rev = "${pname}-${lib.versions.minor version}";
repo = "pdisk";
tag = "pdisk-${lib.versions.minor finalAttrs.version}";
hash = "sha256-+gBgnk/1juEHE0nXaz7laUaH7sxrX5SzsLGr0PHsdHs=";
};

@@ -41,30 +39,30 @@ stdenv.mkDerivation rec {
url = "https://aur.archlinux.org/cgit/aur.git/plain/linux_strerror.patch?h=pdisk&id=d0c930ea8bcac008bbd0ade1811133a625caea54";
sha256 = "sha256-HGJIS+vTn6456KtaETutIgTPPBm2C9OHf1anG8yaJPo=";
})

# Fix missing includes on Linux
./cmdline.patch
];

postPatch =
''
substituteInPlace makefile \
--replace 'cc' '${stdenv.cc.targetPrefix}cc'
--replace-fail 'cc' '${stdenv.cc.targetPrefix}cc'
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace makefile \
--replace '-lbsd' '-framework CoreFoundation -framework IOKit'
--replace-fail '-lbsd' '-framework CoreFoundation -framework IOKit'
'';

strictDeps = true;

nativeBuildInputs = [
installShellFiles
];

buildInputs =
lib.optionals (!stdenv.hostPlatform.isDarwin) [
libbsd
]
++ lib.optionals (stdenv.hostPlatform.isDarwin) [
CoreFoundation
IOKit
];
buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [
libbsd
];

env.NIX_CFLAGS_COMPILE = "-D_GNU_SOURCE";

@@ -73,23 +71,25 @@ stdenv.mkDerivation rec {
installPhase = ''
runHook preInstall

install -Dm755 cvt_pt $out/bin/cvt_pt
install -Dm755 pdisk $out/bin/pdisk
for exe in pdisk cvt_pt; do
install -Dm755 -t $out/bin $exe
done

installManPage pdisk.8
install -Dm644 pdisk.html $out/share/doc/pdisk/pdisk.html

runHook postInstall
'';

meta = with lib; {
meta = {
description = "Low-level Apple partition table editor for Linux, OSS Apple version";
homepage = "https://github.com/apple-oss-distributions/pdisk";
license = with licenses; [
license = with lib.licenses; [
hpnd # original license statements seems to match this (in files that are shared with mac-fdisk)
apple-psl10 # new files
];
maintainers = with maintainers; [ OPNA2608 ];
platforms = platforms.unix;
mainProgram = "pdisk";
maintainers = with lib.maintainers; [ OPNA2608 ];
platforms = lib.platforms.unix;
};
}
})
4 changes: 0 additions & 4 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
@@ -3574,10 +3574,6 @@ with pkgs;

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

pdisk = callPackage ../tools/system/pdisk {
inherit (darwin.apple_sdk.frameworks) CoreFoundation IOKit;
};

plplot = callPackage ../development/libraries/plplot {
inherit (darwin.apple_sdk.frameworks) Cocoa;
};