You are not logged in.

#1 2023-10-19 16:16:23

youseenothing
Member
Registered: 2023-10-16
Posts: 22

PKGBUILD review: jtdx-improved

Looking to add this package to AUR. Any suggestions for changes or better ways of doing things? Thanks in advance!

# Maintainer: James Bowling <kf5u AT pm DOT me>

pkgname=jtdx-improved
_pkgname=jtdx
pkgver=2.2.159
pkgrel=1
pkgdesc="For amateur radio communication using very weak signals. Forked from WSJT-X. JTDX Improved by DG2YCB"
arch=('i686' 'x86_64' 'aarch64')
url="https://sourceforge.net/projects/jtdx-improved/"
license=('GPL3')

depends=(
	'fftw'
	'hamlib>=4.5'
	'libusb'
	'qt5-base'
	'qt5-multimedia'
	'qt5-serialport'
	'qt5-tools'
	'qt5-websockets'
	'readline'
)

makedepends=(
	'cmake'
	'boost'
	'gcc-fortran'
)

install=jtdx-improved.install

provides=('jtdx')
conflicts=('jtdx')
source=("https://downloads.sourceforge.net/project/jtdx-improved/${_pkgname}_${pkgver}/Source%20code/${_pkgname}_${pkgver}_improved_source.zip")
md5sums=('539cfd3092b5a04977ed204166355f86')
sha1sums=('5a9b2b22243e0f511fb6472d913ee277714e7447')

prepare() {
    sed -i 's|$ENV{HOME}|$ENV{DESTDIR}/opt/${CMAKE_PROJECT_NAME}|' $_pkgname/CMakeLists.txt
}

build() {
    cd "$srcdir"
    cmake -B build -S "$_pkgname" \
        -Wno-dev \
	-D CMAKE_INSTALL_PREFIX=/usr \
	-D CMAKE_BUILD_TYPE=Release \
	-D WSJT_SKIP_MANPAGES=ON \
	-D WSJT_GENERATE_DOCS=OFF
    cmake --build build
}

package() {
    DESTDIR=${pkgdir} cmake --install build
}

EDIT: suggestions and modifications added

Last edited by youseenothing (2023-10-19 23:11:48)

Offline

#2 2023-10-19 17:15:35

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,808

Re: PKGBUILD review: jtdx-improved

boost-libs and gcc-libs as makedeps is very odd. They're generally either needed at runtime or not at all.

Does this build in a clean chroot? You're using unzip in the build function, but I don't think that would be installed?
The unzip should be in the prepare function.
You should quote any variables that you don't control, as they could contain a space. You have instances of $srcdir and $pkgdir unquoted.
Why are you executing ../jtdx?
Not wrong, but the install commands can be drastically simplified. You can specify multiple files at once, or even just *.wav, then give the target directory with -t.
Why are you skipping man pages and docs? And if you do skip them, do you still need texinfo/asciidoc/asciidoctor at build time?

Offline

#3 2023-10-19 17:20:17

youseenothing
Member
Registered: 2023-10-16
Posts: 22

Re: PKGBUILD review: jtdx-improved

Scimmia wrote:

boost-libs and gcc-libs as makedeps is very odd. They're generally either needed at runtime or not at all.

Does this build in a clean chroot? You're using unzip in the build function, but I don't think that would be installed?
The unzip should be in the prepare function.
You should quote any variables that you don't control, as they could contain a space. You have instances of $srcdir and $pkgdir unquoted.
Why are you executing ../jtdx?
Not wrong, but the install commands can be drastically simplified. You can specify multiple files at once, or even just *.wav, then give the target directory with -t.
Why are you skipping man pages and docs? And if you do skip them, do you still need texinfo/asciidoc/asciidoctor at build time?

Thanks for the reply. I will move the unzip function to prepare. Thanks for the suggestions for quoting, I will make that change as well. I was unaware of the proper use of install in PKGBUILDs. ../jtdx is part of the cmake command, pointing to the dir where cmake files are. Will make these changes and update for review.

Last edited by youseenothing (2023-10-19 17:21:27)

Offline

#4 2023-10-19 18:25:36

youseenothing
Member
Registered: 2023-10-16
Posts: 22

Re: PKGBUILD review: jtdx-improved

Scimmia wrote:

boost-libs and gcc-libs as makedeps is very odd. They're generally either needed at runtime or not at all.

Does this build in a clean chroot? You're using unzip in the build function, but I don't think that would be installed?
The unzip should be in the prepare function.
You should quote any variables that you don't control, as they could contain a space. You have instances of $srcdir and $pkgdir unquoted.
Why are you executing ../jtdx?
Not wrong, but the install commands can be drastically simplified. You can specify multiple files at once, or even just *.wav, then give the target directory with -t.
Why are you skipping man pages and docs? And if you do skip them, do you still need texinfo/asciidoc/asciidoctor at build time?

Above changes have been made, build works in clean chroot. Thanks again for the suggestions!

Offline

#5 2023-10-19 22:20:00

loqs
Member
Registered: 2014-03-06
Posts: 17,765

Re: PKGBUILD review: jtdx-improved

I think you can skip the manual install by having cmake place the sound files there using:

prepare() {
    sed -i 's|$ENV{HOME}|$ENV{DESTDIR}/opt|' $_pkgname/CMakeLists.txt
}

This also removes use of bsdtar as makepkg will automatically extract the zip archive listed in the source array.  If you follow CMake_package_guidelines you can skip creating the directory build and use of $srcdir.
The package still built for me with git removed from makedepends.  What is using it?

Offline

#6 2023-10-19 22:22:44

youseenothing
Member
Registered: 2023-10-16
Posts: 22

Re: PKGBUILD review: jtdx-improved

loqs wrote:

I think you can skip the manual install by having cmake place the sound files there using:

prepare() {
    sed -i 's|$ENV{HOME}|$ENV{DESTDIR}/opt|' $_pkgname/CMakeLists.txt
}

This also removes use of bsdtar as makepkg will automatically extract the zip archive listed in the source array.  If you follow CMake_package_guidelines you can skip creating the directory build and use of $srcdir.
The package still built for me with git removed from makedepends.  What is using it?

Thank you for that tidbit of info. I appreciate it. The git dep was an oversight. I will get that removed. Thanks!

Offline

#7 2023-10-19 22:43:47

loqs
Member
Registered: 2014-03-06
Posts: 17,765

Re: PKGBUILD review: jtdx-improved

    sed -i 's|$ENV{HOME}|$ENV{DESTDIR}/opt|' $_pkgname/CMakeLists.txt

Should be

    sed -i 's|$ENV{HOME}|$ENV{DESTDIR}/opt/${CMAKE_PROJECT_NAME}|' $_pkgname/CMakeLists.txt

Which includes the project name in the path although you might want to look at GNUInstallDirs.html for other options than /opt.

Offline

#8 2023-10-19 23:03:22

youseenothing
Member
Registered: 2023-10-16
Posts: 22

Re: PKGBUILD review: jtdx-improved

Thanks loqs! I appreciate the help and guidance.

Offline

Board footer

Powered by FluxBB