Skip to content

Instantly share code, notes, and snippets.

@jperkin
Created May 1, 2026 19:53
Show Gist options
  • Select an option

  • Save jperkin/72075147e330b35eb4869898207e828e to your computer and use it in GitHub Desktop.

Select an option

Save jperkin/72075147e330b35eb4869898207e828e to your computer and use it in GitHub Desktop.
bob on omnios

Assumes you have rust, gcc14, etc installed via pkg.

Everything will be stored under /data. Assumes everything runs as root (required to run bob anyway).

Install

Install bob (currently requires installing via git due to patched crates)

$ cargo install --git https://github.com/jperkin/bob

Install config file to /root/.config/bob/config.lua. I'll attach it to this gist, it's stripped down and configured for this build and target host.

Fetch pkgsrc and bootstrap kit.

$ mkdir -p /data
$ cd /data
$ git clone https://github.com/NetBSD/pkgsrc
$ curl -O https://pkgsrc.smartos.org/packages/SmartOS/bootstrap-pbulk/bootstrap-upstream-trunk.tar.gz

The default config is set up to build just audio/openal-soft as the quickest package to fail, uncomment the others to see those fail too (at least the lang/nodejs build will take a lot longer).

Build

Start the build:

$ bob build

Analyze

To see the failure logs:

$ bob log <package>

or just look under /root/.local/share/bob/logs.

Test changes

You can add lofs mounts to the config file if you want to test header changes directly in the sandboxes. For example this is the config section I've been using to test the changes (add it after e.g. the /opt/ooce mount).

        -- test c++ issue fixes
        { action = "mount", fs = "lofs", opts = "-o ro",
          src = "/data/pkgsrc/overlay/gwr/math_c99.h", dest = "/usr/include/iso/math_c99.h" },
        { action = "mount", fs = "lofs", opts = "-o ro",
          src = "/data/pkgsrc/overlay/gwr/math_iso.h", dest = "/usr/include/iso/math_iso.h" },
        { action = "mount", fs = "lofs", opts = "-o ro",
          src = "/data/pkgsrc/overlay/gwr/math.h", dest = "/usr/include/math.h" },

Clean

If you change anything about the pkgsrc build itself, you'll need to run:

$ bob clean

before starting a new build.

@jperkin

jperkin commented May 1, 2026

Copy link
Copy Markdown
Author

Paste this into config.lua:

options = {
    build_threads = 4,
    scan_threads = 4,
    log_level = "info",
}

pkgsrc = {
    basedir = "/data/pkgsrc",
    bootstrap = "/data/bootstrap-upstream-trunk.tar.gz",
    make = "/opt/pkg/bin/bmake",
    pkgpaths = {
        "audio/openal-soft",
        --"lang/nodejs",
        --"multimedia/assimp",
    },
}

sandboxes = {
    basedir = "/data/chroot",
    environment = {
        build = {
            clear = true,
            inherit = { "TERM", "HOME" },
            vars = {
                PATH = "/sbin:/usr/bin:/usr/sbin",
            },
        },
    },
    setup = {
        { action = "mount", fs = "lofs", dir = "/devices", opts = "-o ro",
          only = { exists = "/devices" } },

        { action = "mount", fs = "lofs", dir = "/dev", opts = "-o ro" },
        { action = "mount", fs = "fd", dir = "/dev/fd" },
        { action = "mount", fs = "proc", dir = "/proc" },

        { action = "mount", fs = "tmp", dir = "/tmp", opts = "-o size=1g" },
        { action = "mount", fs = "tmp", dir = "/var", opts = "-o size=1g" },

        { action = "mount", fs = "lofs", dir = "/lib", opts = "-o ro" },
        { action = "mount", fs = "lofs", dir = "/sbin", opts = "-o ro" },
        { action = "mount", fs = "lofs", dir = "/usr", opts = "-o ro" },
        { action = "symlink", src = "usr/bin", dest = "/bin" },
        { action = "mount", fs = "lofs", dir = "/opt/gcc-14", opts = "-o ro" },
        { action = "mount", fs = "lofs", dir = "/opt/ooce", opts = "-o ro" },

        { action = "copy", dir = "/etc" },

        { action = "cmd", chroot = true,
          create = "mkdir -m 1777 /var/tmp; chmod 1777 /tmp" },

        { action = "mount", fs = "lofs", dir = pkgsrc.basedir },
    },
    hooks = {
        { action = "cmd",
          create = dedent [[
            ed ${bob_sandbox_path}/etc/opt/pkg/mk.conf <<-EOF
            /^GCCBASE/d
            /^.include/d
            w
            q
            EOF
          ]]
        },
    },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment