mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 21:40:12 +00:00
81 lines
2.0 KiB
Nix
81 lines
2.0 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchurl,
|
|
cpio,
|
|
xar,
|
|
undmg,
|
|
libtapi,
|
|
isFuse3 ? false,
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "macfuse-stubs";
|
|
version = "5.1.3";
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/osxfuse/osxfuse/releases/download/macfuse-${version}/macfuse-${version}.dmg";
|
|
hash = "sha256-5fgP+MPfgm6Zf7eGs1EloMamcvS7oncLDe9rpjyk74E=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
cpio
|
|
xar
|
|
undmg
|
|
libtapi
|
|
];
|
|
|
|
postUnpack = ''
|
|
xar -xf 'Install macFUSE.pkg'
|
|
cd Core.pkg
|
|
gunzip -dc Payload | cpio -i
|
|
'';
|
|
|
|
sourceRoot = ".";
|
|
|
|
buildPhase = ''
|
|
pushd usr/local/lib
|
|
for f in *.dylib; do
|
|
tapi stubify --filetype=tbd-v2 "$f" -o "''${f%%.dylib}.tbd"
|
|
done
|
|
sed -i "s|^prefix=.*|prefix=$out|" pkgconfig/fuse{,3}.pc
|
|
popd
|
|
'';
|
|
|
|
# NOTE: Keep in mind that different parts of macFUSE are distributed under a
|
|
# different license
|
|
installPhase = ''
|
|
mkdir -p $out/include $out/lib/pkgconfig
|
|
''
|
|
+ lib.optionalString isFuse3 ''
|
|
cp usr/local/lib/libfuse3*.tbd $out/lib
|
|
cp usr/local/lib/pkgconfig/fuse3.pc $out/lib/pkgconfig
|
|
cp -R usr/local/include/fuse3 $out/include
|
|
''
|
|
+ lib.optionalString (!isFuse3) ''
|
|
cp usr/local/lib/libfuse{,.2}.tbd $out/lib
|
|
cp usr/local/lib/pkgconfig/fuse.pc $out/lib/pkgconfig
|
|
cp -R usr/local/include/fuse{,.h} $out/include
|
|
'';
|
|
|
|
passthru.warning = meta.description;
|
|
|
|
meta = {
|
|
homepage = "https://osxfuse.github.io";
|
|
description = "Build time stubs for FUSE on macOS";
|
|
longDescription = ''
|
|
macFUSE is required for this package to work on macOS. To install macFUSE,
|
|
use the installer from the [project website](https://osxfuse.github.io/).
|
|
'';
|
|
platforms = lib.platforms.darwin;
|
|
maintainers = with lib.maintainers; [ midchildan ];
|
|
|
|
# macFUSE as a whole includes code with restrictions on commercial
|
|
# redistribution. However, the build artifacts that we actually touch for
|
|
# this derivation are distributed under a free license.
|
|
license = with lib.licenses; [
|
|
lgpl2Plus # libfuse
|
|
];
|
|
};
|
|
}
|