Skip to content

Commit

Permalink
refactor(packaging): simplify building docs
Browse files Browse the repository at this point in the history
Fixes #101

Why?

- no build.rs that is invoked on _any_ `cargo build/run`
- no extra dev dependency
- no intermediate `docs/*.out` files
- 3 lines of bash instead
- maximum gzip compression (-9/--best)
- docs will be built only when needed,
    i.e. on `make docs` or `make install`

To quickly check:

```sh
make TARGET_DIR=/tmp/wayshot MAN{1,7}_DIR=/tmp/wayshot install
```
  • Loading branch information
murlakatamenka committed Mar 12, 2024
1 parent cb6bd68 commit 596f25b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 77 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
target
*.gz
*.out
.direnv
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ build:
run:
@cargo run

docs:
install: build
@for scd in ./docs/*.scd; do \
scdoc < "$$scd" | gzip --best > "$${scd%.scd}.gz" & \
done

install: build docs
@mkdir -p $(TARGET_DIR)
@cp $(SOURCE_DIR)/$(BINARY) $(TARGET_DIR)
@chmod +x $(TARGET_DIR)/$(BINARY)
Expand All @@ -37,4 +43,4 @@ setup:
@rustup install stable
@rustup default stable

.PHONY: check clean setup all install build
.PHONY: check clean setup all install build docs
3 changes: 0 additions & 3 deletions wayshot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ keywords.workspace = true
license.workspace = true
repository.workspace = true

[build-dependencies]
flate2 = "1.0.27"

[dependencies]
tracing.workspace = true

Expand Down
70 changes: 0 additions & 70 deletions wayshot/build.rs

This file was deleted.

1 change: 0 additions & 1 deletion wayshot/docs

This file was deleted.

0 comments on commit 596f25b

Please sign in to comment.