Merge pull request #286 from hatch01/master

packaging: add nixpkgs avalability and make wrapped script the default
This commit is contained in:
Bartek Kryza
2024-06-06 21:00:04 +02:00
committed by GitHub
3 changed files with 23 additions and 12 deletions

View File

@@ -226,11 +226,10 @@ set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTOR
```
### Nix wrapper
On NixOS or when using `nix`, `clang-uml` provides a wrapper script called
`clang-uml-wrapped`, which builds and exports `CPATH` and `CPLUS_INCLUDE_PATH`
On NixOS or when using `nix`, `clang-uml` uses a wrapper script,
which builds and exports `CPATH` and `CPLUS_INCLUDE_PATH`
environment variables before running `clang-uml`, which contain valid
system header Clang paths for the current Nix environment.
The `clang-uml-wrapped` script can be called the same way as `clang-uml` and
should resolve the system include paths without the need for any of the above
solutions.
If you want to use an unwrapped version, the `clang-uml-unwrapped` binary
can be called the same way as `clang-uml`.

View File

@@ -56,7 +56,16 @@ conda install -c bkryza/label/clang-uml clang-uml
#### Nix
You can use the version packaged in nixpkgs like this:
Currently clang-uml version 0.5.1 is available in nixos-unstable and nixos-24.05
```bash
nix-shell -p clang-uml
```
Or you can build it by yourself
```bash
# To build it by yourself
git clone https://github.com/bkryza/clang-uml
# To build using nix flakes

View File

@@ -30,13 +30,16 @@ stdenv.mkDerivation {
clang = if enableLibcxx then llvmPackages.libcxxClang else llvmPackages.clang;
postInstall = ''
export unwrapped_clang_uml="$out/bin/clang-uml"
# inject clang and unwrap_clang_uml variables into wrapper
substituteAll ${./wrapper} $out/bin/clang-uml-wrapped
chmod +x $out/bin/clang-uml-wrapped
cp $out/bin/clang-uml $out/bin/clang-uml-unwrapped
rm $out/bin/clang-uml
export unwrapped_clang_uml="$out/bin/clang-uml-unwrapped"
installShellCompletion --bash $src/packaging/autocomplete/clang-uml
installShellCompletion --zsh $src/packaging/autocomplete/_clang-uml
# inject clang and unwrapp_clang_uml variables into wrapper
substituteAll ${./wrapper} $out/bin/clang-uml
chmod +x $out/bin/clang-uml
installShellCompletion --cmd clang-uml \
--bash $src/packaging/autocomplete/clang-uml \
--zsh $src/packaging/autocomplete/_clang-uml
'';
}