···173173174174## Extensible Option Types {#sec-option-declarations-eot}
175175176176-Extensible option types is a feature that allow to extend certain types
176176+Extensible option types is a feature that allows to extend certain types
177177declaration through multiple module files. This feature only work with a
178178restricted set of types, namely `enum` and `submodules` and any composed
179179forms of them.
···11-{ stdenv
11+{ lib
22+, stdenv
23, cmake
34, ninja
45, circt
···31323233 outputs = [ "out" "lib" "dev" ];
33343535+ # Get rid of ${extra_libdir} (which ends up containing a path to circt-llvm.dev
3636+ # in circt) so that we only have to remove the one fixed rpath.
3737+ postPatch = lib.optionalString stdenv.isDarwin ''
3838+ substituteInPlace llvm/llvm/cmake/modules/AddLLVM.cmake \
3939+ --replace-fail 'set(_install_rpath "@loader_path/../lib''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' \
4040+ 'set(_install_rpath "@loader_path/../lib''${LLVM_LIBDIR_SUFFIX}")'
4141+ '';
4242+3443 postInstall = ''
3544 # move llvm-config to $dev to resolve a circular dependency
3645 moveToOutput "bin/llvm-config*" "$dev"
···4857 --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
4958 --replace "\''${_IMPORT_PREFIX}/lib/objects-Release" "$lib/lib/objects-Release" \
5059 --replace "$out/bin/llvm-config" "$dev/bin/llvm-config" # patch path for llvm-config
6060+ '';
6161+6262+ # Replace all references to @rpath with absolute paths and remove the rpaths.
6363+ #
6464+ # This is different from what the regular LLVM package does, which is to make
6565+ # everything absolute from the start: however, that doesn't work for us because
6666+ # we have `-DBUILD_SHARED_LIBS=ON`, meaning that many more things are
6767+ # dynamically rather than statically linked. This includes TableGen, which then
6868+ # fails to run halfway through the build because it tries to reference $lib when
6969+ # it hasn't been populated yet.
7070+ #
7171+ # Inspired by fixDarwinDylibNames.
7272+ postFixup = lib.optionalString stdenv.isDarwin ''
7373+ local flags=(-delete_rpath @loader_path/../lib)
7474+ for file in "$lib"/lib/*.dylib; do
7575+ flags+=(-change @rpath/"$(basename "$file")" "$file")
7676+ done
7777+7878+ for file in "$out"/bin/* "$lib"/lib/*.dylib; do
7979+ if [ -L "$file" ]; then continue; fi
8080+ echo "$file: fixing dylib references"
8181+ # note that -id does nothing on binaries
8282+ install_name_tool -id "$file" "''${flags[@]}" "$file"
8383+ done
5184 '';
52855386 # circt only use the mlir part of llvm, occasionally there are some unrelated failure from llvm,
+7
pkgs/development/compilers/circt/default.nix
···67676868 outputs = [ "out" "lib" "dev" ];
69697070+ # Copy circt-llvm's postFixup stage so that it can make all our dylib references
7171+ # absolute as well.
7272+ #
7373+ # We don't need `postPatch` because circt seems to be automatically inheriting
7474+ # the config somehow, presumably via. `-DMLIR_DIR`.
7575+ postFixup = circt-llvm.postFixup;
7676+7077 postInstall = ''
7178 moveToOutput lib "$lib"
7279 '';
···495495 requiredSystemFeatures = [ "big-parallel" ];
496496497497 passthru = {
498498- inherit cudaSupport cudaPackages;
498498+ inherit cudaSupport cudaPackages rocmSupport rocmPackages;
499499 # At least for 1.10.2 `torch.fft` is unavailable unless BLAS provider is MKL. This attribute allows for easy detection of its availability.
500500 blasProvider = blas.provider;
501501 # To help debug when a package is broken due to CUDA support