You are not logged in.
Pages: 1
Hello,
I was using $pkgdir instead of $startdir/pkg. But I realised that, somebody chooses just the opposite. Which one is correct? I know, both of them work. However, I am wondering if there is a standart about it.
Offline
Short: use $pkgdir
Long: It does not really matter at the moment but $pkgdir is better as it guards against future changes to makepkg.
Offline
Thanks for your quick reply
Offline
Same goes with $startdir/src and $srcdir
Offline
Also it's easier to read. Clean code is good code
[git] | [AURpkgs] | [arch-games]
Offline
Are there any other shortcut variables other than $startdir and $srcdir? To be completely honest I don't think I have seen those variables in the wiki either - I noticed them by looking at other people's PKGBUILDs.
Offline
$pkgdir = $startdir/pkg
Not sure of any others off the top of my head. RTFC is easy though, it's only bash.
[git] | [AURpkgs] | [arch-games]
Offline
Are there any other shortcut variables other than $startdir and $srcdir? To be completely honest I don't think I have seen those variables in the wiki either - I noticed them by looking at other people's PKGBUILDs.
The PKGBUILD man page in pacman 3.2 will have the following section :
BUILD() FUNCTION
In addition to the above directives, the build() bash function
comprises the remainder of the PKGBUILD. This is directly sourced and
executed by makepkg, so anything that bash or the system has available
is available for use here. Be sure any exotic commands used are covered
by makedepends.
All of the above variables such as pkgname and pkgver are available for
use in the build function. In addition, makepkg defines three variables
for your use during the build and install process. These three
variables are as follows:
startdir
This contains the absolute path to the directory where the PKGBUILD
was located, which is usually the output of $(pwd) when makepkg is
started. startdir was most often used in combination with /src or
/pkg postfixes, but use of the srcdir and pkgdir variables is
preferred.
srcdir
This points to the directory where makepkg extracts or copies all
source files. Although it currently is an alias for $startdir/src,
this assumption should not be assumed true for all future revisions
of makepkg.
pkgdir
This points to the directory where makepkg bundles the installed
package (this directory will become the root directory of your
built package). Although it currently is an alias for
$startdir/pkg, this assumption should not be assumed true for all
future revisions of makepkg.
If you create any variables of your own in the build function, it is
recommended to use the bash local keyword to scope the variable to
inside the build function.
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline
Pages: 1