import "github.com/egdaemon/eg/runtime/x/wasi/egflatpak"
Package egflatpak provides utilities for build and publishing software using flatpak.
<a name="Build"></a>
func Build(ctx context.Context, runtime shell.Command, b *Builder) error
Build the flatpak, requires that the container is run with --privileged option. due to kernel/bwrap issues. e.g.)
func main() {
ctx, done := context.WithTimeout(context.Background(), egenv.TTL())
defer done()
err := eg.Perform(
ctx,
// not eg.DefaultModule() does not have flatpak installed by default, you'll
// have to provide a container with flatpak installed.
eg.Build(eg.DefaultModule()),
eg.Module(
ctx, eg.DefaultModule().OptionLiteral("--privileged"),
),
)
if err != nil {
log.Fatalln(err)
}
}
<a name="BuildOp"></a>
func BuildOp(runtime shell.Command, b *Builder) eg.OpFn
eg op for running flatpka-builder
<a name="ManifestOp"></a>
func ManifestOp(path string, b *Builder) eg.OpFn
write the manifest to the specified path.
<a name="Builder"></a>
type Builder struct {
Manifest
}
<a name="New"></a>
func New(id string, command string, options ...option) *Builder
configure the manifest for building the flatpak, but default it'll copy everything in the current directory in an rsync like manner.
<a name="Manifest"></a>
Manifests describe how to build the application. see https://docs.flatpak.org/en/latest/manifests.html
type Manifest struct {
ID string `yaml:"id"`
Runtime `yaml:",inline"`
SDK `yaml:",inline"`
Command string `yaml:"command"`
Modules []Module `yaml:"modules"`
FinishArgs []string `yaml:"finish-args"`
}
<a name="Module"></a>
type Module struct {
Name string `yaml:"name"`
BuildSystem string `yaml:"buildsystem,omitempty"`
SubDirectory string `yaml:"subdir,omitempty"` // build inside the specified sub directory.
ConfigOptions []string `yaml:"config-opts,omitempty"`
Cleanup []string `yaml:"cleanup,omitempty"` // files/directories to remove once done.
PostInstall []string `yaml:"post-install,omitempty"` // commands to execute post installation.
Commands []string `yaml:"build-commands,omitempty"`
Sources []Source `yaml:"sources,omitempty"`
}
<a name="ModuleCopy"></a>
func ModuleCopy(dir string) Module
Not recommended, here for testing: build a module directly from a directory.
<a name="ModuleTarball"></a>
func ModuleTarball(url, sha256d string) Module
build a module from a binary tarball.
<a name="NewModule"></a>
func NewModule(name, system string, options ...moption) Module
<a name="Runtime"></a>
type Runtime struct {
ID string `yaml:"runtime"`
Version string `yaml:"runtime-version"`
}
<a name="SDK"></a>
type SDK struct {
ID string `yaml:"sdk"`
Version string `yaml:"-"`
}
<a name="Source"></a>
type Source struct {
Type string `yaml:"type"`
Destination string `yaml:"dest-filename,omitempty"` // used by archive source(s).
Path string `yaml:"path,omitempty"` // used by directory source.
URL string `yaml:"url,omitempty"` // used by archive source.
SHA256 string `yaml:"sha256,omitempty"` // used by archive source(s).
StripComponents int `yaml:"strip-components,omitempty"` // used by archive source(s).
Tag string `yaml:"tag,omitempty"` // used by git sources(s).
Commit string `yaml:"commit,omitempty"` // used by git source(s).
Mirrors []string `yaml:"mirror-urls,omitempty"` // used by git source(s).
Architectures []string `yaml:"only-arches,omitempty"` // used by archive source(s).
Commands []string `yaml:"commands,omitempty"`
}
<a name="SourceDir"></a>
func SourceDir(dir string, options ...soption) Source
<a name="SourceGit"></a>
func SourceGit(url, commit string, options ...soption) Source
<a name="SourceShell"></a>
func SourceShell(options ...soption) Source
<a name="SourceTarball"></a>
func SourceTarball(url, sha256d string, options ...soption) Source