[aur-general] Critique my pkgbuild

Eli Schwartz eschwartz at archlinux.org
Wed Oct 10 14:32:45 UTC 2018

On 10/10/18 9:34 AM, Ethan Rakoff wrote:
> I have submitted a package called threemawebqt to the aur (mostly for
> me, and some friends who use arch). It is a VERY simple thin client for
> a webapp using Qt. This is my first pkgbuild from scratch (and my first
> time working with Qt) so even though it is a super simple one, I would
> like some others to look at it and let me know what I'm doing wrong.
> Thanks!
> Here is the pkgbuild for easy reading:
> # Maintainer: Ethan Rakoff <ethan at ethanrakoff.com>
> pkgname=threemawebqt
> pkgver=0.1
> pkgrel=1
> pkgdesc="Thin client for Threema Web, the web client for Threema, an E2E
> encrypted messaging app."

That's a rather lengthy pkgdesc, what about:
"thin client for the Threema Web E2E encrypted messaging app"

> arch=('i686' 'x86_64')
> url="https://github.com/ethanrakoff/${pkgname}"
> license=('MIT')
> depends=('qt5-base' 'qt5-webengine')
> makedepends=('make')

You specified "make" as a dependency, which is already in base-devel,
but not "git", which you need to download sources.

Protip: you can catch issues like this (where your
coincidentally-installed programs are actually needed to build) by
checking that your package still builds in a clean chroot using the
mkarchroot and makechrootpkg commands from [extra]/devtools. Or use the
extra-x86_64-build convenience wrapper.

> source=("git+${url}")

I like it when people use variables just because they exist, so keep up
the good work!

Also this underlines the association between the url and the source

> md5sums=('SKIP')
> build() {
>   cd "${pkgname}/src"
>   qmake
>   make
> }
> package() {
>   cd "${srcdir}/${pkgname}/src"
>   make INSTALL_ROOT="${pkgdir}" install
>   install -Dm644 icon.png "${pkgdir}/usr/share/icons/${pkgname}/icon.png"
>   install -Dm644 ../threemawebqt.desktop
> "${pkgdir}/usr/share/applications/threemawebqt.desktop"
>   install -Dm644 ../LICENSE
> "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
> }

Since you're the upstream developer, you have the opportunity to fix
your qmake configuration.

It doesn't respect any sort of --prefix option, but hardcodes
/usr/local/bin/ as the install location. You can have this determined at
qmake time using e.g.

It should not require one to install the desktop file and icon by hand,
but add these as additional "thing.files".

The license file is not required to run, and distributions often have
different ideas about where to install it for distribution packages...
so you don't need to install it too.


Correspondingly, the desktop file should not hardcode the Exec path, but
rely on it being in the system $PATH. Likewise, the Icon should not be
/usr/share/icons/threemawebqt/icon.png but instead "threemawebqt", and
you should install icon.png as "threemawebqt.png" to a directory that
obeys the XDG icon theme specification:

e.g. /usr/share/pixmaps/ or /usr/share/icons/hicolor/128x128/apps/


Also your *_DIR setup uses the parent directory but assumes that it is
run from the src/ folder, look what happens if you try to run

cd /tmp
git clone https://github.com/ethanrakoff/threemawebqt /tmp/threemawebqt
cd /tmp/threemawebqt
qmake src/threemawebqt.pro
ls /tmp/build

I'd suggest having your .pro file in the repository root, and adding
SOURCES as src/main.cpp then building in build rather than ../build

Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/aur-general/attachments/20181010/753674bd/attachment-0001.asc>

More information about the aur-general mailing list