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

Co-authored-by: Andrew Childs <lorne@cons.org.nz>

+13 -2
+13 -2
pkgs/os-specific/darwin/darling/default.nix
··· 8 8 url = "https://github.com/darlinghq/darling/archive/d2cc5fa748003aaa70ad4180fff0a9a85dc65e9b.tar.gz"; 9 9 sha256 = "11b51fw47nl505h63bgx5kqiyhf3glhp1q6jkpb6nqfislnzzkrf"; 10 10 postFetch = '' 11 - # Get rid of case conflict 12 - mkdir $out 11 + # The archive contains both `src/opendirectory` and `src/OpenDirectory`, 12 + # pre-create the directory to choose the canonical case on 13 + # case-insensitive filesystems. 14 + mkdir -p $out/src/OpenDirectory 15 + 13 16 cd $out 14 17 tar -xzf $downloadedFile --strip-components=1 15 18 rm -r $out/src/libm 19 + 20 + # If `src/opendirectory` and `src/OpenDirectory` refer to different 21 + # things, then combine them into `src/OpenDirectory` to match the result 22 + # on case-insensitive filesystems. 23 + if [ "$(stat -c %i src/opendirectory)" != "$(stat -c %i src/OpenDirectory)" ]; then 24 + mv src/opendirectory/* src/OpenDirectory/ 25 + rmdir src/opendirectory 26 + fi 16 27 ''; 17 28 }; 18 29