You are not logged in.
Please review my PKGBUILD file (maintainer headline omitted) for the package gsl-lite:
pkgname=gsl-lite
pkgver=v0.40.0.r1.g4b5e9ab
pkgrel=1
pkgdesc="Guidelines Support Library for C++98, C++11 up"
arch=('any')
url="https://github.com/gsl-lite/gsl-lite"
license=('MIT')
makedepends=('cmake' 'git')
source=("$pkgname::git+https://github.com/gsl-lite/gsl-lite.git")
md5sums=('SKIP')
pkgver() {
cd "$srcdir/$pkgname"
git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
cd "$srcdir/$pkgname"
mkdir -p build
}
# header only library, no build step needed
#build() {}
package() {
cd "$srcdir/$pkgname/build"
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make DESTDIR="$pkgdir" install
install -D -t $pkgdir/usr/share/licenses/$pkgname/ ../LICENSE
}
(“It” is referring to the library as well as the package)
✅ It is in no official repo
✅ It is not found by
pacman -Ss
✅ It is not part of the AUR
✅ It was not posted in this forum
✅ It is in none of the unofficial user repositories
✅ Created the PKGBUILD file (see above)
✅ Successfully build the PKGBUILD file with
makepkg
✅ Found no errors or warnings wih
namcap PKGBUILD gsl-lite-v0.40.0.r1.g4b5e9ab-1-any.pkg.tar.xz
✅ Successfully installed the package with
sudo pacman -U gsl-lite-v0.40.0.r1.g4b5e9ab-1-any.pkg.tar.xz
✅ Successfully compiled an example C++ file including this library
✅ Checked that it does not collide with any of the files of the package extra/gsl by using
pacman -Ql gsl
✅ Build it in a clean CHROOT with
makechrootpkg -c -r $CHROOT
Thank you! I'm eager to learn from my own request
Last edited by restore (2022-01-08 19:04:28)
Offline
The package does not use the -git suffix but is not pinned to a commit or tag.
Minor nits.
source=("$pkgname::git+https://github.com/gsl-lite/gsl-lite.git")
The git repo is renamed to the same name?
You could drop prepare() and shorten package to the following, in which cmake creates the build directory as required.
package() {
cmake -S $pkgname -B build -DCMAKE_INSTALL_PREFIX=/usr
DESTDIR="$pkgdir" cmake --install build
install -D -t $pkgdir/usr/share/licenses/$pkgname/ $pkgname/LICENSE
}
Edit:
See also https://github.com/archlinux/svntogit-p … k/PKGBUILD
Last edited by loqs (2022-01-07 23:17:01)
Offline
If no build step is needed, then why are you creating a build folder? There are separate build() and package() functions for a reason. Building should not be done in the fakeroot environment.
You missed a few things reviewing Arch package guidelines:
As @loqs mentioned, if you want to pull directly from master it needs to be a VCS package with a -git suffix in the pkgname
No need for specifying a folder name in the source() array, the git repo name will be used
remove the leading v in the pkgver: VCS package guidelines
no need for the prepare() function at all, the build folder can be created using Cmake commands: Cmake package guidelines
do not use relative paths, either change directory or specify the folder where the file is located
Example PKGBULD:
pkgname=gsl-lite-git
pkgver=0.40.0.r1.g4b5e9ab
pkgrel=1
pkgdesc="Guidelines Support Library for C++98, C++11 up"
arch=('any')
url="https://github.com/gsl-lite/gsl-lite"
license=('MIT')
makedepends=('cmake' 'git')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=('git+https://github.com/gsl-lite/gsl-lite.git')
sha256sums=('SKIP')
pkgver() {
cd "$srcdir/${pkgname%-git}"
git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
build() {
cmake -B build -S "${pkgname%-git}" \
-DCMAKE_BUILD_TYPE='None' \
-DCMAKE_INSTALL_PREFIX='/usr' \
-Wno-dev
cmake --build build
}
package() {
DESTDIR="$pkgdir" cmake --install build
cd "$srcdir/${pkgname%-git}"
install -Dm644 -t "$pkgdir/usr/share/licenses/${pkgname%-git}/" LICENSE
}
Last edited by yochananmarqos (2022-01-07 23:38:59)
Offline
do not use relative paths, either change directory or specify the folder where the file is located
Why would that be an issue as the resolved path is still under $srcdir ?
Offline
Thank you both for your extensive answers! I'll incorporate your suggestions.
The package does not use the -git suffix but is not pinned to a commit or tag.
One thing I do not understand – and I did not found anywhere – is when to use a package as VCS package. I had the impression – and I'm fully aware that this is vague – that VCS packages are more “for development” and therefore “fluid”, hence the 'SKIP' option for the checksum. The VCS package guidelines say:
Suffix pkgname with -cvs, -svn, -hg, -darcs, -bzr, -git etc. unless the package fetches a specific release.
But I do want to use a specific release, namely the “pinned commit” which @loqs suggests. I don't want to “live on the head” but update the package only when there’s a new release/tag. I therefore did not choose to append the suffix -git.
As @loqs mentioned, if you want to pull directly from master it needs to be a VCS package with a -git suffix in the pkgname
Okay, but is software not always pulled from a repository? Isn’t the master branch, as the name suggests, the main source for the software as stable as it can get (in contrast to the dev branch, for instance)? What is the alternative?
Given the maybe wrong assumptions I made above I would prefer a non-VCS package – but the 'SKIP' checksum option clashes with that, doesn't it?
If no build step is needed, then why are you creating a build folder?
Because I just followed the steps in the installation and use guide of the libraries README. I am no cmake expert and did not know there are other ways like those you both showed.
Why would that be an issue as the resolved path is still under $srcdir?
I think just because it is cleaner.
Offline
But I do want to use a specific release, namely the “pinned commit” which @loqs suggests. I don't want to “live on the head” but update the package only when there’s a new release/tag. I therefore did not choose to append the suffix -git.
You can do so by using a the #-syntax at the end of your source-url.
E.g. you can use #commit=<the specific commit you want to use> or #tag=<tag> if upstream provides tags. it is described in the Wiki.
Offline
E.g. you can use #commit=<the specific commit you want to use> or #tag=<tag> if upstream provides tags. it is described in the Wiki.
#commit= is preferred so upstream cannot replace the tag with something different.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Thank you all for your answers! Your improvements are now part of the PKGBUILD. Set to [Solved].
Offline