darwin.removefile: convert to Meson and use mkAppleDerivation
This commit is contained in:
parent
6fca3b4a70
commit
149eb5aef4
@ -301,7 +301,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
|
||||
mDNSResponder = applePackage "mDNSResponder" "osx-10.12.6" "sha256-ddZr6tropkpdMJhq/kUlm3OwO8b0yxtkrMpwec8R4FY=" {};
|
||||
objc4 = applePackage "objc4" "osx-10.12.6" "sha256-ZsxRpdsfv3Dxs7yBBCkjbKXKR6aXwkEpxc1XYXz7ueM=" {};
|
||||
ppp = applePackage "ppp" "osx-10.12.6" "sha256-M1zoEjjeKIDUEP6ACbpUJk3OXjobw4g/qzUmxGdX1J0=" {};
|
||||
removefile = applePackage "removefile" "osx-10.12.6" "sha256-UpNk27kGXnZss1ZXWVJU9jLz/NW63ZAZEDLhyCYoi9M=" {};
|
||||
removefile = callPackage ./removefile/package.nix { };
|
||||
xnu = if isSdk10_12 then
|
||||
applePackage "xnu" "osx-10.12.6" "sha256-C8TPQlUT3RbzAy8YnZPNtr70hpaVG9Llv0h42s3NENI=" {}
|
||||
else macosPackages_11_0_1.xnu;
|
||||
|
@ -1,13 +0,0 @@
|
||||
{ appleDerivation', stdenvNoCC }:
|
||||
|
||||
appleDerivation' stdenvNoCC {
|
||||
installPhase = ''
|
||||
mkdir -p $out/include/
|
||||
cp removefile.h checkint.h $out/include/
|
||||
'';
|
||||
|
||||
appleHeaders = ''
|
||||
checkint.h
|
||||
removefile.h
|
||||
'';
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
# Build settings based on the upstream Xcode project.
|
||||
# See: https://github.com/apple-oss-distributions/removefile/blob/main/removefile.xcodeproj/project.pbxproj
|
||||
|
||||
# Project settings
|
||||
project('removefile', 'c', version : '@version@')
|
||||
|
||||
|
||||
# Dependencies
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
|
||||
# Libraries
|
||||
library(
|
||||
'removefile',
|
||||
c_args : [
|
||||
'-D__DARWIN_NOW_CANCELABLE=1',
|
||||
# Define these flags for the 10.12 SDK assuming that users on older systems can’t encounter dataless files.
|
||||
# https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/sys/stat.h#L520
|
||||
'-DSF_DATALESS=0x40000000',
|
||||
# https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/sys/resource.h#L598
|
||||
'-DIOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES=3',
|
||||
# https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/sys/resource.h#L640
|
||||
'-DIOPOL_MATERIALIZE_DATALESS_FILES_OFF=1',
|
||||
# https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/sys/attr.h#L562
|
||||
# '-DATTR_CMNEXT_LINKID=0x00000010',
|
||||
],
|
||||
install : true,
|
||||
sources : [
|
||||
'removefile.c',
|
||||
'removefile_random.c',
|
||||
'removefile_rename_unlink.c',
|
||||
'removefile_sunlink.c',
|
||||
'removefile_tree_walker.c',
|
||||
],
|
||||
)
|
||||
install_headers(
|
||||
'checkint.h',
|
||||
'removefile.h',
|
||||
)
|
||||
install_man(
|
||||
'checkint.3',
|
||||
'removefile.3',
|
||||
)
|
@ -0,0 +1,49 @@
|
||||
{
|
||||
apple-sdk,
|
||||
apple-sdk_10_13,
|
||||
apple-sdk_11,
|
||||
mkAppleDerivation,
|
||||
stdenvNoCC,
|
||||
}:
|
||||
|
||||
let
|
||||
# The 10.12 SDK doesn’t have the files needed in the same places or possibly at all.
|
||||
# Just use the 11.x SDK to make things easier.
|
||||
xnu = apple-sdk_11.sourceRelease "xnu";
|
||||
|
||||
privateHeaders = stdenvNoCC.mkDerivation {
|
||||
name = "removefile-deps-private-headers";
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p "$out/include/apfs"
|
||||
# APFS group is 'J' per https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/bsd/vfs/vfs_fsevents.c#L1054
|
||||
cat <<EOF > "$out/include/apfs/apfs_fsctl.h"
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <sys/ioccom.h>
|
||||
struct xdstream_obj_id {
|
||||
char* xdi_name;
|
||||
uint64_t xdi_xdtream_obj_id;
|
||||
};
|
||||
#define APFS_CLEAR_PURGEABLE 0
|
||||
#define APFSIOC_MARK_PURGEABLE _IOWR('J', 68, uint64_t)
|
||||
#define APFSIOC_XDSTREAM_OBJ_ID _IOR('J', 35, struct xdstream_obj_id)
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
in
|
||||
mkAppleDerivation {
|
||||
releaseName = "removefile";
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"dev"
|
||||
"man"
|
||||
];
|
||||
|
||||
xcodeHash = "sha256-wDm2LECjateIRDQyjJtcdbxHKVfN3Y8JXVd70d37Jy4=";
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = "-I${privateHeaders}/include";
|
||||
|
||||
meta.description = "Darwin file removing library";
|
||||
}
|
@ -58,5 +58,9 @@
|
||||
"network_cmds": {
|
||||
"hash": "sha256-PChAbC/4cHa0lbojElR2PHOUo+cDvsoNdiorle0IXss=",
|
||||
"version": "606.40.2"
|
||||
},
|
||||
"removefile": {
|
||||
"hash": "sha256-UpNk27kGXnZss1ZXWVJU9jLz/NW63ZAZEDLhyCYoi9M=",
|
||||
"version": "45"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user