All libcanberra/libcanberra-gtk2/libcanberra-gtk3 packages were marked
as broken on commit 806d814516 (libcanberra: mark broken on darwin,
2021-02-11), but only libcanberra-gtk3 is broken due to the missing
header.
This commit refactors how to enable GTK support, to mark just
libcanberra-gtk3 as broken and allow building libcanberra and
libcanberra-gtk2.
libcanberra builds but the linker fails with:
ld: file not found: /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon for architecture x86_64
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
Adding Carbon to the inputs solves the problem.
libcanberra-gtk2 builds and the linker finishes without the above error,
most likely because it depends on gtk2 and gtk2 depends on Cocoa.
Also fix some issues with the derivation:
- Use pname/version instead of name.
- Use lib.optionalString to set postPatch.
- Only set passthru if building with GTK support, and ensure that the
proper directory is passed for each GTK version.