Skip to content

darwin.darling.src: fix build on case-sensitive filesystems#107431

Merged
veprbl merged 1 commit intoNixOS:masterfrom
veprbl:pr/darling_src_fix
Apr 18, 2021
Merged

darwin.darling.src: fix build on case-sensitive filesystems#107431
veprbl merged 1 commit intoNixOS:masterfrom
veprbl:pr/darling_src_fix

Conversation

@veprbl
Copy link
Member

@veprbl veprbl commented Dec 22, 2020

Motivation for this change

Fix #91480 as discussed in #101799 (comment)

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Dec 23, 2020
@veprbl
Copy link
Member Author

veprbl commented Dec 23, 2020

@GrahamcOfBorg build darling.src

@veprbl veprbl force-pushed the pr/darling_src_fix branch from 250b6a9 to c61d59f Compare December 23, 2020 00:12
@veprbl veprbl changed the title darling.src: fix build on case-sensitive filesystems darwin.darling.src: fix build on case-sensitive filesystems Dec 23, 2020
@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Dec 23, 2020
@veprbl
Copy link
Member Author

veprbl commented Dec 23, 2020

@GrahamcOfBorg build darwin.darling.src

@thefloweringash
Copy link
Member

Thanks for working on this. I think there are two things that need to be handled. The first is with case-sensitive filesystems in which the directories are split, and the second is with case-insensitive filesystems where the result is non-deterministic (the canonical name is either lowercase or camelcase). Maybe something like this. It seems to work on my case-insensitive macOS and my case-sensitive linux.

fetchzip {
  url = "https://github.com/darlinghq/darling/archive/d2cc5fa748003aaa70ad4180fff0a9a85dc65e9b.tar.gz";
  sha256 = "0000000000000000000000000000000000000000000000000000"; # for testing
  postFetch = ''
    # Get rid of case conflicts
    mkdir $out

    # The archive contains both `src/opendirectory` and `src/OpenDirectory`,
    # pre-create the directory to choose the canonical case on
    # case-insensitive filesystems.
    mkdir -p $out/src/OpenDirectory

    cd $out
    tar -xzf $downloadedFile --strip-components=1
    rm -r $out/src/libm

    # If `src/opendirectory` and `src/OpenDirectory` refer to different
    # things, then combine them into `src/OpenDirectory` to match the result
    # on case-insensitive filesystems.
    if [ "$(stat -c %i src/opendirectory)" != "$(stat -c %i src/OpenDirectory)" ]; then
      mv src/opendirectory/* src/OpenDirectory/
      rmdir src/opendirectory
    fi
  '';
}

Co-authored-by: Andrew Childs <lorne@cons.org.nz>
@veprbl veprbl force-pushed the pr/darling_src_fix branch from c61d59f to 1a25e9b Compare January 19, 2021 02:12
@holymonson
Copy link
Contributor

@veprbl this has been fixed on upstream darlinghq/darling@ea5f07d , should we use an updated source instead of fixing it here? We need darling to update xnu and Libsystem.

@veprbl veprbl merged commit 6eeab63 into NixOS:master Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

darling.src: case conflict causes fixed-output-derivation hash mismatch

3 participants