# A build wrapper for scdoc, the man page generator

**URL:** <https://ziggit.dev/t/a-build-wrapper-for-scdoc-the-man-page-generator/16613>\
**Category:** Showcase\
**Tags:** c, build-system, zig-0-16\
**Created:** [July 9, 2026, 6:22pm UTC](https://ziggit.dev/t/a-build-wrapper-for-scdoc-the-man-page-generator/16613 "2026-07-09T18:22:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![spiffyk](https://ziggit.dev/user_avatar/ziggit.dev/spiffyk/32/7202_2.png) [@spiffyk](https://ziggit.dev/u/spiffyk)\
**Post date:** [July 9, 2026, 6:22pm UTC](https://ziggit.dev/t/a-build-wrapper-for-scdoc-the-man-page-generator/16613/1 "2026-07-09T18:22:42Z")

</div>

# [scdoc – Zig package](https://codeberg.org/spiffyk/scdoc.zig)

* * *

I made a tiny wrapper for [Drew DeVault’s `scdoc`](https://git.sr.ht/~sircmpwn/scdoc), a simple man page generator for POSIX systems.

The wrapper uses `zig cc` to build `scdoc` from the original C sources, while providing convenience functions when used as a dependency for Zig projects. If you use the built-in `options` function, it can also provide a set of standardized build options, as well as a Zig system integration (`-fsys=scdoc`) for use by packagers.

I personally use it in [ssx](https://ziggit.dev/t/ssx-execute-remote-commands-from-an-sshfs-mount/15123), a companion command for SSHFS.

* * *

It can be used like this:

```txt
zig fetch --save=scdoc git+https://codeberg.org/spiffyk/scdoc.zig.git

```

```zig
pub fn build(b: *std.Build) void {
    // ...

    const scdoc_mode: scdoc.Source = scdoc.options(b) orelse .vendored;

    // Add man page generation command
    const manpage = scdoc.generateManPage(
        b,
        scdoc_mode,
        b.path("my-command.1.scd"),
        "my-command.1",
    );
    b.getInstallStep().dependOn(
      &b.addInstallFile(manpage, "share/man/man1/my-command.1").step,
    );

    // Add convenience command to show the generated man page
    const man_step = b.step("man", "Show man page");
    man_step.dependOn(&scdoc.addRunMan(b, .{ .file = manpage }).step);

    // ...
}

const scdoc = @import("scdoc");
const std = @import("std");

```

### Supported Zig versions

0.16.0

### Link to the project

[https://codeberg.org/spiffyk/scdoc.zig](https://codeberg.org/spiffyk/scdoc.zig)
