You are not logged in.
This is a PKGBUILD I did to install a font
# Maintainer: <myself>
pkgname=ttf-koulen
pkgver=0.1
pkgrel=1
pkgdesc="Koulen is a Khmer font for headlines, titles and subtitles, and even banner designs."
arch=("any")
url="https://fonts.google.com/download?family=Koulen"
license=("OFL")
source=("Koulen-Regular.ttf"
"OFL.txt")
sha256sums=('SKIP'
'SKIP')
package() {
install -d ${pkgdir}/usr/share/fonts/TTF
install -m644 Koulen-Regular.ttf ${pkgdir}/usr/share/fonts/TTF/
install -D -m644 OFL.txt ${pkgdir}/usr/share/licenses/${pkgname}/OFL
}The install lines, can someone explain to me why the variable is being used like that?
wouldn't you get the same result if using /usr/share/fonts/TTF/$pkgdir
I mean, from the noob point of view (which is my viewpoint), it looks weird to place the name of the directory you want created at the beginning of the path.
The only thing I know about placing variable between curly braces is that it expands, meaning it does this:
$ echo prefix-{foo,bar}-suffix
prefix-foo-suffix prefix-bar-suffixLast edited by milojarow (2023-06-13 23:48:26)
Offline
Your package should not be adjusting the actual system while it's being built. the pkgdir variable expands to the directory the package is being built into (and isn't something you create, makepkg will do that during the build process) and all the contents of the pkgdir directory is what will actually make up the root of your package when installing it (so once you have the package your path inside the package will be /usr/share/fonts/TTF as intended). Trying your suggestion would give you a "bogus" path like /usr/share/fonts/TTF/home/milojarow/AURBuild/ttf-koulan/pkg and affect the actual system instead of the package you are intending to create.
See https://wiki.archlinux.org/title/Creati … _variables
Last edited by V1del (2023-06-13 23:55:28)
Offline
but placing ${pkgdir}/usr/share/fonts/TTF wouldn´t be installing the font inside my home dir, something like this: /home/milojarow/AURBuild/ttf-koulan/pkg/usr/share/fonts/TTF ?
I know ${pkgdir}/usr/share/fonts/TTF works, it just that I don't get how
Last edited by milojarow (2023-06-14 00:16:15)
Offline
$pkgdir is where files for the package are staged. Check the actual package, see what's there
Last edited by Scimmia (2023-06-14 00:38:33)
Offline
You can think of arch linux packages as essentially being just compressed archives. When you make a package, the files that will be in the archive are downloaded and/or built and placed into ${pkgdir} using the same directory structure there as the final package. Then at the end, makepkg puts the contents of ${pkgdir} into that archive.
Later, when pacman installs that package, it takes the contents of the package archive, and essentially just unzips the contents as-is into the root directory of your system.
This is a very simplified explanation of what makepkg does and how arch linux packages are actually structured, but hopefully this helps you understand why it has to be done this way.
Offline