[Bug 270594] textproc/fcitx5 ignores the options

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 02 Apr 2023 06:13:15 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270594

            Bug ID: 270594
           Summary: textproc/fcitx5 ignores the options
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: khng@freebsd.org
          Reporter: hellomao@outlook.com
             Flags: maintainer-feedback?(khng@freebsd.org)
          Assignee: khng@freebsd.org

Created attachment 241256
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=241256&action=edit
The patch to the Makefile in textproc/fcitx5

textproc/fcitx5 port provides three options ENCHANT, WAYLAND, and X11. If I
explicitly mark WAYLAND or X11 off, the build still look for WAYLAND or X11 and
fails if they doesn't exist.

Repro steps:
1. Make WAYLAND off. For example, below is the config I'm using
```
fcitx5 $ sudo make showconfig
Password:
===> The following configuration options are available for fcitx5-5.0.11_2:
     ENCHANT=on: Dictionary/spellchecking framework
     WAYLAND=off: Wayland (graphics) support
     X11=on: X11 (graphics) support
===> Use 'make config' to modify these settings
```

2. Build it (the machine must not have wayland install)
Here is the error
```
-- Could NOT find Wayland_Client (missing: Wayland_Client_LIBRARY
Wayland_Client_INCLUDE_DIR) (found version "") -- Could NOT find Wayland_Egl
(missing: Wayland_Egl_LIBRARY Wayland_Egl_INCLUDE_DIR Wayland_Client_FOUND)
(found version "") CMake Error at
/usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230
(message): Could NOT find Wayland (missing: Wayland_LIBRARIES Client Egl) Call
Stack (most recent call first):

/usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594
(_FPHSA_FAILURE_MESSAGE)
/usr/local/share/ECM/find-modules/FindWayland.cmake:110
(find_package_handle_standard_args) CMakeLists.txt:157 (find_package)

-- Configuring incomplete, errors occurred!
```

Root Cause

fcitx5 source code uses the options `ENABLE_X11` and `ENABLE_WAYLAND`. As shown
in the code at https://github.com/fcitx/fcitx5/blob/master/CMakeLists.txt
Here is the code snippet
```
option(ENABLE_X11 "Enable X11 support" On)
option(ENABLE_WAYLAND "Enable wayland support" On)
```

By default FreeBSD port convert the option using the option name. fcitxt5
source code has "ENABLE_" before the name. So neither ENABLE_X11 or
ENABLE_WAYLAND is set and they're always "On" even if I mark them off in
FreeBSD port.

I added the following two lines in the Makefile in the port and it builds
without WAYLAND
```
X11_CMAKE_BOOL=         ENABLE_X11
WAYLAND_CMAKE_BOOL=     ENABLE_WAYLAND
```
I also attach the diff of the Makefile for the port textproc/fcitx5.

-- 
You are receiving this mail because:
You are the assignee for the bug.