140 Commits

Author SHA1 Message Date
2f2c4aa208 New translations test-framework.mdx (Ukrainian)
[ci skip]
2026-07-07 11:22:40 +08:00
87bad94848 New translations test-framework.mdx (Russian)
[ci skip]
2026-07-07 11:22:39 +08:00
39bba3cea8 New translations test-framework.mdx (Polish)
[ci skip]
2026-07-07 11:22:38 +08:00
d498e67782 New translations test-framework.mdx (German)
[ci skip]
2026-07-07 11:22:36 +08:00
82de72ce8d New translations running-tests.mdx (Ukrainian)
[ci skip]
2026-07-07 11:22:35 +08:00
ffaf1f1dd1 New translations running-tests.mdx (Russian)
[ci skip]
2026-07-07 11:22:34 +08:00
c050ffb8c4 New translations running-tests.mdx (Polish)
[ci skip]
2026-07-07 11:22:33 +08:00
e9908f359d New translations running-tests.mdx (German)
[ci skip]
2026-07-07 11:22:32 +08:00
024bbfcaa9 New translations self-update.mdx (Ukrainian)
[ci skip]
2026-07-07 11:22:31 +08:00
4b8d78dac7 New translations self-update.mdx (Russian)
[ci skip]
2026-07-07 11:22:29 +08:00
50a2c59fed New translations self-update.mdx (Polish)
[ci skip]
2026-07-07 11:22:28 +08:00
184c44902c New translations self-update.mdx (German)
[ci skip]
2026-07-07 11:22:27 +08:00
44cb4f3665 New translations workspaces.mdx (Ukrainian)
[ci skip]
2026-07-07 11:22:26 +08:00
98fc25c40d New translations workspaces.mdx (Russian)
[ci skip]
2026-07-07 11:22:25 +08:00
fc968d07bd New translations workspaces.mdx (Polish)
[ci skip]
2026-07-07 11:22:24 +08:00
ba20bf7d3d New translations workspaces.mdx (German)
[ci skip]
2026-07-07 11:22:23 +08:00
787e89f779 New translations platform-support.mdx (Ukrainian)
[ci skip]
2026-07-07 11:22:21 +08:00
a67729a673 New translations platform-support.mdx (Russian)
[ci skip]
2026-07-07 11:22:20 +08:00
25cc7b8f3b New translations platform-support.mdx (Polish)
[ci skip]
2026-07-07 11:22:19 +08:00
bddbc3603a New translations platform-support.mdx (German)
[ci skip]
2026-07-07 11:22:18 +08:00
666794d33d New translations environment-variables.mdx (Ukrainian)
[ci skip]
2026-07-07 11:22:17 +08:00
e35f5e0ad1 New translations environment-variables.mdx (Russian)
[ci skip]
2026-07-07 11:22:16 +08:00
4ce4632a92 New translations environment-variables.mdx (Polish)
[ci skip]
2026-07-07 11:22:14 +08:00
aaa6c99795 New translations environment-variables.mdx (German)
[ci skip]
2026-07-07 11:22:13 +08:00
fe6ac220e6 New translations dependencies.mdx (Ukrainian)
[ci skip]
2026-07-07 11:22:12 +08:00
6622353ff8 New translations dependencies.mdx (Russian)
[ci skip]
2026-07-07 11:22:11 +08:00
b3f14d1e68 New translations dependencies.mdx (Polish)
[ci skip]
2026-07-07 11:22:09 +08:00
4cb8985bfb New translations dependencies.mdx (German)
[ci skip]
2026-07-07 11:22:08 +08:00
95bb204884 New translations dcr-toml.mdx (Ukrainian)
[ci skip]
2026-07-07 11:22:07 +08:00
bebda1fe8a New translations dcr-toml.mdx (Russian)
[ci skip]
2026-07-07 11:22:06 +08:00
f0e587b12b New translations dcr-toml.mdx (Polish)
[ci skip]
2026-07-07 11:22:02 +08:00
476f13676a New translations dcr-toml.mdx (German)
[ci skip]
2026-07-07 11:22:01 +08:00
fcf21b2b2e New translations cross-compilation.mdx (Ukrainian)
[ci skip]
2026-07-07 11:22:00 +08:00
cb519cc4fd New translations cross-compilation.mdx (Russian)
[ci skip]
2026-07-07 11:21:56 +08:00
32911212e8 New translations cross-compilation.mdx (Polish)
[ci skip]
2026-07-07 11:21:52 +08:00
3f506e79af New translations cross-compilation.mdx (German)
[ci skip]
2026-07-07 11:21:48 +08:00
fc657b8a99 New translations build-system.mdx (Ukrainian)
[ci skip]
2026-07-07 11:21:46 +08:00
462c53d93f New translations build-system.mdx (Russian)
[ci skip]
2026-07-07 11:21:45 +08:00
c9ff114b25 New translations build-system.mdx (Polish)
[ci skip]
2026-07-07 11:21:44 +08:00
746a26bae9 New translations build-system.mdx (German)
[ci skip]
2026-07-07 11:21:42 +08:00
b6b171b2a9 New translations build-profiles.mdx (Ukrainian)
[ci skip]
2026-07-07 11:21:41 +08:00
a1ccaebfd3 New translations build-profiles.mdx (Russian)
[ci skip]
2026-07-07 11:21:40 +08:00
a15470e669 New translations build-profiles.mdx (Polish)
[ci skip]
2026-07-07 11:21:39 +08:00
901ea9ebaa New translations build-profiles.mdx (German)
[ci skip]
2026-07-07 11:21:38 +08:00
75cf0af9b4 New translations multi-package-workspace.mdx (Ukrainian)
[ci skip]
2026-07-07 11:21:37 +08:00
54f5f78e2c New translations multi-package-workspace.mdx (Russian)
[ci skip]
2026-07-07 11:21:36 +08:00
bb27b4e2e6 New translations multi-package-workspace.mdx (Polish)
[ci skip]
2026-07-07 11:21:35 +08:00
9d9422b45b New translations multi-package-workspace.mdx (German)
[ci skip]
2026-07-07 11:21:33 +08:00
b37aa2a380 New translations library-project.mdx (Ukrainian)
[ci skip]
2026-07-07 11:21:32 +08:00
af96ba2ac2 New translations library-project.mdx (Russian)
[ci skip]
2026-07-07 11:21:31 +08:00
2d73d07923 New translations library-project.mdx (Polish)
[ci skip]
2026-07-07 11:21:30 +08:00
d193dc1314 New translations library-project.mdx (German)
[ci skip]
2026-07-07 11:21:29 +08:00
8ddf4c3fb9 New translations cross-to-windows.mdx (Ukrainian)
[ci skip]
2026-07-07 11:21:28 +08:00
f7c0a50e0e New translations cross-to-windows.mdx (Russian)
[ci skip]
2026-07-07 11:21:27 +08:00
f4748173f9 New translations cross-to-windows.mdx (Polish)
[ci skip]
2026-07-07 11:21:26 +08:00
1ed2cd9a71 New translations cross-to-windows.mdx (German)
[ci skip]
2026-07-07 11:21:25 +08:00
d77fcf6b29 New translations license.mdx (Ukrainian)
[ci skip]
2026-07-07 11:21:23 +08:00
458cda2da2 New translations license.mdx (Russian)
[ci skip]
2026-07-07 11:21:22 +08:00
af9b67edec New translations license.mdx (Polish)
[ci skip]
2026-07-07 11:21:21 +08:00
72654896c0 New translations license.mdx (German)
[ci skip]
2026-07-07 11:21:20 +08:00
82a2b38132 New translations ide-integration.mdx (Ukrainian)
[ci skip]
2026-07-07 11:21:19 +08:00
c936c03fbf New translations ide-integration.mdx (Russian)
[ci skip]
2026-07-07 11:21:17 +08:00
0fecd4c2b7 New translations ide-integration.mdx (Polish)
[ci skip]
2026-07-07 11:21:16 +08:00
1e6a1ae9c1 New translations ide-integration.mdx (German)
[ci skip]
2026-07-07 11:21:15 +08:00
813354c5da New translations installation.mdx (Ukrainian)
[ci skip]
2026-07-07 11:21:14 +08:00
a02f302c48 New translations installation.mdx (Russian)
[ci skip]
2026-07-07 11:21:13 +08:00
a1d2d41fb0 New translations installation.mdx (Polish)
[ci skip]
2026-07-07 11:21:12 +08:00
c11c1a83df New translations installation.mdx (German)
[ci skip]
2026-07-07 11:21:10 +08:00
98db98d353 New translations first-steps.mdx (Ukrainian)
[ci skip]
2026-07-07 11:21:09 +08:00
6c326c21d4 New translations first-steps.mdx (Russian)
[ci skip]
2026-07-07 11:21:08 +08:00
2e895619bf New translations first-steps.mdx (Polish)
[ci skip]
2026-07-07 11:21:07 +08:00
03146c2857 New translations first-steps.mdx (German)
[ci skip]
2026-07-07 11:21:06 +08:00
6c1e041037 New translations faq.mdx (Ukrainian)
[ci skip]
2026-07-07 11:21:05 +08:00
fc545c6af9 New translations faq.mdx (Russian)
[ci skip]
2026-07-07 11:21:04 +08:00
4e2688d66f New translations faq.mdx (Polish)
[ci skip]
2026-07-07 11:21:02 +08:00
1eca47feb5 New translations faq.mdx (German)
[ci skip]
2026-07-07 11:21:01 +08:00
12f4177a91 New translations contributing.mdx (Ukrainian)
[ci skip]
2026-07-07 11:21:00 +08:00
84eb7c0c52 New translations contributing.mdx (Russian)
[ci skip]
2026-07-07 11:20:59 +08:00
ce643077b3 New translations contributing.mdx (Polish)
[ci skip]
2026-07-07 11:20:58 +08:00
bc71ee7202 New translations contributing.mdx (German)
[ci skip]
2026-07-07 11:20:57 +08:00
42312e10bb New translations system-commands.mdx (Ukrainian)
[ci skip]
2026-07-07 11:20:56 +08:00
7e54cb7155 New translations system-commands.mdx (Russian)
[ci skip]
2026-07-07 11:20:55 +08:00
4c40e74dbb New translations system-commands.mdx (Polish)
[ci skip]
2026-07-07 11:20:54 +08:00
8aa350629c New translations system-commands.mdx (German)
[ci skip]
2026-07-07 11:20:52 +08:00
49d63a1ea1 New translations quality-commands.mdx (Ukrainian)
[ci skip]
2026-07-07 11:20:51 +08:00
f87112faf0 New translations quality-commands.mdx (Russian)
[ci skip]
2026-07-07 11:20:50 +08:00
ab0ad58925 New translations quality-commands.mdx (Polish)
[ci skip]
2026-07-07 11:20:49 +08:00
f5b465446c New translations quality-commands.mdx (German)
[ci skip]
2026-07-07 11:20:48 +08:00
f4124ea268 New translations project-commands.mdx (Ukrainian)
[ci skip]
2026-07-07 11:20:46 +08:00
d10358bdab New translations project-commands.mdx (Russian)
[ci skip]
2026-07-07 11:20:45 +08:00
fd5150f3db New translations project-commands.mdx (Polish)
[ci skip]
2026-07-07 11:20:44 +08:00
82e10cc75d New translations project-commands.mdx (German)
[ci skip]
2026-07-07 11:20:43 +08:00
b7c9edb35e New translations gen-commands.mdx (Ukrainian)
[ci skip]
2026-07-07 11:20:42 +08:00
04fcedc428 New translations gen-commands.mdx (Russian)
[ci skip]
2026-07-07 11:20:41 +08:00
548808a8d8 New translations gen-commands.mdx (Polish)
[ci skip]
2026-07-07 11:20:40 +08:00
dcb8e676f1 New translations gen-commands.mdx (German)
[ci skip]
2026-07-07 11:20:38 +08:00
1b0ee1402a New translations dependency-commands.mdx (Ukrainian)
[ci skip]
2026-07-07 11:20:37 +08:00
6c6fa8d5d4 New translations dependency-commands.mdx (Russian)
[ci skip]
2026-07-07 11:20:36 +08:00
c2c3a7bd7a New translations dependency-commands.mdx (Polish)
[ci skip]
2026-07-07 11:20:35 +08:00
23149d8149 New translations dependency-commands.mdx (German)
[ci skip]
2026-07-07 11:20:34 +08:00
801a164da9 New translations build-commands.mdx (Ukrainian)
[ci skip]
2026-07-07 11:20:33 +08:00
e3ec2c198d New translations build-commands.mdx (Russian)
[ci skip]
2026-07-07 11:20:32 +08:00
312af43702 New translations build-commands.mdx (Polish)
[ci skip]
2026-07-07 11:20:30 +08:00
3ca1db4f7c New translations build-commands.mdx (German)
[ci skip]
2026-07-07 11:20:29 +08:00
0af619907a New translations changelog.mdx (Ukrainian)
[ci skip]
2026-07-07 11:20:28 +08:00
e257afde70 New translations changelog.mdx (Russian)
[ci skip]
2026-07-07 11:20:27 +08:00
cd3ef3a7f5 New translations changelog.mdx (Polish)
[ci skip]
2026-07-07 11:20:26 +08:00
966018c1e0 New translations changelog.mdx (German)
[ci skip]
2026-07-07 11:20:25 +08:00
180f927e85 New translations readme.mdx (Ukrainian)
[ci skip]
2026-07-07 11:20:23 +08:00
7ba9d296a1 New translations readme.mdx (Russian)
[ci skip]
2026-07-07 11:20:22 +08:00
93a894e66a New translations readme.mdx (Polish)
[ci skip]
2026-07-07 11:20:21 +08:00
c7dd8fecaa New translations readme.mdx (German)
[ci skip]
2026-07-07 11:20:20 +08:00
a3f8444c20 Replace GitLab pipeline trigger with Cloudflare build 2026-07-05 18:24:47 +08:00
1f3fc62cb6 Add GitHub Actions workflow to trigger site rebuild 2026-07-05 18:16:45 +08:00
f8d8c95912 Rename сrowdin.yml to crowdin.yml (latin) 2026-07-05 17:26:00 +08:00
9e07f70c78 fix crowdin file name 2026-07-05 17:24:14 +08:00
0376eded3f add Crowdin 2026-07-05 17:21:33 +08:00
803d5891ce Merge pull request #21 from dexoron/dev
v0.7.4
2026-06-19 17:50:59 +08:00
9326e23a53 feat: add native Qt support and dcr lint command; refactor architecture and integration tests 2026-06-17 12:39:22 +08:00
21932ac94a feat(build): add freestanding, lto, strip, panic-abort, and codegen-units support in dcr.toml 2026-06-16 16:42:56 +08:00
97db82e4f8 Merge pull request #20 from dexoron/dev
v0.7.3
2026-06-15 22:36:12 +08:00
3d596d7280 Update install docs 2026-06-15 22:35:38 +08:00
5cb4473bd1 Update README.md 2026-06-15 22:35:06 +08:00
33f955d4e3 refactor(updater): migrate from reqwest to ureq for lightweight builds 2026-06-13 16:15:24 +08:00
838be72dd2 refactor(deps): replace git2 with system git and add vcs support 2026-06-13 15:28:14 +08:00
39fad31c4f Merge pull request #18 from dexoron/master
v0.7.2
2026-06-07 22:31:43 +08:00
c8ef38a99b release: bump version to 0.7.2 and update changelog 2026-06-07 21:41:02 +08:00
8e0c535cfd fix: improve default target triple generation for various OS environments 2026-06-07 21:29:55 +08:00
de88c160ad Merge pull request #16 from XiaoPengYouCode/codex/fix-macos-host-target-link 2026-06-07 21:21:53 +08:00
4daca925a0 Merge pull request #17 from dexoron/master
master -> dev
2026-06-07 21:17:14 +08:00
595b7ac105 Merge pull request #15 from XiaoPengYouCode/codex/fix-readme-badges 2026-06-07 21:13:10 +08:00
XiaoPengYouCode
11ae3762d0 fix: use host macOS target for default builds 2026-06-07 05:41:07 +08:00
XiaoPengYouCode
4c439317e3 docs: fix README badge rendering 2026-06-07 05:09:38 +08:00
0aa3f87f99 feat: temporarily disable Snap Store publishing and update README instructions 2026-06-06 22:18:03 +08:00
a6ce0a3332 feat: enhance release notes extraction and include release name in GitHub release 2026-06-06 21:41:50 +08:00
cea43e99c8 feat: add Windows target dependencies and update README for MinGW 2026-06-06 21:39:17 +08:00
de4fb0bc29 feat: add .SRCINFO for AUR package metadata 2026-06-06 21:33:34 +08:00
59e27b6f5d Merge pull request #14 from dexoron/dev
v0.7.1 The Multi-Arch Expansion
2026-06-06 21:28:24 +08:00
c8cb155e5a feat: update help flag 2026-06-06 21:22:46 +08:00
6424aab69d feet: add license to docs and updated Cargo.toml to add build with no features flag 2026-06-06 21:19:04 +08:00
183 changed files with 10614 additions and 2505 deletions

View File

@@ -41,10 +41,6 @@ on:
description: "Publish to crates.io"
type: boolean
default: false
run_snap:
description: "Publish to Snap Store (dcrup)"
type: boolean
default: false
run_brew:
description: "Update Homebrew tap"
type: boolean
@@ -83,24 +79,42 @@ jobs:
notes:
needs: setup
runs-on: ubuntu-latest
outputs:
release_name: ${{ steps.extract.outputs.release_name }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.setup.outputs.tag }}
- name: Prepare Release Notes
id: extract
shell: bash
run: |
set -euo pipefail
tag="${{ needs.setup.outputs.version }}"
notes_file=".github/release-notes.md"
if grep -q "^## \\[${tag}\\]" CHANGELOG.md; then
awk -v ver="$tag" '
# Strip -dev suffix to match base version in CHANGELOG
changelog_tag="${tag%-dev}"
if grep -q "^## \\[${changelog_tag}\\]" CHANGELOG.md; then
# Extract release name from header: ## [0.7.1] - 2026-06-02 "Title"
release_name=$(awk -v search_ver="$changelog_tag" -v display_ver="$tag" '
$0 ~ "^## \\[" search_ver "\\]" {
match($0, /"([^"]+)"/, arr)
if (arr[1] != "") {
print "v" display_ver " - " arr[1]
} else {
print "v" display_ver
}
}
' CHANGELOG.md)
echo "release_name=${release_name}" >> "$GITHUB_OUTPUT"
awk -v ver="$changelog_tag" '
$0 ~ "^## \\[" ver "\\]" {found=1; next}
found && $0 ~ "^## \\[" {exit}
found {print}
' CHANGELOG.md | sed -e '${/^$/d;}' > "$notes_file"
else
echo "release_name=v${tag}" >> "$GITHUB_OUTPUT"
echo "No CHANGELOG section for $tag." > "$notes_file"
git log -1 --pretty=format:"%s%n%n%b" >> "$notes_file"
fi
@@ -126,6 +140,7 @@ jobs:
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.setup.outputs.tag }}
name: ${{ needs.notes.outputs.release_name }}
body_path: .github/release-notes.md
prerelease: ${{ needs.setup.outputs.prerelease == 'true' }}
@@ -651,6 +666,8 @@ jobs:
done
}
PKG
cat > packages/aur/dcr/.SRCINFO <<SRC
pkgbase = dcr
pkgdesc = Cargo-like utility to manage C/C++ projects
pkgver = ${PKGVER_CLEAN}
@@ -1229,34 +1246,11 @@ jobs:
git commit -m "dcr ${{ needs.setup.outputs.version }}"
git push
# ── Snap Store (dcrup) ─────────────────────────────────────────────────────
publish-snap:
if: |
(github.event_name == 'push' && needs.setup.outputs.prerelease == 'false') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_snap == 'true')
needs: [setup, build-linux-packages]
runs-on: ubuntu-latest
steps:
- name: Download Built Packages
uses: actions/download-artifact@v4
with:
name: snap-package
path: dist-packages
- name: Resolve Snap File
id: snap-file
run: |
snap_file=$(ls dist-packages/*.snap 2>/dev/null | head -1)
if [ -z "$snap_file" ]; then
echo "No .snap file found in dist-packages/"
exit 1
fi
echo "snap=$snap_file" >> "$GITHUB_OUTPUT"
- name: Publish to Snap Store
uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }}
with:
snap: ${{ steps.snap-file.outputs.snap }}
release: stable
# ── Snap Store (dcrup) — temporarily disabled ────────────────────────────
# Classic confinement was denied for this project (too new).
# Snap artifact is still built and attached to the release via
# publish-dexoron-packages. Users can install manually:
# sudo snap install --classic --dangerous dcrup_*.snap
#
# publish-snap:
# if: ...

View File

@@ -0,0 +1,14 @@
name: Trigger site rebuild
on:
push:
branches: [master]
paths:
- 'docs/**'
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Trigger Cloudflare Pages build
run: curl -sS -X POST "${{ secrets.CF_PAGES_DEPLOY_HOOK }}"

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@ target/
sandbox/**
.idea/
.vscode/
.cargo/
.env
personal/

View File

@@ -1,5 +1,121 @@
# Changelog
## [0.7.4] - 2026-06-17 "Qt Поддержка, Linting и Рефакторинг Архитектуры / Qt Support, Linting, & Architecture Refactor"
### RU
**Добавлено:**
- **Нативная поддержка Qt** — добавлена автоматическая обработка мета-объектов (MOC, UIC, RCC) при включении `build.qt = true` в `dcr.toml`.
- **Команда `dcr lint`** — статический анализ C/C++ через `clang-tidy`. Поддерживает `--fix` для автоматического исправления. Уважает `build.roots` и `build.src_disable` из конфига.
- **Три новых ассемблерных бэкенда**:
- **MASM** (`compiler = "ml"` / `"ml64"`) — Microsoft Macro Assembler.
- **FASM** (`compiler = "fasm"`) — Flat Assembler.
- **LLVM IR** (`compiler = "llc"`) — компиляция `.ll` → объектный файл.
- **Общий ASM-пайплайн** — линковка и архивирование вынесены в `core/builder/asm.rs`. Новый ассемблерный бэкенд теперь пишется за ~30 строк.
- **Утилиты для файловой системы** — `to_hex()` и `home_dir()` вынесены в `utils/fs.rs`.
- **Утилиты для сборки** — `normalize_target()`, `normalize_kind()`, `normalize_platform()`, `default_profile_flags()` вынесены в `utils/build.rs`.
- **Утилиты для бэкендов** — `asm_lang_flag()`, `source_extensions()`, `elapsed_secs()` добавлены в `core/builder/common.rs`.
- **Полноценная автоматизация Bare-Metal / Freestanding** — добавлен конфигурационный флаг `build.freestanding = true`. При его включении (или при обнаружении bare-metal таргета) DCR автоматически инжектирует флаг `-ffreestanding` на этапе компиляции, а также `-nostdlib` и `-static` на этапе линковки.
- **Оптимизация артефактов (LTO и Strip)** — в `dcr.toml` добавлены параметры `build.lto` (авто-инжекция флага `-flto` для компилятора и линкера) и `build.strip` (автоматическое отсекание отладочной информации через флаг `-s` линкера).
- **Контроль многопоточности сборки** — добавлен параметр `build.codegen-units`, позволяющий жестко ограничить максимальное количество параллельных потоков сборки для кастомного движка `parallel_build`.
- **Управление паникой (Panic Abort)** — добавлен параметр `build.panic = "abort"`. Для C++ проектов он автоматически отключает генерацию таблиц раскрутки стека и исключений через флаги `-fno-exceptions`, `-fno-unwind-tables` и `-fno-asynchronous-unwind-tables`.
**Изменено:**
- **Интеллектуальные дефолтные флаги (DCR Defaults)** — генерация дефолтных флагов оптимизации (`-O3`/`-O0`), отладки (`-g`) и предупреждений (`-Wall -Wextra`) теперь автоматически отключается для bare-metal и freestanding целей, если пользователь переопределил `build.cflags`.
- **Глобальный вынос bare-metal детектора** — функция `is_bare_metal_target` вынесена в общие утилиты `src/utils/build.rs` для сквозного использования в конвейере сборки.
- **Рефакторинг архитектуры**:
- `src/config.rs` переименован в `src/templates.rs`.
- Начата консолидация конфигурационной логики и оркестрации сборки.
### EN
**Added:**
- **Native Qt support** — automatic meta-object handling (MOC, UIC, RCC) added when `build.qt = true` is set in `dcr.toml`.
- **`dcr lint` command** — C/C++ static analysis via `clang-tidy`. Supports `--fix` for automatic fixes. Respects `build.roots` and `build.src_disable` from config.
- **Three new assembler backends**:
- **MASM** (`compiler = "ml"` / `"ml64"`) — Microsoft Macro Assembler.
- **FASM** (`compiler = "fasm"`) — Flat Assembler.
- **LLVM IR** (`compiler = "llc"`) — compiles `.ll` files via `llc -filetype=obj`.
- **Shared ASM pipeline** — linking and archiving logic consolidated into `core/builder/asm.rs`. Adding a new assembler backend now takes ~30 lines.
- **Filesystem utilities** — `to_hex()` and `home_dir()` extracted to `utils/fs.rs`.
- **Build utilities** — `normalize_target()`, `normalize_kind()`, `normalize_platform()`, `default_profile_flags()` extracted to `utils/build.rs`.
- **Backend helpers** — `asm_lang_flag()`, `source_extensions()`, `elapsed_secs()` added to `core/builder/common.rs`.
- **Full Bare-Metal / Freestanding Automation** — introduced the `build.freestanding = true` configuration option. When enabled (or when a bare-metal target is detected), DCR automatically injects `-ffreestanding` during compilation and both `-nostdlib` and `-static` during linking.
- **Artifact Optimization (LTO & Strip)** — added `build.lto` (auto-injects `-flto` for compiler and linker) and `build.strip` (automatically strips debug symbols via linker `-s` flag) options to `dcr.toml`.
- **Compilation Thread Control** — added the `build.codegen-units` option to strictly limit the maximum number of parallel jobs utilized by the custom `parallel_build` worker pool.
- **Panic Behavior Management** — added `build.panic = "abort"` support. For C++ targets, it automatically strips exception handling and unwind tables via `-fno-exceptions`, `-fno-unwind-tables`, and `-fno-asynchronous-unwind-tables`.
**Changed:**
- **Intelligent Default Flags Generation** — automated injection of fallback optimization (`-O3`/`-O0`), debug (`-g`), and warning (`-Wall -Wextra`) flags is now suppressed for bare-metal and freestanding builds if `build.cflags` are overridden.
- **Centralized Bare-Metal Detection** — relocated the `is_bare_metal_target` helper to common build utilities (`src/utils/build.rs`) for unified access across the building core.
- **Architectural Refactoring**:
- Renamed `src/config.rs` to `src/templates.rs`.
- Started consolidation of configuration and build orchestration logic.
## [0.7.3] - 2026-06-13 "Оптимизация Зависимостей и VCS / Dependency Optimization & VCS"
### RU
**Добавлено:**
- **Параметр `--vcs` для команд `new` и `init`** — добавлена возможность явно указывать систему контроля версий через `--vcs <git|none>`.
- **Интеграция Git-информации в `--version`** — утилита теперь выводит текущий короткий хэш коммита и суффикс `-dirty`, если в репозитории DCR есть незакоммиченные изменения.
- **Автоматическая генерация `.gitignore`** — при инициализации Git-репозитория автоматически создается файл `.gitignore` с исключением директории `/target`.
- **Защита от вложенных репозиториев** — автоматическая инициализация Git теперь пропускается, если `dcr new` или `dcr init` запускаются внутри уже существующего Git-репозитория.
- **Тесты для верификации VCS** — добавлены интеграционные тесты `new_vcs_options_work` и `init_vcs_options_work` для проверки логики инициализации репозиториев.
**Изменено:**
- **Полный отказ от библиотеки `git2`** — работа с Git (клонирование зависимостей, инициализация VCS, проверка статуса) переведена на вызовы системного `git` через `Command`. Это облегчает сборку проекта и убирает необходимость в фичах `vendored` и `openssl`.
- **Миграция с `reqwest` на `ureq`** — в модуле обновления (`flag_update.rs`) тяжелый `reqwest` заменен на легковесный синхронный клиент `ureq 2.10`, что уменьшило оверхед и размер итогового бинарника.
### EN
**Added:**
- **`--vcs` option for `new` and `init` commands** — introduced explicit version control system selection via `--vcs <git|none>`.
- **Git metadata integration in `--version`** — the CLI now appends the current short commit hash and a `-dirty` suffix if there are uncommitted changes in the DCR repository.
- **Automatic `.gitignore` generation** — Git repository initialization now automatically writes a `.gitignore` file excluding the `/target` directory.
- **Nested repository prevention** — automatic Git initialization is now skipped if `dcr new` or `dcr init` is executed inside an already existing Git repository.
- **VCS verification tests** — added `new_vcs_options_work` and `init_vcs_options_work` integration tests to ensure reliable repository behavior.
**Changed:**
- **Complete removal of `git2` dependency** — all Git actions (dependency fetching, VCS setup, status checks) are now delegated to the system `git` executable via `Command`. This simplifies compilation and drops the need for `vendored` and `openssl` features.
- **Migrated from `reqwest` to `ureq`** — replaced the heavy `reqwest` crate in `flag_update.rs` with the lightweight synchronous `ureq 2.10` client, reducing overhead and the final binary size.
## [0.7.2] - 2026-06-07 "Исправление Таргетов и Линковки / Target & Linker Fixes"
### RU
**Добавлено:**
- Учтён `target_env` в `default_target_triple()` — Linux (gnu/musl) и Windows (msvc/gnu) теперь используют правильное окружение, а не хардкод.
**Исправлено:**
- **Сборка на macOS Apple Silicon падала с `_main` undefined** — `--target=` теперь передаётся и в ldflags, не только в cflags. `default_target_triple()` на macOS использует `std::env::consts::ARCH` вместо хардкода `x86_64`.
- **Бейджи GitHub Stars и GPL-3.0 не рендерились в README** — блок бейджей переведён на чистый HTML.
**Изменено:**
- Вычисление таргета по умолчанию вынесено в общую функцию `default_target_triple()` — устранено дублирование в build, run, clean.
### EN
**Added:**
- `default_target_triple()` now respects `target_env` — Linux (gnu/musl) and Windows (msvc/gnu) use the correct environment instead of hardcoded values.
**Fixed:**
- **macOS Apple Silicon builds failed with `_main` undefined** — `--target=` is now passed to ldflags, not just cflags. `default_target_triple()` uses `std::env::consts::ARCH` on macOS instead of hardcoded `x86_64`.
- **GitHub Stars and GPL-3.0 badges not rendering in README** — badge block converted to pure HTML.
**Changed:**
- Default target resolution extracted into shared `default_target_triple()` — removed duplication across build, run, clean.
## [0.7.1] - 2026-06-02 "Мультиархитектурное расширение / The Multi-Arch Expansion"
### RU
@@ -12,7 +128,7 @@
- Оптимизация сборки: `opt-level = "z"`, LTO, `codegen-units = 1`, `panic = "abort"`, `strip = true`.
- Поддержка новых архитектур (i686, armv7, riscv64gc, aarch64) в рабочих процессах и установочных скриптах.
- Сборка пакетов `deb` и `rpm` для всех 5 архитектур Linux через `cargo-zigbuild`.
- Пакеты AUR (`dcr-dev`, `dcr-dev-bin`) и публикация Snap в CI.
- Пакеты AUR (`dcr-dev`, `dcr-dev-bin`) и сборка Snap в CI.
**Изменено:**
- Функция `validate_package_name` стала публичной.
@@ -20,6 +136,15 @@
- Инструкция в README изменена с `| bash` на `| sh` для POSIX.
- Отключена архитектура Windows 32-bit (GNU) из-за проблем со сборкой.
**Исправлено:**
- **`dcr new <invalid-name>` создаёт директорию, затем падает** — валидация теперь происходит до операций с файлами.
- **`dcr init` создаёт dcr.toml, затем падает при невалидном имени директории** — то же исправление.
- **Man-страницы отсутствовали после установки** — теперь устанавливаются через скрипты установки, пакетные менеджеры и Homebrew.
- **Ложное срабатывание на букву диска в Windows** — в парсинге файлов зависимостей.
- **CRLF `\r\n` ломает парсер зависимостей** — теперь обрабатываются смешанные окончания строк.
- **Новая строка после обратного слеша не поглощалась** — в обработке escape-последовательностей `parse_d_file`.
### EN
**Added:**
@@ -30,7 +155,7 @@
- Release profile optimizations (`opt-level = "z"`, LTO, `codegen-units = 1`, `panic = "abort"`, `strip = true`).
- Linux i686, armv7, riscv64gc, aarch64 architecture support in release workflows and installation scripts.
- Multi-arch `deb` and `rpm` package builds for all 5 Linux architectures via `cargo-zigbuild`.
- AUR packages (`dcr-dev`, `dcr-dev-bin`) and automated Snapcraft publishing in CI.
- AUR packages (`dcr-dev`, `dcr-dev-bin`) and Snap build in CI.
**Changed:**
- `validate_package_name` made public and callable from CLI commands directly.

1037
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,13 @@
[package]
name = "dcr"
version = "0.7.1"
version = "0.7.4"
edition = "2024"
build = "build.rs"
description = "DCR is a utility for managing C/C++ projects in a Cargo-like style."
license = "GPL-3.0-or-later"
repository = "https://github.com/dexoron/dcr"
documentation = "https://dcr.dexoron.su/docs"
homepage = "https://dcr.dexoron.su"
documentation = "https://dcr-tool.ru/docs"
homepage = "https://dcr-tool.ru"
[package.metadata.binstall]
pkg-fmt = "bin"
@@ -61,7 +61,7 @@ assets = [
[dependencies]
glob = "0.3"
reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls"] }
ureq = { version = "2.10", default-features = false, features = ["json", "native-certs"] }
serde = { version = "1", features = ["derive"] }
self-replace = "1"
sha2 = "0.10"
@@ -69,16 +69,17 @@ toml = "1.0.3"
serde_json = "1"
ctrlc = "3"
[target.'cfg(not(windows))'.dependencies]
git2 = { version = "0.20.4", features = ["vendored-libgit2", "vendored-openssl"] }
openssl = { version = "0.10", features = ["vendored"] }
[target.'cfg(windows)'.dependencies]
git2 = { version = "0.20.4", features = ["vendored-libgit2"] }
[profile.release]
opt-level = "z"
lto = true
lto = "thin"
codegen-units = 1
panic = "abort"
strip = true
[profile.fast]
inherits = "release"
opt-level = 1
lto = false
codegen-units = 16
panic = "abort"
strip = true

View File

@@ -1,22 +1,21 @@
<div align="center">
<h1 align="center">DCR — Dexoron Cargo Realization</h1>
# DCR — Dexoron Cargo Realization
<p align="center"><strong>A Cargo-style build tool for C/C++ projects</strong></p>
**A Cargo-style build tool for C/C++ projects**
<p align="center">
<a href="https://github.com/dexoron/dcr/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/dexoron/dcr/actions/workflows/ci.yml/badge.svg"></a>
<a href="https://github.com/dexoron/dcr/releases/latest"><img alt="GitHub Release" src="https://img.shields.io/github/v/release/dexoron/dcr"></a>
<a href="https://github.com/dexoron/dcr/releases"><img alt="Platform" src="https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-lightgrey"></a>
<br>
<a href="https://aur.archlinux.org/packages/dcr"><img alt="AUR" src="https://img.shields.io/aur/version/dcr"></a>
<a href="https://crates.io/crates/dcr"><img alt="Crates.io" src="https://img.shields.io/crates/v/dcr"></a>
<a href="https://github.com/dexoron/homebrew-dexoron"><img alt="Homebrew" src="https://img.shields.io/badge/homebrew-dexoron%2Fdexoron-orange"></a>
<br>
<a href="https://github.com/dexoron/dcr/stargazers"><img alt="GitHub Stars" src="https://img.shields.io/github/stars/dexoron/dcr?style=flat"></a>
<a href="LICENSE"><img alt="License: GPL-3.0" src="https://img.shields.io/badge/License-GPL--3.0-blue.svg"></a>
</p>
[![CI](https://github.com/dexoron/dcr/actions/workflows/ci.yml/badge.svg)](https://github.com/dexoron/dcr/actions/workflows/ci.yml)
[![GitHub Release](https://img.shields.io/github/v/release/dexoron/dcr)](https://github.com/dexoron/dcr/releases/latest)
[![Platform](https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-lightgrey)](https://github.com/dexoron/dcr/releases)
<br/>
[![AUR](https://img.shields.io/aur/version/dcr)](https://aur.archlinux.org/packages/dcr)
[![Crates.io](https://img.shields.io/crates/v/dcr)](https://crates.io/crates/dcr)
[![Homebrew](https://img.shields.io/badge/homebrew-dexoron%2Fdexoron-orange)](https://github.com/dexoron/homebrew-dexoron)
[![Snap](https://img.shields.io/badge/snap-dcrup-orange)](https://snapcraft.io/dcrup)
<br/>
[![GitHub Stars](https://img.shields.io/github/stars/dexoron/dcr?style=flat)](https://github.com/dexoron/dcr/stargazers)
[![License: GPL-3.0](https://img.shields.io/badge/License-GPL--3.0-blue.svg)](LICENSE)
</div>
<!-- Snap badge removed: classic confinement was denied for this project. -->
---
@@ -38,7 +37,7 @@
<td><b>Linux (Dexoron Packages)</b></td>
<td>
See https://dcr.dexoron.su for settings youre packages manager
See https://pkg.dexoron.su for settings youre packages manager
**Arch Linux:**
@@ -127,8 +126,11 @@ curl -fsSL https://dcr.dexoron.su/install_bsd.sh | sh
<td><b>Snap (Linux)</b></td>
<td>
> Snap Store publishing temporarily disabled — see [#51671](https://forum.snapcraft.io/t/classic-confinement-request-for-dcrup/51671).
> Download the `.snap` from [GitHub Releases](https://github.com/dexoron/dcr/releases/latest) and install manually:
```sh
sudo snap install dcrup
sudo snap install --classic --dangerous dcrup_*.snap
```
</td>
@@ -226,7 +228,7 @@ other in [docs/](docs/), `dcr --help` and `dcr <command> --help`
| Linux (Musl) | ✅ | ✅ | ✅ | ✅ | 🚧 |
| macOS | ✅ | ✅ | ❌ | ❌ | ❌ |
| Windows (MSVC) | ✅ | ✅ | ❌ | ✅ | ❌ |
| Windows (MinGW) | ✅ | 🚧 | ❌ | ✅ | ❌ |
| Windows (MinGW) | ✅ | 🚧 | ❌ | ❌ | ❌ |
| FreeBSD | ✅ | 🚧 | ❌ | ❌ | ❌ |
| OpenBSD | ✅ | 🚧 | ❌ | ❌ | ❌ |
| NetBSD | ✅ | 🚧 | ❌ | ❌ | ❌ |
@@ -271,6 +273,7 @@ cargo test
<div align="center">
GPL-3.0 — see [LICENSE](LICENSE)<br/>
DCR is a build tool, not a library. The GPL applies only to DCR's own source code, not to projects built with it.<br/>
Made with ❤️ by [Dexoron](https://github.com/dexoron) and contributors.
</div>

60
TODO.md
View File

@@ -2,38 +2,35 @@
Priority list of tasks to turn DCR into a true Cargo killer for C/C++ developers.
## 🔥 High Priority (Next Releases)
**Legend:** `[ ]` — not implemented | `[-]` — partially implemented | `[x]` — implemented
- [x] **Git dependencies support**
`git = "https://github.com/user/repo.git#branch"` and `git = "..."@tag`
- [ ] **Conan and vcpkg integration**
Automatic download, installation and linking of packages
- [ ] **Full freestanding / embedded support**
`-nostdlib`, linker scripts, bare-metal targets (i686-elf, aarch64-none-elf, etc.)
- [ ] **EFI support**
Dedicated platform configuration for EFI targets
- [ ] **Custom project name**
Override binary name in `dcr.toml`
- [ ] **Custom build steps / targets**
Ability to define custom pre-build, post-build, codegen steps in `dcr.toml`
- [ ] **Improved mixed C/C++/ASM projects**
Better handling of `.S` and `.asm` files with correct flags
- [ ] **dcr publish + official package registry**
Publish and fetch your own libraries easily
## 🔥 High Priority
- [ ] **CLI Output Refactoring & Cleanup**
- [ ] Move all terminal strings to a dedicated module (`src/ui/messages.rs`)
- [ ] Standardize logging formats (`error:`, `warning:`, `status:`)
- [x] Add build execution time statistics to the final output (e.g., `Finished in 4.23s`)
- [ ] **Internationalization (i18n) / Localization**
- [ ] Integrate a lightweight localization engine (`fluent` or `gettext` pure-Rust port)
- [ ] Create initial translation catalogs (`en.ftl`, `ru.ftl`)
- [x] **Self-Update Stability Validation**
- [x] Self-update implemented via `self-replace` + `ureq` in `flag_update.rs`
- [-] **Freestanding / Embedded Automation**
- *`-ffreestanding` injected at compile time, `-nostdlib -static` at link time for bare-metal targets or `build.freestanding = true`. Config option `build.freestanding` (bool) added.*
- [ ] **Conan and vcpkg integration** Automatic download, installation and linking of packages
## ✅ Medium Priority
- [ ] **Static analysis** (`dcr check`)
Integration with clang-tidy, cppcheck, include-what-you-use
- [ ] **Linter + Formatter** (`dcr fmt`, `dcr lint`)
- [-] **Linter + Formatter** (`dcr fmt`, `dcr lint`)
*`dcr fmt` (clang-format) implemented; `dcr lint` does not exist yet*
- [ ] **Hot reload / Live reload** for applications (raylib, SFML, SDL, etc.)
- [ ] **Better cross-compilation experience**
Ready-to-use toolchains + automatic download
- [ ] **Linker script support** + direct linker control
- [ ] **Workspaces improvements**
Per-member include directories, selective builds, better dependency graph
- [ ] **Build-time code generation**
Support for protobuf, flatbuffers, Qt moc, custom generators
- [-] **Workspaces improvements** Per-member include directories, selective builds, better dependency graph
*Basic workspaces with dep ordering + topological sort work; advanced features missing*
- [-] **Build-time code generation** Support for protobuf, flatbuffers, Qt moc, custom generators
*Generic `build.steps` machinery + Qt toolchain (uic/moc/rcc) work; no dedicated protobuf/flatbuffers generators*
- [-] **dcr publish + official package registry** *Registry consumption (fetch, resolve, link) works; `dcr publish` command / local packing missing*
## 📌 Low Priority / Nice to Have
@@ -57,13 +54,12 @@ Priority list of tasks to turn DCR into a true Cargo killer for C/C++ developers
---
**Currently in progress:**
- ...
- UI/UX terminal output unification and benchmarking metrics.
**Completed in recent releases:**
- Workspaces
- Cross-compilation
- Extreme binary size optimization (-50% weight reduction via `ureq` + `native-certs`)
- Complete removal of `git2` and `openssl` in favor of system Git execution
- Workspaces & Cross-compilation (`--target <triple>`)
- IDE config generation (VS Code, CLion, compile_commands.json)
- Self-update (`dcr --update`)
- Header tracking
- EFI support & Linker script support (`build.ldscript`)
- Mixed C/C++/ASM compilation with custom `std::thread::scope` work-stealing engine

View File

@@ -18,4 +18,37 @@
fn main() {
let target = std::env::var("TARGET").unwrap_or_else(|_| "unknown-target".to_string());
println!("cargo:rustc-env=DCR_TARGET={target}");
// Let's try to retrieve the commit hash for the version
let commit = std::process::Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.ok()
.and_then(|o| {
if o.status.success() {
String::from_utf8(o.stdout)
.ok()
.map(|s| s.trim().to_string())
} else {
None
}
});
// Check if there are any uncommitted changes in the repository
let is_dirty = std::process::Command::new("git")
.args(["status", "--porcelain"])
.output()
.ok()
.map(|o| o.status.success() && !o.stdout.is_empty())
.unwrap_or(false);
if let Some(commit_hash) = commit {
let dirty_suffix = if is_dirty { "-dirty" } else { "" };
println!(
"cargo:rustc-env=DCR_GIT_INFO= (git {}{})",
commit_hash, dirty_suffix
);
} else {
println!("cargo:rustc-env=DCR_GIT_INFO=");
}
}

3
crowdin.yml Normal file
View File

@@ -0,0 +1,3 @@
files:
- source: /docs/**/*.mdx
translation: /docs-crowdin-export/%locale%/%original_path%/%original_file_name%.%file_extension%

View File

@@ -0,0 +1,63 @@
---
sidebar_label: Introduction
---
# DCR — C/C++ Build Tool & Package Manager
<details>
<summary>Quick reference</summary>
```bash
# Installation
curl -fsSL https://dcr.dexoron.su/install.sh | sh
# Create a project
dcr new my-app
cd my-app
# Build and run
dcr build
dcr run
# Run tests
dcr test
# Add a dependency
dcr add fmt
# Generate IDE files
dcr gen vscode
```
</details>
## Contents
| Section | Description |
| ----------------------------------------------------- | --------------------------------------------- |
| [Getting Started](/docs/getting-started/installation) | Installation and first steps |
| [Commands](/docs/commands/project-commands) | All CLI commands |
| [Reference](/docs/reference/dcr-toml) | Configuration, build, dependencies, platforms |
| [Testing](/docs/testing/test-framework) | Built-in test framework |
| [Recipes](/docs/recipes/cross-to-windows) | Common scenarios |
| [IDE Integration](/docs/ide-integration) | VS Code, CLion, compile_commands.json |
| [Self Update](/docs/self-update) | Auto-update |
| [FAQ](/docs/faq) | Frequently asked questions |
| [Changelog](/docs/changelog) | Version history |
| [License](/docs/license) | DCR and vendored library licenses |
| [Contributing](/docs/contributing) | DCR development |
## Features
* **Incremental builds** — mtime + `.d` headers + SHA256 fingerprint
* **Parallel compilation** — thread::scope, atomic task queue
* **4 backends** — gcc/clang, MSVC/clang-cl, GAS (ARM), NASM (x86)
* **7 project kinds** — bin, staticlib, sharedlib, efi, elf, none, custom
* **Cross-compilation** — short names and full triples
* **Profiles** — debug / release with field overrides
* **Workspaces** — multi-package projects with topological sort
* **Registry + Git + Path** — three dependency mechanisms
* **IDE generation** — VS Code, CLion, compile_commands.json, JSON metadata
* **pkg-config** — automatic system library discovery
* **Per-command `--help`** — `dcr build --help`, `dcr new --help`, etc.
* **Man pages** — `man dcr`, `man dcr-build`, `man dcr-new`

View File

@@ -0,0 +1,91 @@
---
sidebar_label: Changelog
---
# Changelog
## 0.7.1 (2026-06-02)
### Added
* **`--help` for all commands** — `dcr build --help`, `dcr run --help`, `dcr new --help`,
`dcr init --help`, `dcr clean --help`, `dcr add --help`, `dcr fmt --help`,
`dcr setup --help`, `dcr tree --help`, `dcr gen --help`, `dcr --update --help`,
`dcr test --help`. All output uses styled headers (green) and usage lines (cyan).
* **Man pages** — 12 troff pages in `man/man1/`: `dcr.1`, `dcr-build.1`,
`dcr-run.1`, `dcr-new.1`, `dcr-init.1`, `dcr-clean.1`, `dcr-add.1`, `dcr-test.1`,
`dcr-gen.1`, `dcr-fmt.1`, `dcr-tree.1`, `dcr-setup.1`.
* **Man pages in all packaging** — install.sh, install_bsd.sh, AUR PKGBUILD,
Debian (cargo-deb), RPM (cargo-generate-rpm), Nix (postInstall), Homebrew
(resource), Snap, GitHub Release assets.
* **Project name validation** — `dcr init` and `dcr new` now validate names before
creating files. Only ASCII letters, digits, `_` and `-` are allowed.
* **`documentation` and `homepage` fields** — added to `Cargo.toml`.
* **Release profile optimizations** — `opt-level = "z"`, LTO, `codegen-units = 1`,
`panic = "abort"`, `strip = true` for smaller binaries.
* **Linux i686, armv7, riscv64 targets** — added to release workflow and install scripts.
* **Linux musl i686, armv7 targets** — cross-compiled via zigbuild in CI.
* **AUR packages** — `dcr-dev`, `dcr-dev-bin` publishing workflow.
* **Snap publishing** — automated Snapcraft publishing in CI.
* **Snap badge** — in README.
### Changed
* **`validate_package_name` made public** — callable from CLI commands.
* **README platform table** — reorganized: libc variants as separate OS rows,
removed extra columns. Linux architecture list updated.
* **`gen.rs` no-args output** — now uses styled output instead of raw `eprintln!`.
* **`tree.rs`, `fmt.rs`, and `setup.rs`** — now accept arguments for `--help`.
* **README install commands** — `| bash` → `| sh` for POSIX compatibility.
### Fixed
* **`dcr new \<invalid-name>` creates directory then fails** — validation now
happens before any file operations.
* **`dcr init` on invalid directory name** — same fix.
* **Man pages missing in installed packages** — now shipped in all formats.
* **Windows drive letter false positive** — in dependency file parser.
* **CRLF (`\r\n`) breaks dependency parser** — now handles mixed line endings.
* **Newline after backslash not consumed** — in `parse_d_file` escape handling.
## 0.7.0 (2026-06-01)
### Added
* **OpenBSD and NetBSD target support** — full platform routing with dynamic target triples using `std::env::consts::ARCH` and `std::env::consts::OS`. Affects `build`, `run`, `clean` commands and the platform module.
* **`src/platform/bsd.rs`** — new BSD platform module (shared by FreeBSD, OpenBSD, NetBSD) providing `bin_path`, `lib_path`, `elf_path`, `efi_path`, `shared_lib_path`.
* **`build.out_dir` config option** — custom output directory that overrides the default `target/\<triple>/\<profile>` path for final artifacts. Supported in `build`, `run`, and config validation.
* **`dcr fmt` command** — new CLI command that formats all C/C++ source files (`*.c`, `*.cpp`, `*.h`, `*.hpp`) in `src/` and `tests/` using `clang-format`.
* **Incremental linking** — `needs_link()` in `common.rs` checks if any object file is newer than the linked output, skipping unnecessary relinking. Implemented for all backends (`unix_cc`, `msvc`, `gas`, `nasm`).
* **`build.kind = "none"` and `"custom"`** — two new project kinds for special build scenarios that don't produce standard artifacts.
* **`install_bsd.sh`** — POSIX-compliant installation script for BSD systems (FreeBSD, OpenBSD, NetBSD) with binary download and source build modes.
* **Linux ARM64 support in `install.sh`** — added `Linux:aarch64|Linux:arm64` target detection for pre-built binary downloads.
* **BSD OS detection in `install.sh`** — detects FreeBSD, OpenBSD, NetBSD and determines target triple.
* **`rust-toolchain.toml`** — explicit toolchain pinning to `stable` channel.
* **Integration tests** — `build_with_target_config` (verifies `build.target = "linux"`) and `build_with_out_dir` (validates custom output directory).
* **`get_build_string_with_profile` made `pub`** — so `run.rs` can determine custom output directory configuration.
### Changed
* **`build.target` semantics changed** — now strictly contains a target triple (e.g., `x86_64-unknown-linux-gnu`) or short name (`linux`, `macos`, `windows`). No longer used as custom output directory — this functionality moved to `build.out_dir`.
* **`build.standard` made optional** — changed from `String` to `Option\<String>`. Validation only enforces non-empty for non-ASM languages. Skipped in `dcr.toml` output if empty.
* **`dcr run` with `out_dir`** — now determines target directory respecting `build.out_dir` via `get_build_string_with_profile()` from `build.rs`.
* **`collect_sources()` returns empty vector** instead of error when no sources are found, allowing `kind = "none"` or `kind = "custom"` projects with no source files.
* **CI/CD release workflow refactored** — `git2` made target-specific (no vendored-openssl on Windows), Zig-based cross-compilation for non-x86_64 Linux targets, Arch Linux package version cleanup (dashes → dots), `gmake` symlink for NetBSD.
* **README compatibility table** — FreeBSD, OpenBSD, NetBSD build/run status upgraded from "community/best-effort" to "officially supported".
* **Documentation updated** — `build-section.md` describes new `build.target` and `build.out_dir` fields. `target-directory.md` rewritten to clarify the distinction.
### Fixed
* **stdout/stderr not inherited in `dcr run`** — child process output was captured and manually printed, breaking interactive programs. Fixed by switching to `Command::status()`.
* **Race condition in release CI** — matrix build jobs could upload assets to a release that didn't exist yet. Fixed by adding a dedicated `create-release` job.
* **Release GHA — stable toolchain override** — fixed Rust toolchain override issues in CI.
* **Arch Linux package version sanitization** — version strings with dashes (e.g., `0.7.0-dev`) are invalid for `pkgver`. Fixed by replacing dashes with dots.
* **GPG permissions after Docker** — Docker operations changed GPG directory ownership. Fixed by running `chown` after Docker commands.
* **RPM artifact paths** — RPM artifacts were placed in `rpm/x86_64/` instead of `fedora/x86_64/`. Fixed in Dexoron Packages Index workflow.
* **JSON parsing reliability in `install.sh`** — added `jq` as primary parser with `python3` fallback for dev channel release lookup.
### Removed
* **`format_roots()` helper function** — removed from `common.rs`. Was only used by the old error handling path in `collect_sources()`.
* **Per-distribution artifact download steps** — three separate `actions/download-artifact` steps replaced with unified `gh release download --clobber`.

View File

@@ -0,0 +1,42 @@
---
sidebar_label: Build commands (build, run, clean)
---
# Build Commands
## `dcr build`
Builds the project according to `dcr.toml`.
```bash
dcr build # debug profile
dcr build --release # release build
dcr build --debug # explicit debug
dcr build --target aarch64-unknown-linux-gnu
dcr build --force # full rebuild
dcr build --clean # clean + build
dcr build --verbose # show compilation commands
dcr build --workspace pkg-a # build specific workspace package
```
Artifacts: `target/\<triple>/\<profile>/\<binary-name>` (Linux with explicit target).
## `dcr run`
Builds (if sources are newer than artifacts) and runs the binary.
```bash
dcr run
dcr run --release
```
## `dcr clean`
Removes `target/` directory (or `target/\<target>/\<profile>`).
```bash
dcr clean
dcr clean --release # target/release/ only
dcr clean --target windows # target/x86_64-pc-windows-msvc/
dcr clean --all # clean all workspace packages
```

View File

@@ -0,0 +1,53 @@
---
sidebar_label: Dependency commands (add, tree)
---
# Dependency Commands
## `dcr add \<name> [source]`
Adds a dependency to `dcr.toml`.
```bash
dcr add fmt # registry lookup
dcr add mylib ../path/to/lib # path as source
dcr add mylib path:./lib # explicit path prefix
dcr add mylib git:https://github.com/user/repo # explicit git prefix
dcr add mylib github:user/repo # GitHub shorthand
dcr add mylib gitlab:user/repo # GitLab shorthand
```
Source prefixes:
* `path:` — local path
* `git:` — generic git URL
* `github:` — expands to `https://github.com/\<user>/\<repo>`
* `gitlab:` — expands to `https://gitlab.com/\<user>/\<repo>`
* `http://` / `https://` / `git@` — full URL
Flags:
* `--branch \<name>` — git branch
* `--tag \<name>` — git tag
* `--rev \<hash>` — git commit
If source is omitted — DCR searches connected registries.
## `dcr tree`
Displays the project dependency tree.
```bash
dcr tree
```
Example output:
```
my-app v0.1.0
├── fmt (registry)
│ └── spdlog (registry)
└── catch2 (registry)
```
For path dependencies, recursively shows their own dependencies (from their `dcr.toml`).

View File

@@ -0,0 +1,73 @@
---
sidebar_label: Gen commands (vscode, clion, ...)
---
# Gen Commands
## `dcr gen \<target>`
Generates IDE integration files.
### vscode
```bash
dcr gen vscode
```
Creates:
* `.vscode/tasks.json` — `build` task (dcr build)
* `.vscode/launch.json` — debug launch configuration
* `.vscode/settings.json` — C/C++ settings (clangd paths, includes)
* `.vscode/extensions.json` — recommended extensions (vscode-clangd, vscode-lldb)
### clion
```bash
dcr gen clion
```
Creates:
* `.idea/externalTools.xml` — external tools (build, run, clean, test)
* `.idea/customTargets.xml` — custom build targets
* `.idea/misc.xml` — C/C++ project settings
* `.idea/runConfigurations/\<name>.xml` — per-binary run configurations
### compile-commands
```bash
dcr gen compile-commands
```
Generates `compile_commands.json` — standard format for clangd, cpptools, static analyzers.
### project-info
```bash
dcr gen project-info
```
Outputs JSON array with project metadata:
```json
[
{
"name": "my-app",
"version": "0.1.0",
"root": "/path/to/project",
"profile": "debug",
"language": "c",
"standard": "c17",
"cxx_standard": null,
"compiler": "/usr/bin/clang",
"kind": "bin",
"sources": ["src/main.c"],
"include_dirs": ["src"],
"lib_dirs": [],
"libs": [],
"cflags": ["-std=c17", "-O0", "-g"],
"ldflags": []
}
]
```

View File

@@ -0,0 +1,31 @@
---
sidebar_label: Project commands (new, init)
---
# Project Commands
## `dcr new \<name>`
Creates a new project with a standard structure and `dcr.toml`. The `name` argument is required.
Only ASCII letters, digits, underscores `_` and hyphens `-` are allowed in the project name.
```bash
dcr new my-app
```
Generates:
* `dcr.toml` with basic fields
* `src/main.c` with a `main` template
## `dcr init`
Initializes a DCR project in the current (empty) directory.
```bash
mkdir app && cd app
dcr init
```
The project name is taken from the current directory name. The directory name must follow the same naming rules as `dcr new`.

View File

@@ -0,0 +1,60 @@
---
sidebar_label: Quality commands (test, fmt)
---
# Quality Commands
## `dcr test`
Runs tests.
```bash
dcr test # debug profile
dcr test --release # release profile
dcr test --debug # explicit debug
dcr test --help # detailed help
```
Before first use, initialize tests:
```bash
dcr test --init
```
This creates `tests/dcr_test.h` (framework) and `tests/test.c` (template).
What `dcr test` does:
1. Builds the project
2. Collects `tests/*.c` files (`.c` only, not `.cpp`)
3. Compiles and links each test file
4. Runs each test binary
5. Prints summary: TOTAL, PASS, SKIP, FAIL
6. Returns non-zero exit code on any FAIL
## `dcr fmt`
Formats C/C++ source files using `clang-format`.
```bash
dcr fmt
```
Processes: `src/**/*.{c,cpp,cxx,cc,h,hpp,hxx,hh}` and `tests/**/*.{c,cpp,cxx,cc,h,hpp,hxx,hh}`.
Uses `.clang-format` at the project root (if present), otherwise default clang-format style.
## `dcr lint`
Runs `clang-tidy` on C/C++ source files for static analysis.
```bash
dcr lint # show diagnostics
dcr lint --fix # apply fixes automatically
dcr lint --help # detailed help
```
Processes: `src/**/*.{c,cpp,cxx,cc}` and `tests/**/*.{c,cpp,cxx,cc}`.
Without `--fix`, clang-tidy reports warnings and errors without modifying files.
With `--fix`, clang-tidy applies automatic suggestions in place.

View File

@@ -0,0 +1,51 @@
---
sidebar_label: System commands (setup, --help, ...)
---
# System Commands
## `dcr setup`
Shows configured registries from `~/.dcr/config.toml`.
```bash
dcr setup
```
If `~/.dcr/config.toml` is not found, DCR returns an error. Create it manually:
```toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
```
## `dcr --help`
Shows help for all commands.
```bash
dcr --help
```
## `dcr --version`
Shows version and target triple.
```bash
dcr --version # dcr 0.7.0 (x86_64-unknown-linux-gnu)
```
## `dcr --update`
Self-update. Downloads the latest release binary from GitHub Releases and replaces the current one.
```bash
dcr --update
```
Features:
* Auto-detects platform and architecture
* Warns if installed via AUR (use package manager instead)
* Works on Linux, macOS, Windows

View File

@@ -0,0 +1,51 @@
---
sidebar_label: Contributing
---
# Contributing
## Setup
```bash
git clone https://github.com/dexoron/dcr
cd dcr
cargo build
```
## Code style
All code must be formatted with `cargo fmt`:
```bash
cargo fmt
```
## Linting
```bash
cargo clippy --all-targets -- -D warnings
```
## Tests
```bash
cargo test --all-targets
```
## PR process
1. Fork the repository
2. Create a branch: `git checkout -b feature/description`
3. Make changes
4. Run `cargo fmt && cargo clippy && cargo test`
5. Open a Pull Request
## CI
CI runs:
* `cargo fmt --check`
* `cargo clippy --all-targets -- -D warnings`
* `cargo test --all-targets`
* Build on Linux, macOS, Windows
* Integration tests

View File

@@ -0,0 +1,81 @@
---
sidebar_label: FAQ
---
# FAQ
## Registry not found
```
error: registry not found
```
**Solution:** Make sure `~/.dcr/config.toml` exists:
```toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
```
And check `DCR_INDEX_PATH`:
```bash
echo $DCR_INDEX_PATH
```
## Compiler not found
```
error: compiler not found
```
**Solution:** Ensure a compiler is installed and available in PATH.
```bash
which gcc
which clang
```
Or specify explicitly via `[toolchain]` in `dcr.toml`.
## openssl-sys build failed
When building DCR from source:
```
error: failed to run custom build command for openssl-sys
```
**Solution:** Install OpenSSL development headers:
```bash
# Ubuntu/Debian
sudo apt install libssl-dev
# Fedora
sudo dnf install openssl-devel
# macOS
brew install openssl
```
## Ctrl+C during build
DCR handles SIGINT: interrupts the current compilation and exits with non-zero code.
## How to create a library?
See [Library Recipe](/docs/recipes/library-project).
## How to cross-compile to Windows?
See [Cross-Compile Recipe](/docs/recipes/cross-to-windows).
## How to create a multi-package project?
See [Workspace Recipe](/docs/recipes/multi-package-workspace).
## Lock file
`dcr.lock` is created during builds (`dcr build`) when registry dependencies are present. To force an update — delete `dcr.lock` and run `dcr build`.

View File

@@ -0,0 +1,72 @@
---
sidebar_label: First steps
---
# First Steps
## Create a project
```bash
dcr new my-app
cd my-app
```
Structure:
```
my-app/
├── dcr.toml
└── src/
└── main.c
```
`dcr.toml`:
```toml
[package]
name = "my-app"
version = "0.1.0"
type = "none"
[build]
language = "c"
standard = "c11"
compiler = "clang"
kind = "bin"
```
## Build
```bash
dcr build
```
Output — `target/\<triple>/debug/my-app` (Linux) or `target/debug/my-app.exe` (Windows).
Build profiles:
```bash
dcr build --release # release build
dcr build --debug # debug (default)
```
## Run
```bash
dcr run
```
Builds (if needed) and runs the binary.
## First test
```bash
dcr test --init # create test template
dcr test # run tests
```
## Formatting
```bash
dcr fmt # clang-format with .clang-format
```

View File

@@ -0,0 +1,109 @@
---
sidebar_label: Installation
---
# Installation
## Linux (Dexoron Packages)
Configure your package manager at https://pkg.dexoron.su and install:
**Arch Linux**
```sh
sudo pacman -Sy dcr
```
**Debian/Ubuntu**
```sh
sudo apt update && sudo apt install dcr
```
**Fedora/RHEL**
```sh
sudo dnf install dcr
```
## Arch Linux (AUR)
```sh
yay -S dcr
```
## macOS / Linux (Homebrew)
```sh
brew tap dexoron/dexoron
brew install dcr
```
## Snap (Linux)
```sh
sudo snap install dcrup
```
## Nix (flake)
```sh
nix run github:dexoron/dcr
# or install to profile:
nix profile install github:dexoron/dcr
```
## Cargo (crates.io)
```sh
cargo install dcr
```
## Linux / macOS (script)
```sh
curl -fsSL https://dcr.dexoron.su/install.sh | sh
```
## BSD (script)
```sh
curl -fsSL https://dcr.dexoron.su/install_bsd.sh | sh
```
## Windows (PowerShell)
```powershell
irm https://dcr.dexoron.su/install.ps1 | iex
```
## From source
```sh
git clone https://github.com/dexoron/dcr.git
cd dcr && cargo build --release
ln -sf "$PWD/target/release/dcr" ~/.local/bin/dcr
```
## Post-install
Verify the installation:
```bash
dcr --version
```
Man pages are available after installation:
```bash
man dcr
man dcr-build
```
To use the registry, create `~/.dcr/config.toml`:
```toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
```

View File

@@ -0,0 +1,51 @@
---
sidebar_label: IDE Integration
---
# IDE Integration
## VS Code
```bash
dcr gen vscode
```
Generates in `.vscode/`:
| File | Purpose |
| ----------------- | -------------------------------------------- |
| `tasks.json` | `build` task (dcr build) |
| `launch.json` | Debug launch configuration |
| `settings.json` | clangd/IntelliSense: include paths, standard |
| `extensions.json` | Recommends vscode-clangd, vscode-lldb |
## CLion
```bash
dcr gen clion
```
Generates in `.idea/`:
| File | Purpose |
| ------------------------------------------------ | ----------------------------------------- |
| `externalTools.xml` | Build, Run, Clean, Test as external tools |
| `customTargets.xml` | Custom build targets |
| `misc.xml` | C/C++ project settings |
| `runConfigurations/\<name>.xml` | Per-binary run configurations |
## compile_commands.json
```bash
dcr gen compile-commands
```
Generates `compile_commands.json` at project root. Standard format for clangd, C/C++ IntelliSense, static analyzers.
## project-info
```bash
dcr gen project-info
```
Outputs JSON array with project metadata (see [gen-commands](/docs/commands/gen-commands)).

View File

@@ -0,0 +1,46 @@
---
sidebar_label: License
---
# License
## DCR
DCR itself is [GPL-3.0-or-later](https://spdx.org/licenses/GPL-3.0-or-later.html) licensed.
> **Note:** DCR is a build tool, not a library. The GPL applies only to DCR's own source code. Projects built with DCR are not subject to DCR's license — their licensing is determined solely by their own code and dependencies.
## Vendored libraries
DCR statically links the following C libraries through its vendored Rust dependencies:
| Library | License | Bundled by |
| ------------------------------------------ | ------------------ | ----------------------------- |
| [libgit2](https://libgit2.org) | MIT OR Apache-2.0 | `git2` / `libgit2-sys` |
| [libssh2](https://libssh2.org) | MIT OR Apache-2.0 | `libgit2-sys` |
| [zlib](https://zlib.net) | MIT OR Apache-2.0 | `libgit2-sys` |
| [OpenSSL](https://openssl.org) | Apache-2.0 | `openssl-sys` / `openssl-src` |
| [ring](https://github.com/briansmith/ring) | Apache-2.0 AND ISC | `rustls` |
## Rust dependencies
DCR is written in Rust. The following notable Rust crates are statically linked:
| Crate | License |
| --------------------------------------------- | ------------------------ |
| [`reqwest`](https://crates.io/crates/reqwest) | MIT OR Apache-2.0 |
| [`rustls`](https://crates.io/crates/rustls) | Apache-2.0 OR ISC OR MIT |
| [`serde`](https://crates.io/crates/serde) | MIT OR Apache-2.0 |
| [`toml`](https://crates.io/crates/toml) | MIT OR Apache-2.0 |
| [`sha2`](https://crates.io/crates/sha2) | MIT OR Apache-2.0 |
| [`git2`](https://crates.io/crates/git2) | MIT OR Apache-2.0 |
| [`openssl`](https://crates.io/crates/openssl) | Apache-2.0 |
| [`tokio`](https://crates.io/crates/tokio) | MIT |
| [`hyper`](https://crates.io/crates/hyper) | MIT |
| [`ctrlc`](https://crates.io/crates/ctrlc) | MIT OR Apache-2.0 |
Full dependency tree (143 packages) is available in [`Cargo.lock`](https://github.com/dexoron/dcr/blob/main/Cargo.lock). The overwhelming majority are dual-licensed under MIT OR Apache-2.0.
## Additional credits
* DCR's CLI design and project model are inspired by [Cargo](https://doc.rust-lang.org/cargo/).

View File

@@ -0,0 +1,49 @@
---
sidebar_label: Cross-compile to Windows
---
# Cross-Compile to Windows from Linux
Building a Windows binary on Linux using mingw-w64.
## Install toolchain
```bash
# Ubuntu/Debian
sudo apt install mingw-w64
# Fedora
sudo dnf install mingw64-gcc mingw64-binutils
```
## Configuration
```toml
[package]
name = "my-app"
version = "0.1.0"
type = "none"
[build]
language = "c"
standard = "c11"
compiler = "clang"
kind = "bin"
target = "x86_64-pc-windows-gnu" # explicit mingw, not msvc
```
## Build
```bash
dcr build --target x86_64-pc-windows-gnu --release
```
Artifact: `target/x86_64-pc-windows-gnu/release/my-app.exe`.
## Custom toolchain
```toml
[toolchain]
cc = "x86_64-w64-mingw32-gcc"
cxx = "x86_64-w64-mingw32-g++"
```

View File

@@ -0,0 +1,70 @@
---
sidebar_label: Library project
---
# Library Project
Creating a static library and using it in another project.
## Step 1: Create the library
```bash
dcr new my-lib
cd my-lib
```
`dcr.toml`:
```toml
[package]
name = "my-lib"
version = "0.1.0"
type = "none"
[build]
language = "c"
standard = "c11"
kind = "staticlib"
```
`src/my_lib.h`:
```c
#ifndef MY_LIB_H
#define MY_LIB_H
int add(int a, int b);
#endif
```
`src/my_lib.c`:
```c
#include "my_lib.h"
int add(int a, int b) { return a + b; }
```
## Step 2: Build
```bash
dcr build --release
```
Artifacts:
* `target/\<triple>/release/libmy-lib.a` (Linux)
* `target/release/my-lib.lib` (Windows)
* `target/include/` — header files
## Step 3: Use in another project
```bash
dcr new my-app
cd my-app
dcr add my-lib ../my-lib
```
Automatically:
* Adds include path to `target/include/` of the library
* Adds lib path to `target/\<triple>/release/`
* Links `libmy-lib.a` / `my-lib.lib`

View File

@@ -0,0 +1,102 @@
---
sidebar_label: Multi-package workspace
---
# Multi-Package Workspace
A project with three packages: two libraries and a binary.
## Structure
```
workspace/
├── dcr.toml # root workspace
├── lib-core/
│ ├── dcr.toml
│ └── src/core.c
├── lib-utils/
│ ├── dcr.toml
│ └── src/utils.c
└── app/
├── dcr.toml
└── src/main.c
```
## Root dcr.toml
```toml
[package]
name = "my-workspace"
version = "0.1.0"
type = "none"
[build]
inherit = true
language = "c"
standard = "c11"
[workspace.lib-core]
path = "lib-core"
[workspace.lib-utils]
path = "lib-utils"
deps = ["lib-core"]
[workspace.app]
path = "app"
deps = ["lib-core", "lib-utils"]
main = true
```
## Packages
`lib-core/dcr.toml`:
```toml
[package]
name = "lib-core"
version = "0.1.0"
type = "none"
[build]
kind = "staticlib"
```
`lib-utils/dcr.toml`:
```toml
[package]
name = "lib-utils"
version = "0.1.0"
type = "none"
[build]
kind = "staticlib"
```
`app/dcr.toml`:
```toml
[package]
name = "app"
version = "0.1.0"
type = "none"
[build]
kind = "bin"
```
## Build
```bash
cd workspace
dcr build # builds everything in correct order
dcr build --workspace app # only app (lib-core and lib-utils built as deps)
dcr run # builds and runs main package
```
Build order (topological sort):
1. `lib-core`
2. `lib-utils` (depends on lib-core)
3. `app` (depends on lib-core, lib-utils)

View File

@@ -0,0 +1,82 @@
---
sidebar_label: Build profiles
---
# Build Profiles
Profiles allow overriding `[build]` fields for specific build modes.
## Configuration
```toml
[build]
language = "c"
standard = "c17"
cflags = ["-Wall"]
[build.debug]
cflags = ["-O0", "-g"]
[build.release]
cflags = ["-O3", "-DNDEBUG"]
```
## Merge rules
Fields from `[build.\<profile>]` are merged on top of `[build]`:
* **Scalar fields** (strings, numbers, bools) — replaced
* **Arrays** (`cflags`, `ldflags`, ...) — **appended** (extend the `[build]` array)
Set `inherit = false` to disable array inheritance (only profile's own arrays are used).
## Built-in profiles
The default flags for each profile are composed from three config fields:
| Field | debug default | release default |
| ----------- | ------------------ | --------------- |
| `opt_level` | `"0"` | `"3"` |
| `debug` | `true` | `false` |
| `warnings` | `["all", "extra"]` | `[]` |
Which produce the equivalent compiler flags:
| Profile | Effective flags |
| --------- | ---------------------------------------------------------- |
| `debug` | `-O0 -g -Wall -Wextra -fno-omit-frame-pointer -DDCR_DEBUG` |
| `release` | `-O3 -DNDEBUG` |
Additional build options can be toggled per-profile:
```toml
[build.release]
opt_level = "z"
lto = true
strip = true
panic = "abort"
codegen-units = "1"
[build.debug]
opt_level = "1"
debug = false
warnings = ["all", "error"]
```
## Target-specific profiles
```toml
[build.linux]
cflags = ["-DLINUX"]
[build.windows.debug]
cflags = ["-DWIN32", "-O0", "-g"]
```
Application order (highest priority first):
1. `[build.\<target>.\<profile>]`
2. `[build.\<profile>.\<target>]`
3. `[build.\<target>]`
4. `[build.\<profile>]`
5. `[build]`

View File

@@ -0,0 +1,131 @@
---
sidebar_label: Build system
---
# Build System
## Compiler Backends
DCR supports 7 compilation backends. Selection is automatic based on file extension and `build.compiler` value.
| Backend | Files | When used |
| --------- | --------------------------------- | ------------------------------------- |
| `unix_cc` | `.c`, `.cpp`, `.cxx`, `.cc`, `.S` | gcc/clang on Linux/macOS/BSD |
| `msvc` | `.c`, `.cpp`, `.cxx`, `.cc` | Windows (cl, clang-cl) |
| `gas` | `.s` | ARM/ARM64 assembler (no preprocessor) |
| `nasm` | `.asm`, `.s` | x86/x86_64 NASM assembler |
| `masm` | `.asm` | MASM (ml/ml64) on Windows |
| `fasm` | `.asm`, `.fasm` | Flat Assembler |
| `llvm_ir` | `.ll` | LLVM IR via `llc -filetype=obj` |
## Qt Support
DCR provides native Qt support for automatic meta-object handling (MOC, UIC, RCC).
Enable it by setting `build.qt = true` in `dcr.toml`. DCR will automatically detect Qt-related files (`.ui`, `.qrc`, `.h` with `Q_OBJECT`) and process them.
```toml
[build]
qt = true
```
*Note: Requires `qt6` modules (Core, Widgets, Gui, Svg) installed via `pkg-config`.*
Advanced customization is still possible via `build.steps` if special handling is needed:
```toml
[build.steps]
moc = "moc {in} -o {out}"
```
### Unix CC
* Compiler resolved via `resolve_compiler()`: `DCR_COMPILER` > `DCR_CC` > `[toolchain]` > `build.compiler` > `PATH`
* Supports `.d` files for header dependency tracking
* Flags: `-std=`, `-MMD -MF`, `-c -o`, `-I`, `-L`, `-l`
* Conditional flags based on config:
* `freestanding` or bare-metal target: `-ffreestanding` (compile), `-nostdlib -static` (link)
* `lto`: `-flto` (compile + link)
* `panic = "abort"`: `-fno-exceptions` (C++ only), `-fno-unwind-tables`, `-fno-asynchronous-unwind-tables`
### MSVC
* Supports cl.exe and clang-cl.exe
* Flags: `/std:`, `/Fo:`, `/Fe:`, `/I`, `/link`
### GAS / NASM / MASM / FASM / LLVM-IR
* GAS: `-I`, `-c -o`, `--defsym`
* NASM: `-I`, `-o`, `-D`, `-f` (format: win64/elf64/macho64/macho32/elf32)
* MASM: `/nologo /c /Fo\<obj> <source>`
* FASM: `<source> \<output>` (output path is the object file)
* LLVM IR: `-filetype=obj <source> -o \<output>`
## Incremental Builds
Three levels of incrementality:
1. **mtime** — if output is newer than all inputs, skip
2. **`.d` files** — header change tracking (including transitive)
3. **SHA256 fingerprint** — recompile if compiler flags changed (stored in `.dcr_fingerprint`)
## Parallel Compilation
* `thread::scope` for thread pool
* Atomic task queue (`AtomicU64`)
* Mutex on stdout (`OUTPUT_MUTEX`)
* Thread count = `available_parallelism()`, capped by `build.codegen-units` if set
## Build Kinds
| Kind | Type | Path (Linux example) |
| ----------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `bin` | Executable | `target/\<triple>/\<profile>/\<name>` (.exe on Windows) |
| `staticlib` | Static library | `target/\<triple>/\<profile>/lib\<name>.a` (.lib) |
| `sharedlib` | Dynamic library | `target/\<triple>/\<profile>/lib\<name>.so` (.dll/.dylib) |
| `efi` | UEFI application | `target/\<triple>/\<profile>/\<name>.efi` |
| `elf` | ELF without stdlib | `target/\<triple>/\<profile>/\<name>` |
| `none` | Compile only, no link | — |
| `custom` | Full filename+extension control | `target/\<triple>/\<profile>/\<filename>.\<extension>` |
## Build Steps
DCR supports pre-build and post-build steps:
* `build.steps` — commands before compilation
* `build.post_steps` — commands after compilation
Substitutions: `{stem}`, `{in}`, `{out}`, `{profile}`, `{version}`, `{name}`.
Example Qt codegen via build steps:
```toml
[build.steps]
moc = "moc {in} -o {out}"
```
## pkg-config
Automatic lookup (read from raw config):
```toml
[build]
pkg_config = ["sdl2", "gl"]
```
DCR runs `pkg-config --cflags sdl2 gl` and `pkg-config --libs sdl2 gl` and adds results to compiler/linker flags.
## Variable Substitution
Supported variables:
| Variable | Description |
| ----------------------- | ---------------------------- |
| `{version}` | Package version |
| `{version_major}` | Major version part |
| `{version_minor}` | Minor version part |
| `{version_patch}` | Patch version |
| `{version_suffix}` | Suffix (e.g., `-rc1`) |
| `{version_suffix_dash}` | Suffix with dash |
| `{profile}` | Profile name (debug/release) |
| `{name}` | Package name |

View File

@@ -0,0 +1,70 @@
---
sidebar_label: Cross-compilation
---
# Cross-Compilation
## Short Names
DCR supports short platform names:
| Short Name | Full Triple |
| ---------- | -------------------------- |
| `linux` | `x86_64-unknown-linux-gnu` |
| `macos` | `x86_64-apple-darwin` |
| `windows` | `x86_64-pc-windows-msvc` |
```bash
dcr build --target windows
```
## Full Triples
```bash
dcr build --target aarch64-unknown-linux-gnu
dcr build --target x86_64-pc-windows-gnu # mingw
dcr build --target armv7-unknown-linux-gnueabihf
```
## clang --target
When using clang, DCR injects `--target=\<triple>` into CFLAGS.
```toml
[build]
compiler = "clang"
target = "aarch64-unknown-linux-gnu"
# Auto: cflags += ["--target=aarch64-unknown-linux-gnu"]
```
## Bare-Metal / Freestanding
For targets containing `none`, `-elf`, `eabi`, or `baremetal`, DCR automatically:
1. **Disables default flags** — no system include paths, no `-l` libc
2. **Injects `-ffreestanding`** at compile time and `-nostdlib -static` at link time
You can also enable freestanding mode explicitly:
```toml
[build]
freestanding = true
```
```bash
dcr build --target aarch64-none-elf
```
## Target Directory
On Linux with explicit target:
```
target/<triple>/<profile>/
```
On macOS/Windows or without target:
```
target/<profile>/
```

View File

@@ -0,0 +1,152 @@
---
sidebar_label: dcr.toml overview
---
# dcr.toml
Main project configuration file. Located at the project root.
## Structure
```toml
[package]
# required fields
[build]
# build settings
[build.debug] # optional: debug override
[build.release] # optional: release override
[build.linux] # optional: Linux override
[build.windows] # optional: Windows override
[build.windows.debug] # target + profile combination
[toolchain]
# compiler/linker paths
[dependencies]
# project dependencies
[workspace]
# multi-package configuration
[run]
# run settings
```
## [package]
| Field | Required | Description |
| --------- | -------- | ----------------------- |
| `name` | yes | Project name |
| `version` | yes | Semantic version |
| `type` | yes | `app`, `lib`, `none` |
| `license` | no | SPDX license identifier |
| `author` | no | Author |
```toml
[package]
name = "my-app"
version = "0.1.0"
type = "app"
license = "MIT"
author = "John Doe"
```
## [build]
...
* `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`.
| Field | Default | Description |
| ---------------- | ------------------------------------------- | --------------------------------------------------------------------- |
| `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` |
| `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) |
| `cxx_standard` | `"c++20"` | C++ standard (`c++17`, `c++20`, `c++23`) |
| `compiler` | `"clang"` | Preferred compiler |
| `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` |
| `target` | host | Target triple for cross-compilation |
| `platform` | `"native"` | `native`, `efi` |
| `cflags` | `[]` | Additional C/C++/ASM flags |
| `ldflags` | `[]` | Additional linker flags |
| `filename` | `""` | Custom output file name |
| `extension` | `""` | Custom file extension |
| `roots` | `["src"]` | Source root directories |
| `exclude` | `[]` | Exclude patterns |
| `include` | `[]` | Additional include directories |
| `src_disable` | `false` | Disable auto source discovery |
| `inherit` | `false` | Inherit build from workspace root |
| `clean` | `[]` | Glob patterns for custom clean paths |
| `out_dir` | `""` | Custom output directory |
| `workspace_only` | `false` | Workspace-only, not built standalone |
| `freestanding` | `false` | Compile in freestanding mode (`-ffreestanding` + `-nostdlib -static`) |
| `opt_level` | `"0"` (debug) / `"3"` (release) | Optimization level: `0`-`3`, `"s"`, `"z"` |
| `debug` | `true` (debug) / `false` (release) | Emit debug symbols (`-g`) |
| `lto` | `false` | Link-time optimization (`-flto` for both compiler and linker) |
| `strip` | `false` | Strip symbols from output (`-s` in ldflags) |
| `warnings` | `["all", "extra"]` (debug) / `[]` (release) | Warning flags (e.g. `"all"`, `"extra"`, `"pedantic"`) |
| `panic` | `""` | Panic strategy: `"abort"` disables exceptions and unwind tables |
| `codegen-units` | `""` | Max parallel compilation jobs (`"0"` = auto) |
| `qt` | `false` | Enable automatic Qt meta-object handling (MOC, UIC, RCC) |
Settings from raw config (not in typed struct):
* `pkg_config` — list of pkg-config packages
* `ldscript` — linker script path
* `build.steps` / `build.post_steps` — codegen steps
Example:
```toml
[build]
language = "c++"
standard = "c23"
cxx_standard = "c++23"
compiler = "clang"
kind = "sharedlib"
cflags = ["-Wall", "-Wextra"]
opt_level = "z"
lto = true
strip = true
panic = "abort"
codegen-units = "2"
```
## [toolchain]
```toml
[toolchain]
cc = "/usr/bin/clang"
cxx = "/usr/bin/clang++"
as = "/usr/bin/as"
ar = "/usr/bin/ar"
ld = "/usr/bin/ld.lld"
```
Raw config also supports `uic`, `moc`, `rcc` for Qt codegen.
## [dependencies]
See [dependencies](/docs/reference/dependencies).
## [run]
```toml
[run]
cmd = "./target/{profile}/{name}"
```
Substitutions:
* `{version}` — package version
* `{version_major}`, `{version_minor}`, `{version_patch}`, `{version_suffix}`, `{version_suffix_dash}` — version parts
* `{profile}` — debug / release
* `{name}` — package name
Default `cmd` = `./target/{profile}/{name}` (macOS/Windows) or `./target/\<triple>/\<profile>/\<name>` (Linux).
## [workspace]
See [workspaces](/docs/reference/workspaces).

View File

@@ -0,0 +1,84 @@
---
sidebar_label: Dependencies
---
# Dependencies
## Formats
The `[dependencies]` section supports three formats:
### String (registry)
```toml
[dependencies]
fmt = "10.1.1"
spdlog = "1.12"
catch2 = "3.4.0"
```
The version string is used as-is for registry lookup.
### Table (git)
```toml
[dependencies]
fmt = { git = "https://github.com/fmtlib/fmt", tag = "10.1.1" }
```
Fields: `git`, `branch`, `tag`, `rev`.
### Table (path)
```toml
[dependencies]
mylib = { path = "../mylib" }
```
## Registry
DCR uses a package registry for dependency lookup by name.
```toml
# ~/.dcr/config.toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
```
Registry priority: order in `config.toml`. The `DCR_INDEX_PATH` variable overrides the path to `index.json`.
## Git dependencies
DCR clones git repositories via `git2`:
* `branch` — switch to a branch
* `tag` — switch to a tag
* `rev` — switch to a specific commit
* `features` — feature flags (parsed, but does not affect build)
Cache path: `~/.dcr/git/\<hash>/`.
## Path dependencies
Local paths. DCR automatically discovers include and lib directories from the neighbor's `dcr.toml`.
```toml
[dependencies]
mylib = { path = "/abs/path/to/lib" }
mylib = { path = "../relative/path" }
```
## dcr.lock
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`.
## Resolution process
1. Load all dependencies (registry → git → path)
2. For path deps: recursively read their `dcr.toml`
3. For registry deps: search `index.json`
4. For git deps: clone to cache
5. Collect `include_dirs`, `lib_dirs`, `libs` for the compiler

View File

@@ -0,0 +1,60 @@
---
sidebar_label: Environment variables
---
# Environment Variables
## DCR_COMPILER
Overrides the compiler for all languages. **Highest priority.**
```bash
export DCR_COMPILER=clang
dcr build
```
Compiler resolution priority:
1. `DCR_COMPILER` (env)
2. `DCR_CC` / `DCR_CXX` / `DCR_AS` (env)
3. `[toolchain]` (dcr.toml)
4. `build.compiler` (dcr.toml)
5. `PATH`
## DCR_CC / DCR_CXX / DCR_AS
Per-language override (lower priority than `DCR_COMPILER`, higher than `[toolchain]`).
```bash
export DCR_CC=gcc-14
export DCR_CXX=g++-14
export DCR_AS=arm-linux-gnueabihf-as
```
## DCR_LD / DCR_AR
Override linker and archiver.
```bash
export DCR_LD=ld.lld
export DCR_AR=llvm-ar
```
## DCR_DEBUG
Enables debug mode — prints all compilation commands to stderr before execution.
```bash
export DCR_DEBUG=1
dcr build
```
## DCR_INDEX_PATH
Overrides the path to the registry `index.json`.
```bash
export DCR_INDEX_PATH=/custom/path/index.json
```
Default: `~/.dcr/index.json`.

View File

@@ -0,0 +1,51 @@
---
sidebar_label: Platform support
---
# Platform Support
## Target Triples
DCR normalizes target triples. Short platform names are expanded to full triples.
### Linux
```
target/<arch>-unknown-linux-gnu/<profile>/
```
Architectures: `x86_64`, `aarch64` (host-detected).
Artifact type: ELF. Extensions: `.so` (sharedlib), `.a` (staticlib).
### macOS
```
target/<profile>/
```
Architectures: `x86_64`, `aarch64` (host-detected).
Extensions: `.dylib` (sharedlib), `.a` (staticlib).
### Windows
```
target/<profile>/
```
Architectures: `x86_64`, `aarch64`.
Extensions: `.exe` (bin), `.lib` (staticlib), `.dll` (sharedlib), `.efi` (UEFI).
### BSD
```
target/<arch>-unknown-<os>/<profile>/
```
Supported systems: `freebsd`, `openbsd`, `netbsd`, `dragonfly`.
## Host Detection
DCR uses `std::env::consts::ARCH` and `std::env::consts::OS` for host platform detection. Used as fallback when `target` is not specified.

View File

@@ -0,0 +1,67 @@
---
sidebar_label: Workspaces
---
# Workspaces
Workspaces allow managing multiple packages in a single repository.
## Configuration
```toml
[workspace.lib-core]
path = "lib-core"
[workspace.lib-utils]
path = "lib-utils"
deps = ["lib-core"]
[workspace.app]
path = "app"
deps = ["lib-core", "lib-utils"]
main = true
```
### Member fields
| Field | Description |
| ------ | ------------------------------------------------ |
| `path` | Path to the package (relative to workspace root) |
| `deps` | Dependencies on other members |
| `main` | Mark as the main package |
## Topological sort
DCR automatically sorts packages by dependencies: package A is built before B if B depends on A.
Cyclic dependencies are detected and cause an error.
## Build
```bash
dcr build # build all packages in dependency order
dcr build --workspace app # build only app (dependencies built automatically)
```
When building a workspace, member outputs (libraries) are automatically added to include/lib paths of dependent packages.
## Clean
```bash
dcr clean # clean only root target/
dcr clean --all # clean target/ of all packages
```
## Inheritance
If a member has `inherit = true` in its `[build]` section, fields from the root `[build]` are merged into the member:
```toml
# root dcr.toml
[build]
inherit = true
language = "c"
standard = "c17"
# member inherits language and standard
```

View File

@@ -0,0 +1,46 @@
---
sidebar_label: Self Update
---
# Self Update
## dcr --update
Automatic update to the latest version. Downloads a binary (not an archive) from GitHub Releases and replaces the current executable.
```bash
dcr --update
```
## How it works
1. DCR detects the current platform and architecture
2. Fetches the latest release from `api.github.com/repos/dexoron/dcr/releases/latest`
3. Compares versions
4. Downloads the matching asset (direct binary URL, not archive)
5. Replaces the current executable via `self_replace`
## Asset naming
Pattern: `dcr-\<triple>` or `dcr-\<triple>.exe`
| Platform | Asset name |
| -------------- | -------------------------------- |
| Linux x86_64 | `dcr-x86_64-unknown-linux-gnu` |
| macOS x86_64 | `dcr-x86_64-apple-darwin` |
| macOS ARM64 | `dcr-aarch64-apple-darwin` |
| Windows x86_64 | `dcr-x86_64-pc-windows-msvc.exe` |
## AUR
If DCR was installed via AUR, `--update` shows a warning:
```
Update via package manager: yay/paru -Syu {package_name} or sudo pacman -Syu {package_name}
```
## Errors
* Cannot detect platform — error
* Cannot fetch release — error with URL
* No write permission — error (use `sudo` or manual install)

View File

@@ -0,0 +1,45 @@
---
sidebar_label: Running tests
---
# Running Tests
## Execution
```bash
dcr test
```
Builds the project, then compiles and runs test files from `tests/`.
## Profiles
```bash
dcr test # debug (default)
dcr test --release # release
dcr test --debug # explicit debug
```
## Output
```
=====================
Testsuite summary
=====================
TOTAL: 5
PASS: 3
SKIP: 1
FAIL: 1
=====================
```
## Exit code
* 0 — all tests passed (FAIL = 0)
* 1 — test failures or build error
## What gets built
* All `.c` files from `tests/` (`.cpp` not supported)
* Include path: `tests/` (for `dcr_test.h`)
* Linked with project if `package.type = "lib"` or `kind = "staticlib"`/`"sharedlib"`

View File

@@ -0,0 +1,69 @@
---
sidebar_label: Test framework (EXPECT, TEST, ...)
---
# Test Framework
DCR has a built-in minimal test framework for C.
## Macros
### `EXPECT(expr)`
Asserts that an expression is true.
```c
EXPECT(1 + 1 == 2);
EXPECT(ptr != NULL);
```
### `SKIP(reason)`
Skips a test with a message.
```c
SKIP("not implemented on Windows");
```
### `TEST(name)`
Defines a test.
```c
TEST(addition) {
EXPECT(1 + 1 == 2);
EXPECT(2 + 2 == 4);
}
```
### `TEST_CASE(name)`
Registers a test case.
```c
TEST_CASE(math) {
EXPECT(1 + 1 == 2);
}
```
## Initialization
```bash
dcr test --init
```
Creates:
* `tests/dcr_test.h` — framework header (do not edit)
* `tests/test.c` — template with example test
## Structure
```
tests/
├── dcr_test.h # framework (do not edit)
├── test.c # main tests
└── ... # additional .c test files
```
Only `.c` files are compiled (`.cpp` is not supported).

View File

@@ -0,0 +1,63 @@
---
sidebar_label: Introduction
---
# DCR — C/C++ Build Tool & Package Manager
<details>
<summary>Quick reference</summary>
```bash
# Installation
curl -fsSL https://dcr.dexoron.su/install.sh | sh
# Create a project
dcr new my-app
cd my-app
# Build and run
dcr build
dcr run
# Run tests
dcr test
# Add a dependency
dcr add fmt
# Generate IDE files
dcr gen vscode
```
</details>
## Contents
| Section | Description |
| ----------------------------------------------------- | --------------------------------------------- |
| [Getting Started](/docs/getting-started/installation) | Installation and first steps |
| [Commands](/docs/commands/project-commands) | All CLI commands |
| [Reference](/docs/reference/dcr-toml) | Configuration, build, dependencies, platforms |
| [Testing](/docs/testing/test-framework) | Built-in test framework |
| [Recipes](/docs/recipes/cross-to-windows) | Common scenarios |
| [IDE Integration](/docs/ide-integration) | VS Code, CLion, compile_commands.json |
| [Self Update](/docs/self-update) | Auto-update |
| [FAQ](/docs/faq) | Frequently asked questions |
| [Changelog](/docs/changelog) | Version history |
| [License](/docs/license) | DCR and vendored library licenses |
| [Contributing](/docs/contributing) | DCR development |
## Features
* **Incremental builds** — mtime + `.d` headers + SHA256 fingerprint
* **Parallel compilation** — thread::scope, atomic task queue
* **4 backends** — gcc/clang, MSVC/clang-cl, GAS (ARM), NASM (x86)
* **7 project kinds** — bin, staticlib, sharedlib, efi, elf, none, custom
* **Cross-compilation** — short names and full triples
* **Profiles** — debug / release with field overrides
* **Workspaces** — multi-package projects with topological sort
* **Registry + Git + Path** — three dependency mechanisms
* **IDE generation** — VS Code, CLion, compile_commands.json, JSON metadata
* **pkg-config** — automatic system library discovery
* **Per-command `--help`** — `dcr build --help`, `dcr new --help`, etc.
* **Man pages** — `man dcr`, `man dcr-build`, `man dcr-new`

View File

@@ -0,0 +1,91 @@
---
sidebar_label: Changelog
---
# Changelog
## 0.7.1 (2026-06-02)
### Added
* **`--help` for all commands** — `dcr build --help`, `dcr run --help`, `dcr new --help`,
`dcr init --help`, `dcr clean --help`, `dcr add --help`, `dcr fmt --help`,
`dcr setup --help`, `dcr tree --help`, `dcr gen --help`, `dcr --update --help`,
`dcr test --help`. All output uses styled headers (green) and usage lines (cyan).
* **Man pages** — 12 troff pages in `man/man1/`: `dcr.1`, `dcr-build.1`,
`dcr-run.1`, `dcr-new.1`, `dcr-init.1`, `dcr-clean.1`, `dcr-add.1`, `dcr-test.1`,
`dcr-gen.1`, `dcr-fmt.1`, `dcr-tree.1`, `dcr-setup.1`.
* **Man pages in all packaging** — install.sh, install_bsd.sh, AUR PKGBUILD,
Debian (cargo-deb), RPM (cargo-generate-rpm), Nix (postInstall), Homebrew
(resource), Snap, GitHub Release assets.
* **Project name validation** — `dcr init` and `dcr new` now validate names before
creating files. Only ASCII letters, digits, `_` and `-` are allowed.
* **`documentation` and `homepage` fields** — added to `Cargo.toml`.
* **Release profile optimizations** — `opt-level = "z"`, LTO, `codegen-units = 1`,
`panic = "abort"`, `strip = true` for smaller binaries.
* **Linux i686, armv7, riscv64 targets** — added to release workflow and install scripts.
* **Linux musl i686, armv7 targets** — cross-compiled via zigbuild in CI.
* **AUR packages** — `dcr-dev`, `dcr-dev-bin` publishing workflow.
* **Snap publishing** — automated Snapcraft publishing in CI.
* **Snap badge** — in README.
### Changed
* **`validate_package_name` made public** — callable from CLI commands.
* **README platform table** — reorganized: libc variants as separate OS rows,
removed extra columns. Linux architecture list updated.
* **`gen.rs` no-args output** — now uses styled output instead of raw `eprintln!`.
* **`tree.rs`, `fmt.rs`, and `setup.rs`** — now accept arguments for `--help`.
* **README install commands** — `| bash` → `| sh` for POSIX compatibility.
### Fixed
* **`dcr new \<invalid-name>` creates directory then fails** — validation now
happens before any file operations.
* **`dcr init` on invalid directory name** — same fix.
* **Man pages missing in installed packages** — now shipped in all formats.
* **Windows drive letter false positive** — in dependency file parser.
* **CRLF (`\r\n`) breaks dependency parser** — now handles mixed line endings.
* **Newline after backslash not consumed** — in `parse_d_file` escape handling.
## 0.7.0 (2026-06-01)
### Added
* **OpenBSD and NetBSD target support** — full platform routing with dynamic target triples using `std::env::consts::ARCH` and `std::env::consts::OS`. Affects `build`, `run`, `clean` commands and the platform module.
* **`src/platform/bsd.rs`** — new BSD platform module (shared by FreeBSD, OpenBSD, NetBSD) providing `bin_path`, `lib_path`, `elf_path`, `efi_path`, `shared_lib_path`.
* **`build.out_dir` config option** — custom output directory that overrides the default `target/\<triple>/\<profile>` path for final artifacts. Supported in `build`, `run`, and config validation.
* **`dcr fmt` command** — new CLI command that formats all C/C++ source files (`*.c`, `*.cpp`, `*.h`, `*.hpp`) in `src/` and `tests/` using `clang-format`.
* **Incremental linking** — `needs_link()` in `common.rs` checks if any object file is newer than the linked output, skipping unnecessary relinking. Implemented for all backends (`unix_cc`, `msvc`, `gas`, `nasm`).
* **`build.kind = "none"` and `"custom"`** — two new project kinds for special build scenarios that don't produce standard artifacts.
* **`install_bsd.sh`** — POSIX-compliant installation script for BSD systems (FreeBSD, OpenBSD, NetBSD) with binary download and source build modes.
* **Linux ARM64 support in `install.sh`** — added `Linux:aarch64|Linux:arm64` target detection for pre-built binary downloads.
* **BSD OS detection in `install.sh`** — detects FreeBSD, OpenBSD, NetBSD and determines target triple.
* **`rust-toolchain.toml`** — explicit toolchain pinning to `stable` channel.
* **Integration tests** — `build_with_target_config` (verifies `build.target = "linux"`) and `build_with_out_dir` (validates custom output directory).
* **`get_build_string_with_profile` made `pub`** — so `run.rs` can determine custom output directory configuration.
### Changed
* **`build.target` semantics changed** — now strictly contains a target triple (e.g., `x86_64-unknown-linux-gnu`) or short name (`linux`, `macos`, `windows`). No longer used as custom output directory — this functionality moved to `build.out_dir`.
* **`build.standard` made optional** — changed from `String` to `Option\<String>`. Validation only enforces non-empty for non-ASM languages. Skipped in `dcr.toml` output if empty.
* **`dcr run` with `out_dir`** — now determines target directory respecting `build.out_dir` via `get_build_string_with_profile()` from `build.rs`.
* **`collect_sources()` returns empty vector** instead of error when no sources are found, allowing `kind = "none"` or `kind = "custom"` projects with no source files.
* **CI/CD release workflow refactored** — `git2` made target-specific (no vendored-openssl on Windows), Zig-based cross-compilation for non-x86_64 Linux targets, Arch Linux package version cleanup (dashes → dots), `gmake` symlink for NetBSD.
* **README compatibility table** — FreeBSD, OpenBSD, NetBSD build/run status upgraded from "community/best-effort" to "officially supported".
* **Documentation updated** — `build-section.md` describes new `build.target` and `build.out_dir` fields. `target-directory.md` rewritten to clarify the distinction.
### Fixed
* **stdout/stderr not inherited in `dcr run`** — child process output was captured and manually printed, breaking interactive programs. Fixed by switching to `Command::status()`.
* **Race condition in release CI** — matrix build jobs could upload assets to a release that didn't exist yet. Fixed by adding a dedicated `create-release` job.
* **Release GHA — stable toolchain override** — fixed Rust toolchain override issues in CI.
* **Arch Linux package version sanitization** — version strings with dashes (e.g., `0.7.0-dev`) are invalid for `pkgver`. Fixed by replacing dashes with dots.
* **GPG permissions after Docker** — Docker operations changed GPG directory ownership. Fixed by running `chown` after Docker commands.
* **RPM artifact paths** — RPM artifacts were placed in `rpm/x86_64/` instead of `fedora/x86_64/`. Fixed in Dexoron Packages Index workflow.
* **JSON parsing reliability in `install.sh`** — added `jq` as primary parser with `python3` fallback for dev channel release lookup.
### Removed
* **`format_roots()` helper function** — removed from `common.rs`. Was only used by the old error handling path in `collect_sources()`.
* **Per-distribution artifact download steps** — three separate `actions/download-artifact` steps replaced with unified `gh release download --clobber`.

View File

@@ -0,0 +1,42 @@
---
sidebar_label: Build commands (build, run, clean)
---
# Build Commands
## `dcr build`
Builds the project according to `dcr.toml`.
```bash
dcr build # debug profile
dcr build --release # release build
dcr build --debug # explicit debug
dcr build --target aarch64-unknown-linux-gnu
dcr build --force # full rebuild
dcr build --clean # clean + build
dcr build --verbose # show compilation commands
dcr build --workspace pkg-a # build specific workspace package
```
Artifacts: `target/\<triple>/\<profile>/\<binary-name>` (Linux with explicit target).
## `dcr run`
Builds (if sources are newer than artifacts) and runs the binary.
```bash
dcr run
dcr run --release
```
## `dcr clean`
Removes `target/` directory (or `target/\<target>/\<profile>`).
```bash
dcr clean
dcr clean --release # target/release/ only
dcr clean --target windows # target/x86_64-pc-windows-msvc/
dcr clean --all # clean all workspace packages
```

View File

@@ -0,0 +1,53 @@
---
sidebar_label: Dependency commands (add, tree)
---
# Dependency Commands
## `dcr add \<name> [source]`
Adds a dependency to `dcr.toml`.
```bash
dcr add fmt # registry lookup
dcr add mylib ../path/to/lib # path as source
dcr add mylib path:./lib # explicit path prefix
dcr add mylib git:https://github.com/user/repo # explicit git prefix
dcr add mylib github:user/repo # GitHub shorthand
dcr add mylib gitlab:user/repo # GitLab shorthand
```
Source prefixes:
* `path:` — local path
* `git:` — generic git URL
* `github:` — expands to `https://github.com/\<user>/\<repo>`
* `gitlab:` — expands to `https://gitlab.com/\<user>/\<repo>`
* `http://` / `https://` / `git@` — full URL
Flags:
* `--branch \<name>` — git branch
* `--tag \<name>` — git tag
* `--rev \<hash>` — git commit
If source is omitted — DCR searches connected registries.
## `dcr tree`
Displays the project dependency tree.
```bash
dcr tree
```
Example output:
```
my-app v0.1.0
├── fmt (registry)
│ └── spdlog (registry)
└── catch2 (registry)
```
For path dependencies, recursively shows their own dependencies (from their `dcr.toml`).

View File

@@ -0,0 +1,73 @@
---
sidebar_label: Gen commands (vscode, clion, ...)
---
# Gen Commands
## `dcr gen \<target>`
Generates IDE integration files.
### vscode
```bash
dcr gen vscode
```
Creates:
* `.vscode/tasks.json` — `build` task (dcr build)
* `.vscode/launch.json` — debug launch configuration
* `.vscode/settings.json` — C/C++ settings (clangd paths, includes)
* `.vscode/extensions.json` — recommended extensions (vscode-clangd, vscode-lldb)
### clion
```bash
dcr gen clion
```
Creates:
* `.idea/externalTools.xml` — external tools (build, run, clean, test)
* `.idea/customTargets.xml` — custom build targets
* `.idea/misc.xml` — C/C++ project settings
* `.idea/runConfigurations/\<name>.xml` — per-binary run configurations
### compile-commands
```bash
dcr gen compile-commands
```
Generates `compile_commands.json` — standard format for clangd, cpptools, static analyzers.
### project-info
```bash
dcr gen project-info
```
Outputs JSON array with project metadata:
```json
[
{
"name": "my-app",
"version": "0.1.0",
"root": "/path/to/project",
"profile": "debug",
"language": "c",
"standard": "c17",
"cxx_standard": null,
"compiler": "/usr/bin/clang",
"kind": "bin",
"sources": ["src/main.c"],
"include_dirs": ["src"],
"lib_dirs": [],
"libs": [],
"cflags": ["-std=c17", "-O0", "-g"],
"ldflags": []
}
]
```

View File

@@ -0,0 +1,31 @@
---
sidebar_label: Project commands (new, init)
---
# Project Commands
## `dcr new \<name>`
Creates a new project with a standard structure and `dcr.toml`. The `name` argument is required.
Only ASCII letters, digits, underscores `_` and hyphens `-` are allowed in the project name.
```bash
dcr new my-app
```
Generates:
* `dcr.toml` with basic fields
* `src/main.c` with a `main` template
## `dcr init`
Initializes a DCR project in the current (empty) directory.
```bash
mkdir app && cd app
dcr init
```
The project name is taken from the current directory name. The directory name must follow the same naming rules as `dcr new`.

View File

@@ -0,0 +1,60 @@
---
sidebar_label: Quality commands (test, fmt)
---
# Quality Commands
## `dcr test`
Runs tests.
```bash
dcr test # debug profile
dcr test --release # release profile
dcr test --debug # explicit debug
dcr test --help # detailed help
```
Before first use, initialize tests:
```bash
dcr test --init
```
This creates `tests/dcr_test.h` (framework) and `tests/test.c` (template).
What `dcr test` does:
1. Builds the project
2. Collects `tests/*.c` files (`.c` only, not `.cpp`)
3. Compiles and links each test file
4. Runs each test binary
5. Prints summary: TOTAL, PASS, SKIP, FAIL
6. Returns non-zero exit code on any FAIL
## `dcr fmt`
Formats C/C++ source files using `clang-format`.
```bash
dcr fmt
```
Processes: `src/**/*.{c,cpp,cxx,cc,h,hpp,hxx,hh}` and `tests/**/*.{c,cpp,cxx,cc,h,hpp,hxx,hh}`.
Uses `.clang-format` at the project root (if present), otherwise default clang-format style.
## `dcr lint`
Runs `clang-tidy` on C/C++ source files for static analysis.
```bash
dcr lint # show diagnostics
dcr lint --fix # apply fixes automatically
dcr lint --help # detailed help
```
Processes: `src/**/*.{c,cpp,cxx,cc}` and `tests/**/*.{c,cpp,cxx,cc}`.
Without `--fix`, clang-tidy reports warnings and errors without modifying files.
With `--fix`, clang-tidy applies automatic suggestions in place.

View File

@@ -0,0 +1,51 @@
---
sidebar_label: System commands (setup, --help, ...)
---
# System Commands
## `dcr setup`
Shows configured registries from `~/.dcr/config.toml`.
```bash
dcr setup
```
If `~/.dcr/config.toml` is not found, DCR returns an error. Create it manually:
```toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
```
## `dcr --help`
Shows help for all commands.
```bash
dcr --help
```
## `dcr --version`
Shows version and target triple.
```bash
dcr --version # dcr 0.7.0 (x86_64-unknown-linux-gnu)
```
## `dcr --update`
Self-update. Downloads the latest release binary from GitHub Releases and replaces the current one.
```bash
dcr --update
```
Features:
* Auto-detects platform and architecture
* Warns if installed via AUR (use package manager instead)
* Works on Linux, macOS, Windows

View File

@@ -0,0 +1,51 @@
---
sidebar_label: Contributing
---
# Contributing
## Setup
```bash
git clone https://github.com/dexoron/dcr
cd dcr
cargo build
```
## Code style
All code must be formatted with `cargo fmt`:
```bash
cargo fmt
```
## Linting
```bash
cargo clippy --all-targets -- -D warnings
```
## Tests
```bash
cargo test --all-targets
```
## PR process
1. Fork the repository
2. Create a branch: `git checkout -b feature/description`
3. Make changes
4. Run `cargo fmt && cargo clippy && cargo test`
5. Open a Pull Request
## CI
CI runs:
* `cargo fmt --check`
* `cargo clippy --all-targets -- -D warnings`
* `cargo test --all-targets`
* Build on Linux, macOS, Windows
* Integration tests

View File

@@ -0,0 +1,81 @@
---
sidebar_label: FAQ
---
# FAQ
## Registry not found
```
error: registry not found
```
**Solution:** Make sure `~/.dcr/config.toml` exists:
```toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
```
And check `DCR_INDEX_PATH`:
```bash
echo $DCR_INDEX_PATH
```
## Compiler not found
```
error: compiler not found
```
**Solution:** Ensure a compiler is installed and available in PATH.
```bash
which gcc
which clang
```
Or specify explicitly via `[toolchain]` in `dcr.toml`.
## openssl-sys build failed
When building DCR from source:
```
error: failed to run custom build command for openssl-sys
```
**Solution:** Install OpenSSL development headers:
```bash
# Ubuntu/Debian
sudo apt install libssl-dev
# Fedora
sudo dnf install openssl-devel
# macOS
brew install openssl
```
## Ctrl+C during build
DCR handles SIGINT: interrupts the current compilation and exits with non-zero code.
## How to create a library?
See [Library Recipe](/docs/recipes/library-project).
## How to cross-compile to Windows?
See [Cross-Compile Recipe](/docs/recipes/cross-to-windows).
## How to create a multi-package project?
See [Workspace Recipe](/docs/recipes/multi-package-workspace).
## Lock file
`dcr.lock` is created during builds (`dcr build`) when registry dependencies are present. To force an update — delete `dcr.lock` and run `dcr build`.

View File

@@ -0,0 +1,72 @@
---
sidebar_label: First steps
---
# First Steps
## Create a project
```bash
dcr new my-app
cd my-app
```
Structure:
```
my-app/
├── dcr.toml
└── src/
└── main.c
```
`dcr.toml`:
```toml
[package]
name = "my-app"
version = "0.1.0"
type = "none"
[build]
language = "c"
standard = "c11"
compiler = "clang"
kind = "bin"
```
## Build
```bash
dcr build
```
Output — `target/\<triple>/debug/my-app` (Linux) or `target/debug/my-app.exe` (Windows).
Build profiles:
```bash
dcr build --release # release build
dcr build --debug # debug (default)
```
## Run
```bash
dcr run
```
Builds (if needed) and runs the binary.
## First test
```bash
dcr test --init # create test template
dcr test # run tests
```
## Formatting
```bash
dcr fmt # clang-format with .clang-format
```

View File

@@ -0,0 +1,109 @@
---
sidebar_label: Installation
---
# Installation
## Linux (Dexoron Packages)
Configure your package manager at https://pkg.dexoron.su and install:
**Arch Linux**
```sh
sudo pacman -Sy dcr
```
**Debian/Ubuntu**
```sh
sudo apt update && sudo apt install dcr
```
**Fedora/RHEL**
```sh
sudo dnf install dcr
```
## Arch Linux (AUR)
```sh
yay -S dcr
```
## macOS / Linux (Homebrew)
```sh
brew tap dexoron/dexoron
brew install dcr
```
## Snap (Linux)
```sh
sudo snap install dcrup
```
## Nix (flake)
```sh
nix run github:dexoron/dcr
# or install to profile:
nix profile install github:dexoron/dcr
```
## Cargo (crates.io)
```sh
cargo install dcr
```
## Linux / macOS (script)
```sh
curl -fsSL https://dcr.dexoron.su/install.sh | sh
```
## BSD (script)
```sh
curl -fsSL https://dcr.dexoron.su/install_bsd.sh | sh
```
## Windows (PowerShell)
```powershell
irm https://dcr.dexoron.su/install.ps1 | iex
```
## From source
```sh
git clone https://github.com/dexoron/dcr.git
cd dcr && cargo build --release
ln -sf "$PWD/target/release/dcr" ~/.local/bin/dcr
```
## Post-install
Verify the installation:
```bash
dcr --version
```
Man pages are available after installation:
```bash
man dcr
man dcr-build
```
To use the registry, create `~/.dcr/config.toml`:
```toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
```

View File

@@ -0,0 +1,51 @@
---
sidebar_label: IDE Integration
---
# IDE Integration
## VS Code
```bash
dcr gen vscode
```
Generates in `.vscode/`:
| File | Purpose |
| ----------------- | -------------------------------------------- |
| `tasks.json` | `build` task (dcr build) |
| `launch.json` | Debug launch configuration |
| `settings.json` | clangd/IntelliSense: include paths, standard |
| `extensions.json` | Recommends vscode-clangd, vscode-lldb |
## CLion
```bash
dcr gen clion
```
Generates in `.idea/`:
| File | Purpose |
| ------------------------------------------------ | ----------------------------------------- |
| `externalTools.xml` | Build, Run, Clean, Test as external tools |
| `customTargets.xml` | Custom build targets |
| `misc.xml` | C/C++ project settings |
| `runConfigurations/\<name>.xml` | Per-binary run configurations |
## compile_commands.json
```bash
dcr gen compile-commands
```
Generates `compile_commands.json` at project root. Standard format for clangd, C/C++ IntelliSense, static analyzers.
## project-info
```bash
dcr gen project-info
```
Outputs JSON array with project metadata (see [gen-commands](/docs/commands/gen-commands)).

View File

@@ -0,0 +1,46 @@
---
sidebar_label: License
---
# License
## DCR
DCR itself is [GPL-3.0-or-later](https://spdx.org/licenses/GPL-3.0-or-later.html) licensed.
> **Note:** DCR is a build tool, not a library. The GPL applies only to DCR's own source code. Projects built with DCR are not subject to DCR's license — their licensing is determined solely by their own code and dependencies.
## Vendored libraries
DCR statically links the following C libraries through its vendored Rust dependencies:
| Library | License | Bundled by |
| ------------------------------------------ | ------------------ | ----------------------------- |
| [libgit2](https://libgit2.org) | MIT OR Apache-2.0 | `git2` / `libgit2-sys` |
| [libssh2](https://libssh2.org) | MIT OR Apache-2.0 | `libgit2-sys` |
| [zlib](https://zlib.net) | MIT OR Apache-2.0 | `libgit2-sys` |
| [OpenSSL](https://openssl.org) | Apache-2.0 | `openssl-sys` / `openssl-src` |
| [ring](https://github.com/briansmith/ring) | Apache-2.0 AND ISC | `rustls` |
## Rust dependencies
DCR is written in Rust. The following notable Rust crates are statically linked:
| Crate | License |
| --------------------------------------------- | ------------------------ |
| [`reqwest`](https://crates.io/crates/reqwest) | MIT OR Apache-2.0 |
| [`rustls`](https://crates.io/crates/rustls) | Apache-2.0 OR ISC OR MIT |
| [`serde`](https://crates.io/crates/serde) | MIT OR Apache-2.0 |
| [`toml`](https://crates.io/crates/toml) | MIT OR Apache-2.0 |
| [`sha2`](https://crates.io/crates/sha2) | MIT OR Apache-2.0 |
| [`git2`](https://crates.io/crates/git2) | MIT OR Apache-2.0 |
| [`openssl`](https://crates.io/crates/openssl) | Apache-2.0 |
| [`tokio`](https://crates.io/crates/tokio) | MIT |
| [`hyper`](https://crates.io/crates/hyper) | MIT |
| [`ctrlc`](https://crates.io/crates/ctrlc) | MIT OR Apache-2.0 |
Full dependency tree (143 packages) is available in [`Cargo.lock`](https://github.com/dexoron/dcr/blob/main/Cargo.lock). The overwhelming majority are dual-licensed under MIT OR Apache-2.0.
## Additional credits
* DCR's CLI design and project model are inspired by [Cargo](https://doc.rust-lang.org/cargo/).

View File

@@ -0,0 +1,49 @@
---
sidebar_label: Cross-compile to Windows
---
# Cross-Compile to Windows from Linux
Building a Windows binary on Linux using mingw-w64.
## Install toolchain
```bash
# Ubuntu/Debian
sudo apt install mingw-w64
# Fedora
sudo dnf install mingw64-gcc mingw64-binutils
```
## Configuration
```toml
[package]
name = "my-app"
version = "0.1.0"
type = "none"
[build]
language = "c"
standard = "c11"
compiler = "clang"
kind = "bin"
target = "x86_64-pc-windows-gnu" # explicit mingw, not msvc
```
## Build
```bash
dcr build --target x86_64-pc-windows-gnu --release
```
Artifact: `target/x86_64-pc-windows-gnu/release/my-app.exe`.
## Custom toolchain
```toml
[toolchain]
cc = "x86_64-w64-mingw32-gcc"
cxx = "x86_64-w64-mingw32-g++"
```

View File

@@ -0,0 +1,70 @@
---
sidebar_label: Library project
---
# Library Project
Creating a static library and using it in another project.
## Step 1: Create the library
```bash
dcr new my-lib
cd my-lib
```
`dcr.toml`:
```toml
[package]
name = "my-lib"
version = "0.1.0"
type = "none"
[build]
language = "c"
standard = "c11"
kind = "staticlib"
```
`src/my_lib.h`:
```c
#ifndef MY_LIB_H
#define MY_LIB_H
int add(int a, int b);
#endif
```
`src/my_lib.c`:
```c
#include "my_lib.h"
int add(int a, int b) { return a + b; }
```
## Step 2: Build
```bash
dcr build --release
```
Artifacts:
* `target/\<triple>/release/libmy-lib.a` (Linux)
* `target/release/my-lib.lib` (Windows)
* `target/include/` — header files
## Step 3: Use in another project
```bash
dcr new my-app
cd my-app
dcr add my-lib ../my-lib
```
Automatically:
* Adds include path to `target/include/` of the library
* Adds lib path to `target/\<triple>/release/`
* Links `libmy-lib.a` / `my-lib.lib`

View File

@@ -0,0 +1,102 @@
---
sidebar_label: Multi-package workspace
---
# Multi-Package Workspace
A project with three packages: two libraries and a binary.
## Structure
```
workspace/
├── dcr.toml # root workspace
├── lib-core/
│ ├── dcr.toml
│ └── src/core.c
├── lib-utils/
│ ├── dcr.toml
│ └── src/utils.c
└── app/
├── dcr.toml
└── src/main.c
```
## Root dcr.toml
```toml
[package]
name = "my-workspace"
version = "0.1.0"
type = "none"
[build]
inherit = true
language = "c"
standard = "c11"
[workspace.lib-core]
path = "lib-core"
[workspace.lib-utils]
path = "lib-utils"
deps = ["lib-core"]
[workspace.app]
path = "app"
deps = ["lib-core", "lib-utils"]
main = true
```
## Packages
`lib-core/dcr.toml`:
```toml
[package]
name = "lib-core"
version = "0.1.0"
type = "none"
[build]
kind = "staticlib"
```
`lib-utils/dcr.toml`:
```toml
[package]
name = "lib-utils"
version = "0.1.0"
type = "none"
[build]
kind = "staticlib"
```
`app/dcr.toml`:
```toml
[package]
name = "app"
version = "0.1.0"
type = "none"
[build]
kind = "bin"
```
## Build
```bash
cd workspace
dcr build # builds everything in correct order
dcr build --workspace app # only app (lib-core and lib-utils built as deps)
dcr run # builds and runs main package
```
Build order (topological sort):
1. `lib-core`
2. `lib-utils` (depends on lib-core)
3. `app` (depends on lib-core, lib-utils)

View File

@@ -0,0 +1,82 @@
---
sidebar_label: Build profiles
---
# Build Profiles
Profiles allow overriding `[build]` fields for specific build modes.
## Configuration
```toml
[build]
language = "c"
standard = "c17"
cflags = ["-Wall"]
[build.debug]
cflags = ["-O0", "-g"]
[build.release]
cflags = ["-O3", "-DNDEBUG"]
```
## Merge rules
Fields from `[build.\<profile>]` are merged on top of `[build]`:
* **Scalar fields** (strings, numbers, bools) — replaced
* **Arrays** (`cflags`, `ldflags`, ...) — **appended** (extend the `[build]` array)
Set `inherit = false` to disable array inheritance (only profile's own arrays are used).
## Built-in profiles
The default flags for each profile are composed from three config fields:
| Field | debug default | release default |
| ----------- | ------------------ | --------------- |
| `opt_level` | `"0"` | `"3"` |
| `debug` | `true` | `false` |
| `warnings` | `["all", "extra"]` | `[]` |
Which produce the equivalent compiler flags:
| Profile | Effective flags |
| --------- | ---------------------------------------------------------- |
| `debug` | `-O0 -g -Wall -Wextra -fno-omit-frame-pointer -DDCR_DEBUG` |
| `release` | `-O3 -DNDEBUG` |
Additional build options can be toggled per-profile:
```toml
[build.release]
opt_level = "z"
lto = true
strip = true
panic = "abort"
codegen-units = "1"
[build.debug]
opt_level = "1"
debug = false
warnings = ["all", "error"]
```
## Target-specific profiles
```toml
[build.linux]
cflags = ["-DLINUX"]
[build.windows.debug]
cflags = ["-DWIN32", "-O0", "-g"]
```
Application order (highest priority first):
1. `[build.\<target>.\<profile>]`
2. `[build.\<profile>.\<target>]`
3. `[build.\<target>]`
4. `[build.\<profile>]`
5. `[build]`

View File

@@ -0,0 +1,131 @@
---
sidebar_label: Build system
---
# Build System
## Compiler Backends
DCR supports 7 compilation backends. Selection is automatic based on file extension and `build.compiler` value.
| Backend | Files | When used |
| --------- | --------------------------------- | ------------------------------------- |
| `unix_cc` | `.c`, `.cpp`, `.cxx`, `.cc`, `.S` | gcc/clang on Linux/macOS/BSD |
| `msvc` | `.c`, `.cpp`, `.cxx`, `.cc` | Windows (cl, clang-cl) |
| `gas` | `.s` | ARM/ARM64 assembler (no preprocessor) |
| `nasm` | `.asm`, `.s` | x86/x86_64 NASM assembler |
| `masm` | `.asm` | MASM (ml/ml64) on Windows |
| `fasm` | `.asm`, `.fasm` | Flat Assembler |
| `llvm_ir` | `.ll` | LLVM IR via `llc -filetype=obj` |
## Qt Support
DCR provides native Qt support for automatic meta-object handling (MOC, UIC, RCC).
Enable it by setting `build.qt = true` in `dcr.toml`. DCR will automatically detect Qt-related files (`.ui`, `.qrc`, `.h` with `Q_OBJECT`) and process them.
```toml
[build]
qt = true
```
*Note: Requires `qt6` modules (Core, Widgets, Gui, Svg) installed via `pkg-config`.*
Advanced customization is still possible via `build.steps` if special handling is needed:
```toml
[build.steps]
moc = "moc {in} -o {out}"
```
### Unix CC
* Compiler resolved via `resolve_compiler()`: `DCR_COMPILER` > `DCR_CC` > `[toolchain]` > `build.compiler` > `PATH`
* Supports `.d` files for header dependency tracking
* Flags: `-std=`, `-MMD -MF`, `-c -o`, `-I`, `-L`, `-l`
* Conditional flags based on config:
* `freestanding` or bare-metal target: `-ffreestanding` (compile), `-nostdlib -static` (link)
* `lto`: `-flto` (compile + link)
* `panic = "abort"`: `-fno-exceptions` (C++ only), `-fno-unwind-tables`, `-fno-asynchronous-unwind-tables`
### MSVC
* Supports cl.exe and clang-cl.exe
* Flags: `/std:`, `/Fo:`, `/Fe:`, `/I`, `/link`
### GAS / NASM / MASM / FASM / LLVM-IR
* GAS: `-I`, `-c -o`, `--defsym`
* NASM: `-I`, `-o`, `-D`, `-f` (format: win64/elf64/macho64/macho32/elf32)
* MASM: `/nologo /c /Fo\<obj> <source>`
* FASM: `<source> \<output>` (output path is the object file)
* LLVM IR: `-filetype=obj <source> -o \<output>`
## Incremental Builds
Three levels of incrementality:
1. **mtime** — if output is newer than all inputs, skip
2. **`.d` files** — header change tracking (including transitive)
3. **SHA256 fingerprint** — recompile if compiler flags changed (stored in `.dcr_fingerprint`)
## Parallel Compilation
* `thread::scope` for thread pool
* Atomic task queue (`AtomicU64`)
* Mutex on stdout (`OUTPUT_MUTEX`)
* Thread count = `available_parallelism()`, capped by `build.codegen-units` if set
## Build Kinds
| Kind | Type | Path (Linux example) |
| ----------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `bin` | Executable | `target/\<triple>/\<profile>/\<name>` (.exe on Windows) |
| `staticlib` | Static library | `target/\<triple>/\<profile>/lib\<name>.a` (.lib) |
| `sharedlib` | Dynamic library | `target/\<triple>/\<profile>/lib\<name>.so` (.dll/.dylib) |
| `efi` | UEFI application | `target/\<triple>/\<profile>/\<name>.efi` |
| `elf` | ELF without stdlib | `target/\<triple>/\<profile>/\<name>` |
| `none` | Compile only, no link | — |
| `custom` | Full filename+extension control | `target/\<triple>/\<profile>/\<filename>.\<extension>` |
## Build Steps
DCR supports pre-build and post-build steps:
* `build.steps` — commands before compilation
* `build.post_steps` — commands after compilation
Substitutions: `{stem}`, `{in}`, `{out}`, `{profile}`, `{version}`, `{name}`.
Example Qt codegen via build steps:
```toml
[build.steps]
moc = "moc {in} -o {out}"
```
## pkg-config
Automatic lookup (read from raw config):
```toml
[build]
pkg_config = ["sdl2", "gl"]
```
DCR runs `pkg-config --cflags sdl2 gl` and `pkg-config --libs sdl2 gl` and adds results to compiler/linker flags.
## Variable Substitution
Supported variables:
| Variable | Description |
| ----------------------- | ---------------------------- |
| `{version}` | Package version |
| `{version_major}` | Major version part |
| `{version_minor}` | Minor version part |
| `{version_patch}` | Patch version |
| `{version_suffix}` | Suffix (e.g., `-rc1`) |
| `{version_suffix_dash}` | Suffix with dash |
| `{profile}` | Profile name (debug/release) |
| `{name}` | Package name |

View File

@@ -0,0 +1,70 @@
---
sidebar_label: Cross-compilation
---
# Cross-Compilation
## Short Names
DCR supports short platform names:
| Short Name | Full Triple |
| ---------- | -------------------------- |
| `linux` | `x86_64-unknown-linux-gnu` |
| `macos` | `x86_64-apple-darwin` |
| `windows` | `x86_64-pc-windows-msvc` |
```bash
dcr build --target windows
```
## Full Triples
```bash
dcr build --target aarch64-unknown-linux-gnu
dcr build --target x86_64-pc-windows-gnu # mingw
dcr build --target armv7-unknown-linux-gnueabihf
```
## clang --target
When using clang, DCR injects `--target=\<triple>` into CFLAGS.
```toml
[build]
compiler = "clang"
target = "aarch64-unknown-linux-gnu"
# Auto: cflags += ["--target=aarch64-unknown-linux-gnu"]
```
## Bare-Metal / Freestanding
For targets containing `none`, `-elf`, `eabi`, or `baremetal`, DCR automatically:
1. **Disables default flags** — no system include paths, no `-l` libc
2. **Injects `-ffreestanding`** at compile time and `-nostdlib -static` at link time
You can also enable freestanding mode explicitly:
```toml
[build]
freestanding = true
```
```bash
dcr build --target aarch64-none-elf
```
## Target Directory
On Linux with explicit target:
```
target/<triple>/<profile>/
```
On macOS/Windows or without target:
```
target/<profile>/
```

View File

@@ -0,0 +1,152 @@
---
sidebar_label: dcr.toml overview
---
# dcr.toml
Main project configuration file. Located at the project root.
## Structure
```toml
[package]
# required fields
[build]
# build settings
[build.debug] # optional: debug override
[build.release] # optional: release override
[build.linux] # optional: Linux override
[build.windows] # optional: Windows override
[build.windows.debug] # target + profile combination
[toolchain]
# compiler/linker paths
[dependencies]
# project dependencies
[workspace]
# multi-package configuration
[run]
# run settings
```
## [package]
| Field | Required | Description |
| --------- | -------- | ----------------------- |
| `name` | yes | Project name |
| `version` | yes | Semantic version |
| `type` | yes | `app`, `lib`, `none` |
| `license` | no | SPDX license identifier |
| `author` | no | Author |
```toml
[package]
name = "my-app"
version = "0.1.0"
type = "app"
license = "MIT"
author = "John Doe"
```
## [build]
...
* `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`.
| Field | Default | Description |
| ---------------- | ------------------------------------------- | --------------------------------------------------------------------- |
| `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` |
| `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) |
| `cxx_standard` | `"c++20"` | C++ standard (`c++17`, `c++20`, `c++23`) |
| `compiler` | `"clang"` | Preferred compiler |
| `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` |
| `target` | host | Target triple for cross-compilation |
| `platform` | `"native"` | `native`, `efi` |
| `cflags` | `[]` | Additional C/C++/ASM flags |
| `ldflags` | `[]` | Additional linker flags |
| `filename` | `""` | Custom output file name |
| `extension` | `""` | Custom file extension |
| `roots` | `["src"]` | Source root directories |
| `exclude` | `[]` | Exclude patterns |
| `include` | `[]` | Additional include directories |
| `src_disable` | `false` | Disable auto source discovery |
| `inherit` | `false` | Inherit build from workspace root |
| `clean` | `[]` | Glob patterns for custom clean paths |
| `out_dir` | `""` | Custom output directory |
| `workspace_only` | `false` | Workspace-only, not built standalone |
| `freestanding` | `false` | Compile in freestanding mode (`-ffreestanding` + `-nostdlib -static`) |
| `opt_level` | `"0"` (debug) / `"3"` (release) | Optimization level: `0`-`3`, `"s"`, `"z"` |
| `debug` | `true` (debug) / `false` (release) | Emit debug symbols (`-g`) |
| `lto` | `false` | Link-time optimization (`-flto` for both compiler and linker) |
| `strip` | `false` | Strip symbols from output (`-s` in ldflags) |
| `warnings` | `["all", "extra"]` (debug) / `[]` (release) | Warning flags (e.g. `"all"`, `"extra"`, `"pedantic"`) |
| `panic` | `""` | Panic strategy: `"abort"` disables exceptions and unwind tables |
| `codegen-units` | `""` | Max parallel compilation jobs (`"0"` = auto) |
| `qt` | `false` | Enable automatic Qt meta-object handling (MOC, UIC, RCC) |
Settings from raw config (not in typed struct):
* `pkg_config` — list of pkg-config packages
* `ldscript` — linker script path
* `build.steps` / `build.post_steps` — codegen steps
Example:
```toml
[build]
language = "c++"
standard = "c23"
cxx_standard = "c++23"
compiler = "clang"
kind = "sharedlib"
cflags = ["-Wall", "-Wextra"]
opt_level = "z"
lto = true
strip = true
panic = "abort"
codegen-units = "2"
```
## [toolchain]
```toml
[toolchain]
cc = "/usr/bin/clang"
cxx = "/usr/bin/clang++"
as = "/usr/bin/as"
ar = "/usr/bin/ar"
ld = "/usr/bin/ld.lld"
```
Raw config also supports `uic`, `moc`, `rcc` for Qt codegen.
## [dependencies]
See [dependencies](/docs/reference/dependencies).
## [run]
```toml
[run]
cmd = "./target/{profile}/{name}"
```
Substitutions:
* `{version}` — package version
* `{version_major}`, `{version_minor}`, `{version_patch}`, `{version_suffix}`, `{version_suffix_dash}` — version parts
* `{profile}` — debug / release
* `{name}` — package name
Default `cmd` = `./target/{profile}/{name}` (macOS/Windows) or `./target/\<triple>/\<profile>/\<name>` (Linux).
## [workspace]
See [workspaces](/docs/reference/workspaces).

View File

@@ -0,0 +1,84 @@
---
sidebar_label: Dependencies
---
# Dependencies
## Formats
The `[dependencies]` section supports three formats:
### String (registry)
```toml
[dependencies]
fmt = "10.1.1"
spdlog = "1.12"
catch2 = "3.4.0"
```
The version string is used as-is for registry lookup.
### Table (git)
```toml
[dependencies]
fmt = { git = "https://github.com/fmtlib/fmt", tag = "10.1.1" }
```
Fields: `git`, `branch`, `tag`, `rev`.
### Table (path)
```toml
[dependencies]
mylib = { path = "../mylib" }
```
## Registry
DCR uses a package registry for dependency lookup by name.
```toml
# ~/.dcr/config.toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
```
Registry priority: order in `config.toml`. The `DCR_INDEX_PATH` variable overrides the path to `index.json`.
## Git dependencies
DCR clones git repositories via `git2`:
* `branch` — switch to a branch
* `tag` — switch to a tag
* `rev` — switch to a specific commit
* `features` — feature flags (parsed, but does not affect build)
Cache path: `~/.dcr/git/\<hash>/`.
## Path dependencies
Local paths. DCR automatically discovers include and lib directories from the neighbor's `dcr.toml`.
```toml
[dependencies]
mylib = { path = "/abs/path/to/lib" }
mylib = { path = "../relative/path" }
```
## dcr.lock
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`.
## Resolution process
1. Load all dependencies (registry → git → path)
2. For path deps: recursively read their `dcr.toml`
3. For registry deps: search `index.json`
4. For git deps: clone to cache
5. Collect `include_dirs`, `lib_dirs`, `libs` for the compiler

View File

@@ -0,0 +1,60 @@
---
sidebar_label: Environment variables
---
# Environment Variables
## DCR_COMPILER
Overrides the compiler for all languages. **Highest priority.**
```bash
export DCR_COMPILER=clang
dcr build
```
Compiler resolution priority:
1. `DCR_COMPILER` (env)
2. `DCR_CC` / `DCR_CXX` / `DCR_AS` (env)
3. `[toolchain]` (dcr.toml)
4. `build.compiler` (dcr.toml)
5. `PATH`
## DCR_CC / DCR_CXX / DCR_AS
Per-language override (lower priority than `DCR_COMPILER`, higher than `[toolchain]`).
```bash
export DCR_CC=gcc-14
export DCR_CXX=g++-14
export DCR_AS=arm-linux-gnueabihf-as
```
## DCR_LD / DCR_AR
Override linker and archiver.
```bash
export DCR_LD=ld.lld
export DCR_AR=llvm-ar
```
## DCR_DEBUG
Enables debug mode — prints all compilation commands to stderr before execution.
```bash
export DCR_DEBUG=1
dcr build
```
## DCR_INDEX_PATH
Overrides the path to the registry `index.json`.
```bash
export DCR_INDEX_PATH=/custom/path/index.json
```
Default: `~/.dcr/index.json`.

View File

@@ -0,0 +1,51 @@
---
sidebar_label: Platform support
---
# Platform Support
## Target Triples
DCR normalizes target triples. Short platform names are expanded to full triples.
### Linux
```
target/<arch>-unknown-linux-gnu/<profile>/
```
Architectures: `x86_64`, `aarch64` (host-detected).
Artifact type: ELF. Extensions: `.so` (sharedlib), `.a` (staticlib).
### macOS
```
target/<profile>/
```
Architectures: `x86_64`, `aarch64` (host-detected).
Extensions: `.dylib` (sharedlib), `.a` (staticlib).
### Windows
```
target/<profile>/
```
Architectures: `x86_64`, `aarch64`.
Extensions: `.exe` (bin), `.lib` (staticlib), `.dll` (sharedlib), `.efi` (UEFI).
### BSD
```
target/<arch>-unknown-<os>/<profile>/
```
Supported systems: `freebsd`, `openbsd`, `netbsd`, `dragonfly`.
## Host Detection
DCR uses `std::env::consts::ARCH` and `std::env::consts::OS` for host platform detection. Used as fallback when `target` is not specified.

View File

@@ -0,0 +1,67 @@
---
sidebar_label: Workspaces
---
# Workspaces
Workspaces allow managing multiple packages in a single repository.
## Configuration
```toml
[workspace.lib-core]
path = "lib-core"
[workspace.lib-utils]
path = "lib-utils"
deps = ["lib-core"]
[workspace.app]
path = "app"
deps = ["lib-core", "lib-utils"]
main = true
```
### Member fields
| Field | Description |
| ------ | ------------------------------------------------ |
| `path` | Path to the package (relative to workspace root) |
| `deps` | Dependencies on other members |
| `main` | Mark as the main package |
## Topological sort
DCR automatically sorts packages by dependencies: package A is built before B if B depends on A.
Cyclic dependencies are detected and cause an error.
## Build
```bash
dcr build # build all packages in dependency order
dcr build --workspace app # build only app (dependencies built automatically)
```
When building a workspace, member outputs (libraries) are automatically added to include/lib paths of dependent packages.
## Clean
```bash
dcr clean # clean only root target/
dcr clean --all # clean target/ of all packages
```
## Inheritance
If a member has `inherit = true` in its `[build]` section, fields from the root `[build]` are merged into the member:
```toml
# root dcr.toml
[build]
inherit = true
language = "c"
standard = "c17"
# member inherits language and standard
```

View File

@@ -0,0 +1,46 @@
---
sidebar_label: Self Update
---
# Self Update
## dcr --update
Automatic update to the latest version. Downloads a binary (not an archive) from GitHub Releases and replaces the current executable.
```bash
dcr --update
```
## How it works
1. DCR detects the current platform and architecture
2. Fetches the latest release from `api.github.com/repos/dexoron/dcr/releases/latest`
3. Compares versions
4. Downloads the matching asset (direct binary URL, not archive)
5. Replaces the current executable via `self_replace`
## Asset naming
Pattern: `dcr-\<triple>` or `dcr-\<triple>.exe`
| Platform | Asset name |
| -------------- | -------------------------------- |
| Linux x86_64 | `dcr-x86_64-unknown-linux-gnu` |
| macOS x86_64 | `dcr-x86_64-apple-darwin` |
| macOS ARM64 | `dcr-aarch64-apple-darwin` |
| Windows x86_64 | `dcr-x86_64-pc-windows-msvc.exe` |
## AUR
If DCR was installed via AUR, `--update` shows a warning:
```
Update via package manager: yay/paru -Syu {package_name} or sudo pacman -Syu {package_name}
```
## Errors
* Cannot detect platform — error
* Cannot fetch release — error with URL
* No write permission — error (use `sudo` or manual install)

View File

@@ -0,0 +1,45 @@
---
sidebar_label: Running tests
---
# Running Tests
## Execution
```bash
dcr test
```
Builds the project, then compiles and runs test files from `tests/`.
## Profiles
```bash
dcr test # debug (default)
dcr test --release # release
dcr test --debug # explicit debug
```
## Output
```
=====================
Testsuite summary
=====================
TOTAL: 5
PASS: 3
SKIP: 1
FAIL: 1
=====================
```
## Exit code
* 0 — all tests passed (FAIL = 0)
* 1 — test failures or build error
## What gets built
* All `.c` files from `tests/` (`.cpp` not supported)
* Include path: `tests/` (for `dcr_test.h`)
* Linked with project if `package.type = "lib"` or `kind = "staticlib"`/`"sharedlib"`

View File

@@ -0,0 +1,69 @@
---
sidebar_label: Test framework (EXPECT, TEST, ...)
---
# Test Framework
DCR has a built-in minimal test framework for C.
## Macros
### `EXPECT(expr)`
Asserts that an expression is true.
```c
EXPECT(1 + 1 == 2);
EXPECT(ptr != NULL);
```
### `SKIP(reason)`
Skips a test with a message.
```c
SKIP("not implemented on Windows");
```
### `TEST(name)`
Defines a test.
```c
TEST(addition) {
EXPECT(1 + 1 == 2);
EXPECT(2 + 2 == 4);
}
```
### `TEST_CASE(name)`
Registers a test case.
```c
TEST_CASE(math) {
EXPECT(1 + 1 == 2);
}
```
## Initialization
```bash
dcr test --init
```
Creates:
* `tests/dcr_test.h` — framework header (do not edit)
* `tests/test.c` — template with example test
## Structure
```
tests/
├── dcr_test.h # framework (do not edit)
├── test.c # main tests
└── ... # additional .c test files
```
Only `.c` files are compiled (`.cpp` is not supported).

View File

@@ -0,0 +1,63 @@
---
sidebar_label: Introduction
---
# DCR — C/C++ Build Tool & Package Manager
<details>
<summary>Quick reference</summary>
```bash
# Installation
curl -fsSL https://dcr.dexoron.su/install.sh | sh
# Create a project
dcr new my-app
cd my-app
# Build and run
dcr build
dcr run
# Run tests
dcr test
# Add a dependency
dcr add fmt
# Generate IDE files
dcr gen vscode
```
</details>
## Contents
| Section | Description |
| ----------------------------------------------------- | --------------------------------------------- |
| [Getting Started](/docs/getting-started/installation) | Installation and first steps |
| [Commands](/docs/commands/project-commands) | All CLI commands |
| [Reference](/docs/reference/dcr-toml) | Configuration, build, dependencies, platforms |
| [Testing](/docs/testing/test-framework) | Built-in test framework |
| [Recipes](/docs/recipes/cross-to-windows) | Common scenarios |
| [IDE Integration](/docs/ide-integration) | VS Code, CLion, compile_commands.json |
| [Self Update](/docs/self-update) | Auto-update |
| [FAQ](/docs/faq) | Frequently asked questions |
| [Changelog](/docs/changelog) | Version history |
| [License](/docs/license) | DCR and vendored library licenses |
| [Contributing](/docs/contributing) | DCR development |
## Features
* **Incremental builds** — mtime + `.d` headers + SHA256 fingerprint
* **Parallel compilation** — thread::scope, atomic task queue
* **4 backends** — gcc/clang, MSVC/clang-cl, GAS (ARM), NASM (x86)
* **7 project kinds** — bin, staticlib, sharedlib, efi, elf, none, custom
* **Cross-compilation** — short names and full triples
* **Profiles** — debug / release with field overrides
* **Workspaces** — multi-package projects with topological sort
* **Registry + Git + Path** — three dependency mechanisms
* **IDE generation** — VS Code, CLion, compile_commands.json, JSON metadata
* **pkg-config** — automatic system library discovery
* **Per-command `--help`** — `dcr build --help`, `dcr new --help`, etc.
* **Man pages** — `man dcr`, `man dcr-build`, `man dcr-new`

View File

@@ -0,0 +1,91 @@
---
sidebar_label: Changelog
---
# Changelog
## 0.7.1 (2026-06-02)
### Added
* **`--help` for all commands** — `dcr build --help`, `dcr run --help`, `dcr new --help`,
`dcr init --help`, `dcr clean --help`, `dcr add --help`, `dcr fmt --help`,
`dcr setup --help`, `dcr tree --help`, `dcr gen --help`, `dcr --update --help`,
`dcr test --help`. All output uses styled headers (green) and usage lines (cyan).
* **Man pages** — 12 troff pages in `man/man1/`: `dcr.1`, `dcr-build.1`,
`dcr-run.1`, `dcr-new.1`, `dcr-init.1`, `dcr-clean.1`, `dcr-add.1`, `dcr-test.1`,
`dcr-gen.1`, `dcr-fmt.1`, `dcr-tree.1`, `dcr-setup.1`.
* **Man pages in all packaging** — install.sh, install_bsd.sh, AUR PKGBUILD,
Debian (cargo-deb), RPM (cargo-generate-rpm), Nix (postInstall), Homebrew
(resource), Snap, GitHub Release assets.
* **Project name validation** — `dcr init` and `dcr new` now validate names before
creating files. Only ASCII letters, digits, `_` and `-` are allowed.
* **`documentation` and `homepage` fields** — added to `Cargo.toml`.
* **Release profile optimizations** — `opt-level = "z"`, LTO, `codegen-units = 1`,
`panic = "abort"`, `strip = true` for smaller binaries.
* **Linux i686, armv7, riscv64 targets** — added to release workflow and install scripts.
* **Linux musl i686, armv7 targets** — cross-compiled via zigbuild in CI.
* **AUR packages** — `dcr-dev`, `dcr-dev-bin` publishing workflow.
* **Snap publishing** — automated Snapcraft publishing in CI.
* **Snap badge** — in README.
### Changed
* **`validate_package_name` made public** — callable from CLI commands.
* **README platform table** — reorganized: libc variants as separate OS rows,
removed extra columns. Linux architecture list updated.
* **`gen.rs` no-args output** — now uses styled output instead of raw `eprintln!`.
* **`tree.rs`, `fmt.rs`, and `setup.rs`** — now accept arguments for `--help`.
* **README install commands** — `| bash` → `| sh` for POSIX compatibility.
### Fixed
* **`dcr new \<invalid-name>` creates directory then fails** — validation now
happens before any file operations.
* **`dcr init` on invalid directory name** — same fix.
* **Man pages missing in installed packages** — now shipped in all formats.
* **Windows drive letter false positive** — in dependency file parser.
* **CRLF (`\r\n`) breaks dependency parser** — now handles mixed line endings.
* **Newline after backslash not consumed** — in `parse_d_file` escape handling.
## 0.7.0 (2026-06-01)
### Added
* **OpenBSD and NetBSD target support** — full platform routing with dynamic target triples using `std::env::consts::ARCH` and `std::env::consts::OS`. Affects `build`, `run`, `clean` commands and the platform module.
* **`src/platform/bsd.rs`** — new BSD platform module (shared by FreeBSD, OpenBSD, NetBSD) providing `bin_path`, `lib_path`, `elf_path`, `efi_path`, `shared_lib_path`.
* **`build.out_dir` config option** — custom output directory that overrides the default `target/\<triple>/\<profile>` path for final artifacts. Supported in `build`, `run`, and config validation.
* **`dcr fmt` command** — new CLI command that formats all C/C++ source files (`*.c`, `*.cpp`, `*.h`, `*.hpp`) in `src/` and `tests/` using `clang-format`.
* **Incremental linking** — `needs_link()` in `common.rs` checks if any object file is newer than the linked output, skipping unnecessary relinking. Implemented for all backends (`unix_cc`, `msvc`, `gas`, `nasm`).
* **`build.kind = "none"` and `"custom"`** — two new project kinds for special build scenarios that don't produce standard artifacts.
* **`install_bsd.sh`** — POSIX-compliant installation script for BSD systems (FreeBSD, OpenBSD, NetBSD) with binary download and source build modes.
* **Linux ARM64 support in `install.sh`** — added `Linux:aarch64|Linux:arm64` target detection for pre-built binary downloads.
* **BSD OS detection in `install.sh`** — detects FreeBSD, OpenBSD, NetBSD and determines target triple.
* **`rust-toolchain.toml`** — explicit toolchain pinning to `stable` channel.
* **Integration tests** — `build_with_target_config` (verifies `build.target = "linux"`) and `build_with_out_dir` (validates custom output directory).
* **`get_build_string_with_profile` made `pub`** — so `run.rs` can determine custom output directory configuration.
### Changed
* **`build.target` semantics changed** — now strictly contains a target triple (e.g., `x86_64-unknown-linux-gnu`) or short name (`linux`, `macos`, `windows`). No longer used as custom output directory — this functionality moved to `build.out_dir`.
* **`build.standard` made optional** — changed from `String` to `Option\<String>`. Validation only enforces non-empty for non-ASM languages. Skipped in `dcr.toml` output if empty.
* **`dcr run` with `out_dir`** — now determines target directory respecting `build.out_dir` via `get_build_string_with_profile()` from `build.rs`.
* **`collect_sources()` returns empty vector** instead of error when no sources are found, allowing `kind = "none"` or `kind = "custom"` projects with no source files.
* **CI/CD release workflow refactored** — `git2` made target-specific (no vendored-openssl on Windows), Zig-based cross-compilation for non-x86_64 Linux targets, Arch Linux package version cleanup (dashes → dots), `gmake` symlink for NetBSD.
* **README compatibility table** — FreeBSD, OpenBSD, NetBSD build/run status upgraded from "community/best-effort" to "officially supported".
* **Documentation updated** — `build-section.md` describes new `build.target` and `build.out_dir` fields. `target-directory.md` rewritten to clarify the distinction.
### Fixed
* **stdout/stderr not inherited in `dcr run`** — child process output was captured and manually printed, breaking interactive programs. Fixed by switching to `Command::status()`.
* **Race condition in release CI** — matrix build jobs could upload assets to a release that didn't exist yet. Fixed by adding a dedicated `create-release` job.
* **Release GHA — stable toolchain override** — fixed Rust toolchain override issues in CI.
* **Arch Linux package version sanitization** — version strings with dashes (e.g., `0.7.0-dev`) are invalid for `pkgver`. Fixed by replacing dashes with dots.
* **GPG permissions after Docker** — Docker operations changed GPG directory ownership. Fixed by running `chown` after Docker commands.
* **RPM artifact paths** — RPM artifacts were placed in `rpm/x86_64/` instead of `fedora/x86_64/`. Fixed in Dexoron Packages Index workflow.
* **JSON parsing reliability in `install.sh`** — added `jq` as primary parser with `python3` fallback for dev channel release lookup.
### Removed
* **`format_roots()` helper function** — removed from `common.rs`. Was only used by the old error handling path in `collect_sources()`.
* **Per-distribution artifact download steps** — three separate `actions/download-artifact` steps replaced with unified `gh release download --clobber`.

View File

@@ -0,0 +1,42 @@
---
sidebar_label: Build commands (build, run, clean)
---
# Build Commands
## `dcr build`
Builds the project according to `dcr.toml`.
```bash
dcr build # debug profile
dcr build --release # release build
dcr build --debug # explicit debug
dcr build --target aarch64-unknown-linux-gnu
dcr build --force # full rebuild
dcr build --clean # clean + build
dcr build --verbose # show compilation commands
dcr build --workspace pkg-a # build specific workspace package
```
Artifacts: `target/\<triple>/\<profile>/\<binary-name>` (Linux with explicit target).
## `dcr run`
Builds (if sources are newer than artifacts) and runs the binary.
```bash
dcr run
dcr run --release
```
## `dcr clean`
Removes `target/` directory (or `target/\<target>/\<profile>`).
```bash
dcr clean
dcr clean --release # target/release/ only
dcr clean --target windows # target/x86_64-pc-windows-msvc/
dcr clean --all # clean all workspace packages
```

View File

@@ -0,0 +1,53 @@
---
sidebar_label: Dependency commands (add, tree)
---
# Dependency Commands
## `dcr add \<name> [source]`
Adds a dependency to `dcr.toml`.
```bash
dcr add fmt # registry lookup
dcr add mylib ../path/to/lib # path as source
dcr add mylib path:./lib # explicit path prefix
dcr add mylib git:https://github.com/user/repo # explicit git prefix
dcr add mylib github:user/repo # GitHub shorthand
dcr add mylib gitlab:user/repo # GitLab shorthand
```
Source prefixes:
* `path:` — local path
* `git:` — generic git URL
* `github:` — expands to `https://github.com/\<user>/\<repo>`
* `gitlab:` — expands to `https://gitlab.com/\<user>/\<repo>`
* `http://` / `https://` / `git@` — full URL
Flags:
* `--branch \<name>` — git branch
* `--tag \<name>` — git tag
* `--rev \<hash>` — git commit
If source is omitted — DCR searches connected registries.
## `dcr tree`
Displays the project dependency tree.
```bash
dcr tree
```
Example output:
```
my-app v0.1.0
├── fmt (registry)
│ └── spdlog (registry)
└── catch2 (registry)
```
For path dependencies, recursively shows their own dependencies (from their `dcr.toml`).

View File

@@ -0,0 +1,73 @@
---
sidebar_label: Gen commands (vscode, clion, ...)
---
# Gen Commands
## `dcr gen \<target>`
Generates IDE integration files.
### vscode
```bash
dcr gen vscode
```
Creates:
* `.vscode/tasks.json` — `build` task (dcr build)
* `.vscode/launch.json` — debug launch configuration
* `.vscode/settings.json` — C/C++ settings (clangd paths, includes)
* `.vscode/extensions.json` — recommended extensions (vscode-clangd, vscode-lldb)
### clion
```bash
dcr gen clion
```
Creates:
* `.idea/externalTools.xml` — external tools (build, run, clean, test)
* `.idea/customTargets.xml` — custom build targets
* `.idea/misc.xml` — C/C++ project settings
* `.idea/runConfigurations/\<name>.xml` — per-binary run configurations
### compile-commands
```bash
dcr gen compile-commands
```
Generates `compile_commands.json` — standard format for clangd, cpptools, static analyzers.
### project-info
```bash
dcr gen project-info
```
Outputs JSON array with project metadata:
```json
[
{
"name": "my-app",
"version": "0.1.0",
"root": "/path/to/project",
"profile": "debug",
"language": "c",
"standard": "c17",
"cxx_standard": null,
"compiler": "/usr/bin/clang",
"kind": "bin",
"sources": ["src/main.c"],
"include_dirs": ["src"],
"lib_dirs": [],
"libs": [],
"cflags": ["-std=c17", "-O0", "-g"],
"ldflags": []
}
]
```

View File

@@ -0,0 +1,31 @@
---
sidebar_label: Project commands (new, init)
---
# Project Commands
## `dcr new \<name>`
Creates a new project with a standard structure and `dcr.toml`. The `name` argument is required.
Only ASCII letters, digits, underscores `_` and hyphens `-` are allowed in the project name.
```bash
dcr new my-app
```
Generates:
* `dcr.toml` with basic fields
* `src/main.c` with a `main` template
## `dcr init`
Initializes a DCR project in the current (empty) directory.
```bash
mkdir app && cd app
dcr init
```
The project name is taken from the current directory name. The directory name must follow the same naming rules as `dcr new`.

View File

@@ -0,0 +1,60 @@
---
sidebar_label: Quality commands (test, fmt)
---
# Quality Commands
## `dcr test`
Runs tests.
```bash
dcr test # debug profile
dcr test --release # release profile
dcr test --debug # explicit debug
dcr test --help # detailed help
```
Before first use, initialize tests:
```bash
dcr test --init
```
This creates `tests/dcr_test.h` (framework) and `tests/test.c` (template).
What `dcr test` does:
1. Builds the project
2. Collects `tests/*.c` files (`.c` only, not `.cpp`)
3. Compiles and links each test file
4. Runs each test binary
5. Prints summary: TOTAL, PASS, SKIP, FAIL
6. Returns non-zero exit code on any FAIL
## `dcr fmt`
Formats C/C++ source files using `clang-format`.
```bash
dcr fmt
```
Processes: `src/**/*.{c,cpp,cxx,cc,h,hpp,hxx,hh}` and `tests/**/*.{c,cpp,cxx,cc,h,hpp,hxx,hh}`.
Uses `.clang-format` at the project root (if present), otherwise default clang-format style.
## `dcr lint`
Runs `clang-tidy` on C/C++ source files for static analysis.
```bash
dcr lint # show diagnostics
dcr lint --fix # apply fixes automatically
dcr lint --help # detailed help
```
Processes: `src/**/*.{c,cpp,cxx,cc}` and `tests/**/*.{c,cpp,cxx,cc}`.
Without `--fix`, clang-tidy reports warnings and errors without modifying files.
With `--fix`, clang-tidy applies automatic suggestions in place.

View File

@@ -0,0 +1,51 @@
---
sidebar_label: System commands (setup, --help, ...)
---
# System Commands
## `dcr setup`
Shows configured registries from `~/.dcr/config.toml`.
```bash
dcr setup
```
If `~/.dcr/config.toml` is not found, DCR returns an error. Create it manually:
```toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
```
## `dcr --help`
Shows help for all commands.
```bash
dcr --help
```
## `dcr --version`
Shows version and target triple.
```bash
dcr --version # dcr 0.7.0 (x86_64-unknown-linux-gnu)
```
## `dcr --update`
Self-update. Downloads the latest release binary from GitHub Releases and replaces the current one.
```bash
dcr --update
```
Features:
* Auto-detects platform and architecture
* Warns if installed via AUR (use package manager instead)
* Works on Linux, macOS, Windows

View File

@@ -0,0 +1,51 @@
---
sidebar_label: Contributing
---
# Contributing
## Setup
```bash
git clone https://github.com/dexoron/dcr
cd dcr
cargo build
```
## Code style
All code must be formatted with `cargo fmt`:
```bash
cargo fmt
```
## Linting
```bash
cargo clippy --all-targets -- -D warnings
```
## Tests
```bash
cargo test --all-targets
```
## PR process
1. Fork the repository
2. Create a branch: `git checkout -b feature/description`
3. Make changes
4. Run `cargo fmt && cargo clippy && cargo test`
5. Open a Pull Request
## CI
CI runs:
* `cargo fmt --check`
* `cargo clippy --all-targets -- -D warnings`
* `cargo test --all-targets`
* Build on Linux, macOS, Windows
* Integration tests

View File

@@ -0,0 +1,81 @@
---
sidebar_label: FAQ
---
# FAQ
## Registry not found
```
error: registry not found
```
**Solution:** Make sure `~/.dcr/config.toml` exists:
```toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
```
And check `DCR_INDEX_PATH`:
```bash
echo $DCR_INDEX_PATH
```
## Compiler not found
```
error: compiler not found
```
**Solution:** Ensure a compiler is installed and available in PATH.
```bash
which gcc
which clang
```
Or specify explicitly via `[toolchain]` in `dcr.toml`.
## openssl-sys build failed
When building DCR from source:
```
error: failed to run custom build command for openssl-sys
```
**Solution:** Install OpenSSL development headers:
```bash
# Ubuntu/Debian
sudo apt install libssl-dev
# Fedora
sudo dnf install openssl-devel
# macOS
brew install openssl
```
## Ctrl+C during build
DCR handles SIGINT: interrupts the current compilation and exits with non-zero code.
## How to create a library?
See [Library Recipe](/docs/recipes/library-project).
## How to cross-compile to Windows?
See [Cross-Compile Recipe](/docs/recipes/cross-to-windows).
## How to create a multi-package project?
See [Workspace Recipe](/docs/recipes/multi-package-workspace).
## Lock file
`dcr.lock` is created during builds (`dcr build`) when registry dependencies are present. To force an update — delete `dcr.lock` and run `dcr build`.

View File

@@ -0,0 +1,72 @@
---
sidebar_label: First steps
---
# First Steps
## Create a project
```bash
dcr new my-app
cd my-app
```
Structure:
```
my-app/
├── dcr.toml
└── src/
└── main.c
```
`dcr.toml`:
```toml
[package]
name = "my-app"
version = "0.1.0"
type = "none"
[build]
language = "c"
standard = "c11"
compiler = "clang"
kind = "bin"
```
## Build
```bash
dcr build
```
Output — `target/\<triple>/debug/my-app` (Linux) or `target/debug/my-app.exe` (Windows).
Build profiles:
```bash
dcr build --release # release build
dcr build --debug # debug (default)
```
## Run
```bash
dcr run
```
Builds (if needed) and runs the binary.
## First test
```bash
dcr test --init # create test template
dcr test # run tests
```
## Formatting
```bash
dcr fmt # clang-format with .clang-format
```

View File

@@ -0,0 +1,109 @@
---
sidebar_label: Installation
---
# Installation
## Linux (Dexoron Packages)
Configure your package manager at https://pkg.dexoron.su and install:
**Arch Linux**
```sh
sudo pacman -Sy dcr
```
**Debian/Ubuntu**
```sh
sudo apt update && sudo apt install dcr
```
**Fedora/RHEL**
```sh
sudo dnf install dcr
```
## Arch Linux (AUR)
```sh
yay -S dcr
```
## macOS / Linux (Homebrew)
```sh
brew tap dexoron/dexoron
brew install dcr
```
## Snap (Linux)
```sh
sudo snap install dcrup
```
## Nix (flake)
```sh
nix run github:dexoron/dcr
# or install to profile:
nix profile install github:dexoron/dcr
```
## Cargo (crates.io)
```sh
cargo install dcr
```
## Linux / macOS (script)
```sh
curl -fsSL https://dcr.dexoron.su/install.sh | sh
```
## BSD (script)
```sh
curl -fsSL https://dcr.dexoron.su/install_bsd.sh | sh
```
## Windows (PowerShell)
```powershell
irm https://dcr.dexoron.su/install.ps1 | iex
```
## From source
```sh
git clone https://github.com/dexoron/dcr.git
cd dcr && cargo build --release
ln -sf "$PWD/target/release/dcr" ~/.local/bin/dcr
```
## Post-install
Verify the installation:
```bash
dcr --version
```
Man pages are available after installation:
```bash
man dcr
man dcr-build
```
To use the registry, create `~/.dcr/config.toml`:
```toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
```

View File

@@ -0,0 +1,51 @@
---
sidebar_label: IDE Integration
---
# IDE Integration
## VS Code
```bash
dcr gen vscode
```
Generates in `.vscode/`:
| File | Purpose |
| ----------------- | -------------------------------------------- |
| `tasks.json` | `build` task (dcr build) |
| `launch.json` | Debug launch configuration |
| `settings.json` | clangd/IntelliSense: include paths, standard |
| `extensions.json` | Recommends vscode-clangd, vscode-lldb |
## CLion
```bash
dcr gen clion
```
Generates in `.idea/`:
| File | Purpose |
| ------------------------------------------------ | ----------------------------------------- |
| `externalTools.xml` | Build, Run, Clean, Test as external tools |
| `customTargets.xml` | Custom build targets |
| `misc.xml` | C/C++ project settings |
| `runConfigurations/\<name>.xml` | Per-binary run configurations |
## compile_commands.json
```bash
dcr gen compile-commands
```
Generates `compile_commands.json` at project root. Standard format for clangd, C/C++ IntelliSense, static analyzers.
## project-info
```bash
dcr gen project-info
```
Outputs JSON array with project metadata (see [gen-commands](/docs/commands/gen-commands)).

View File

@@ -0,0 +1,46 @@
---
sidebar_label: License
---
# License
## DCR
DCR itself is [GPL-3.0-or-later](https://spdx.org/licenses/GPL-3.0-or-later.html) licensed.
> **Note:** DCR is a build tool, not a library. The GPL applies only to DCR's own source code. Projects built with DCR are not subject to DCR's license — their licensing is determined solely by their own code and dependencies.
## Vendored libraries
DCR statically links the following C libraries through its vendored Rust dependencies:
| Library | License | Bundled by |
| ------------------------------------------ | ------------------ | ----------------------------- |
| [libgit2](https://libgit2.org) | MIT OR Apache-2.0 | `git2` / `libgit2-sys` |
| [libssh2](https://libssh2.org) | MIT OR Apache-2.0 | `libgit2-sys` |
| [zlib](https://zlib.net) | MIT OR Apache-2.0 | `libgit2-sys` |
| [OpenSSL](https://openssl.org) | Apache-2.0 | `openssl-sys` / `openssl-src` |
| [ring](https://github.com/briansmith/ring) | Apache-2.0 AND ISC | `rustls` |
## Rust dependencies
DCR is written in Rust. The following notable Rust crates are statically linked:
| Crate | License |
| --------------------------------------------- | ------------------------ |
| [`reqwest`](https://crates.io/crates/reqwest) | MIT OR Apache-2.0 |
| [`rustls`](https://crates.io/crates/rustls) | Apache-2.0 OR ISC OR MIT |
| [`serde`](https://crates.io/crates/serde) | MIT OR Apache-2.0 |
| [`toml`](https://crates.io/crates/toml) | MIT OR Apache-2.0 |
| [`sha2`](https://crates.io/crates/sha2) | MIT OR Apache-2.0 |
| [`git2`](https://crates.io/crates/git2) | MIT OR Apache-2.0 |
| [`openssl`](https://crates.io/crates/openssl) | Apache-2.0 |
| [`tokio`](https://crates.io/crates/tokio) | MIT |
| [`hyper`](https://crates.io/crates/hyper) | MIT |
| [`ctrlc`](https://crates.io/crates/ctrlc) | MIT OR Apache-2.0 |
Full dependency tree (143 packages) is available in [`Cargo.lock`](https://github.com/dexoron/dcr/blob/main/Cargo.lock). The overwhelming majority are dual-licensed under MIT OR Apache-2.0.
## Additional credits
* DCR's CLI design and project model are inspired by [Cargo](https://doc.rust-lang.org/cargo/).

View File

@@ -0,0 +1,49 @@
---
sidebar_label: Cross-compile to Windows
---
# Cross-Compile to Windows from Linux
Building a Windows binary on Linux using mingw-w64.
## Install toolchain
```bash
# Ubuntu/Debian
sudo apt install mingw-w64
# Fedora
sudo dnf install mingw64-gcc mingw64-binutils
```
## Configuration
```toml
[package]
name = "my-app"
version = "0.1.0"
type = "none"
[build]
language = "c"
standard = "c11"
compiler = "clang"
kind = "bin"
target = "x86_64-pc-windows-gnu" # explicit mingw, not msvc
```
## Build
```bash
dcr build --target x86_64-pc-windows-gnu --release
```
Artifact: `target/x86_64-pc-windows-gnu/release/my-app.exe`.
## Custom toolchain
```toml
[toolchain]
cc = "x86_64-w64-mingw32-gcc"
cxx = "x86_64-w64-mingw32-g++"
```

View File

@@ -0,0 +1,70 @@
---
sidebar_label: Library project
---
# Library Project
Creating a static library and using it in another project.
## Step 1: Create the library
```bash
dcr new my-lib
cd my-lib
```
`dcr.toml`:
```toml
[package]
name = "my-lib"
version = "0.1.0"
type = "none"
[build]
language = "c"
standard = "c11"
kind = "staticlib"
```
`src/my_lib.h`:
```c
#ifndef MY_LIB_H
#define MY_LIB_H
int add(int a, int b);
#endif
```
`src/my_lib.c`:
```c
#include "my_lib.h"
int add(int a, int b) { return a + b; }
```
## Step 2: Build
```bash
dcr build --release
```
Artifacts:
* `target/\<triple>/release/libmy-lib.a` (Linux)
* `target/release/my-lib.lib` (Windows)
* `target/include/` — header files
## Step 3: Use in another project
```bash
dcr new my-app
cd my-app
dcr add my-lib ../my-lib
```
Automatically:
* Adds include path to `target/include/` of the library
* Adds lib path to `target/\<triple>/release/`
* Links `libmy-lib.a` / `my-lib.lib`

View File

@@ -0,0 +1,102 @@
---
sidebar_label: Multi-package workspace
---
# Multi-Package Workspace
A project with three packages: two libraries and a binary.
## Structure
```
workspace/
├── dcr.toml # root workspace
├── lib-core/
│ ├── dcr.toml
│ └── src/core.c
├── lib-utils/
│ ├── dcr.toml
│ └── src/utils.c
└── app/
├── dcr.toml
└── src/main.c
```
## Root dcr.toml
```toml
[package]
name = "my-workspace"
version = "0.1.0"
type = "none"
[build]
inherit = true
language = "c"
standard = "c11"
[workspace.lib-core]
path = "lib-core"
[workspace.lib-utils]
path = "lib-utils"
deps = ["lib-core"]
[workspace.app]
path = "app"
deps = ["lib-core", "lib-utils"]
main = true
```
## Packages
`lib-core/dcr.toml`:
```toml
[package]
name = "lib-core"
version = "0.1.0"
type = "none"
[build]
kind = "staticlib"
```
`lib-utils/dcr.toml`:
```toml
[package]
name = "lib-utils"
version = "0.1.0"
type = "none"
[build]
kind = "staticlib"
```
`app/dcr.toml`:
```toml
[package]
name = "app"
version = "0.1.0"
type = "none"
[build]
kind = "bin"
```
## Build
```bash
cd workspace
dcr build # builds everything in correct order
dcr build --workspace app # only app (lib-core and lib-utils built as deps)
dcr run # builds and runs main package
```
Build order (topological sort):
1. `lib-core`
2. `lib-utils` (depends on lib-core)
3. `app` (depends on lib-core, lib-utils)

View File

@@ -0,0 +1,82 @@
---
sidebar_label: Build profiles
---
# Build Profiles
Profiles allow overriding `[build]` fields for specific build modes.
## Configuration
```toml
[build]
language = "c"
standard = "c17"
cflags = ["-Wall"]
[build.debug]
cflags = ["-O0", "-g"]
[build.release]
cflags = ["-O3", "-DNDEBUG"]
```
## Merge rules
Fields from `[build.\<profile>]` are merged on top of `[build]`:
* **Scalar fields** (strings, numbers, bools) — replaced
* **Arrays** (`cflags`, `ldflags`, ...) — **appended** (extend the `[build]` array)
Set `inherit = false` to disable array inheritance (only profile's own arrays are used).
## Built-in profiles
The default flags for each profile are composed from three config fields:
| Field | debug default | release default |
| ----------- | ------------------ | --------------- |
| `opt_level` | `"0"` | `"3"` |
| `debug` | `true` | `false` |
| `warnings` | `["all", "extra"]` | `[]` |
Which produce the equivalent compiler flags:
| Profile | Effective flags |
| --------- | ---------------------------------------------------------- |
| `debug` | `-O0 -g -Wall -Wextra -fno-omit-frame-pointer -DDCR_DEBUG` |
| `release` | `-O3 -DNDEBUG` |
Additional build options can be toggled per-profile:
```toml
[build.release]
opt_level = "z"
lto = true
strip = true
panic = "abort"
codegen-units = "1"
[build.debug]
opt_level = "1"
debug = false
warnings = ["all", "error"]
```
## Target-specific profiles
```toml
[build.linux]
cflags = ["-DLINUX"]
[build.windows.debug]
cflags = ["-DWIN32", "-O0", "-g"]
```
Application order (highest priority first):
1. `[build.\<target>.\<profile>]`
2. `[build.\<profile>.\<target>]`
3. `[build.\<target>]`
4. `[build.\<profile>]`
5. `[build]`

View File

@@ -0,0 +1,131 @@
---
sidebar_label: Build system
---
# Build System
## Compiler Backends
DCR supports 7 compilation backends. Selection is automatic based on file extension and `build.compiler` value.
| Backend | Files | When used |
| --------- | --------------------------------- | ------------------------------------- |
| `unix_cc` | `.c`, `.cpp`, `.cxx`, `.cc`, `.S` | gcc/clang on Linux/macOS/BSD |
| `msvc` | `.c`, `.cpp`, `.cxx`, `.cc` | Windows (cl, clang-cl) |
| `gas` | `.s` | ARM/ARM64 assembler (no preprocessor) |
| `nasm` | `.asm`, `.s` | x86/x86_64 NASM assembler |
| `masm` | `.asm` | MASM (ml/ml64) on Windows |
| `fasm` | `.asm`, `.fasm` | Flat Assembler |
| `llvm_ir` | `.ll` | LLVM IR via `llc -filetype=obj` |
## Qt Support
DCR provides native Qt support for automatic meta-object handling (MOC, UIC, RCC).
Enable it by setting `build.qt = true` in `dcr.toml`. DCR will automatically detect Qt-related files (`.ui`, `.qrc`, `.h` with `Q_OBJECT`) and process them.
```toml
[build]
qt = true
```
*Note: Requires `qt6` modules (Core, Widgets, Gui, Svg) installed via `pkg-config`.*
Advanced customization is still possible via `build.steps` if special handling is needed:
```toml
[build.steps]
moc = "moc {in} -o {out}"
```
### Unix CC
* Compiler resolved via `resolve_compiler()`: `DCR_COMPILER` > `DCR_CC` > `[toolchain]` > `build.compiler` > `PATH`
* Supports `.d` files for header dependency tracking
* Flags: `-std=`, `-MMD -MF`, `-c -o`, `-I`, `-L`, `-l`
* Conditional flags based on config:
* `freestanding` or bare-metal target: `-ffreestanding` (compile), `-nostdlib -static` (link)
* `lto`: `-flto` (compile + link)
* `panic = "abort"`: `-fno-exceptions` (C++ only), `-fno-unwind-tables`, `-fno-asynchronous-unwind-tables`
### MSVC
* Supports cl.exe and clang-cl.exe
* Flags: `/std:`, `/Fo:`, `/Fe:`, `/I`, `/link`
### GAS / NASM / MASM / FASM / LLVM-IR
* GAS: `-I`, `-c -o`, `--defsym`
* NASM: `-I`, `-o`, `-D`, `-f` (format: win64/elf64/macho64/macho32/elf32)
* MASM: `/nologo /c /Fo\<obj> <source>`
* FASM: `<source> \<output>` (output path is the object file)
* LLVM IR: `-filetype=obj <source> -o \<output>`
## Incremental Builds
Three levels of incrementality:
1. **mtime** — if output is newer than all inputs, skip
2. **`.d` files** — header change tracking (including transitive)
3. **SHA256 fingerprint** — recompile if compiler flags changed (stored in `.dcr_fingerprint`)
## Parallel Compilation
* `thread::scope` for thread pool
* Atomic task queue (`AtomicU64`)
* Mutex on stdout (`OUTPUT_MUTEX`)
* Thread count = `available_parallelism()`, capped by `build.codegen-units` if set
## Build Kinds
| Kind | Type | Path (Linux example) |
| ----------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `bin` | Executable | `target/\<triple>/\<profile>/\<name>` (.exe on Windows) |
| `staticlib` | Static library | `target/\<triple>/\<profile>/lib\<name>.a` (.lib) |
| `sharedlib` | Dynamic library | `target/\<triple>/\<profile>/lib\<name>.so` (.dll/.dylib) |
| `efi` | UEFI application | `target/\<triple>/\<profile>/\<name>.efi` |
| `elf` | ELF without stdlib | `target/\<triple>/\<profile>/\<name>` |
| `none` | Compile only, no link | — |
| `custom` | Full filename+extension control | `target/\<triple>/\<profile>/\<filename>.\<extension>` |
## Build Steps
DCR supports pre-build and post-build steps:
* `build.steps` — commands before compilation
* `build.post_steps` — commands after compilation
Substitutions: `{stem}`, `{in}`, `{out}`, `{profile}`, `{version}`, `{name}`.
Example Qt codegen via build steps:
```toml
[build.steps]
moc = "moc {in} -o {out}"
```
## pkg-config
Automatic lookup (read from raw config):
```toml
[build]
pkg_config = ["sdl2", "gl"]
```
DCR runs `pkg-config --cflags sdl2 gl` and `pkg-config --libs sdl2 gl` and adds results to compiler/linker flags.
## Variable Substitution
Supported variables:
| Variable | Description |
| ----------------------- | ---------------------------- |
| `{version}` | Package version |
| `{version_major}` | Major version part |
| `{version_minor}` | Minor version part |
| `{version_patch}` | Patch version |
| `{version_suffix}` | Suffix (e.g., `-rc1`) |
| `{version_suffix_dash}` | Suffix with dash |
| `{profile}` | Profile name (debug/release) |
| `{name}` | Package name |

View File

@@ -0,0 +1,70 @@
---
sidebar_label: Cross-compilation
---
# Cross-Compilation
## Short Names
DCR supports short platform names:
| Short Name | Full Triple |
| ---------- | -------------------------- |
| `linux` | `x86_64-unknown-linux-gnu` |
| `macos` | `x86_64-apple-darwin` |
| `windows` | `x86_64-pc-windows-msvc` |
```bash
dcr build --target windows
```
## Full Triples
```bash
dcr build --target aarch64-unknown-linux-gnu
dcr build --target x86_64-pc-windows-gnu # mingw
dcr build --target armv7-unknown-linux-gnueabihf
```
## clang --target
When using clang, DCR injects `--target=\<triple>` into CFLAGS.
```toml
[build]
compiler = "clang"
target = "aarch64-unknown-linux-gnu"
# Auto: cflags += ["--target=aarch64-unknown-linux-gnu"]
```
## Bare-Metal / Freestanding
For targets containing `none`, `-elf`, `eabi`, or `baremetal`, DCR automatically:
1. **Disables default flags** — no system include paths, no `-l` libc
2. **Injects `-ffreestanding`** at compile time and `-nostdlib -static` at link time
You can also enable freestanding mode explicitly:
```toml
[build]
freestanding = true
```
```bash
dcr build --target aarch64-none-elf
```
## Target Directory
On Linux with explicit target:
```
target/<triple>/<profile>/
```
On macOS/Windows or without target:
```
target/<profile>/
```

View File

@@ -0,0 +1,152 @@
---
sidebar_label: dcr.toml overview
---
# dcr.toml
Main project configuration file. Located at the project root.
## Structure
```toml
[package]
# required fields
[build]
# build settings
[build.debug] # optional: debug override
[build.release] # optional: release override
[build.linux] # optional: Linux override
[build.windows] # optional: Windows override
[build.windows.debug] # target + profile combination
[toolchain]
# compiler/linker paths
[dependencies]
# project dependencies
[workspace]
# multi-package configuration
[run]
# run settings
```
## [package]
| Field | Required | Description |
| --------- | -------- | ----------------------- |
| `name` | yes | Project name |
| `version` | yes | Semantic version |
| `type` | yes | `app`, `lib`, `none` |
| `license` | no | SPDX license identifier |
| `author` | no | Author |
```toml
[package]
name = "my-app"
version = "0.1.0"
type = "app"
license = "MIT"
author = "John Doe"
```
## [build]
...
* `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`.
| Field | Default | Description |
| ---------------- | ------------------------------------------- | --------------------------------------------------------------------- |
| `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` |
| `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) |
| `cxx_standard` | `"c++20"` | C++ standard (`c++17`, `c++20`, `c++23`) |
| `compiler` | `"clang"` | Preferred compiler |
| `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` |
| `target` | host | Target triple for cross-compilation |
| `platform` | `"native"` | `native`, `efi` |
| `cflags` | `[]` | Additional C/C++/ASM flags |
| `ldflags` | `[]` | Additional linker flags |
| `filename` | `""` | Custom output file name |
| `extension` | `""` | Custom file extension |
| `roots` | `["src"]` | Source root directories |
| `exclude` | `[]` | Exclude patterns |
| `include` | `[]` | Additional include directories |
| `src_disable` | `false` | Disable auto source discovery |
| `inherit` | `false` | Inherit build from workspace root |
| `clean` | `[]` | Glob patterns for custom clean paths |
| `out_dir` | `""` | Custom output directory |
| `workspace_only` | `false` | Workspace-only, not built standalone |
| `freestanding` | `false` | Compile in freestanding mode (`-ffreestanding` + `-nostdlib -static`) |
| `opt_level` | `"0"` (debug) / `"3"` (release) | Optimization level: `0`-`3`, `"s"`, `"z"` |
| `debug` | `true` (debug) / `false` (release) | Emit debug symbols (`-g`) |
| `lto` | `false` | Link-time optimization (`-flto` for both compiler and linker) |
| `strip` | `false` | Strip symbols from output (`-s` in ldflags) |
| `warnings` | `["all", "extra"]` (debug) / `[]` (release) | Warning flags (e.g. `"all"`, `"extra"`, `"pedantic"`) |
| `panic` | `""` | Panic strategy: `"abort"` disables exceptions and unwind tables |
| `codegen-units` | `""` | Max parallel compilation jobs (`"0"` = auto) |
| `qt` | `false` | Enable automatic Qt meta-object handling (MOC, UIC, RCC) |
Settings from raw config (not in typed struct):
* `pkg_config` — list of pkg-config packages
* `ldscript` — linker script path
* `build.steps` / `build.post_steps` — codegen steps
Example:
```toml
[build]
language = "c++"
standard = "c23"
cxx_standard = "c++23"
compiler = "clang"
kind = "sharedlib"
cflags = ["-Wall", "-Wextra"]
opt_level = "z"
lto = true
strip = true
panic = "abort"
codegen-units = "2"
```
## [toolchain]
```toml
[toolchain]
cc = "/usr/bin/clang"
cxx = "/usr/bin/clang++"
as = "/usr/bin/as"
ar = "/usr/bin/ar"
ld = "/usr/bin/ld.lld"
```
Raw config also supports `uic`, `moc`, `rcc` for Qt codegen.
## [dependencies]
See [dependencies](/docs/reference/dependencies).
## [run]
```toml
[run]
cmd = "./target/{profile}/{name}"
```
Substitutions:
* `{version}` — package version
* `{version_major}`, `{version_minor}`, `{version_patch}`, `{version_suffix}`, `{version_suffix_dash}` — version parts
* `{profile}` — debug / release
* `{name}` — package name
Default `cmd` = `./target/{profile}/{name}` (macOS/Windows) or `./target/\<triple>/\<profile>/\<name>` (Linux).
## [workspace]
See [workspaces](/docs/reference/workspaces).

View File

@@ -0,0 +1,84 @@
---
sidebar_label: Dependencies
---
# Dependencies
## Formats
The `[dependencies]` section supports three formats:
### String (registry)
```toml
[dependencies]
fmt = "10.1.1"
spdlog = "1.12"
catch2 = "3.4.0"
```
The version string is used as-is for registry lookup.
### Table (git)
```toml
[dependencies]
fmt = { git = "https://github.com/fmtlib/fmt", tag = "10.1.1" }
```
Fields: `git`, `branch`, `tag`, `rev`.
### Table (path)
```toml
[dependencies]
mylib = { path = "../mylib" }
```
## Registry
DCR uses a package registry for dependency lookup by name.
```toml
# ~/.dcr/config.toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
```
Registry priority: order in `config.toml`. The `DCR_INDEX_PATH` variable overrides the path to `index.json`.
## Git dependencies
DCR clones git repositories via `git2`:
* `branch` — switch to a branch
* `tag` — switch to a tag
* `rev` — switch to a specific commit
* `features` — feature flags (parsed, but does not affect build)
Cache path: `~/.dcr/git/\<hash>/`.
## Path dependencies
Local paths. DCR automatically discovers include and lib directories from the neighbor's `dcr.toml`.
```toml
[dependencies]
mylib = { path = "/abs/path/to/lib" }
mylib = { path = "../relative/path" }
```
## dcr.lock
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`.
## Resolution process
1. Load all dependencies (registry → git → path)
2. For path deps: recursively read their `dcr.toml`
3. For registry deps: search `index.json`
4. For git deps: clone to cache
5. Collect `include_dirs`, `lib_dirs`, `libs` for the compiler

View File

@@ -0,0 +1,60 @@
---
sidebar_label: Environment variables
---
# Environment Variables
## DCR_COMPILER
Overrides the compiler for all languages. **Highest priority.**
```bash
export DCR_COMPILER=clang
dcr build
```
Compiler resolution priority:
1. `DCR_COMPILER` (env)
2. `DCR_CC` / `DCR_CXX` / `DCR_AS` (env)
3. `[toolchain]` (dcr.toml)
4. `build.compiler` (dcr.toml)
5. `PATH`
## DCR_CC / DCR_CXX / DCR_AS
Per-language override (lower priority than `DCR_COMPILER`, higher than `[toolchain]`).
```bash
export DCR_CC=gcc-14
export DCR_CXX=g++-14
export DCR_AS=arm-linux-gnueabihf-as
```
## DCR_LD / DCR_AR
Override linker and archiver.
```bash
export DCR_LD=ld.lld
export DCR_AR=llvm-ar
```
## DCR_DEBUG
Enables debug mode — prints all compilation commands to stderr before execution.
```bash
export DCR_DEBUG=1
dcr build
```
## DCR_INDEX_PATH
Overrides the path to the registry `index.json`.
```bash
export DCR_INDEX_PATH=/custom/path/index.json
```
Default: `~/.dcr/index.json`.

View File

@@ -0,0 +1,51 @@
---
sidebar_label: Platform support
---
# Platform Support
## Target Triples
DCR normalizes target triples. Short platform names are expanded to full triples.
### Linux
```
target/<arch>-unknown-linux-gnu/<profile>/
```
Architectures: `x86_64`, `aarch64` (host-detected).
Artifact type: ELF. Extensions: `.so` (sharedlib), `.a` (staticlib).
### macOS
```
target/<profile>/
```
Architectures: `x86_64`, `aarch64` (host-detected).
Extensions: `.dylib` (sharedlib), `.a` (staticlib).
### Windows
```
target/<profile>/
```
Architectures: `x86_64`, `aarch64`.
Extensions: `.exe` (bin), `.lib` (staticlib), `.dll` (sharedlib), `.efi` (UEFI).
### BSD
```
target/<arch>-unknown-<os>/<profile>/
```
Supported systems: `freebsd`, `openbsd`, `netbsd`, `dragonfly`.
## Host Detection
DCR uses `std::env::consts::ARCH` and `std::env::consts::OS` for host platform detection. Used as fallback when `target` is not specified.

View File

@@ -0,0 +1,67 @@
---
sidebar_label: Workspaces
---
# Workspaces
Workspaces allow managing multiple packages in a single repository.
## Configuration
```toml
[workspace.lib-core]
path = "lib-core"
[workspace.lib-utils]
path = "lib-utils"
deps = ["lib-core"]
[workspace.app]
path = "app"
deps = ["lib-core", "lib-utils"]
main = true
```
### Member fields
| Field | Description |
| ------ | ------------------------------------------------ |
| `path` | Path to the package (relative to workspace root) |
| `deps` | Dependencies on other members |
| `main` | Mark as the main package |
## Topological sort
DCR automatically sorts packages by dependencies: package A is built before B if B depends on A.
Cyclic dependencies are detected and cause an error.
## Build
```bash
dcr build # build all packages in dependency order
dcr build --workspace app # build only app (dependencies built automatically)
```
When building a workspace, member outputs (libraries) are automatically added to include/lib paths of dependent packages.
## Clean
```bash
dcr clean # clean only root target/
dcr clean --all # clean target/ of all packages
```
## Inheritance
If a member has `inherit = true` in its `[build]` section, fields from the root `[build]` are merged into the member:
```toml
# root dcr.toml
[build]
inherit = true
language = "c"
standard = "c17"
# member inherits language and standard
```

View File

@@ -0,0 +1,46 @@
---
sidebar_label: Self Update
---
# Self Update
## dcr --update
Automatic update to the latest version. Downloads a binary (not an archive) from GitHub Releases and replaces the current executable.
```bash
dcr --update
```
## How it works
1. DCR detects the current platform and architecture
2. Fetches the latest release from `api.github.com/repos/dexoron/dcr/releases/latest`
3. Compares versions
4. Downloads the matching asset (direct binary URL, not archive)
5. Replaces the current executable via `self_replace`
## Asset naming
Pattern: `dcr-\<triple>` or `dcr-\<triple>.exe`
| Platform | Asset name |
| -------------- | -------------------------------- |
| Linux x86_64 | `dcr-x86_64-unknown-linux-gnu` |
| macOS x86_64 | `dcr-x86_64-apple-darwin` |
| macOS ARM64 | `dcr-aarch64-apple-darwin` |
| Windows x86_64 | `dcr-x86_64-pc-windows-msvc.exe` |
## AUR
If DCR was installed via AUR, `--update` shows a warning:
```
Update via package manager: yay/paru -Syu {package_name} or sudo pacman -Syu {package_name}
```
## Errors
* Cannot detect platform — error
* Cannot fetch release — error with URL
* No write permission — error (use `sudo` or manual install)

View File

@@ -0,0 +1,45 @@
---
sidebar_label: Running tests
---
# Running Tests
## Execution
```bash
dcr test
```
Builds the project, then compiles and runs test files from `tests/`.
## Profiles
```bash
dcr test # debug (default)
dcr test --release # release
dcr test --debug # explicit debug
```
## Output
```
=====================
Testsuite summary
=====================
TOTAL: 5
PASS: 3
SKIP: 1
FAIL: 1
=====================
```
## Exit code
* 0 — all tests passed (FAIL = 0)
* 1 — test failures or build error
## What gets built
* All `.c` files from `tests/` (`.cpp` not supported)
* Include path: `tests/` (for `dcr_test.h`)
* Linked with project if `package.type = "lib"` or `kind = "staticlib"`/`"sharedlib"`

View File

@@ -0,0 +1,69 @@
---
sidebar_label: Test framework (EXPECT, TEST, ...)
---
# Test Framework
DCR has a built-in minimal test framework for C.
## Macros
### `EXPECT(expr)`
Asserts that an expression is true.
```c
EXPECT(1 + 1 == 2);
EXPECT(ptr != NULL);
```
### `SKIP(reason)`
Skips a test with a message.
```c
SKIP("not implemented on Windows");
```
### `TEST(name)`
Defines a test.
```c
TEST(addition) {
EXPECT(1 + 1 == 2);
EXPECT(2 + 2 == 4);
}
```
### `TEST_CASE(name)`
Registers a test case.
```c
TEST_CASE(math) {
EXPECT(1 + 1 == 2);
}
```
## Initialization
```bash
dcr test --init
```
Creates:
* `tests/dcr_test.h` — framework header (do not edit)
* `tests/test.c` — template with example test
## Structure
```
tests/
├── dcr_test.h # framework (do not edit)
├── test.c # main tests
└── ... # additional .c test files
```
Only `.c` files are compiled (`.cpp` is not supported).

View File

@@ -0,0 +1,63 @@
---
sidebar_label: Introduction
---
# DCR — C/C++ Build Tool & Package Manager
<details>
<summary>Quick reference</summary>
```bash
# Installation
curl -fsSL https://dcr.dexoron.su/install.sh | sh
# Create a project
dcr new my-app
cd my-app
# Build and run
dcr build
dcr run
# Run tests
dcr test
# Add a dependency
dcr add fmt
# Generate IDE files
dcr gen vscode
```
</details>
## Contents
| Section | Description |
| ----------------------------------------------------- | --------------------------------------------- |
| [Getting Started](/docs/getting-started/installation) | Installation and first steps |
| [Commands](/docs/commands/project-commands) | All CLI commands |
| [Reference](/docs/reference/dcr-toml) | Configuration, build, dependencies, platforms |
| [Testing](/docs/testing/test-framework) | Built-in test framework |
| [Recipes](/docs/recipes/cross-to-windows) | Common scenarios |
| [IDE Integration](/docs/ide-integration) | VS Code, CLion, compile_commands.json |
| [Self Update](/docs/self-update) | Auto-update |
| [FAQ](/docs/faq) | Frequently asked questions |
| [Changelog](/docs/changelog) | Version history |
| [License](/docs/license) | DCR and vendored library licenses |
| [Contributing](/docs/contributing) | DCR development |
## Features
* **Incremental builds** — mtime + `.d` headers + SHA256 fingerprint
* **Parallel compilation** — thread::scope, atomic task queue
* **4 backends** — gcc/clang, MSVC/clang-cl, GAS (ARM), NASM (x86)
* **7 project kinds** — bin, staticlib, sharedlib, efi, elf, none, custom
* **Cross-compilation** — short names and full triples
* **Profiles** — debug / release with field overrides
* **Workspaces** — multi-package projects with topological sort
* **Registry + Git + Path** — three dependency mechanisms
* **IDE generation** — VS Code, CLion, compile_commands.json, JSON metadata
* **pkg-config** — automatic system library discovery
* **Per-command `--help`** — `dcr build --help`, `dcr new --help`, etc.
* **Man pages** — `man dcr`, `man dcr-build`, `man dcr-new`

View File

@@ -0,0 +1,91 @@
---
sidebar_label: Changelog
---
# Changelog
## 0.7.1 (2026-06-02)
### Added
* **`--help` for all commands** — `dcr build --help`, `dcr run --help`, `dcr new --help`,
`dcr init --help`, `dcr clean --help`, `dcr add --help`, `dcr fmt --help`,
`dcr setup --help`, `dcr tree --help`, `dcr gen --help`, `dcr --update --help`,
`dcr test --help`. All output uses styled headers (green) and usage lines (cyan).
* **Man pages** — 12 troff pages in `man/man1/`: `dcr.1`, `dcr-build.1`,
`dcr-run.1`, `dcr-new.1`, `dcr-init.1`, `dcr-clean.1`, `dcr-add.1`, `dcr-test.1`,
`dcr-gen.1`, `dcr-fmt.1`, `dcr-tree.1`, `dcr-setup.1`.
* **Man pages in all packaging** — install.sh, install_bsd.sh, AUR PKGBUILD,
Debian (cargo-deb), RPM (cargo-generate-rpm), Nix (postInstall), Homebrew
(resource), Snap, GitHub Release assets.
* **Project name validation** — `dcr init` and `dcr new` now validate names before
creating files. Only ASCII letters, digits, `_` and `-` are allowed.
* **`documentation` and `homepage` fields** — added to `Cargo.toml`.
* **Release profile optimizations** — `opt-level = "z"`, LTO, `codegen-units = 1`,
`panic = "abort"`, `strip = true` for smaller binaries.
* **Linux i686, armv7, riscv64 targets** — added to release workflow and install scripts.
* **Linux musl i686, armv7 targets** — cross-compiled via zigbuild in CI.
* **AUR packages** — `dcr-dev`, `dcr-dev-bin` publishing workflow.
* **Snap publishing** — automated Snapcraft publishing in CI.
* **Snap badge** — in README.
### Changed
* **`validate_package_name` made public** — callable from CLI commands.
* **README platform table** — reorganized: libc variants as separate OS rows,
removed extra columns. Linux architecture list updated.
* **`gen.rs` no-args output** — now uses styled output instead of raw `eprintln!`.
* **`tree.rs`, `fmt.rs`, and `setup.rs`** — now accept arguments for `--help`.
* **README install commands** — `| bash` → `| sh` for POSIX compatibility.
### Fixed
* **`dcr new \<invalid-name>` creates directory then fails** — validation now
happens before any file operations.
* **`dcr init` on invalid directory name** — same fix.
* **Man pages missing in installed packages** — now shipped in all formats.
* **Windows drive letter false positive** — in dependency file parser.
* **CRLF (`\r\n`) breaks dependency parser** — now handles mixed line endings.
* **Newline after backslash not consumed** — in `parse_d_file` escape handling.
## 0.7.0 (2026-06-01)
### Added
* **OpenBSD and NetBSD target support** — full platform routing with dynamic target triples using `std::env::consts::ARCH` and `std::env::consts::OS`. Affects `build`, `run`, `clean` commands and the platform module.
* **`src/platform/bsd.rs`** — new BSD platform module (shared by FreeBSD, OpenBSD, NetBSD) providing `bin_path`, `lib_path`, `elf_path`, `efi_path`, `shared_lib_path`.
* **`build.out_dir` config option** — custom output directory that overrides the default `target/\<triple>/\<profile>` path for final artifacts. Supported in `build`, `run`, and config validation.
* **`dcr fmt` command** — new CLI command that formats all C/C++ source files (`*.c`, `*.cpp`, `*.h`, `*.hpp`) in `src/` and `tests/` using `clang-format`.
* **Incremental linking** — `needs_link()` in `common.rs` checks if any object file is newer than the linked output, skipping unnecessary relinking. Implemented for all backends (`unix_cc`, `msvc`, `gas`, `nasm`).
* **`build.kind = "none"` and `"custom"`** — two new project kinds for special build scenarios that don't produce standard artifacts.
* **`install_bsd.sh`** — POSIX-compliant installation script for BSD systems (FreeBSD, OpenBSD, NetBSD) with binary download and source build modes.
* **Linux ARM64 support in `install.sh`** — added `Linux:aarch64|Linux:arm64` target detection for pre-built binary downloads.
* **BSD OS detection in `install.sh`** — detects FreeBSD, OpenBSD, NetBSD and determines target triple.
* **`rust-toolchain.toml`** — explicit toolchain pinning to `stable` channel.
* **Integration tests** — `build_with_target_config` (verifies `build.target = "linux"`) and `build_with_out_dir` (validates custom output directory).
* **`get_build_string_with_profile` made `pub`** — so `run.rs` can determine custom output directory configuration.
### Changed
* **`build.target` semantics changed** — now strictly contains a target triple (e.g., `x86_64-unknown-linux-gnu`) or short name (`linux`, `macos`, `windows`). No longer used as custom output directory — this functionality moved to `build.out_dir`.
* **`build.standard` made optional** — changed from `String` to `Option\<String>`. Validation only enforces non-empty for non-ASM languages. Skipped in `dcr.toml` output if empty.
* **`dcr run` with `out_dir`** — now determines target directory respecting `build.out_dir` via `get_build_string_with_profile()` from `build.rs`.
* **`collect_sources()` returns empty vector** instead of error when no sources are found, allowing `kind = "none"` or `kind = "custom"` projects with no source files.
* **CI/CD release workflow refactored** — `git2` made target-specific (no vendored-openssl on Windows), Zig-based cross-compilation for non-x86_64 Linux targets, Arch Linux package version cleanup (dashes → dots), `gmake` symlink for NetBSD.
* **README compatibility table** — FreeBSD, OpenBSD, NetBSD build/run status upgraded from "community/best-effort" to "officially supported".
* **Documentation updated** — `build-section.md` describes new `build.target` and `build.out_dir` fields. `target-directory.md` rewritten to clarify the distinction.
### Fixed
* **stdout/stderr not inherited in `dcr run`** — child process output was captured and manually printed, breaking interactive programs. Fixed by switching to `Command::status()`.
* **Race condition in release CI** — matrix build jobs could upload assets to a release that didn't exist yet. Fixed by adding a dedicated `create-release` job.
* **Release GHA — stable toolchain override** — fixed Rust toolchain override issues in CI.
* **Arch Linux package version sanitization** — version strings with dashes (e.g., `0.7.0-dev`) are invalid for `pkgver`. Fixed by replacing dashes with dots.
* **GPG permissions after Docker** — Docker operations changed GPG directory ownership. Fixed by running `chown` after Docker commands.
* **RPM artifact paths** — RPM artifacts were placed in `rpm/x86_64/` instead of `fedora/x86_64/`. Fixed in Dexoron Packages Index workflow.
* **JSON parsing reliability in `install.sh`** — added `jq` as primary parser with `python3` fallback for dev channel release lookup.
### Removed
* **`format_roots()` helper function** — removed from `common.rs`. Was only used by the old error handling path in `collect_sources()`.
* **Per-distribution artifact download steps** — three separate `actions/download-artifact` steps replaced with unified `gh release download --clobber`.

View File

@@ -0,0 +1,42 @@
---
sidebar_label: Build commands (build, run, clean)
---
# Build Commands
## `dcr build`
Builds the project according to `dcr.toml`.
```bash
dcr build # debug profile
dcr build --release # release build
dcr build --debug # explicit debug
dcr build --target aarch64-unknown-linux-gnu
dcr build --force # full rebuild
dcr build --clean # clean + build
dcr build --verbose # show compilation commands
dcr build --workspace pkg-a # build specific workspace package
```
Artifacts: `target/\<triple>/\<profile>/\<binary-name>` (Linux with explicit target).
## `dcr run`
Builds (if sources are newer than artifacts) and runs the binary.
```bash
dcr run
dcr run --release
```
## `dcr clean`
Removes `target/` directory (or `target/\<target>/\<profile>`).
```bash
dcr clean
dcr clean --release # target/release/ only
dcr clean --target windows # target/x86_64-pc-windows-msvc/
dcr clean --all # clean all workspace packages
```

View File

@@ -0,0 +1,53 @@
---
sidebar_label: Dependency commands (add, tree)
---
# Dependency Commands
## `dcr add \<name> [source]`
Adds a dependency to `dcr.toml`.
```bash
dcr add fmt # registry lookup
dcr add mylib ../path/to/lib # path as source
dcr add mylib path:./lib # explicit path prefix
dcr add mylib git:https://github.com/user/repo # explicit git prefix
dcr add mylib github:user/repo # GitHub shorthand
dcr add mylib gitlab:user/repo # GitLab shorthand
```
Source prefixes:
* `path:` — local path
* `git:` — generic git URL
* `github:` — expands to `https://github.com/\<user>/\<repo>`
* `gitlab:` — expands to `https://gitlab.com/\<user>/\<repo>`
* `http://` / `https://` / `git@` — full URL
Flags:
* `--branch \<name>` — git branch
* `--tag \<name>` — git tag
* `--rev \<hash>` — git commit
If source is omitted — DCR searches connected registries.
## `dcr tree`
Displays the project dependency tree.
```bash
dcr tree
```
Example output:
```
my-app v0.1.0
├── fmt (registry)
│ └── spdlog (registry)
└── catch2 (registry)
```
For path dependencies, recursively shows their own dependencies (from their `dcr.toml`).

View File

@@ -0,0 +1,73 @@
---
sidebar_label: Gen commands (vscode, clion, ...)
---
# Gen Commands
## `dcr gen \<target>`
Generates IDE integration files.
### vscode
```bash
dcr gen vscode
```
Creates:
* `.vscode/tasks.json` — `build` task (dcr build)
* `.vscode/launch.json` — debug launch configuration
* `.vscode/settings.json` — C/C++ settings (clangd paths, includes)
* `.vscode/extensions.json` — recommended extensions (vscode-clangd, vscode-lldb)
### clion
```bash
dcr gen clion
```
Creates:
* `.idea/externalTools.xml` — external tools (build, run, clean, test)
* `.idea/customTargets.xml` — custom build targets
* `.idea/misc.xml` — C/C++ project settings
* `.idea/runConfigurations/\<name>.xml` — per-binary run configurations
### compile-commands
```bash
dcr gen compile-commands
```
Generates `compile_commands.json` — standard format for clangd, cpptools, static analyzers.
### project-info
```bash
dcr gen project-info
```
Outputs JSON array with project metadata:
```json
[
{
"name": "my-app",
"version": "0.1.0",
"root": "/path/to/project",
"profile": "debug",
"language": "c",
"standard": "c17",
"cxx_standard": null,
"compiler": "/usr/bin/clang",
"kind": "bin",
"sources": ["src/main.c"],
"include_dirs": ["src"],
"lib_dirs": [],
"libs": [],
"cflags": ["-std=c17", "-O0", "-g"],
"ldflags": []
}
]
```

View File

@@ -0,0 +1,31 @@
---
sidebar_label: Project commands (new, init)
---
# Project Commands
## `dcr new \<name>`
Creates a new project with a standard structure and `dcr.toml`. The `name` argument is required.
Only ASCII letters, digits, underscores `_` and hyphens `-` are allowed in the project name.
```bash
dcr new my-app
```
Generates:
* `dcr.toml` with basic fields
* `src/main.c` with a `main` template
## `dcr init`
Initializes a DCR project in the current (empty) directory.
```bash
mkdir app && cd app
dcr init
```
The project name is taken from the current directory name. The directory name must follow the same naming rules as `dcr new`.

Some files were not shown because too many files have changed in this diff Show More