diff --git a/core/shell.go b/core/shell.go index 7f48ed5..9b2f062 100644 --- a/core/shell.go +++ b/core/shell.go @@ -12,7 +12,7 @@ import ( type ShellModule struct { Name string `json:"name"` Type string `json:"type"` - Source api.Source + Sources []api.Source Commands []string } @@ -26,14 +26,16 @@ func BuildShellModule(moduleInterface interface{}, recipe *api.Recipe) (string, return "", err } - if strings.TrimSpace(module.Source.Type) != "" { - err := api.DownloadSource(recipe.DownloadsPath, module.Source, module.Name) - if err != nil { - return "", err - } - err = api.MoveSource(recipe.DownloadsPath, recipe.SourcesPath, module.Source, module.Name) - if err != nil { - return "", err + for _, source := range module.Sources { + if strings.TrimSpace(source.Type) != "" { + err := api.DownloadSource(recipe.DownloadsPath, source, module.Name) + if err != nil { + return "", err + } + err = api.MoveSource(recipe.DownloadsPath, recipe.SourcesPath, source, module.Name) + if err != nil { + return "", err + } } } diff --git a/docs/articles/en/built-in-modules.md b/docs/articles/en/built-in-modules.md index 44f7028..f39bb28 100644 --- a/docs/articles/en/built-in-modules.md +++ b/docs/articles/en/built-in-modules.md @@ -205,7 +205,8 @@ The following specific fields are available: ```yaml - name: example-meson-project type: meson - buildflags: "-Dfoo=bar" + buildflags: + - "-Dfoo=bar" source: url: "https://example.com/meson-project-source.tar.gz" type: tar diff --git a/docs/articles/en/getting-started.md b/docs/articles/en/getting-started.md index 8cc9c33..6bfc5f4 100644 --- a/docs/articles/en/getting-started.md +++ b/docs/articles/en/getting-started.md @@ -27,7 +27,7 @@ Other container engines might work but have not been tested. If you have tested ## Installation -Vib is distributed as a single binary, so there's no need to install any runtime or dependencies. You can download the latest version of Vib from the [GitHub releases page](https://github.com/Vanilla-OS/Vib). Once downloaded, make the file executable and move it to a directory included in your PATH. +Vib is distributed as a single binary, so there's no need to install any runtime or dependencies. You can download the latest version of Vib from the [GitHub releases page](https://github.com/Vanilla-OS/Vib). In addition to this, Vib has official plugins which are used for all the Vanilla-OS images, they can also be downlaoded from the [Github releases page](https://github.com/Vanilla-OS/Vib) as the `plugins.tar.xz` archvie. Once downloaded, make vib executable and move it to a directory included in your PATH. Vib searches for plugins in a global search path at `/usr/share/vib/plugins/` and inside the `plugins` directory in your project directory. It is recommended to extract `plugins.tar.xz` to `/usr/share/vib/plugins/` as they are considered core vib plugins and may be used by a lot of images. The following commands will allow you to download and install Vib: @@ -40,11 +40,27 @@ mv vib ~/.local/bin If wget is not installed, you can use curl: ```bash -curl -L https://github.com/Vanilla-OS/Vib/releases/latest/download/vib -o vib +curl -SLO https://github.com/Vanilla-OS/Vib/releases/latest/download/vib chmod +x vib mv vib ~/.local/bin ``` +The following commands for the plugins: + +```bash +wget https://github.com/Vanilla-OS/Vib/releases/latest/download/plugins.tar.xz +mkdir -p /usr/share/vib/plugins +tar -xvf plugins.tar.xz -C /usr/share/vib/plugins/ +``` + +Or with curl: + +```bash +curl -SLO https://github.com/Vanilla-OS/Vib/releases/latest/download/plugins.tar.xz +mkdir -p /usr/share/vib/plugins +tar xvf plugins.tar.xz -C /usr/share/vib/plugins +``` + ## Usage To start using Vib, create a `vib.yml` file in a new directory. This file will contain the recipe for your container image. diff --git a/plugins/meson.go b/plugins/meson.go index c6808d6..eb03cc3 100644 --- a/plugins/meson.go +++ b/plugins/meson.go @@ -4,6 +4,7 @@ import ( "C" "encoding/json" "fmt" + "strings" "github.com/vanilla-os/vib/api" ) @@ -12,6 +13,7 @@ import ( type MesonModule struct { Name string Type string + BuildFlags []string `json:"buildflags"` Source api.Source } @@ -58,8 +60,9 @@ func BuildModule(moduleInterface *C.char, recipeInterface *C.char) *C.char { // it is safe to simply use the specified checksum from the module definition tmpDir := fmt.Sprintf("/tmp/%s-%s", module.Source.Checksum, module.Name) cmd := fmt.Sprintf( - "cd /sources/%s && meson %s && ninja -C %s && ninja -C %s install", + "cd /sources/%s && meson %s %s && ninja -C %s && ninja -C %s install", api.GetSourcePath(module.Source, module.Name), + strings.Join(module.BuildFlags, " "), tmpDir, tmpDir, tmpDir,