On 1/7/24 08:37, Doug Newgard wrote:
If there is
ever an actual "Release" of wiringX, then we can remove the pkgver() function
entirely.
That's not how -git PKGBUILDs work. It builds from HEAD and should always build
from HEAD. You really need to fix the pkgver function. Looking at the upstream
CMakeLists.txt, I would version it the way they do their deb/rpm packages.
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}-${git_commits}-g${git_ver})
Adjusting for the dashes, of course, which would also include adding r before
the commit count. Again, see the wiki link from earlier.
I think I've got it.
There is no way to pull from the internal CPACK name to get precisely the
CPACK_PACKAGE_VERSION out of it. You also cannot simply add a "TZST" generator
and then either "cmake --build . --target package" or "make package" to use
the zst generator as it would bypass the pacman package() altogether.
You can change the format to meet your suggestion of
r(commit count).g(commit)
but that is about the best I was able to work out. If you know some additional
cmake magic I missed that allows grabbing the name from one of the generated
files in a format better than that above, you will have to help me with it, I
couldn't find it.
With all the changes, and removing ${srcdir} from my circa 2009 PKGBUILD
go-by, the PKGBUILD is now quite tidy:
pkgname=wiringx-git
_gitname=wiringX
pkgver=251.54030cd
pkgrel=1
pkgdesc="Provides a modular approach to several GPIO interfaces."
url="https://wiringx.org/"
arch=('i686' 'x86_64' 'armv6h' 'armv7h' 'aarch64')
license=('MPL-2.0')
makedepends=('git' 'cmake')
provides=('libwiringx.so' 'wiringx')
source=('git+https://github.com/wiringX/wiringX.git')
md5sums=('SKIP')
pkgver() {
cd "$_gitname"
echo "r$(git rev-list --count HEAD).g$(git rev-parse --short HEAD)"
}
prepare() {
cd "$_gitname"
sed -i '/DESTINATION sbin/s/sbin/bin/' CMakeLists.txt
mkdir -p build
}
build() {
cd "$_gitname/build"
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make
}
package() {
cd "$_gitname/build"
make DESTDIR="$pkgdir/" install
}
Which produces the following:
$ pacman -Qpl wiringx-git-r251.g54030cd-1-x86_64.pkg.tar.zst
wiringx-git /usr/
wiringx-git /usr/bin/
wiringx-git /usr/bin/wiringx-blink
wiringx-git /usr/bin/wiringx-interrupt
wiringx-git /usr/bin/wiringx-read
wiringx-git /usr/include/
wiringx-git /usr/include/wiringx.h
wiringx-git /usr/lib/
wiringx-git /usr/lib/libwiringx.so
Let me know if I need to tweak the name further -- and you may have to
spoon feed me there...
--
David C. Rankin, J.D.,P.E.