Skip to content

Commit 9dd6fd2

Browse files
authored
feat: improve docs and render files that contain prefix with [prefix:text] or [prefix:bin] (#2031)
1 parent ecbc3e9 commit 9dd6fd2

File tree

4 files changed

+144
-108
lines changed

4 files changed

+144
-108
lines changed

docs/understanding_terminal_output.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ Then, any license files matched by the globs given are copied into `info/license
404404
```txt
405405
│ │ Files in package:
406406
│ │ ├─ bin/curl (198.28 KiB)
407-
│ │ ├─ bin/curl-config (8.92 KiB)
407+
│ │ ├─ bin/curl-config (8.92 KiB) [prefix:text]
408408
│ │ ├─ include/curl/curl.h (124.84 KiB)
409409
│ │ ├─ include/curl/curlver.h (2.97 KiB)
410410
│ │ ├─ include/curl/easy.h (3.93 KiB)
@@ -419,7 +419,7 @@ Then, any license files matched by the globs given are copied into `info/license
419419
│ │ ├─ include/curl/websockets.h (2.68 KiB)
420420
│ │ ├─ lib/libcurl.4.dylib (541.50 KiB)
421421
│ │ ├─ lib/libcurl.dylib -> libcurl.4.dylib
422-
│ │ ├─ lib/pkgconfig/libcurl.pc (1.86 KiB)
422+
│ │ ├─ lib/pkgconfig/libcurl.pc (1.86 KiB) [prefix:text]
423423
│ │ ├─ info/about.json (453 B)
424424
│ │ ├─ info/hash_input.json (32 B)
425425
│ │ ├─ info/index.json (253 B)
@@ -448,6 +448,12 @@ The files are highlighted:
448448

449449
- green: executable
450450
- magenta: symlink (shows symlink target)
451+
- yellow brackets: files that contain the value of `$PREFIX` as a string (`[prefix:text]` or `[prefix:bin]`).
452+
453+
Files that contain the $PREFIX (that is files that contain the current installation path, e.g. `/user/name/.../output/.../host_env_placehold_placehold...`) are marked with the yellow brackets.
454+
455+
When a file contains the $PREFIX as a string, it will be replaced at installation time with the actual installation prefix (that is also the reason for the long placeholder string!). You can read more about prefix replacement in [Debugging Builds](internals.md#making-packages-relocatable-with-rattler-build).
456+
Ideally, no file contains the installation prefix as string, so that there is no text replacement at installation time.
451457

452458
We then see a listing of the largest files in the package which can be a helpful sanity check.
453459

docs/windows_quirks.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ On the top level, there is an additional `Scripts` folder, as well as a `bin/` f
2222
Additionally, the site-packages folder is _also_ located at the root of the filesystem layout:
2323

2424
```text
25-
- Library\
26-
- lib\
27-
- bin\
28-
- share\
29-
...
30-
- site-packages\
31-
- Scripts\
32-
- bin\
25+
%PREFIX%
26+
├── Library
27+
│ ├── lib
28+
│ ├── bin
29+
│ ├── share
30+
│ ├── etc
31+
│ └── ...
32+
├── site-packages
33+
├── Scripts
34+
└── bin
3335
```
3436

3537
The reasons for this layout are historical: Python on Windows traditionally installs packages to `site-packages` at the root, and `Scripts` is where Python console scripts and entry points are placed. The `Library` folder mimics a Unix-style hierarchy for non-Python packages.
@@ -40,15 +42,15 @@ To make this easier, certain shortcut env vars are available on Windows: `%LIBRA
4042

4143
### Cmd.exe
4244

43-
The _default interpreter_ for build scripts on Windows is `cmd.exe` which has a quite clunky syntax and execution model.
45+
The _default interpreter_ for build scripts on Windows is `cmd.exe` which has a quite clunky syntax and execution model.
4446

4547
It will, for example, skip over errors if you do not manually insert `if %ERRORLEVEL% neq 0 exit 1` after each statement. If the build script is a list of commands, then rattler-build will automatically inject this after each list item. If you pass in a complete build script or file, you will have to do this manually to recognize issues in command execution early on.
4648

4749
### Using Powershell
4850

4951
You can select PowerShell as an interpreter, which comes pre-installed on Windows these days. To do so, just set
5052

51-
```
53+
```yaml title="recipe.yaml"
5254
build:
5355
script:
5456
interpreter: powershell
@@ -61,7 +63,7 @@ Or save your build script as `build.ps1` (which will automatically use powershel
6163

6264
To use bash on Windows, you can install bash in your build requirements (e.g. on conda-forge it would be `m2-bash`) and call the bash script from a cmd.exe script:
6365

64-
```batch
66+
```batch title="build.bat"
6567
bash %RECIPE_DIR%/build_win.sh
6668
if %ERRORLEVEL% neq 0 exit 1
6769
@@ -90,6 +92,9 @@ Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vs_BuildTools.exe" -OutFile
9092

9193
## MinGW64 compiler stack
9294

95+
!!! note conda-forge specific information
96+
Everything that follows on this page is specific to `conda-forge` and choices this distribution made. If you run your own software distribution you might do things differently, or not have certain compilers available.
97+
9398
As an alternative to MSVC, conda-forge provides a MinGW-based compiler stack for Windows. This can be useful when porting Unix software that relies on GCC-specific features or when you want to avoid MSVC licensing requirements.
9499

95100
### Using MinGW compilers in recipes
@@ -117,12 +122,13 @@ The MinGW C++ and Fortran compilers are **not ABI-compatible** with the default
117122

118123
### When to use MinGW vs MSVC
119124

120-
| Use MinGW when... | Use MSVC when... |
121-
|-------------------|------------------|
122-
| Porting Unix/Linux software with GCC-specific code | Building native Windows applications |
123-
| The project uses GNU autotools extensively | Integrating with other MSVC-compiled libraries |
124-
| You need GCC-specific compiler extensions | Maximum compatibility with Windows ecosystem |
125-
| Building Fortran code (simpler than Flang setup) | Performance-critical Windows applications |
125+
| Use MinGW when... | Use MSVC when... |
126+
| -------------------------------------------------- | ---------------------------------------------- |
127+
| Porting Unix/Linux software with GCC-specific code | Building native Windows applications |
128+
| The project uses GNU autotools extensively | Integrating with other MSVC-compiled libraries |
129+
| You need GCC-specific compiler extensions | Maximum compatibility with Windows ecosystem |
130+
| Building Fortran code (simpler than Flang setup) | Performance-critical Windows applications |
131+
| Building R packages (requires MingW64) | |
126132

127133
### Legacy packages
128134

@@ -136,10 +142,10 @@ Note that while Clang replaces the compiler itself, you still need the **Windows
136142

137143
### clang vs clang-cl
138144

139-
| Frontend | Argument syntax | Use case |
140-
|----------|-----------------|----------|
141-
| `clang` | GCC-style arguments | Cross-platform builds, porting from Unix |
142-
| `clang-cl` | MSVC-style arguments | Drop-in replacement for MSVC's `cl.exe` |
145+
| Frontend | Argument syntax | Use case |
146+
| ---------- | -------------------- | ---------------------------------------- |
147+
| `clang` | GCC-style arguments | Cross-platform builds, porting from Unix |
148+
| `clang-cl` | MSVC-style arguments | Drop-in replacement for MSVC's `cl.exe` |
143149

144150
### Using Clang in recipes
145151

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ nav:
136136
- Creating patches: create_patch.md
137137
- Debugging builds: debugging_builds.md
138138
- Tips and tricks: tips_and_tricks.md
139+
- Windows Quirks: windows_quirks.md
139140

140141
- Testing:
141142
- Testing packages: testing.md

0 commit comments

Comments
 (0)