# 20.x\_exec

## Core Fields

```yaml
x_exec:
  shell: "bash"
  pkgver: |
    # Commands to fetch version (output only the version string)
    curl -qfsSL "https://api.github.com/repos/owner/repo/releases/latest" | jq -r '.tag_name'
  run: |
    # Commands to build/download the package
    # Output must be placed in ${SBUILD_OUTDIR}
```

* `shell`: Interpreter to use (bash, sh, fish, nu, zsh, etc.)
* `pkgver`: Fetches version, saved to `${SBUILD_OUTDIR}/${SBUILD_PKG}.version` and `${PKG_VER}` env
* `run`: Main build/download script, must produce [required output files](https://docs.pkgforge.dev/sbuild/instructions/needed_files)

***

## Optional Fields

### arch

Restrict to specific architectures. Build terminates if host arch doesn't match.

```yaml
x_exec:
  arch:
    - "aarch64"
    - "x86_64"
```

### os

Restrict to specific operating systems.

```yaml
x_exec:
  os:
    - "linux"
    - "freebsd"
```

### host

Combined arch + os restriction.

```yaml
x_exec:
  host:
    - "aarch64-Linux"
    - "x86_64-Linux"
```

### conflicts

Packages to uninstall after successful build.

```yaml
x_exec:
  conflicts:
    - "old.pkg.id"
```

### depends

Packages to install before running `x_exec.run`.

```yaml
x_exec:
  depends:
    - "required.pkg.id"
```

### entrypoint

Path to main binary when it's not at `${SBUILD_OUTDIR}/${SBUILD_PKG}`.

```yaml
x_exec:
  entrypoint: "${SBUILD_OUTDIR}/bin/my-binary"
```
