You are not logged in.

#1 2020-12-19 22:01:45

quickreader
Member
Registered: 2020-12-19
Posts: 2

Requesting review of PKGBUILD

This is the first PKGBUILD I've ever written for my first FLOSS program. I want to upload it to the AUR, but I'm afraid it's not up to standards. May I ask for your opinions on it? This is gitlab - https://gitlab.com/quickreader/quickreader

# Maintainer: quickreader <quickreader at mail dot bg>

pkgname='quickreader'
pkgver=1.0dev
pkgrel=1
pkgdesc='Quick Reader is a program that enables its user to quickly read through text.'
arch=('x86_64')
url="https://gitlab.com/$pkgname/$pkgname"
license=('GPL3')
depends=('bzip2' 'gcc-libs' 'glib2' 'glibc' 'icu' 'libgcrypt' 'libgpg-error' 'lz4' 'pcre' 'pcre2' 'systemd-libs' 'xz' 'zlib' 'zstd' 'double-conversion' 'freetype2' 'graphite' 'harfbuzz' 'libglvnd' 'libpng' 'libx11' 'libxau' 'libxcb' 'libxdmcp' 'md4c' 'qt5-base')
source=("https://gitlab.com/$pkgname/$pkgname/-/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('845ab223f49a4073c50ae6e59de4addb7c6e1b436c7b8211a023ac0d688744ca')

build() {
    cd "$srcdir/$pkgname-$pkgver/build/Linux"
    qmake -o Makefile ../../QuickReader.pro -spec linux-g++ CONFIG+=qtquickcompiler
    make -f Makefile -j$(nproc)
}

package() {
    mkdir -vp "$pkgdir/usr/bin"
    mkdir -vp "$pkgdir/usr/share/applications"
    mkdir -vp "$pkgdir/usr/share/icons/hicolor/scalable/apps"
    install -m 755 "$srcdir/$pkgname-$pkgver/build/Linux/QuickReader" "$pkgdir/usr/bin/"
    install -m 644 "$srcdir/$pkgname-$pkgver/Assets/$pkgname.desktop" "$pkgdir/usr/share/applications"
    install -m 644 "$srcdir/$pkgname-$pkgver/Assets/$pkgname-icon.svg" "$pkgdir/usr/share/icons/hicolor/scalable/apps"
}

The program builds, installs and runs fine, at least on my PC. However, I'm concerned if I've got the dependencies correct. I used ldd to find the libraries loaded by the binary, then put them in a text file called deps. Then I tried to find the packages that provide those libraries with the following script:

cat deps | while read dep; do pacman -Fq "$dep" | head -1; done | sort -u

Which resulted in that big list of dependencies in the PKGBUILD. Another concern of mine is the package() stage. I did most of it myself, because the Makefile of the program (written in Qt) was not very convenient - it tried to copy the binary to /opt which then failed because it didn't have permission and it didn't include a desktop file or an icon. So I tried to do those parts myself. I have not written the Makefile myself - it was all generated by Qt Creator.

In short, it all works, but I'm not sure if I'm following the right standards or if it would work on another person's computer.

Offline

#2 2020-12-19 22:18:51

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,936
Website

Re: Requesting review of PKGBUILD

That looks like a very good start, but a few changes should be made:

1) Remove the self-referential start from pkgdesc, so at most it would be "a program that enables its user to quickly read through text", but far better yet would be to eliminate the implied or filler words which leaves "quickly read through text."  Of course at that point it becomes apparent that this description really isn't saying much.  HOW does it help users "quickly read through text"?  What does that mean?

2) Remove the -j flag from make.  User's configure this in their own makepkg.conf and you should not override it.

3) I'll check on the Makefile momentarily for the install - it should accept variables like DESTDIR ..., Nope.  Not only does it not accept standard variables, it has /opt hardcoded.  Isn't this your code?  If it is, just fix the makefile.  If it is a generated makefile, read the documentation for the tools you used to generate it: QT can definitely generate proper Makefiles when used correctly.

4) The dependencies are what they are, if your binary actually links to libraries provided by all of those packages, then they should be listed.  I'd doublecheck whether your binary actually links to them though and ensure you are not just picking up recursive dependencies.

EDIT: namcap has this to say about your dependencies:

$ namcap quickreader-1.0dev-1-x86_64.pkg.tar.zst
quickreader E: Dependency hicolor-icon-theme detected and not included (needed for hicolor theme hierarchy)
quickreader W: Dependency bzip2 included but already satisfied
quickreader W: Dependency gcc-libs included but already satisfied
quickreader W: Dependency glib2 included but already satisfied
quickreader W: Dependency glibc included but already satisfied
quickreader W: Dependency icu included but already satisfied
quickreader W: Dependency libgcrypt included but already satisfied
quickreader W: Dependency libgpg-error included but already satisfied
quickreader W: Dependency lz4 included but already satisfied
quickreader W: Dependency pcre included but already satisfied
quickreader W: Dependency pcre2 included but already satisfied
quickreader W: Dependency systemd-libs included but already satisfied
quickreader W: Dependency xz included but already satisfied
quickreader W: Dependency zlib included but already satisfied
quickreader W: Dependency zstd included but already satisfied
quickreader W: Dependency double-conversion included but already satisfied
quickreader W: Dependency included and not needed ('freetype2')
quickreader W: Dependency included and not needed ('graphite')
quickreader W: Dependency included and not needed ('harfbuzz')
quickreader W: Dependency libglvnd included but already satisfied
quickreader W: Dependency libpng included but already satisfied
quickreader W: Dependency libx11 included but already satisfied
quickreader W: Dependency libxau included but already satisfied
quickreader W: Dependency libxcb included but already satisfied
quickreader W: Dependency libxdmcp included but already satisfied
quickreader W: Dependency md4c included but already satisfied

Last edited by Trilby (2020-12-19 22:23:10)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2020-12-19 22:22:06

loqs
Member
Registered: 2014-03-06
Posts: 12,600

Re: Requesting review of PKGBUILD

Trilby was right about the recursive dependencies:

    libQt5Widgets.so.5 => /usr/lib/libQt5Widgets.so.5
        libm.so.6 => /usr/lib/libm.so.6
    libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5
        libpthread.so.0 => /usr/lib/libpthread.so.0
        libGL.so.1 => /usr/lib/libGL.so.1
            libGLdispatch.so.0 => /usr/lib/libGLdispatch.so.0
                libdl.so.2 => /usr/lib/libdl.so.2
            libGLX.so.0 => /usr/lib/libGLX.so.0
                libX11.so.6 => /usr/lib/libX11.so.6
                    libxcb.so.1 => /usr/lib/libxcb.so.1
                        libXau.so.6 => /usr/lib/libXau.so.6
                        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6
        libpng16.so.16 => /usr/lib/libpng16.so.16
        libz.so.1 => /usr/lib/libz.so.1
        libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0
            libfreetype.so.6 => /usr/lib/libfreetype.so.6
            libharfbuzz.so.0 => !!! circular loop !!!
                libbz2.so.1.0 => /usr/lib/libbz2.so.1.0
            libgraphite2.so.3 => /usr/lib/libgraphite2.so.3
            libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0
                libpcre.so.1 => /usr/lib/libpcre.so.1
        libmd4c.so.0 => /usr/lib/libmd4c.so.0
    libQt5Core.so.5 => /usr/lib/libQt5Core.so.5
        libsystemd.so.0 => /usr/lib/libsystemd.so.0
            librt.so.1 => /usr/lib/librt.so.1
            liblzma.so.5 => /usr/lib/liblzma.so.5
            liblz4.so.1 => /usr/lib/liblz4.so.1
            libgcrypt.so.20 => /usr/lib/libgcrypt.so.20
                libgpg-error.so.0 => /usr/lib/libgpg-error.so.0
        libdouble-conversion.so.3 => /usr/lib/libdouble-conversion.so.3
        libicui18n.so.67 => /usr/lib/libicui18n.so.67
        libicuuc.so.67 => /usr/lib/libicuuc.so.67
            libicudata.so.67 => /usr/lib/libicudata.so.67
        libpcre2-16.so.0 => /usr/lib/libpcre2-16.so.0
        libzstd.so.1 => /usr/lib/libzstd.so.1
    libstdc++.so.6 => /usr/lib/libstdc++.so.6
    libgcc_s.so.1 => /usr/lib/libgcc_s.so.1

I think the dependencies can be reduced to:

depends=('qt5-base' 'hicolor-icon-theme')

Offline

#4 2020-12-19 22:47:06

quickreader
Member
Registered: 2020-12-19
Posts: 2

Re: Requesting review of PKGBUILD

Trilby wrote:
2) Remove the -j flag from make.  User's configure this in their own makepkg.conf and you should not override it.

3) I'll check on the Makefile momentarily for the install - [del]it should accept variables like DESTDIR ...[/del], Nope.  Not only does it not accept standard variables, it has /opt hardcoded.  Isn't this your code?  If it is, just fix the makefile.  If it is a generated makefile, read the documentation for the tools you used to generate it: QT can definitely generate proper Makefiles when used correctly.

I fixed 2), but the reason why I originally made it like that is because I wasn't sure how to make it inherit the makeflags. If I didn't pass -j it would default to 1 thread. But after a little investigation just now I discovered that it was me who'd made a stupid mistake - I had indeed changed my MAKEFLAGS in /etc/makepkg.conf, but I'd forgotten to uncomment it. I didn't notice it cause I reinstalled my system just 4 days ago and hadn't compiled anything else yet. So anyways yeah now it works and inherits them correctly.

3) I see, so there is a way to generate a more usable Makefile. I'll need to look into it.

I improved 1) and 4) as per the suggestions from both of you. The description now says
"A program that enables its user to quickly read through text by encouraging the silencing of their subvocalization."

Trilby wrote:
HOW does it help users "quickly read through text"?  What does that mean?

I made the program based on another which I haven't named anywhere in the project because I'm not sure if I'm allowed to do that. You can watch the demo video on the gitlab page to see how it works. I edited the description to make it more clear, but I'm not quite sure how to explain it in words better than that without making it a very long explanation.

And I reduced the dependencies to the suggested 2. I guess qt5-base already included most of those.

It's quite late where I am now, so I likely won't look into the Makefile until tomorrow. I'll come back here if I need more help. Thanks for now for your advice on such short notice.

Last edited by quickreader (2020-12-19 22:54:53)

Offline

#5 2020-12-19 23:20:31

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,936
Website

Re: Requesting review of PKGBUILD

The new description looks great - it's much more informative about what the program is for.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB