mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 08:58:35 +00:00
Compare commits
28 Commits
01f76fe052
...
l10n_maste
| Author | SHA1 | Date | |
|---|---|---|---|
| 000ad89798 | |||
| 2c7ca13775 | |||
| 8fd2dd00d2 | |||
| 8c3fbf4d80 | |||
| cd566872db | |||
| 864cd0565e | |||
| 706131ea57 | |||
| 0b461ac906 | |||
| 2a777d1124 | |||
| 3200d7f719 | |||
| 543099e934 | |||
| 07e8776bf8 | |||
| e516f17704 | |||
| 2bc37d5960 | |||
| ddd06b4b06 | |||
| 46356739e9 | |||
| 80c87539f5 | |||
| dee16616e4 | |||
| 9181276bde | |||
| 0ca083a6c0 | |||
| 95fe4eab02 | |||
| bf0d38e2e9 | |||
| 3ffe6eeca9 | |||
| 51439a79a0 | |||
| 0820574db6 | |||
| 2857bfa058 | |||
| 790c4933fa | |||
| 396412048f |
@@ -4,10 +4,22 @@ sidebar_label: Changelog
|
|||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## Unreleased
|
## 0.9.1 (2026-09-13)
|
||||||
|
|
||||||
|
* **`pkg-config` dependencies** — declare `fmt = { pkg-config = "fmt" }` or multiple package names in `[dependencies]`; DCR applies `.pc` compiler/linker flags and records the resolved package in `dcr.lock`.
|
||||||
|
* **`dcr add` support for `pkg-config`** — easily add system package dependencies with `dcr add fmt pkg-config:fmt` or `dcr add openssl pkg:openssl,libcrypto`.
|
||||||
|
* **`dcr tree` & IDE integration** — `pkg-config` packages are marked in `dcr tree` and resolved into compiler flags in `dcr gen` (`compile_commands.json`).
|
||||||
|
* **Fixed `dcr new` in non-ASCII / spaced paths** — initializing projects from folders with non-ASCII characters or spaces no longer fails validation.
|
||||||
|
|
||||||
|
## 0.9.0 (2026-08-31)
|
||||||
|
|
||||||
* **Download mirrors in `dcrup`** — `--mirror auto|cf|gh|sf|ya` and `DCRUP_MIRROR`.
|
* **Download mirrors in `dcrup`** — `--mirror auto|cf|gh|sf|ya` and `DCRUP_MIRROR`.
|
||||||
Default `auto` tries **cf → gh → sf → ya** (CloudFlare CDN, GitHub, SourceForge, Yandex CDN).
|
Default `auto` tries **cf → gh → sf → ya** (CloudFlare CDN, GitHub, SourceForge, Yandex CDN).
|
||||||
|
* **Complete Path/Git dependencies** — DCR packages from `path` and `git` are built before their consumer. Git sources are cached in `~/.dcr/git`, support `branch`/`tag`/`rev`, and record the exact commit in `dcr.lock`.
|
||||||
|
* **Build and prebuild modes** — `path` and `git` dependencies can build a DCR package from `dcr.toml` or link existing `include`/`lib`/`libs` artifacts; `mode = "build"` / `"prebuild"` selects explicitly when both forms are present.
|
||||||
|
* **Prebuilt dependency examples** — documentation now shows the `dcr-math-lib` Git repository and recommended build/prebuilt layouts for both `git` and `path`.
|
||||||
|
* **Transitive dependency builds and cycle reporting** — DCR recursively builds DCR packages and reports a clear dependency chain for cycles.
|
||||||
|
* **Bare path arguments for `dcr add`** — `dcr add mylib ../mylib` now works in addition to the explicit `path:` form.
|
||||||
* **Removed `install.sh` / `install.ps1` / `install_bsd.sh`** — superseded by `dcrup`.
|
* **Removed `install.sh` / `install.ps1` / `install_bsd.sh`** — superseded by `dcrup`.
|
||||||
|
|
||||||
## 0.8.5 (2026-08-08)
|
## 0.8.5 (2026-08-08)
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ dcr add mylib path:./lib # explicit path prefix
|
|||||||
dcr add mylib git:https://github.com/user/repo # explicit git prefix
|
dcr add mylib git:https://github.com/user/repo # explicit git prefix
|
||||||
dcr add mylib github:user/repo # GitHub shorthand
|
dcr add mylib github:user/repo # GitHub shorthand
|
||||||
dcr add mylib gitlab:user/repo # GitLab shorthand
|
dcr add mylib gitlab:user/repo # GitLab shorthand
|
||||||
|
dcr add fmt pkg-config:fmt # system package via pkg-config
|
||||||
|
dcr add openssl pkg:openssl,libcrypto # multiple pkg-config packages
|
||||||
```
|
```
|
||||||
|
|
||||||
Source prefixes:
|
Source prefixes:
|
||||||
@@ -23,6 +25,7 @@ Source prefixes:
|
|||||||
* `git:` — generic git URL
|
* `git:` — generic git URL
|
||||||
* `github:` — expands to `https://github.com/\<user>/\<repo>`
|
* `github:` — expands to `https://github.com/\<user>/\<repo>`
|
||||||
* `gitlab:` — expands to `https://gitlab.com/\<user>/\<repo>`
|
* `gitlab:` — expands to `https://gitlab.com/\<user>/\<repo>`
|
||||||
|
* `pkg-config:` / `pkg:` — one or more packages resolved by `pkg-config`
|
||||||
* `http://` / `https://` / `git@` — full URL
|
* `http://` / `https://` / `git@` — full URL
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
@@ -31,7 +34,12 @@ Flags:
|
|||||||
* `--tag \<name>` — git tag
|
* `--tag \<name>` — git tag
|
||||||
* `--rev \<hash>` — git commit
|
* `--rev \<hash>` — git commit
|
||||||
|
|
||||||
If source is omitted — DCR searches connected registries.
|
If source is omitted — DCR searches connected registries. A bare relative or absolute path is accepted as a path dependency.
|
||||||
|
|
||||||
|
For `pkg-config` dependencies, the referenced packages must already be installed
|
||||||
|
and provide `.pc` files. DCR invokes `pkg-config` during the build (using
|
||||||
|
`PATH` and `PKG_CONFIG_PATH`) and forwards the returned compiler and linker
|
||||||
|
flags; it does not download or build these packages.
|
||||||
|
|
||||||
## `dcr tree`
|
## `dcr tree`
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,12 @@ Never fails the command — warnings only. Pre-release suffixes (`1.0.0-dev`) ar
|
|||||||
|
|
||||||
Settings from raw config (not in typed struct):
|
Settings from raw config (not in typed struct):
|
||||||
|
|
||||||
* `pkg_config` — list of pkg-config packages
|
* `pkg_config` — list of packages queried for build-wide compiler/linker flags
|
||||||
|
|
||||||
|
Dependencies can also declare a system package directly, for example
|
||||||
|
`fmt = { pkg-config = "fmt" }`. This records the package in `dcr.lock` and applies
|
||||||
|
the flags returned by `pkg-config --cflags` and `pkg-config --libs`.
|
||||||
|
|
||||||
* `ldscript` — linker script path
|
* `ldscript` — linker script path
|
||||||
* `build.steps` / `build.post_steps` — codegen steps
|
* `build.steps` / `build.post_steps` — codegen steps
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ sidebar_label: Dependencies
|
|||||||
|
|
||||||
## Formats
|
## Formats
|
||||||
|
|
||||||
The `[dependencies]` section supports three formats:
|
The `[dependencies]` section supports registry, path, Git, and `pkg-config` dependencies:
|
||||||
|
|
||||||
### String (registry)
|
### String (registry)
|
||||||
|
|
||||||
@@ -23,10 +23,10 @@ The version string is used as-is for registry lookup.
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
fmt = { git = "https://github.com/fmtlib/fmt", tag = "10.1.1" }
|
dcr-math = { git = "https://github.com/dexoron/dcr-math-lib.git", tag = "v0.1.0" }
|
||||||
```
|
```
|
||||||
|
|
||||||
Fields: `git`, `branch`, `tag`, `rev`.
|
Fields: `git`, `branch`, `tag`, `rev`, `mode`, `include`, `lib`, `libs`.
|
||||||
|
|
||||||
### Table (path)
|
### Table (path)
|
||||||
|
|
||||||
@@ -35,6 +35,32 @@ Fields: `git`, `branch`, `tag`, `rev`.
|
|||||||
mylib = { path = "../mylib" }
|
mylib = { path = "../mylib" }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For a prebuilt external library, specify its layout explicitly. The three
|
||||||
|
arrays are paths relative to the dependency root (`include`, `lib`) and linker
|
||||||
|
names (`libs`):
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
dcr-math = { path = "../deps/dcr-math", include = ["include"], lib = ["lib"], libs = ["dcr-math"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
### Table (`pkg-config`)
|
||||||
|
|
||||||
|
Use an installed `.pc` package when the library is provided by the operating system
|
||||||
|
or another system package manager. DCR invokes `pkg-config --cflags` and
|
||||||
|
`pkg-config --libs`, preserving include, library, linker, and other flags:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
fmt = { pkg-config = "fmt" }
|
||||||
|
openssl = { pkg-config = ["openssl", "libcrypto"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
The `pkg-config` executable must be available in `PATH`. The named `.pc` files must
|
||||||
|
be available through pkg-config's standard search paths or via `PKG_CONFIG_PATH`.
|
||||||
|
These dependencies are not downloaded or built by DCR; they are recorded in
|
||||||
|
`dcr.lock` with a `pkg-config+...` source.
|
||||||
|
|
||||||
## Registry
|
## Registry
|
||||||
|
|
||||||
DCR uses a package registry for dependency lookup by name.
|
DCR uses a package registry for dependency lookup by name.
|
||||||
@@ -42,7 +68,7 @@ DCR uses a package registry for dependency lookup by name.
|
|||||||
```toml
|
```toml
|
||||||
# ~/.dcr/config.toml
|
# ~/.dcr/config.toml
|
||||||
[registry.default]
|
[registry.default]
|
||||||
url = "https://index.dcr.pm"
|
url = "https://index.dcr.dexoron.tech"
|
||||||
priority = 1
|
priority = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -50,7 +76,23 @@ Registry priority: order in `config.toml`. The `DCR_INDEX_PATH` variable overrid
|
|||||||
|
|
||||||
## Git dependencies
|
## Git dependencies
|
||||||
|
|
||||||
Git dependencies are parsed and recorded in `dcr.lock`. DCR supports specifying branch/tag/rev for git sources:
|
Git dependencies are cloned into `~/.dcr/git/`; their exact checked-out commit is written to `dcr.lock`.
|
||||||
|
|
||||||
|
Both Git and path dependencies have two modes:
|
||||||
|
|
||||||
|
* **DCR package:** the source has `dcr.toml`. DCR builds it before the consumer and uses the package name from its manifest for linking.
|
||||||
|
* **Prebuilt library:** it provides existing headers and binaries through `include`, `lib`, and `libs`. DCR passes them to the compiler/linker without building the dependency.
|
||||||
|
|
||||||
|
The mode is normally detected automatically. Use `mode = "build"` or `mode = "prebuild"` when a source contains both a manifest and prebuilt artifacts and you need to choose explicitly.
|
||||||
|
|
||||||
|
`dcr-math-lib` publishes both forms. Select its prebuilt library explicitly:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
dcr-math = { git = "https://github.com/dexoron/dcr-math-lib.git", tag = "v0.1.0", mode = "prebuild", include = ["include"], lib = ["lib"], libs = ["dcr-math"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
DCR supports specifying branch/tag/rev for git sources:
|
||||||
|
|
||||||
* `branch` — switch to a branch
|
* `branch` — switch to a branch
|
||||||
* `tag` — switch to a tag
|
* `tag` — switch to a tag
|
||||||
@@ -59,7 +101,7 @@ Git dependencies are parsed and recorded in `dcr.lock`. DCR supports specifying
|
|||||||
|
|
||||||
## Path dependencies
|
## Path dependencies
|
||||||
|
|
||||||
Local paths. DCR automatically discovers include and lib directories from the neighbor's `dcr.toml`.
|
Local paths may point at a DCR package or a prebuilt external library. A path DCR package is built before its consumer, including its own path/git dependencies. DCR detects dependency cycles. A prebuilt library is never built by DCR; it is linked from the directories declared in its dependency entry.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -67,18 +109,51 @@ mylib = { path = "/abs/path/to/lib" }
|
|||||||
mylib = { path = "../relative/path" }
|
mylib = { path = "../relative/path" }
|
||||||
```
|
```
|
||||||
|
|
||||||
*Note: Header resolution automatically checks the packaged `target/include` directory of path dependencies, ensuring consumer packages can find headers from compiled static or dynamic libraries.*
|
For DCR packages, the package name from `dcr.toml` is used for linking (so the dependency key may differ from the library name). Header resolution includes the packaged `target/include` directory and link search includes `target/lib`.
|
||||||
|
|
||||||
|
### Recommended library layouts
|
||||||
|
|
||||||
|
Buildable DCR library:
|
||||||
|
|
||||||
|
```text
|
||||||
|
dcr-math-lib/
|
||||||
|
├── dcr.toml
|
||||||
|
└── src/
|
||||||
|
├── dcr_math.c
|
||||||
|
└── dcr_math.h
|
||||||
|
```
|
||||||
|
|
||||||
|
Prebuilt library:
|
||||||
|
|
||||||
|
```text
|
||||||
|
dcr-math-lib/
|
||||||
|
├── include/
|
||||||
|
│ └── dcr_math.h
|
||||||
|
└── lib/
|
||||||
|
└── libdcr-math.a # or .so / .lib
|
||||||
|
```
|
||||||
|
|
||||||
|
`libs` contains linker names without the `lib` prefix and file extension: use
|
||||||
|
`["dcr-math"]` for `libdcr-math.a`.
|
||||||
|
|
||||||
|
If one repository contains both forms, keep the prebuilt files in `include/` and `lib/` and select the mode explicitly:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
dcr-math = { git = "https://github.com/dexoron/dcr-math-lib.git", tag = "v0.1.0", mode = "prebuild", include = ["include"], lib = ["lib"], libs = ["dcr-math"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
For a local copy, replace `git` with `path = "../dcr-math-lib"`. In `prebuild` mode DCR does not run the dependency build, even when `dcr.toml` is present.
|
||||||
|
|
||||||
## dcr.lock
|
## dcr.lock
|
||||||
|
|
||||||
Dependency lock file. Contains package names and sources.
|
Dependency lock file. Contains package names and sources.
|
||||||
|
|
||||||
Created during `dcr build` when registry dependencies are present. Not updated during `dcr add` — only on the next `dcr build`.
|
Created during `dcr build` for resolved registry, path, and Git dependencies. Not updated during `dcr add` — only on the next `dcr build`.
|
||||||
|
|
||||||
## Resolution process
|
## Resolution process
|
||||||
|
|
||||||
1. Load all dependencies (registry → git → path)
|
1. Resolve dependency sources (registry → git → path)
|
||||||
2. For path deps: recursively read their `dcr.toml`
|
2. Fetch git dependencies into `~/.dcr/git/` and check out the requested ref
|
||||||
3. For registry deps: search `index.json`
|
3. Build DCR package dependencies recursively
|
||||||
4. For git deps: clone to cache
|
4. Collect `include_dirs`, `lib_dirs`, `libs` for the compiler
|
||||||
5. Collect `include_dirs`, `lib_dirs`, `libs` for the compiler
|
|
||||||
|
|||||||
@@ -4,10 +4,22 @@ sidebar_label: Changelog
|
|||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## Unreleased
|
## 0.9.1 (2026-09-13)
|
||||||
|
|
||||||
|
* **`pkg-config` dependencies** — declare `fmt = { pkg-config = "fmt" }` or multiple package names in `[dependencies]`; DCR applies `.pc` compiler/linker flags and records the resolved package in `dcr.lock`.
|
||||||
|
* **`dcr add` support for `pkg-config`** — easily add system package dependencies with `dcr add fmt pkg-config:fmt` or `dcr add openssl pkg:openssl,libcrypto`.
|
||||||
|
* **`dcr tree` & IDE integration** — `pkg-config` packages are marked in `dcr tree` and resolved into compiler flags in `dcr gen` (`compile_commands.json`).
|
||||||
|
* **Fixed `dcr new` in non-ASCII / spaced paths** — initializing projects from folders with non-ASCII characters or spaces no longer fails validation.
|
||||||
|
|
||||||
|
## 0.9.0 (2026-08-31)
|
||||||
|
|
||||||
* **Download mirrors in `dcrup`** — `--mirror auto|cf|gh|sf|ya` and `DCRUP_MIRROR`.
|
* **Download mirrors in `dcrup`** — `--mirror auto|cf|gh|sf|ya` and `DCRUP_MIRROR`.
|
||||||
Default `auto` tries **cf → gh → sf → ya** (CloudFlare CDN, GitHub, SourceForge, Yandex CDN).
|
Default `auto` tries **cf → gh → sf → ya** (CloudFlare CDN, GitHub, SourceForge, Yandex CDN).
|
||||||
|
* **Complete Path/Git dependencies** — DCR packages from `path` and `git` are built before their consumer. Git sources are cached in `~/.dcr/git`, support `branch`/`tag`/`rev`, and record the exact commit in `dcr.lock`.
|
||||||
|
* **Build and prebuild modes** — `path` and `git` dependencies can build a DCR package from `dcr.toml` or link existing `include`/`lib`/`libs` artifacts; `mode = "build"` / `"prebuild"` selects explicitly when both forms are present.
|
||||||
|
* **Prebuilt dependency examples** — documentation now shows the `dcr-math-lib` Git repository and recommended build/prebuilt layouts for both `git` and `path`.
|
||||||
|
* **Transitive dependency builds and cycle reporting** — DCR recursively builds DCR packages and reports a clear dependency chain for cycles.
|
||||||
|
* **Bare path arguments for `dcr add`** — `dcr add mylib ../mylib` now works in addition to the explicit `path:` form.
|
||||||
* **Removed `install.sh` / `install.ps1` / `install_bsd.sh`** — superseded by `dcrup`.
|
* **Removed `install.sh` / `install.ps1` / `install_bsd.sh`** — superseded by `dcrup`.
|
||||||
|
|
||||||
## 0.8.5 (2026-08-08)
|
## 0.8.5 (2026-08-08)
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ dcr add mylib path:./lib # explicit path prefix
|
|||||||
dcr add mylib git:https://github.com/user/repo # explicit git prefix
|
dcr add mylib git:https://github.com/user/repo # explicit git prefix
|
||||||
dcr add mylib github:user/repo # GitHub shorthand
|
dcr add mylib github:user/repo # GitHub shorthand
|
||||||
dcr add mylib gitlab:user/repo # GitLab shorthand
|
dcr add mylib gitlab:user/repo # GitLab shorthand
|
||||||
|
dcr add fmt pkg-config:fmt # system package via pkg-config
|
||||||
|
dcr add openssl pkg:openssl,libcrypto # multiple pkg-config packages
|
||||||
```
|
```
|
||||||
|
|
||||||
Source prefixes:
|
Source prefixes:
|
||||||
@@ -23,6 +25,7 @@ Source prefixes:
|
|||||||
* `git:` — generic git URL
|
* `git:` — generic git URL
|
||||||
* `github:` — expands to `https://github.com/\<user>/\<repo>`
|
* `github:` — expands to `https://github.com/\<user>/\<repo>`
|
||||||
* `gitlab:` — expands to `https://gitlab.com/\<user>/\<repo>`
|
* `gitlab:` — expands to `https://gitlab.com/\<user>/\<repo>`
|
||||||
|
* `pkg-config:` / `pkg:` — one or more packages resolved by `pkg-config`
|
||||||
* `http://` / `https://` / `git@` — full URL
|
* `http://` / `https://` / `git@` — full URL
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
@@ -31,7 +34,12 @@ Flags:
|
|||||||
* `--tag \<name>` — git tag
|
* `--tag \<name>` — git tag
|
||||||
* `--rev \<hash>` — git commit
|
* `--rev \<hash>` — git commit
|
||||||
|
|
||||||
If source is omitted — DCR searches connected registries.
|
If source is omitted — DCR searches connected registries. A bare relative or absolute path is accepted as a path dependency.
|
||||||
|
|
||||||
|
For `pkg-config` dependencies, the referenced packages must already be installed
|
||||||
|
and provide `.pc` files. DCR invokes `pkg-config` during the build (using
|
||||||
|
`PATH` and `PKG_CONFIG_PATH`) and forwards the returned compiler and linker
|
||||||
|
flags; it does not download or build these packages.
|
||||||
|
|
||||||
## `dcr tree`
|
## `dcr tree`
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,12 @@ Never fails the command — warnings only. Pre-release suffixes (`1.0.0-dev`) ar
|
|||||||
|
|
||||||
Settings from raw config (not in typed struct):
|
Settings from raw config (not in typed struct):
|
||||||
|
|
||||||
* `pkg_config` — list of pkg-config packages
|
* `pkg_config` — list of packages queried for build-wide compiler/linker flags
|
||||||
|
|
||||||
|
Dependencies can also declare a system package directly, for example
|
||||||
|
`fmt = { pkg-config = "fmt" }`. This records the package in `dcr.lock` and applies
|
||||||
|
the flags returned by `pkg-config --cflags` and `pkg-config --libs`.
|
||||||
|
|
||||||
* `ldscript` — linker script path
|
* `ldscript` — linker script path
|
||||||
* `build.steps` / `build.post_steps` — codegen steps
|
* `build.steps` / `build.post_steps` — codegen steps
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ sidebar_label: Dependencies
|
|||||||
|
|
||||||
## Formats
|
## Formats
|
||||||
|
|
||||||
The `[dependencies]` section supports three formats:
|
The `[dependencies]` section supports registry, path, Git, and `pkg-config` dependencies:
|
||||||
|
|
||||||
### String (registry)
|
### String (registry)
|
||||||
|
|
||||||
@@ -23,10 +23,10 @@ The version string is used as-is for registry lookup.
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
fmt = { git = "https://github.com/fmtlib/fmt", tag = "10.1.1" }
|
dcr-math = { git = "https://github.com/dexoron/dcr-math-lib.git", tag = "v0.1.0" }
|
||||||
```
|
```
|
||||||
|
|
||||||
Fields: `git`, `branch`, `tag`, `rev`.
|
Fields: `git`, `branch`, `tag`, `rev`, `mode`, `include`, `lib`, `libs`.
|
||||||
|
|
||||||
### Table (path)
|
### Table (path)
|
||||||
|
|
||||||
@@ -35,6 +35,32 @@ Fields: `git`, `branch`, `tag`, `rev`.
|
|||||||
mylib = { path = "../mylib" }
|
mylib = { path = "../mylib" }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For a prebuilt external library, specify its layout explicitly. The three
|
||||||
|
arrays are paths relative to the dependency root (`include`, `lib`) and linker
|
||||||
|
names (`libs`):
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
dcr-math = { path = "../deps/dcr-math", include = ["include"], lib = ["lib"], libs = ["dcr-math"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
### Table (`pkg-config`)
|
||||||
|
|
||||||
|
Use an installed `.pc` package when the library is provided by the operating system
|
||||||
|
or another system package manager. DCR invokes `pkg-config --cflags` and
|
||||||
|
`pkg-config --libs`, preserving include, library, linker, and other flags:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
fmt = { pkg-config = "fmt" }
|
||||||
|
openssl = { pkg-config = ["openssl", "libcrypto"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
The `pkg-config` executable must be available in `PATH`. The named `.pc` files must
|
||||||
|
be available through pkg-config's standard search paths or via `PKG_CONFIG_PATH`.
|
||||||
|
These dependencies are not downloaded or built by DCR; they are recorded in
|
||||||
|
`dcr.lock` with a `pkg-config+...` source.
|
||||||
|
|
||||||
## Registry
|
## Registry
|
||||||
|
|
||||||
DCR uses a package registry for dependency lookup by name.
|
DCR uses a package registry for dependency lookup by name.
|
||||||
@@ -42,7 +68,7 @@ DCR uses a package registry for dependency lookup by name.
|
|||||||
```toml
|
```toml
|
||||||
# ~/.dcr/config.toml
|
# ~/.dcr/config.toml
|
||||||
[registry.default]
|
[registry.default]
|
||||||
url = "https://index.dcr.pm"
|
url = "https://index.dcr.dexoron.tech"
|
||||||
priority = 1
|
priority = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -50,7 +76,23 @@ Registry priority: order in `config.toml`. The `DCR_INDEX_PATH` variable overrid
|
|||||||
|
|
||||||
## Git dependencies
|
## Git dependencies
|
||||||
|
|
||||||
Git dependencies are parsed and recorded in `dcr.lock`. DCR supports specifying branch/tag/rev for git sources:
|
Git dependencies are cloned into `~/.dcr/git/`; their exact checked-out commit is written to `dcr.lock`.
|
||||||
|
|
||||||
|
Both Git and path dependencies have two modes:
|
||||||
|
|
||||||
|
* **DCR package:** the source has `dcr.toml`. DCR builds it before the consumer and uses the package name from its manifest for linking.
|
||||||
|
* **Prebuilt library:** it provides existing headers and binaries through `include`, `lib`, and `libs`. DCR passes them to the compiler/linker without building the dependency.
|
||||||
|
|
||||||
|
The mode is normally detected automatically. Use `mode = "build"` or `mode = "prebuild"` when a source contains both a manifest and prebuilt artifacts and you need to choose explicitly.
|
||||||
|
|
||||||
|
`dcr-math-lib` publishes both forms. Select its prebuilt library explicitly:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
dcr-math = { git = "https://github.com/dexoron/dcr-math-lib.git", tag = "v0.1.0", mode = "prebuild", include = ["include"], lib = ["lib"], libs = ["dcr-math"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
DCR supports specifying branch/tag/rev for git sources:
|
||||||
|
|
||||||
* `branch` — switch to a branch
|
* `branch` — switch to a branch
|
||||||
* `tag` — switch to a tag
|
* `tag` — switch to a tag
|
||||||
@@ -59,7 +101,7 @@ Git dependencies are parsed and recorded in `dcr.lock`. DCR supports specifying
|
|||||||
|
|
||||||
## Path dependencies
|
## Path dependencies
|
||||||
|
|
||||||
Local paths. DCR automatically discovers include and lib directories from the neighbor's `dcr.toml`.
|
Local paths may point at a DCR package or a prebuilt external library. A path DCR package is built before its consumer, including its own path/git dependencies. DCR detects dependency cycles. A prebuilt library is never built by DCR; it is linked from the directories declared in its dependency entry.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -67,18 +109,51 @@ mylib = { path = "/abs/path/to/lib" }
|
|||||||
mylib = { path = "../relative/path" }
|
mylib = { path = "../relative/path" }
|
||||||
```
|
```
|
||||||
|
|
||||||
*Note: Header resolution automatically checks the packaged `target/include` directory of path dependencies, ensuring consumer packages can find headers from compiled static or dynamic libraries.*
|
For DCR packages, the package name from `dcr.toml` is used for linking (so the dependency key may differ from the library name). Header resolution includes the packaged `target/include` directory and link search includes `target/lib`.
|
||||||
|
|
||||||
|
### Recommended library layouts
|
||||||
|
|
||||||
|
Buildable DCR library:
|
||||||
|
|
||||||
|
```text
|
||||||
|
dcr-math-lib/
|
||||||
|
├── dcr.toml
|
||||||
|
└── src/
|
||||||
|
├── dcr_math.c
|
||||||
|
└── dcr_math.h
|
||||||
|
```
|
||||||
|
|
||||||
|
Prebuilt library:
|
||||||
|
|
||||||
|
```text
|
||||||
|
dcr-math-lib/
|
||||||
|
├── include/
|
||||||
|
│ └── dcr_math.h
|
||||||
|
└── lib/
|
||||||
|
└── libdcr-math.a # or .so / .lib
|
||||||
|
```
|
||||||
|
|
||||||
|
`libs` contains linker names without the `lib` prefix and file extension: use
|
||||||
|
`["dcr-math"]` for `libdcr-math.a`.
|
||||||
|
|
||||||
|
If one repository contains both forms, keep the prebuilt files in `include/` and `lib/` and select the mode explicitly:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
dcr-math = { git = "https://github.com/dexoron/dcr-math-lib.git", tag = "v0.1.0", mode = "prebuild", include = ["include"], lib = ["lib"], libs = ["dcr-math"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
For a local copy, replace `git` with `path = "../dcr-math-lib"`. In `prebuild` mode DCR does not run the dependency build, even when `dcr.toml` is present.
|
||||||
|
|
||||||
## dcr.lock
|
## dcr.lock
|
||||||
|
|
||||||
Dependency lock file. Contains package names and sources.
|
Dependency lock file. Contains package names and sources.
|
||||||
|
|
||||||
Created during `dcr build` when registry dependencies are present. Not updated during `dcr add` — only on the next `dcr build`.
|
Created during `dcr build` for resolved registry, path, and Git dependencies. Not updated during `dcr add` — only on the next `dcr build`.
|
||||||
|
|
||||||
## Resolution process
|
## Resolution process
|
||||||
|
|
||||||
1. Load all dependencies (registry → git → path)
|
1. Resolve dependency sources (registry → git → path)
|
||||||
2. For path deps: recursively read their `dcr.toml`
|
2. Fetch git dependencies into `~/.dcr/git/` and check out the requested ref
|
||||||
3. For registry deps: search `index.json`
|
3. Build DCR package dependencies recursively
|
||||||
4. For git deps: clone to cache
|
4. Collect `include_dirs`, `lib_dirs`, `libs` for the compiler
|
||||||
5. Collect `include_dirs`, `lib_dirs`, `libs` for the compiler
|
|
||||||
|
|||||||
@@ -4,10 +4,22 @@ sidebar_label: Список изменений
|
|||||||
|
|
||||||
# Список изменений
|
# Список изменений
|
||||||
|
|
||||||
## Unreleased
|
## 0.9.1 (2026-09-13)
|
||||||
|
|
||||||
|
* **`pkg-config` dependencies** — declare `fmt = { pkg-config = "fmt" }` or multiple package names in `[dependencies]`; DCR applies `.pc` compiler/linker flags and records the resolved package in `dcr.lock`.
|
||||||
|
* **`dcr add` support for `pkg-config`** — easily add system package dependencies with `dcr add fmt pkg-config:fmt` or `dcr add openssl pkg:openssl,libcrypto`.
|
||||||
|
* **`dcr tree` & IDE integration** — `pkg-config` packages are marked in `dcr tree` and resolved into compiler flags in `dcr gen` (`compile_commands.json`).
|
||||||
|
* **Fixed `dcr new` in non-ASCII / spaced paths** — initializing projects from folders with non-ASCII characters or spaces no longer fails validation.
|
||||||
|
|
||||||
|
## 0.9.0 (2026-08-31)
|
||||||
|
|
||||||
* **Download mirrors in `dcrup`** — `--mirror auto|cf|gh|sf|ya` and `DCRUP_MIRROR`.
|
* **Download mirrors in `dcrup`** — `--mirror auto|cf|gh|sf|ya` and `DCRUP_MIRROR`.
|
||||||
Default `auto` tries **cf → gh → sf → ya** (CloudFlare CDN, GitHub, SourceForge, Yandex CDN).
|
Default `auto` tries **cf → gh → sf → ya** (CloudFlare CDN, GitHub, SourceForge, Yandex CDN).
|
||||||
|
* **Complete Path/Git dependencies** — DCR packages from `path` and `git` are built before their consumer. Git sources are cached in `~/.dcr/git`, support `branch`/`tag`/`rev`, and record the exact commit in `dcr.lock`.
|
||||||
|
* **Build and prebuild modes** — `path` and `git` dependencies can build a DCR package from `dcr.toml` or link existing `include`/`lib`/`libs` artifacts; `mode = "build"` / `"prebuild"` selects explicitly when both forms are present.
|
||||||
|
* **Prebuilt dependency examples** — documentation now shows the `dcr-math-lib` Git repository and recommended build/prebuilt layouts for both `git` and `path`.
|
||||||
|
* **Transitive dependency builds and cycle reporting** — DCR recursively builds DCR packages and reports a clear dependency chain for cycles.
|
||||||
|
* **Bare path arguments for `dcr add`** — `dcr add mylib ../mylib` now works in addition to the explicit `path:` form.
|
||||||
* **Removed `install.sh` / `install.ps1` / `install_bsd.sh`** — superseded by `dcrup`.
|
* **Removed `install.sh` / `install.ps1` / `install_bsd.sh`** — superseded by `dcrup`.
|
||||||
|
|
||||||
## 0.8.5 (2026-08-08)
|
## 0.8.5 (2026-08-08)
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ sidebar_label: Команды зависимостей (add, tree)
|
|||||||
Добавляет зависимость в `dcr.toml`.
|
Добавляет зависимость в `dcr.toml`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
dcr add fmt # поиск в реестре
|
dcr add fmt # registry lookup
|
||||||
dcr add mylib ../path/to/lib # путь как источник
|
dcr add mylib ../path/to/lib # path as source
|
||||||
dcr add mylib path:./lib # явный префикс пути
|
dcr add mylib path:./lib # explicit path prefix
|
||||||
dcr add mylib git:https://github.com/user/repo # явный префикс git
|
dcr add mylib git:https://github.com/user/repo # explicit git prefix
|
||||||
dcr add mylib github:user/repo # сокращённая запись GitHub
|
dcr add mylib github:user/repo # GitHub shorthand
|
||||||
dcr add mylib gitlab:user/repo # сокращённая запись GitLab
|
dcr add mylib gitlab:user/repo # GitLab shorthand
|
||||||
|
dcr add fmt pkg-config:fmt # system package via pkg-config
|
||||||
|
dcr add openssl pkg:openssl,libcrypto # multiple pkg-config packages
|
||||||
```
|
```
|
||||||
|
|
||||||
Префиксы источника:
|
Префиксы источника:
|
||||||
@@ -23,6 +25,7 @@ dcr add mylib gitlab:user/repo # сокращённая запись GitLab
|
|||||||
* `git:` — URL адрес git-репозитория
|
* `git:` — URL адрес git-репозитория
|
||||||
* `github:` — расширение `https://github.com/\<user>/\<repo>`
|
* `github:` — расширение `https://github.com/\<user>/\<repo>`
|
||||||
* `gitlab:` — расширение `https://gitlab.com/\<user>/\<repo>`
|
* `gitlab:` — расширение `https://gitlab.com/\<user>/\<repo>`
|
||||||
|
* `pkg-config:` / `pkg:` — one or more packages resolved by `pkg-config`
|
||||||
* `http://` / `https://` / `git@` — полный URL
|
* `http://` / `https://` / `git@` — полный URL
|
||||||
|
|
||||||
Флаги:
|
Флаги:
|
||||||
@@ -31,7 +34,12 @@ dcr add mylib gitlab:user/repo # сокращённая запись GitLab
|
|||||||
* `--tag \<name>` — git tag
|
* `--tag \<name>` — git tag
|
||||||
* `--rev \<hash>` — git commit
|
* `--rev \<hash>` — git commit
|
||||||
|
|
||||||
Если источник не указан — DCR выполняет поиск в подключенных реестрах.
|
Если источник не указан — DCR выполняет поиск в подключенных реестрах. A bare relative or absolute path is accepted as a path dependency.
|
||||||
|
|
||||||
|
For `pkg-config` dependencies, the referenced packages must already be installed
|
||||||
|
and provide `.pc` files. DCR invokes `pkg-config` during the build (using
|
||||||
|
`PATH` and `PKG_CONFIG_PATH`) and forwards the returned compiler and linker
|
||||||
|
flags; it does not download or build these packages.
|
||||||
|
|
||||||
## `dcr tree`
|
## `dcr tree`
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,12 @@ Never fails the command — warnings only. Pre-release suffixes (`1.0.0-dev`) ar
|
|||||||
|
|
||||||
Параметры из исходного файла конфигурации (не в виде типизированной структуры):
|
Параметры из исходного файла конфигурации (не в виде типизированной структуры):
|
||||||
|
|
||||||
* Пакеты для pkg-config
|
* `pkg_config` — list of packages queried for build-wide compiler/linker flags
|
||||||
|
|
||||||
|
Dependencies can also declare a system package directly, for example
|
||||||
|
`fmt = { pkg-config = "fmt" }`. This records the package in `dcr.lock` and applies
|
||||||
|
the flags returned by `pkg-config --cflags` and `pkg-config --libs`.
|
||||||
|
|
||||||
* Путь к linker script
|
* Путь к linker script
|
||||||
* `build.steps` / `build.post_steps` — этапы генерации кода
|
* `build.steps` / `build.post_steps` — этапы генерации кода
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ sidebar_label: Зависимости
|
|||||||
|
|
||||||
## Форматы
|
## Форматы
|
||||||
|
|
||||||
В секции `[dependencies]` поддерживаются три формата:
|
The `[dependencies]` section supports registry, path, Git, and `pkg-config` dependencies:
|
||||||
|
|
||||||
### Строка (реестр)
|
### Строка (реестр)
|
||||||
|
|
||||||
@@ -23,10 +23,10 @@ catch2 = ">=3.0,<4.0"
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
fmt = { git = "https://github.com/fmtlib/fmt", tag = "10.1.1" }
|
dcr-math = { git = "https://github.com/dexoron/dcr-math-lib.git", tag = "v0.1.0" }
|
||||||
```
|
```
|
||||||
|
|
||||||
Поля: `git`, `branch`, `tag`, `rev`, `features`.
|
Fields: `git`, `branch`, `tag`, `rev`, `mode`, `include`, `lib`, `libs`.
|
||||||
|
|
||||||
### Табличный (path)
|
### Табличный (path)
|
||||||
|
|
||||||
@@ -35,6 +35,32 @@ fmt = { git = "https://github.com/fmtlib/fmt", tag = "10.1.1" }
|
|||||||
mylib = { path = "../mylib" }
|
mylib = { path = "../mylib" }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For a prebuilt external library, specify its layout explicitly. The three
|
||||||
|
arrays are paths relative to the dependency root (`include`, `lib`) and linker
|
||||||
|
names (`libs`):
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
dcr-math = { path = "../deps/dcr-math", include = ["include"], lib = ["lib"], libs = ["dcr-math"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
### Table (`pkg-config`)
|
||||||
|
|
||||||
|
Use an installed `.pc` package when the library is provided by the operating system
|
||||||
|
or another system package manager. DCR invokes `pkg-config --cflags` and
|
||||||
|
`pkg-config --libs`, preserving include, library, linker, and other flags:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
fmt = { pkg-config = "fmt" }
|
||||||
|
openssl = { pkg-config = ["openssl", "libcrypto"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
The `pkg-config` executable must be available in `PATH`. The named `.pc` files must
|
||||||
|
be available through pkg-config's standard search paths or via `PKG_CONFIG_PATH`.
|
||||||
|
These dependencies are not downloaded or built by DCR; they are recorded in
|
||||||
|
`dcr.lock` with a `pkg-config+...` source.
|
||||||
|
|
||||||
## Реестр
|
## Реестр
|
||||||
|
|
||||||
## RegistryDCR использует реестр пакетов для поиска зависимостей по имени.```toml
|
## RegistryDCR использует реестр пакетов для поиска зависимостей по имени.```toml
|
||||||
@@ -46,7 +72,7 @@ main = { url = "https://github.com/dcr-ports/dcr-index", priority = 1 }
|
|||||||
```toml
|
```toml
|
||||||
# ~/.dcr/config.toml
|
# ~/.dcr/config.toml
|
||||||
[registry.default]
|
[registry.default]
|
||||||
url = "https://index.dcr.pm"
|
url = "https://index.dcr.dexoron.tech"
|
||||||
priority = 1
|
priority = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -54,7 +80,23 @@ priority = 1
|
|||||||
|
|
||||||
## Git-зависимости
|
## Git-зависимости
|
||||||
|
|
||||||
Git dependencies are parsed and recorded in `dcr.lock`. DCR supports specifying branch/tag/rev for git sources:
|
Git dependencies are cloned into `~/.dcr/git/`; their exact checked-out commit is written to `dcr.lock`.
|
||||||
|
|
||||||
|
Both Git and path dependencies have two modes:
|
||||||
|
|
||||||
|
* **DCR package:** the source has `dcr.toml`. DCR builds it before the consumer and uses the package name from its manifest for linking.
|
||||||
|
* **Prebuilt library:** it provides existing headers and binaries through `include`, `lib`, and `libs`. DCR passes them to the compiler/linker without building the dependency.
|
||||||
|
|
||||||
|
The mode is normally detected automatically. Use `mode = "build"` or `mode = "prebuild"` when a source contains both a manifest and prebuilt artifacts and you need to choose explicitly.
|
||||||
|
|
||||||
|
`dcr-math-lib` publishes both forms. Select its prebuilt library explicitly:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
dcr-math = { git = "https://github.com/dexoron/dcr-math-lib.git", tag = "v0.1.0", mode = "prebuild", include = ["include"], lib = ["lib"], libs = ["dcr-math"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
DCR supports specifying branch/tag/rev for git sources:
|
||||||
|
|
||||||
* `branch` — переключиться на ветку
|
* `branch` — переключиться на ветку
|
||||||
* `tag` — переключиться на тег
|
* `tag` — переключиться на тег
|
||||||
@@ -63,7 +105,7 @@ Git dependencies are parsed and recorded in `dcr.lock`. DCR supports specifying
|
|||||||
|
|
||||||
## Path dependencies
|
## Path dependencies
|
||||||
|
|
||||||
Local paths. DCR automatically discovers include and lib directories from the neighbor's `dcr.toml`.
|
Local paths may point at a DCR package or a prebuilt external library. A path DCR package is built before its consumer, including its own path/git dependencies. DCR detects dependency cycles. A prebuilt library is never built by DCR; it is linked from the directories declared in its dependency entry.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -71,18 +113,51 @@ mylib = { path = "/abs/path/to/lib" }
|
|||||||
mylib = { path = "../relative/path" }
|
mylib = { path = "../relative/path" }
|
||||||
```
|
```
|
||||||
|
|
||||||
*Note: Header resolution automatically checks the packaged `target/include` directory of path dependencies, ensuring consumer packages can find headers from compiled static or dynamic libraries.*
|
For DCR packages, the package name from `dcr.toml` is used for linking (so the dependency key may differ from the library name). Header resolution includes the packaged `target/include` directory and link search includes `target/lib`.
|
||||||
|
|
||||||
|
### Recommended library layouts
|
||||||
|
|
||||||
|
Buildable DCR library:
|
||||||
|
|
||||||
|
```text
|
||||||
|
dcr-math-lib/
|
||||||
|
├── dcr.toml
|
||||||
|
└── src/
|
||||||
|
├── dcr_math.c
|
||||||
|
└── dcr_math.h
|
||||||
|
```
|
||||||
|
|
||||||
|
Prebuilt library:
|
||||||
|
|
||||||
|
```text
|
||||||
|
dcr-math-lib/
|
||||||
|
├── include/
|
||||||
|
│ └── dcr_math.h
|
||||||
|
└── lib/
|
||||||
|
└── libdcr-math.a # or .so / .lib
|
||||||
|
```
|
||||||
|
|
||||||
|
`libs` contains linker names without the `lib` prefix and file extension: use
|
||||||
|
`["dcr-math"]` for `libdcr-math.a`.
|
||||||
|
|
||||||
|
If one repository contains both forms, keep the prebuilt files in `include/` and `lib/` and select the mode explicitly:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
dcr-math = { git = "https://github.com/dexoron/dcr-math-lib.git", tag = "v0.1.0", mode = "prebuild", include = ["include"], lib = ["lib"], libs = ["dcr-math"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
For a local copy, replace `git` with `path = "../dcr-math-lib"`. In `prebuild` mode DCR does not run the dependency build, even when `dcr.toml` is present.
|
||||||
|
|
||||||
## dcr.lock
|
## dcr.lock
|
||||||
|
|
||||||
Dependency lock file. Contains package names and sources.
|
Dependency lock file. Contains package names and sources.
|
||||||
|
|
||||||
Created during `dcr build` when registry dependencies are present. Not updated during `dcr add` — only on the next `dcr build`.
|
Created during `dcr build` for resolved registry, path, and Git dependencies. Not updated during `dcr add` — only on the next `dcr build`.
|
||||||
|
|
||||||
## Resolution process
|
## Resolution process
|
||||||
|
|
||||||
1. Load all dependencies (registry → git → path)
|
1. Resolve dependency sources (registry → git → path)
|
||||||
2. For path deps: recursively read their `dcr.toml`
|
2. Fetch git dependencies into `~/.dcr/git/` and check out the requested ref
|
||||||
3. For registry deps: search `index.json`
|
3. Build DCR package dependencies recursively
|
||||||
4. For git deps: clone to cache
|
4. Collect `include_dirs`, `lib_dirs`, `libs` for the compiler
|
||||||
5. Collect `include_dirs`, `lib_dirs`, `libs` for the compiler
|
|
||||||
|
|||||||
@@ -4,10 +4,22 @@ sidebar_label: Changelog
|
|||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## Unreleased
|
## 0.9.1 (2026-09-13)
|
||||||
|
|
||||||
|
* **`pkg-config` dependencies** — declare `fmt = { pkg-config = "fmt" }` or multiple package names in `[dependencies]`; DCR applies `.pc` compiler/linker flags and records the resolved package in `dcr.lock`.
|
||||||
|
* **`dcr add` support for `pkg-config`** — easily add system package dependencies with `dcr add fmt pkg-config:fmt` or `dcr add openssl pkg:openssl,libcrypto`.
|
||||||
|
* **`dcr tree` & IDE integration** — `pkg-config` packages are marked in `dcr tree` and resolved into compiler flags in `dcr gen` (`compile_commands.json`).
|
||||||
|
* **Fixed `dcr new` in non-ASCII / spaced paths** — initializing projects from folders with non-ASCII characters or spaces no longer fails validation.
|
||||||
|
|
||||||
|
## 0.9.0 (2026-08-31)
|
||||||
|
|
||||||
* **Download mirrors in `dcrup`** — `--mirror auto|cf|gh|sf|ya` and `DCRUP_MIRROR`.
|
* **Download mirrors in `dcrup`** — `--mirror auto|cf|gh|sf|ya` and `DCRUP_MIRROR`.
|
||||||
Default `auto` tries **cf → gh → sf → ya** (CloudFlare CDN, GitHub, SourceForge, Yandex CDN).
|
Default `auto` tries **cf → gh → sf → ya** (CloudFlare CDN, GitHub, SourceForge, Yandex CDN).
|
||||||
|
* **Complete Path/Git dependencies** — DCR packages from `path` and `git` are built before their consumer. Git sources are cached in `~/.dcr/git`, support `branch`/`tag`/`rev`, and record the exact commit in `dcr.lock`.
|
||||||
|
* **Build and prebuild modes** — `path` and `git` dependencies can build a DCR package from `dcr.toml` or link existing `include`/`lib`/`libs` artifacts; `mode = "build"` / `"prebuild"` selects explicitly when both forms are present.
|
||||||
|
* **Prebuilt dependency examples** — documentation now shows the `dcr-math-lib` Git repository and recommended build/prebuilt layouts for both `git` and `path`.
|
||||||
|
* **Transitive dependency builds and cycle reporting** — DCR recursively builds DCR packages and reports a clear dependency chain for cycles.
|
||||||
|
* **Bare path arguments for `dcr add`** — `dcr add mylib ../mylib` now works in addition to the explicit `path:` form.
|
||||||
* **Removed `install.sh` / `install.ps1` / `install_bsd.sh`** — superseded by `dcrup`.
|
* **Removed `install.sh` / `install.ps1` / `install_bsd.sh`** — superseded by `dcrup`.
|
||||||
|
|
||||||
## 0.8.5 (2026-08-08)
|
## 0.8.5 (2026-08-08)
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ dcr add mylib path:./lib # explicit path prefix
|
|||||||
dcr add mylib git:https://github.com/user/repo # explicit git prefix
|
dcr add mylib git:https://github.com/user/repo # explicit git prefix
|
||||||
dcr add mylib github:user/repo # GitHub shorthand
|
dcr add mylib github:user/repo # GitHub shorthand
|
||||||
dcr add mylib gitlab:user/repo # GitLab shorthand
|
dcr add mylib gitlab:user/repo # GitLab shorthand
|
||||||
|
dcr add fmt pkg-config:fmt # system package via pkg-config
|
||||||
|
dcr add openssl pkg:openssl,libcrypto # multiple pkg-config packages
|
||||||
```
|
```
|
||||||
|
|
||||||
Source prefixes:
|
Source prefixes:
|
||||||
@@ -23,6 +25,7 @@ Source prefixes:
|
|||||||
* `git:` — generic git URL
|
* `git:` — generic git URL
|
||||||
* `github:` — expands to `https://github.com/\<user>/\<repo>`
|
* `github:` — expands to `https://github.com/\<user>/\<repo>`
|
||||||
* `gitlab:` — expands to `https://gitlab.com/\<user>/\<repo>`
|
* `gitlab:` — expands to `https://gitlab.com/\<user>/\<repo>`
|
||||||
|
* `pkg-config:` / `pkg:` — one or more packages resolved by `pkg-config`
|
||||||
* `http://` / `https://` / `git@` — full URL
|
* `http://` / `https://` / `git@` — full URL
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
@@ -31,7 +34,12 @@ Flags:
|
|||||||
* `--tag \<name>` — git tag
|
* `--tag \<name>` — git tag
|
||||||
* `--rev \<hash>` — git commit
|
* `--rev \<hash>` — git commit
|
||||||
|
|
||||||
If source is omitted — DCR searches connected registries.
|
If source is omitted — DCR searches connected registries. A bare relative or absolute path is accepted as a path dependency.
|
||||||
|
|
||||||
|
For `pkg-config` dependencies, the referenced packages must already be installed
|
||||||
|
and provide `.pc` files. DCR invokes `pkg-config` during the build (using
|
||||||
|
`PATH` and `PKG_CONFIG_PATH`) and forwards the returned compiler and linker
|
||||||
|
flags; it does not download or build these packages.
|
||||||
|
|
||||||
## `dcr tree`
|
## `dcr tree`
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,12 @@ Never fails the command — warnings only. Pre-release suffixes (`1.0.0-dev`) ar
|
|||||||
|
|
||||||
Settings from raw config (not in typed struct):
|
Settings from raw config (not in typed struct):
|
||||||
|
|
||||||
* `pkg_config` — list of pkg-config packages
|
* `pkg_config` — list of packages queried for build-wide compiler/linker flags
|
||||||
|
|
||||||
|
Dependencies can also declare a system package directly, for example
|
||||||
|
`fmt = { pkg-config = "fmt" }`. This records the package in `dcr.lock` and applies
|
||||||
|
the flags returned by `pkg-config --cflags` and `pkg-config --libs`.
|
||||||
|
|
||||||
* `ldscript` — linker script path
|
* `ldscript` — linker script path
|
||||||
* `build.steps` / `build.post_steps` — codegen steps
|
* `build.steps` / `build.post_steps` — codegen steps
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ sidebar_label: Dependencies
|
|||||||
|
|
||||||
## Formats
|
## Formats
|
||||||
|
|
||||||
The `[dependencies]` section supports three formats:
|
The `[dependencies]` section supports registry, path, Git, and `pkg-config` dependencies:
|
||||||
|
|
||||||
### String (registry)
|
### String (registry)
|
||||||
|
|
||||||
@@ -23,10 +23,10 @@ The version string is used as-is for registry lookup.
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
fmt = { git = "https://github.com/fmtlib/fmt", tag = "10.1.1" }
|
dcr-math = { git = "https://github.com/dexoron/dcr-math-lib.git", tag = "v0.1.0" }
|
||||||
```
|
```
|
||||||
|
|
||||||
Fields: `git`, `branch`, `tag`, `rev`.
|
Fields: `git`, `branch`, `tag`, `rev`, `mode`, `include`, `lib`, `libs`.
|
||||||
|
|
||||||
### Table (path)
|
### Table (path)
|
||||||
|
|
||||||
@@ -35,6 +35,32 @@ Fields: `git`, `branch`, `tag`, `rev`.
|
|||||||
mylib = { path = "../mylib" }
|
mylib = { path = "../mylib" }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For a prebuilt external library, specify its layout explicitly. The three
|
||||||
|
arrays are paths relative to the dependency root (`include`, `lib`) and linker
|
||||||
|
names (`libs`):
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
dcr-math = { path = "../deps/dcr-math", include = ["include"], lib = ["lib"], libs = ["dcr-math"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
### Table (`pkg-config`)
|
||||||
|
|
||||||
|
Use an installed `.pc` package when the library is provided by the operating system
|
||||||
|
or another system package manager. DCR invokes `pkg-config --cflags` and
|
||||||
|
`pkg-config --libs`, preserving include, library, linker, and other flags:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
fmt = { pkg-config = "fmt" }
|
||||||
|
openssl = { pkg-config = ["openssl", "libcrypto"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
The `pkg-config` executable must be available in `PATH`. The named `.pc` files must
|
||||||
|
be available through pkg-config's standard search paths or via `PKG_CONFIG_PATH`.
|
||||||
|
These dependencies are not downloaded or built by DCR; they are recorded in
|
||||||
|
`dcr.lock` with a `pkg-config+...` source.
|
||||||
|
|
||||||
## Registry
|
## Registry
|
||||||
|
|
||||||
DCR uses a package registry for dependency lookup by name.
|
DCR uses a package registry for dependency lookup by name.
|
||||||
@@ -42,7 +68,7 @@ DCR uses a package registry for dependency lookup by name.
|
|||||||
```toml
|
```toml
|
||||||
# ~/.dcr/config.toml
|
# ~/.dcr/config.toml
|
||||||
[registry.default]
|
[registry.default]
|
||||||
url = "https://index.dcr.pm"
|
url = "https://index.dcr.dexoron.tech"
|
||||||
priority = 1
|
priority = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -50,7 +76,23 @@ Registry priority: order in `config.toml`. The `DCR_INDEX_PATH` variable overrid
|
|||||||
|
|
||||||
## Git dependencies
|
## Git dependencies
|
||||||
|
|
||||||
Git dependencies are parsed and recorded in `dcr.lock`. DCR supports specifying branch/tag/rev for git sources:
|
Git dependencies are cloned into `~/.dcr/git/`; their exact checked-out commit is written to `dcr.lock`.
|
||||||
|
|
||||||
|
Both Git and path dependencies have two modes:
|
||||||
|
|
||||||
|
* **DCR package:** the source has `dcr.toml`. DCR builds it before the consumer and uses the package name from its manifest for linking.
|
||||||
|
* **Prebuilt library:** it provides existing headers and binaries through `include`, `lib`, and `libs`. DCR passes them to the compiler/linker without building the dependency.
|
||||||
|
|
||||||
|
The mode is normally detected automatically. Use `mode = "build"` or `mode = "prebuild"` when a source contains both a manifest and prebuilt artifacts and you need to choose explicitly.
|
||||||
|
|
||||||
|
`dcr-math-lib` publishes both forms. Select its prebuilt library explicitly:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
dcr-math = { git = "https://github.com/dexoron/dcr-math-lib.git", tag = "v0.1.0", mode = "prebuild", include = ["include"], lib = ["lib"], libs = ["dcr-math"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
DCR supports specifying branch/tag/rev for git sources:
|
||||||
|
|
||||||
* `branch` — switch to a branch
|
* `branch` — switch to a branch
|
||||||
* `tag` — switch to a tag
|
* `tag` — switch to a tag
|
||||||
@@ -59,7 +101,7 @@ Git dependencies are parsed and recorded in `dcr.lock`. DCR supports specifying
|
|||||||
|
|
||||||
## Path dependencies
|
## Path dependencies
|
||||||
|
|
||||||
Local paths. DCR automatically discovers include and lib directories from the neighbor's `dcr.toml`.
|
Local paths may point at a DCR package or a prebuilt external library. A path DCR package is built before its consumer, including its own path/git dependencies. DCR detects dependency cycles. A prebuilt library is never built by DCR; it is linked from the directories declared in its dependency entry.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -67,18 +109,51 @@ mylib = { path = "/abs/path/to/lib" }
|
|||||||
mylib = { path = "../relative/path" }
|
mylib = { path = "../relative/path" }
|
||||||
```
|
```
|
||||||
|
|
||||||
*Note: Header resolution automatically checks the packaged `target/include` directory of path dependencies, ensuring consumer packages can find headers from compiled static or dynamic libraries.*
|
For DCR packages, the package name from `dcr.toml` is used for linking (so the dependency key may differ from the library name). Header resolution includes the packaged `target/include` directory and link search includes `target/lib`.
|
||||||
|
|
||||||
|
### Recommended library layouts
|
||||||
|
|
||||||
|
Buildable DCR library:
|
||||||
|
|
||||||
|
```text
|
||||||
|
dcr-math-lib/
|
||||||
|
├── dcr.toml
|
||||||
|
└── src/
|
||||||
|
├── dcr_math.c
|
||||||
|
└── dcr_math.h
|
||||||
|
```
|
||||||
|
|
||||||
|
Prebuilt library:
|
||||||
|
|
||||||
|
```text
|
||||||
|
dcr-math-lib/
|
||||||
|
├── include/
|
||||||
|
│ └── dcr_math.h
|
||||||
|
└── lib/
|
||||||
|
└── libdcr-math.a # or .so / .lib
|
||||||
|
```
|
||||||
|
|
||||||
|
`libs` contains linker names without the `lib` prefix and file extension: use
|
||||||
|
`["dcr-math"]` for `libdcr-math.a`.
|
||||||
|
|
||||||
|
If one repository contains both forms, keep the prebuilt files in `include/` and `lib/` and select the mode explicitly:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
dcr-math = { git = "https://github.com/dexoron/dcr-math-lib.git", tag = "v0.1.0", mode = "prebuild", include = ["include"], lib = ["lib"], libs = ["dcr-math"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
For a local copy, replace `git` with `path = "../dcr-math-lib"`. In `prebuild` mode DCR does not run the dependency build, even when `dcr.toml` is present.
|
||||||
|
|
||||||
## dcr.lock
|
## dcr.lock
|
||||||
|
|
||||||
Dependency lock file. Contains package names and sources.
|
Dependency lock file. Contains package names and sources.
|
||||||
|
|
||||||
Created during `dcr build` when registry dependencies are present. Not updated during `dcr add` — only on the next `dcr build`.
|
Created during `dcr build` for resolved registry, path, and Git dependencies. Not updated during `dcr add` — only on the next `dcr build`.
|
||||||
|
|
||||||
## Resolution process
|
## Resolution process
|
||||||
|
|
||||||
1. Load all dependencies (registry → git → path)
|
1. Resolve dependency sources (registry → git → path)
|
||||||
2. For path deps: recursively read their `dcr.toml`
|
2. Fetch git dependencies into `~/.dcr/git/` and check out the requested ref
|
||||||
3. For registry deps: search `index.json`
|
3. Build DCR package dependencies recursively
|
||||||
4. For git deps: clone to cache
|
4. Collect `include_dirs`, `lib_dirs`, `libs` for the compiler
|
||||||
5. Collect `include_dirs`, `lib_dirs`, `libs` for the compiler
|
|
||||||
|
|||||||
Reference in New Issue
Block a user