Questions about porting Qt app from Github (thinking about porting)

Source from GitHub that is free with GPL - https://gitlab.com/tp3/Entropy-Piano-Tuner.

About the original GitHub source code.
  • The source contains code for multiple target platforms
  • There's code to build two libraries that are already in base system
  • To compile some changes are necessary to some config files
  • It's uses Qt6, xorg, qmake, mate, gl
  • Compiles with QtCreator on latest GhostBSD (FreeBSD 14.3) or from shell with qmake and make
  • Because of the "inside" libraries some LD_LIBRARY_PATHS needs to be added to run, ie startscript required
Having never done a port for FreeBSD before I am thinking this could be as easy as creating patches with diff between GitHub source and the changes required to make it run.​
What is best practice?​
Is it possible to make fetch the original GitHub repo as a tarball into distfiles (Without a GitHub account?)​
How will the patches get to the ports - are there PATCH_SITES (bsd.port.mk) available?​
Could a beginning Makefile look something like this? (using /usr/ports/audio/fmit as example)​
Makefile:
PORTNAME=    entropypianotuner[/INDENT]
PORTVERSION=    ??
DISTVERSIONPREFIX=    v
PORTREVISION=    ??
CATEGORIES=    audio

MAINTAINER=    thinking.about@creating.port
COMMENT=    Free Piano Tuning software
WWW=        https://gitlab.com/tp3/Entropy-Piano-Tuner

LICENSE=    GPLv3
LICENSE_COMB=    ???
LICENSE_FILE_GPLv3=    ${WRKSRC}/gpl_v3.md

LIB_DEPENDS=    libfftw3.so:math/fftw3 libuv.so:devel/libuv

USES=        compiler:c++14 gl gnome pkgconfig qmake qt:6 tar:bzip2 xorg

USE_QT=        buildtools:build core gui opengl qmake:build multimedia network svg widgets
USE_GL=        gl glut

USE_GITHUB=    yes
GH_ACCOUNT=    ??????

QMAKE_ARGS+=    PREFIXSHORTCUT=${PREFIX}

OPTIONS_DEFINE=        ALSA JACK OSS PORTAUDIO
OPTIONS_DEFAULT=    JACK OSS

ALSA_LIB_DEPENDS=    libasound.so:audio/alsa-lib
ALSA_QMAKE_ON=        CONFIG+=acs_alsa

OSS_QMAKE_ON=        CONFIG+=acs_oss

JACK_LIB_DEPENDS=    libjack.so:audio/jack
JACK_QMAKE_ON=        CONFIG+=acs_jack

PORTAUDIO_LIB_DEPENDS=    libportaudio.so:audio/portaudio
PORTAUDIO_QMAKE_ON=    CONFIG+=acs_portaudio

.include <bsd.port.mk>

/grandpa
 
There's code to build two libraries that are already in base system
To compile some changes are necessary to some config files
It's uses Qt6, xorg, qmake, mate, gl
Compiles with QtCreator on latest GhostBSD (FreeBSD 14.3) or from shell with qmake and make
 
Some progress but stuck at USE_GITLAB.
I need the GITLAB fetch to be recursive - like this

git clone --recursive https://gitlab.com/tp3/Entropy-Piano-Tuner.git

I have this but make fetch only grabs the surface:

Makefile:
USE_GITLAB=     yes

GL_SITE=        https://gitlab.com

GL_ACCOUNT=     tp3

GL_PROJECT=     Entropy-Piano-Tuner

GL_TAGNAME=     f9181865345be460ab5a08a009b49caae1f0d37c

CONFIGURE_ARGS= --recursive

Is there a way?
/grandpa
 
Dear SirDice,
Porters-handbook really need a project based approach. To learn basic stuff about the FreeBSD ports build system. Now all in one document, too much in one for my little brain... It would be nice if someone could make not "a reference document" but "a guide", i know in an ideal world :)
 
I've tried to handwrite the git{hub/lab} submodules.
sh:
$ grep -m1 GL_TUPLE /usr/ports/Mk/bsd.sites.mk
# GL_TUPLE      - above shortened to [site[:port][/webroot]:]account:project:tagname:group[/subdir]
Makefile:
USE_GITHUB=     nodefault
GH_TUPLE=       libuv:libuv:ca107b7:libuv/thirdparty/libuv/libuv
USE_GITLAB=     yes
GL_ACCOUNT=     tp3
GL_TAGNAME=     f9181865345be460ab5a08a009b49caae1f0d37c
GL_TUPLE=       chwick:fftw3-qmake:9fc2a56:fftw3_qmake/thirdparty/fftw3 \
                tp3:qtmidi:1c3bf17:qtmidi/thirdparty/qtmidi \
                chwick:qwt-lib:c778d34:qwt_lib/thirdparty/qwt-lib \
                tp3:tp3log:3861a44:tp3log/thirdparty/tp3log
sh:
yusuf@freebsd:/tmp/Entropy-Piano-Tuner $ git submodule
 9fc2a56e20f80a22a4b55e795a94647f536ee498 thirdparty/fftw3 (remotes/origin/Qt6)
 ca107b7f17fdbede154f00b63952eb523b003a4b thirdparty/libuv/libuv (v1.9.1-92-gca107b7f)
 1c3bf17cef82b9b6ac92b8c50e5b3f0c0ecbb550 thirdparty/qtmidi (qt5-3-g1c3bf17)
 c778d34abbfe7e2d28f4b493f61ef9b8ec17cb84 thirdparty/qwt-lib (heads/master)
 3861a44979d42ed3ded3367d9216d36df9893f13 thirdparty/tp3log (remotes/origin/no-qml-4-g3861a44)

Code:
[submodule "thirdparty/fftw3"]
    path = thirdparty/fftw3
    url = https://gitlab.com/chwick/fftw3-qmake.git
[submodule "thirdparty/libuv/libuv"]
    path = thirdparty/libuv/libuv
    url = https://github.com/libuv/libuv.git
[submodule "thirdparty/qwt-lib"]
    path = thirdparty/qwt-lib
    url = https://gitlab.com/chwick/qwt-lib.git
[submodule "thirdparty/tp3log"]
    path = thirdparty/tp3log
    url = https://gitlab.com/tp3/tp3log.git
[submodule "thirdparty/qtmidi"]
    path = thirdparty/qtmidi
    url = https://gitlab.com/tp3/qtmidi
 
I've tried to handwrite the git{hub/lab} submodules.
Thank you, I had just added qtmidi when I saw your reply :)

Your help proved invaluable - now it's compiling, albeit manually in the workdir. Have to change some arguments for qmake and do some testing and cleanup after build but this looks promising. Thank you once again!

Confirmed working 👍
 
Not sure if it was mentioned or inferred above, but best practice also includes submitting the platform patches back to the main github FOSS project repo. Granted, some FOSS project organizers can be jerks about accepting patches that don't fit their particular vision or FOSS license religion, but at least give it a shot. Just make sure the freeBSD port build is non-destructive to other platforms if it is merged back upstream.
 
Not sure if it was mentioned or inferred above, but best practice also includes submitting the platform patches back to the main github FOSS project repo. Granted, some FOSS project organizers can be jerks about accepting patches that don't fit their particular vision or FOSS license religion, but at least give it a shot. Just make sure the freeBSD port build is non-destructive to other platforms if it is merged back upstream.
I will contact the original authors and ask if they would like that.
 
Ok, so far I have it doing the following:

make fetch - ok
make stage - ok
make stage-qa - Warning: you might not need LIB_DEPENDS on libGL.so
make package - working on sorting this out

As for the stage-qa warning - there is no LIB_DEPENDS for libGL.so in the Makefile but there is USES+=gl. Can this warning be ignored?

/grandpa
 
So, with below Makefile it now does:

make fetch - ok
make stage - ok
make package - ok
make install - ok
runs as user - ok
make deinstall - ok
make clean - ok

There's 2 warnings for make-qa
make stage-qa
- Warning: you might not need LIB_DEPENDS on libGL.so
- Warning: you might not need LIB_DEPENDS on libQt6Qml.so

How do I go about managing these 2 warnings?

Moving on to testing on a fresh FreeBSD14.

/grandpa

Makefile:
PORTNAME=entropypianotuner
PORTVERSION=master
PORTREVISION=0
CATEGORIES=audio

MAINTAINER=maintainer@maintainers.net
COMMENT=Experimental software for tuning a piano

LICENSE=GPLv3
LICENSE_FILE_GPLv3=${WRKSRC}/gpl_v3.md

LIB_DEPENDS+=libfftw3.so:math/fftw3
LIB_DEPENDS+=libuv.so:devel/libuv
USE_LDCONFIG=   ${PREFIX}/lib/entropypianotuner ${PREFIX}/lib/entropypianotuner/algorithms

USES=compiler:c++14-lang qmake
USES+=qt:6
USES+=gl
USE_QT+=base
USE_QT+=declarative
USE_QT+=multimedia
USE_QT+=svg
USE_QT6+=buildtools:build core gui widgets
USE_GL+=gl
USE_GL+=opengl
USE_GITLAB=yes
GL_ACCOUNT=tp3
GL_PROJECT=Entropy-Piano-Tuner
GL_TUPLE=tp3:qtmidi:1c3bf17:qtmidi/thirdparty/qtmidi \
chwick:qwt-lib:c778d34:qwt_lib/thirdparty/qwt-lib \
tp3:tp3log:3861a44:tp3log/thirdparty/tp3log

post-fetch:
        DISTVERSION=1.3.0

do-install:
        ${INSTALL_PROGRAM} ${WRKSRC}/bin/entropypianotuner ${STAGEDIR}${PREFIX}/bin/
        ${MKDIR} ${STAGEDIR}${PREFIX}/lib/entropypianotuner
        ${INSTALL_LIB} ${WRKSRC}/bin/libcore.so.1.0.0 ${STAGEDIR}${PREFIX}/lib/entropypianotuner/

        ${RLN} ${STAGEDIR}${PREFIX}/lib/entropypianotuner/libcore.so.1.0.0  ${STAGEDIR}${PREFIX}/lib/entropypianotuner/libcore.so
        ${RLN} ${STAGEDIR}${PREFIX}/lib/entropypianotuner/libcore.so.1.0.0  ${STAGEDIR}${PREFIX}/lib/entropypianotuner/libcore.so.1
        ${RLN} ${STAGEDIR}${PREFIX}/lib/entropypianotuner/libcore.so.1.0.0  ${STAGEDIR}${PREFIX}/lib/entropypianotuner/libcore.so.1.0

        ${MKDIR} ${STAGEDIR}${PREFIX}/lib/entropypianotuner/algorithms
        ${INSTALL_LIB} ${WRKSRC}/bin/algorithms/libentropyminimizer.so ${STAGEDIR}${PREFIX}/lib/entropypianotuner/algorithms/
        ${INSTALL_LIB} ${WRKSRC}/bin/algorithms/libpitchraise.so ${STAGEDIR}${PREFIX}/lib/entropypianotuner/algorithms/
        ${INSTALL_LIB} ${WRKSRC}/bin/algorithms/libresettorecording.so ${STAGEDIR}${PREFIX}/lib/entropypianotuner/algorithms/

.include <bsd.port.mk>
 
I know nothing , this automatic build system tells maybe not needed.
- What happens when you remove these dependencies ?
- Otherwise i think everything will just be ok, its a warning , not an error.
 
There's 2 warnings for make-qa
make stage-qa
- Warning: you might not need LIB_DEPENDS on libGL.so
- Warning: you might not need LIB_DEPENDS on libQt6Qml.so
No need to explicitly request GL if using Qt6. Here's a recent port switch from Qt5 to Qt6: https://cgit.freebsd.org/ports/commit/?id=017ebc5f1c79dd3abc3535c5e368adbe59c7feac
As you can see, USES=gl and USE_GL are no longer needed.

As for QML: Don't put it in USE_QT if it's not actually needed/used by upstream.
 
Back
Top