You are not logged in.
Hi,
I'd like to write a correct PKGBUILD for the library "chemfiles" from https://chemfiles.org.
This is my attempt:
pkgname="chemfiles"
pkgver=0.9.3
pkgrel=1
pkgdesc='Library written in modern C++ for reading and writing from and to molecular trajectory files.'
url='https://chemfiles.org/'
depends=()
makedepends=('cmake')
license=('BSD')
arch=('x86_64')
source=("$pkgname-$pkgver.tar.gz::https://github.com/chemfiles/chemfiles/archive/$pkgver.tar.gz")
md5sums=('801fc7e8c445e981348344d6a4836603')
check() {
cd "$srcdir/$pkgname-$pkgver"
#cd build
#cd tests
#ctest
}
build() {
cd "$srcdir/$pkgname-$pkgver"
mkdir -p build
cd build
cmake ..
cmake --build .
}
package() {
cd "$srcdir/$pkgname-$pkgver"
cd build
make DESTDIR="$pkgdir/" install
}
On its official website https://chemfiles.org/chemfiles/0.9.1/i … uild-steps, it has these instructions:
cd chemfiles
mkdir build
cd build
cmake .. # various options are allowed here
cmake --build .
# if you whant to run the tests before installing:
ctest
cmake --build . --target install
My attempted PKGBUILD only kinda works. Some problems I have:
I couldn't make the tests work. Not sure where to put ctest/make test in the PKGBUILD
I'm not sure if I need to actually create the "build" directory.
"DESTDIR="$pkgdir/" cmake --build . --target install" didn't work. It complained "could not load cache". So I used "make install".
Any help is appreciated.
edit: Thanks for all of the comments, people.
Last edited by E3LDDfrK (2020-02-17 16:48:14)
Offline
Here you go. Your PKGBUILD was almost ready. I did not include the docs, but this should not be hard to do. It builds in a clean chroot.
pkgname="chemfiles"
pkgver=0.9.3
pkgrel=1
pkgdesc='Library written in modern C++ for reading and writing from and to molecular trajectory files.'
url='https://chemfiles.org/'
depends=('gcc-libs')
makedepends=('cmake' 'python')
license=('BSD')
arch=('x86_64')
source=("$pkgname-$pkgver.tar.gz::https://github.com/chemfiles/chemfiles/archive/$pkgver.tar.gz")
md5sums=('801fc7e8c445e981348344d6a4836603')
check() {
cd "$pkgname-$pkgver/build"
ctest
}
build() {
cd "$pkgname-$pkgver"
mkdir -p build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=release \
-DBUILD_SHARED_LIBS=ON \
-DCHFL_BUILD_TESTS=ON \
..
make
}
package() {
cd "$pkgname-$pkgver"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
cd build
make DESTDIR="$pkgdir" install
}
Offline
Wow, thanks a lot, @a821. It seems obvious now, but I needed "-DCHFL_BUILD_TESTS=ON" to run the tests.
Offline
The molecular modeling community being often close to the HPC community, you might want to add `-j"$(nproc --all)"` to cmake/cmake to build the package with all your CPU cores :-)
Edit: or `-j"$(grep -c ^processor /proc/cpuinfo`)"` if you don't want to rely on nproc (coreutils).
Last edited by aurelieng (2020-02-15 19:35:59)
Offline
The molecular modeling community being often close to the HPC community, you might want to add `-j"$(nprocs --all)"` to cmake/cmake to build the package with all your CPU cores :-)
No, you really shouldn't.
If a user wants to compile using multiple cores then they should set the option in their makepkg.conf. PKGFILES should never be used to override this.
Offline
Thanks, @Slithery, I did not know there was such an option.
Offline
Thanks, @Slithery, I did not know there was such an option.
makepkg has a number of tuneable options in makepkg.conf, which are intended to be used for *all* customizations which some users might want, and some users might not want, and which can reasonably be expected to apply to all packages.
That means setting up C(XX)FLAGS, LDFLAGS, and debugging CFLAGS (which can then be opted into by defining OPTIONS+=(debug) or the PKGBUILD-specific equivalent), the compression type and options for the final .pkg.tar, and a bunch of other things. I strongly recommend you take a look at the things it lets you do.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline