newsboat: fix build on darwin, use mkDerivation/cargoSetupHook (#449525)
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
cargo,
|
||||
rustc,
|
||||
stfl,
|
||||
sqlite,
|
||||
curl,
|
||||
@@ -17,7 +20,7 @@
|
||||
nix-update-script,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "newsboat";
|
||||
version = "2.41";
|
||||
|
||||
@@ -28,19 +31,35 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
hash = "sha256-LhEhbK66OYwAD/pel81N7Hgh/xEvnFR8GlZzgqZIe5M=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-CyhyzNw2LXwIVf/SX2rQRvEex5LmjZfZKgCe88jthz0=";
|
||||
cargoDeps = rustPlatform.fetchCargoVendor {
|
||||
inherit (finalAttrs) pname version src;
|
||||
hash = "sha256-CyhyzNw2LXwIVf/SX2rQRvEex5LmjZfZKgCe88jthz0=";
|
||||
};
|
||||
|
||||
# TODO: Check if that's still needed
|
||||
# fix macOS build
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
url = "https://github.com/newsboat/newsboat/commit/4139a0ba1ec87e442ef1408823b07fc739742f9d.patch";
|
||||
hash = "sha256-zdtdpUQGATq/9w+hAY/Va9Ob95c8VT2D9aKFmAF+O0c=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/newsboat/newsboat/commit/4eb748b6b6b63acddb3582e012442e519e8704ea.patch";
|
||||
hash = "sha256-A/0WbuMIapTsLoziUPr95ZctIr2hW7JOJSdMVaWayYI=";
|
||||
})
|
||||
];
|
||||
|
||||
# allow other ncurses versions on Darwin
|
||||
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
# Allow other ncurses versions on Darwin
|
||||
substituteInPlace config.sh \
|
||||
--replace "ncurses5.4" "ncurses"
|
||||
substituteInPlace config.sh --replace-fail "ncurses5.4" "ncurses"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
asciidoctor
|
||||
gettext
|
||||
cargo
|
||||
rustc
|
||||
rustPlatform.cargoSetupHook
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
makeWrapper
|
||||
@@ -60,12 +79,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
gettext
|
||||
];
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=deprecated-declarations" ];
|
||||
|
||||
postBuild = ''
|
||||
make -j $NIX_BUILD_CORES prefix="$out"
|
||||
'';
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/pull/98471#issuecomment-703100014 . We set
|
||||
# these for all platforms, since upstream's gettext crate behavior might
|
||||
# change in the future.
|
||||
@@ -73,16 +86,13 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
GETTEXT_INCLUDE_DIR = "${lib.getDev gettext}/include";
|
||||
GETTEXT_BIN_DIR = "${lib.getBin gettext}/bin";
|
||||
|
||||
makeFlags = [ "prefix=$(out)" ];
|
||||
enableParallelBuilding = true;
|
||||
|
||||
doCheck = true;
|
||||
checkTarget = "test";
|
||||
|
||||
preCheck = ''
|
||||
make -j $NIX_BUILD_CORES test
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
make -j $NIX_BUILD_CORES prefix="$out" install
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
for prog in $out/bin/*; do
|
||||
wrapProgram "$prog" --prefix DYLD_LIBRARY_PATH : "${stfl}/lib"
|
||||
done
|
||||
@@ -92,13 +102,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
updateScript = nix-update-script { };
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm755 newsboat $out/bin/newsboat
|
||||
install -Dm755 podboat $out/bin/podboat
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "https://newsboat.org/";
|
||||
changelog = "https://github.com/newsboat/newsboat/blob/${finalAttrs.src.tag}/CHANGELOG.md";
|
||||
|
||||
Reference in New Issue
Block a user