diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index d51ed593173d..562fb9a10b8f 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -296,7 +296,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { libpthread = applePackage "libpthread" "osx-10.12.6" "sha256-QvJ9PERmrCWBiDmOWrLvQUKZ4JxHuh8gS5nlZKDLqE8=" {}; libresolv = callPackage ./libresolv/package.nix { }; Libsystem = applePackage "Libsystem" "osx-10.12.6" "sha256-zvRdCP//TjKCGAqm/5nJXPppshU1cv2fg/L/yK/olGQ=" { inherit (pkgs.darwin.apple_sdk) sdkRoot; }; - libutil = applePackage "libutil" "osx-10.12.6" "sha256-4PFuk+CTLwvd/Ll9GLBkiIM0Sh/CVaiKwh5m1noheRs=" {}; + libutil = callPackage ./libutil/package.nix { }; libunwind = applePackage "libunwind" "osx-10.12.6" "sha256-CC0sndP/mKYe3dZu3v7fjuDASV4V4w7dAcnWMvpoquE=" {}; mDNSResponder = applePackage "mDNSResponder" "osx-10.12.6" "sha256-ddZr6tropkpdMJhq/kUlm3OwO8b0yxtkrMpwec8R4FY=" {}; objc4 = applePackage "objc4" "osx-10.12.6" "sha256-ZsxRpdsfv3Dxs7yBBCkjbKXKR6aXwkEpxc1XYXz7ueM=" {}; @@ -328,7 +328,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // { Security = null; xpc = null; }; - libutilHeaders = pkgs.darwin.libutil.override { headersOnly = true; }; + libutilHeaders = lib.getDev self.libutil; hfsHeaders = pkgs.darwin.hfs.override { headersOnly = true; }; libresolvHeaders= lib.getDev self.libresolv; diff --git a/pkgs/os-specific/darwin/apple-source-releases/libutil/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libutil/default.nix deleted file mode 100644 index 5cc8e0ffa28a..000000000000 --- a/pkgs/os-specific/darwin/apple-source-releases/libutil/default.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ lib, stdenv, stdenvNoCC, appleDerivation', xcbuildHook - -# headersOnly is true when building for libSystem -, headersOnly ? false }: - -appleDerivation' (if headersOnly then stdenvNoCC else stdenv) { - nativeBuildInputs = lib.optional (!headersOnly) xcbuildHook; - - prePatch = '' - substituteInPlace tzlink.c \ - --replace '#include ' "" - ''; - - xcbuildFlags = [ "-target" "util" ]; - - installPhase = '' - mkdir -p $out/include - '' + lib.optionalString headersOnly '' - cp *.h $out/include - '' + lib.optionalString (!headersOnly)'' - mkdir -p $out/lib $out/include - - cp Products/Release/*.dylib $out/lib - cp Products/Release/*.h $out/include - - # TODO: figure out how to get this to be right the first time around - install_name_tool -id $out/lib/libutil.dylib $out/lib/libutil.dylib - ''; - - # FIXME: headers are different against headersOnly. And all the headers are NOT in macos, do we really want them? - # appleHeaders = '' - # libutil.h - # mntopts.h - # tzlink.h - # wipefs.h - # ''; - - meta = with lib; { - maintainers = with maintainers; [ copumpkin ]; - platforms = platforms.darwin; - license = licenses.apple-psl20; - }; -} diff --git a/pkgs/os-specific/darwin/apple-source-releases/libutil/meson.build.in b/pkgs/os-specific/darwin/apple-source-releases/libutil/meson.build.in new file mode 100644 index 000000000000..fa7f3610f532 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/libutil/meson.build.in @@ -0,0 +1,49 @@ +# Build settings based on the upstream Xcode project. +# See: https://github.com/apple-oss-distributions/libutil/blob/main/libutil.xcodeproj/project.pbxproj + +# Project settings +project('libutil', 'c', 'cpp', version : '@version@') + + +# Dependencies +cc = meson.get_compiler('c') +cxx = meson.get_compiler('cpp') + + +# Libraries +libutil = library( + 'util', + darwin_versions : '1', + install : true, + sources : [ + 'ExtentManager.cpp', + 'expand_number.c', + 'getmntopts.c', + 'humanize_number.c', + 'pidfile.c', + 'realhostname.c', + 'reexec_to_match_kernel.c', + 'trimdomain.c', + 'tzbootuuid.c', + 'tzlink.c', + 'tzlink.h', + 'wipefs.cpp', + ], +) +install_headers( + 'libutil.h', + 'mntopts.h', + 'tzlink.h', + 'wipefs.h', +) +install_man( + 'expand_number.3', + 'getmntopts.3', + 'humanize_number.3', + 'pidfile.3', + 'realhostname.3', + 'realhostname_sa.3', + 'reexec_to_match_kernel.3', + 'trimdomain.3', + 'wipefs.3', +) diff --git a/pkgs/os-specific/darwin/apple-source-releases/libutil/package.nix b/pkgs/os-specific/darwin/apple-source-releases/libutil/package.nix new file mode 100644 index 000000000000..311ef2f21498 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/libutil/package.nix @@ -0,0 +1,22 @@ +{ + copyfile, + mkAppleDerivation, +}: + +mkAppleDerivation { + releaseName = "libutil"; + + outputs = [ + "out" + "dev" + "man" + ]; + + xcodeHash = "sha256-7t2yz022PUuVwMQP7NBB3I9neuhxJin5W2C+Y5IQYAA="; + + buildInputs = [ + copyfile + ]; + + meta.description = "System utilities library"; +} diff --git a/pkgs/os-specific/darwin/apple-source-releases/versions.json b/pkgs/os-specific/darwin/apple-source-releases/versions.json index 05a0469e5049..a2bff622b0eb 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/versions.json +++ b/pkgs/os-specific/darwin/apple-source-releases/versions.json @@ -46,5 +46,9 @@ "libresolv": { "hash": "sha256-FtvwjJKSFX6j9APYPC8WLXVOjbHLZa1Gcoc8yxLy8qE=", "version": "64" + }, + "libutil": { + "hash": "sha256-4PFuk+CTLwvd/Ll9GLBkiIM0Sh/CVaiKwh5m1noheRs=", + "version": "47.30.1" } }