# X11-TOOLKIT/QT5-GUI, no dbus



## BSD-Kitsune (Sep 12, 2021)

As of yesterday I appear to have built it but haven't installed any supplementary ports to check it's operation.






						dpaste: D8MSMH49H
					






					dpaste.com
				




Here's the version of it without  devel/dbus support. If anyone's interested in a more complete thing or if there's a need to add these options upstream, then explain to me how we reconcile it. I'm not super familiar with big ports like this passing options into the binaries.


----------



## sidetone (Sep 30, 2021)

Did you get a response from emailing the maintainer?

A `diff -u` between the original Makefile and edited Makefile sent to them will help.

How about one with a radio or single option, to select it with `make config`. That way, it won't interfere with the way they intend to have it work, and it can be easily tested by deselecting dbus. I may try this, this week, and post the diff -u.


----------



## sidetone (Oct 1, 2021)

This is an attempt to make DBUS an option that can be selected by the user for x11-toolkits/qt5-gui. The `diff -u` is from the original Makefile.

```
--- Makefile.orig       2021-10-01 07:16:46.714179000 +0000
+++ Makefile    2021-10-01 07:39:08.581456000 +0000
@@ -14,8 +14,7 @@
                ${BUILD_DEPENDS_${ARCH}}
 BUILD_DEPENDS_armv6=   as:devel/binutils
 BUILD_DEPENDS_armv7=   as:devel/binutils
-LIB_DEPENDS=   libdbus-1.so:devel/dbus \
-               libevdev.so:devel/libevdev \
+LIB_DEPENDS=   libevdev.so:devel/libevdev \
                libfontconfig.so:x11-fonts/fontconfig \
                libfreetype.so:print/freetype2 \
                libharfbuzz.so:print/harfbuzz \
@@ -36,7 +35,7 @@
                        qmake:no_env qt-dist:5,base
 USE_GL=                        egl gl
 USE_GNOME=             glib20
-USE_QT=                        core dbus network buildtools_build qmake_build
+USE_QT=                        core network buildtools_build qmake_build
 QT_BINARIES=           yes
 QT_CONFIG=             accessibility accessibility-atspi-bridge dbus \
                        fontconfig glib opengl png system-freetype system-jpeg \
@@ -57,12 +56,14 @@
 BUILD_WRKSRC=  ${WRKSRC}/src/${PORTNAME}
 INSTALL_WRKSRC=        ${BUILD_WRKSRC}
 
-OPTIONS_DEFINE=                X11
-OPTIONS_DEFAULT=       X11
+OPTIONS_DEFINE=                X11 DBUS
+OPTIONS_DEFAULT=       X11 DBUS
 OPTIONS_SUB=           yes
 
 X11_USES=      xorg
 X11_USE=       xorg=x11
+DBUS_LIB_DEPENDS=      libdbus-1.so:devel/dbus
+DBUS_USE=      QT=dbus
 
 # Build and install QtPlatformSupport and default QPA plugins (XCB,
 # minimal and offscreen). QtGui won't work without (one of) them, but
```

These following lines were taken care of, and turned into options, to only be used when DBUS is chosen in the diff above.

```
LIB_DEPENDS=    libdbus-1.so:devel/dbus \
USE_QT=            core dbus network buildtools_build qmake_build
```
The following lines are the ones I couldn't figure out how to remove DBUS from hardset requirements, to include it into the option.

```
QT_CONFIG=        accessibility accessibility-atspi-bridge dbus \
QT_DEFINES=        ACCESSIBILITY DBUS FONTCONFIG FREETYPE GLIB \
```
An if/then statement can be used if DBUS is selected, or I don't know if it can possibly be included into the `DBUS_USE=` line. These two lines reference within /usr/ports/Mk/Uses/. When this part is figured out, it can be submitted to the maintainer. An if/then statement when DBUS is selected may be the best way to complete the last steps.


----------



## sidetone (Oct 1, 2021)

Here, I used an if-then statement, to take care of the remaining parts of QT_CONFIG= and QT_DEFINES=. This is the diff -u between the original and adjusted Makefile. This adjustment turns dbus into an option, to make it simpler for those who wish to test this port without it.
	
	



```
--- Makefile.orig       2021-10-01 07:16:46.714179000 +0000
+++ Makefile    2021-10-01 22:44:22.847818000 +0000
@@ -14,8 +14,7 @@
                ${BUILD_DEPENDS_${ARCH}}
 BUILD_DEPENDS_armv6=   as:devel/binutils
 BUILD_DEPENDS_armv7=   as:devel/binutils
-LIB_DEPENDS=   libdbus-1.so:devel/dbus \
-               libevdev.so:devel/libevdev \
+LIB_DEPENDS=   libevdev.so:devel/libevdev \
                libfontconfig.so:x11-fonts/fontconfig \
                libfreetype.so:print/freetype2 \
                libharfbuzz.so:print/harfbuzz \
@@ -36,13 +35,13 @@
                        qmake:no_env qt-dist:5,base
 USE_GL=                        egl gl
 USE_GNOME=             glib20
-USE_QT=                        core dbus network buildtools_build qmake_build
+USE_QT=                        core network buildtools_build qmake_build
 QT_BINARIES=           yes
-QT_CONFIG=             accessibility accessibility-atspi-bridge dbus \
+QT_CONFIG=             accessibility accessibility-atspi-bridge \
                        fontconfig glib opengl png system-freetype system-jpeg \
                        system-png xcb xcb-glx xcb-render xcb-xlib xinput2 xlib \
                        xrender
-QT_DEFINES=            ACCESSIBILITY DBUS FONTCONFIG FREETYPE GLIB \
+QT_DEFINES=            ACCESSIBILITY FONTCONFIG FREETYPE GLIB \
                        IMAGEFORMAT_PNG OPENGL SHAPE XCB XKB XKBCOMMON XRENDER
 USE_XORG=              ice sm xi xrender
 HAS_CONFIGURE=         yes
@@ -57,12 +56,14 @@
 BUILD_WRKSRC=  ${WRKSRC}/src/${PORTNAME}
 INSTALL_WRKSRC=        ${BUILD_WRKSRC}
 
-OPTIONS_DEFINE=                X11
-OPTIONS_DEFAULT=       X11
+OPTIONS_DEFINE=                X11 DBUS
+OPTIONS_DEFAULT=       X11 DBUS
 OPTIONS_SUB=           yes
 
 X11_USES=      xorg
 X11_USE=       xorg=x11
+DBUS_LIB_DEPENDS=      libdbus-1.so:devel/dbus
+DBUS_USE=      QT=dbus
 
 # Build and install QtPlatformSupport and default QPA plugins (XCB,
 # minimal and offscreen). QtGui won't work without (one of) them, but
@@ -113,3 +114,8 @@
 .endfor
 
 .include <bsd.port.mk>
+
+.if ${PORT_OPTIONS:MDBUS}
+QT_CONFIG+=    dbus
+QT_DEFINES+=   DBUS
+.endif
```

This diff got sent to the maintainer. (Update - it took getting on the https://mail.kde.org/mailman/listinfo/kde-freebsd mailing list for the message to pass through, otherwise it's put on hold and could get blocked.)



			The kde-freebsd October 2021 Archive by thread


----------



## sidetone (Oct 4, 2021)

I got a response, to add <bsd.port.options.mk> to the bottom. Also, there was a suggested replacement for the if-then statement.
	
	



```
--- Makefile.orig       2021-10-04 20:16:17.706647000 +0000
+++ Makefile    2021-10-04 20:23:18.678333000 +0000
@@ -14,8 +14,7 @@
                ${BUILD_DEPENDS_${ARCH}}
 BUILD_DEPENDS_armv6=   as:devel/binutils
 BUILD_DEPENDS_armv7=   as:devel/binutils
-LIB_DEPENDS=   libdbus-1.so:devel/dbus \
-               libevdev.so:devel/libevdev \
+LIB_DEPENDS=   libevdev.so:devel/libevdev \
                libfontconfig.so:x11-fonts/fontconfig \
                libfreetype.so:print/freetype2 \
                libharfbuzz.so:print/harfbuzz \
@@ -36,13 +35,13 @@
                        qmake:no_env qt-dist:5,base
 USE_GL=                        egl gl
 USE_GNOME=             glib20
-USE_QT=                        core dbus network buildtools_build qmake_build
+USE_QT=                        core network buildtools_build qmake_build
 QT_BINARIES=           yes
-QT_CONFIG=             accessibility accessibility-atspi-bridge dbus \
+QT_CONFIG=             accessibility accessibility-atspi-bridge \
                        fontconfig glib opengl png system-freetype system-jpeg \
                        system-png xcb xcb-glx xcb-render xcb-xlib xinput2 xlib \
                        xrender
-QT_DEFINES=            ACCESSIBILITY DBUS FONTCONFIG FREETYPE GLIB \
+QT_DEFINES=            ACCESSIBILITY FONTCONFIG FREETYPE GLIB \
                        IMAGEFORMAT_PNG OPENGL SHAPE XCB XKB XKBCOMMON XRENDER
 USE_XORG=              ice sm xi xrender
 HAS_CONFIGURE=         yes
@@ -57,13 +56,17 @@
 BUILD_WRKSRC=  ${WRKSRC}/src/${PORTNAME}
 INSTALL_WRKSRC=        ${BUILD_WRKSRC}
 
-OPTIONS_DEFINE=                X11
-OPTIONS_DEFAULT=       X11
+OPTIONS_DEFINE=                X11 DBUS
+OPTIONS_DEFAULT=       X11 DBUS
 OPTIONS_SUB=           yes
 
 X11_USES=      xorg
 X11_USE=       xorg=x11
 
+DBUS_LIB_DEPENDS=      libdbus-1.so:devel/dbus
+DBUS_USE=              QT=dbus
+DBUS_VARS=             QT_CONFIG+=dbus QT_DEFINES+=DBUS
+
 # Build and install QtPlatformSupport and default QPA plugins (XCB,
 # minimal and offscreen). QtGui won't work without (one of) them, but
 # they depend on QtGui itself, so they can't be added as dependencies.
@@ -113,3 +116,4 @@
 .endfor
 
 .include <bsd.port.mk>
+.include <bsd.port.options.mk>
```
If I understand correctly, suggested edits can be sent to be reviewed at https://deref-mail.com/mail/client/H77agQHcC7s/dereferrer/?redirectUrl=https://reviews.freebsd.org/


----------



## astyle (Oct 4, 2021)

Removing the tightly interwoven dependencies like this is generally a good idea... but if you don't like DBus, is there an alternative to the IPC that QT needs to have access to?


----------



## sidetone (Oct 4, 2021)

There's not that I know of. It doesn't hurt for those who want to try it without dbus. For those, it's better that it's an option, so it's uniform and testing it becomes simpler. A lot still works, in the past even faster without dbus.

Still, it was a good learning exercise for me. I also believe that, making more dependencies into options will be the start of a way the Ports tree gets cleaned up and improved. It will show, which ones pull in unnecessary dependencies. By making it an option, it won't hurt anything for those who use the default settings.

I forgot, that there was mention of masking of dbus in plist when it's changed from a hardset dependency. It has been sent to Bugzilla, https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258953.

I may get a Phabricator account at another time. That would be helpful for future edits/trials.


----------



## BSD-Kitsune (Oct 17, 2021)

Hi there Sidetone,

Sorry for the delay, as I mentioned in another thread I was sick and also preoccupied. Life stuff.

This looks better than I could have imagined. Good job. We can definitely benefit if this gets upstreamed. It may be good to push the FreeBSD-KDE ML to the existence of the bug, so we can get it upstreamed. I can probably do it sooner or later.


----------



## zirias@ (Oct 17, 2021)

sidetone said:


> I got a response, to add <bsd.port.options.mk> to the bottom. Also, there was a suggested replacement for the if-then statement.


Don't do _both_, you can remove this last line again.

In general, you include <bsd.port.options.mk> _before_ you check any options-related variables. <bsd.port.mk> must stay at the very bottom. Most of the time, doing this is unnecessary because the ports framework offers a lot of options-related helpers, see for example here a list of variables that understand the `<option>_FOO` and `<option>_FOO_OFF` variants: https://docs.freebsd.org/en/books/porters-handbook/makefiles/#options-variables

Did you check whether this change also influences pkg-plist?

Also, just using diff(1) will always work, but if you do changes more often and/or more complex changes, you'd profit a lot from learning to use `git` instead. It will take time to learn, but then it's much easier than manually fiddling with diff(1).

On the topic: A KDE Desktop uses dbus a lot, so will never work without it. But as for this change, it makes sense that the gui part of qt doesn't _have_ to depend on dbus.


----------



## BSD-Kitsune (Oct 18, 2021)

Yes, but obviously we're talking about for QT PROGRAMS, not DEs

I'm not building GNOME or KDE, and as I've said unpopularly -- i think we should give up on packaging/porting them and reallocate our forces elsewhere. But as these are volunteers, you can't bark orders at people.


----------



## sidetone (Oct 18, 2021)

That's a relevant point. It's useful for those who want to try it out and don't use KDE. It's an important note for those who do use KDE. They'll use it anyway, and I'm for it remaining as default.

It's partly why I wanted to make it an option, so it can be tried without breaking functionality for those who need it for something, or risking functionality for port sets that may rely on it.



BSD-Kitsune said:


> I'm not building GNOME or KDE, and as I've said unpopularly -- i think we should give up on packaging/porting them and reallocate our forces elsewhere. But as these are volunteers, you can't bark orders at people.


We need to learn about it, and improve our understanding of porting and helping with patches. Use options as a way of suiting different camps of thought. Using options in the wrong places could increase complexity. When an option isn't needed, for the port to work at all, the option is better as an option than a hardset dependency. When it comes to basic use without a desktop environment, it will decrease complexity. I'm slowly learning how to apply what's needed to achieve this through ports.


----------



## grahamperrin@ (Oct 18, 2021)

BSD-Kitsune said:


> … It may be good to push the FreeBSD-KDE ML to the existence …



<https://discord.com/channels/727023752348434432/831066226074976267/899547834427265054> (in _desktop_) draws attention to this topic.


----------



## BSD-Kitsune (Oct 18, 2021)

sidetone said:


> That's a relevant point. It's useful for those who want to try it out and don't use KDE. It's an important note for those who do use KDE. They'll use it anyway, and I'm for it remaining as default.
> 
> It's partly why I wanted to make it an option, so it can be tried without breaking functionality for those who need it for something, or risking functionality for port sets that may rely on it.
> 
> ...



My view is along the same sort of lines -- I wanted to make it an option but it's a lot harder with big ports like this than smaller ones, so I didn't know how. 

Additionally, for me, I'm pretty anti-GNOME/KDE/XFCE etc. If I had it my way, we'd only focus on our stuff. 

The fact that Lumina can't be built currently without dbus is a crying shame.


----------



## BSD-Kitsune (Nov 21, 2021)

I attempted Sidetone's patches and it didn't work. I tried finagling some more, it's still failing. 

Here's my current makefile (it's not an option here, just trying to get a raw build of it to work without dbus first. 

Not sure where to go, but it's absolutely possible to straight up build qt5 without dbus.


----------



## BSD-Kitsune (Nov 29, 2021)

http://216.10.183.226:9080/data/desktop-pkg/2021-11-28_17h54m39s/logs/errors/qt5-gui-5.15.2_7.log
		


With a similar makefile to above. here's where it breaks down. 

Uploaded as well for those interested in case my IP changes in the future. 

I'm not sure how to fix this.


----------

