On 1/5/24 21:01, Aaron Liu wrote:
Hmm,
I know nothing on the library side of things, but as Arch conventions dictate:
1. All package titles should be lowercase, so wiringx-git, perhaps?.
2. You should probably do a provides=(libwiringx.so wiringx) so the soname is
searchable and conflicts are better detected
3. According to the [wiki][1], "Do not use makepkg subroutines (e.g. error,
msg, msg2, plain, warning) as they might change at any time. To print data,
use printf or echo." I'm not sure if such messages are even necessary. AFAIK
outputting the current step is already done by makepkg and I'm pretty sure
cmake will produce its own output that make outputting "Cmake..." redundant.
Otherwise, this looks like a pretty solid PKGBUILD to me! Make sure the use
namcap on the PKGBUILD and the built .pkg(.tar.zst)
[1]: https://wiki.archlinux.org/title/Arch_package_guidelines
I think I have all comments from all replies incorporated and it works great.
The --prefix issue was solved via cmake, but the sbin issue required a quick
sed of the existing CMakeLists.txt. The static lib is excluded. If there is
ever an actual "Release" of wiringX, then we can remove the pkgver() function
entirely.
The current PKGBUID is:
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 "${srcdir}/$_gitname"
echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}
prepare() {
cd "${srcdir}/$_gitname"
sed -i '/DESTINATION sbin/s/sbin/bin/' CMakeLists.txt
mkdir -p build
}
build() {
cd "${srcdir}/$_gitname/build"
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make
}
package() {
cd "${srcdir}/$_gitname/build"
make DESTDIR="$pkgdir/" install
install -Dm644 "${srcdir}/$_gitname/LICENSE"
"${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
The package it produces and contents are:
$ pacman -Qpl wiringx-git-251.54030cd-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
wiringx-git /usr/share/
wiringx-git /usr/share/licenses/
wiringx-git /usr/share/licenses/wiringx-git/
wiringx-git /usr/share/licenses/wiringx-git/LICENSE
Let me know what else we can improve on here. The comments have all helped.
If it all looks good, I'll try and put together a package for it and add it to
AUR.
This was prompted by my recent purchase of a milkV-duo board, a RaspberryPi
Pico look-alike -- that currently runs busybox, but can actually run Arch
(risc). Pretty neat little $6 computer (another $10 buys the 4-port
USB/Ethernet IO board - now the little board sits on my network like a normal PI)
--
David C. Rankin, J.D.,P.E.