Add docs for version() function
This commit is contained in:
parent
a42c9b27e7
commit
2b6815e287
|
@ -26,6 +26,11 @@ LURE uses build scripts similar to the AUR's PKGBUILDs. This is the documentatio
|
||||||
- [checksums](#checksums)
|
- [checksums](#checksums)
|
||||||
- [backup](#backup)
|
- [backup](#backup)
|
||||||
- [scripts](#scripts)
|
- [scripts](#scripts)
|
||||||
|
- [Functions](#functions)
|
||||||
|
- [prepare](#prepare)
|
||||||
|
- [version](#version-1)
|
||||||
|
- [build](#build)
|
||||||
|
- [package](#package)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -225,6 +230,21 @@ All functions start in the `$srcdir` directory
|
||||||
|
|
||||||
The `prepare()` function runs first. It is meant to prepare the sources for building and packaging. This is the function in which patches should be applied, for example, by the `patch` command, and where tools like `go generate` should be executed.
|
The `prepare()` function runs first. It is meant to prepare the sources for building and packaging. This is the function in which patches should be applied, for example, by the `patch` command, and where tools like `go generate` should be executed.
|
||||||
|
|
||||||
|
### version
|
||||||
|
|
||||||
|
The `version()` function updates the `version` variable. This allows for automatically deriving the version from sources. This is most useful for git packages, which usually don't need to be changed, so their `version` variable stays the same.
|
||||||
|
|
||||||
|
An example of using this for git:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
version() {
|
||||||
|
cd "$srcdir/itd"
|
||||||
|
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The AUR equivalent is the [`pkgver()` function](https://wiki.archlinux.org/title/VCS_package_guidelines#The_pkgver()_function)
|
||||||
|
|
||||||
### build
|
### build
|
||||||
|
|
||||||
The `build()` function is where the package is actually built. Use the same commands that would be used to manually compile the software. Often, this function is just one line:
|
The `build()` function is where the package is actually built. Use the same commands that would be used to manually compile the software. Often, this function is just one line:
|
||||||
|
|
Loading…
Reference in New Issue