From b1c8efa18df289d7b3e14e29fa4cea93537698c2 Mon Sep 17 00:00:00 2001 From: suyuan168 <175338101@qq.com> Date: Sat, 9 Apr 2022 03:16:11 +0800 Subject: [PATCH] fix libqmi modemamanger --- libqmi/Config.in | 15 +++ libqmi/Makefile | 52 +++++----- modemmanager/Config.in | 41 ++++---- modemmanager/Makefile | 66 ++++++------- modemmanager/files/modemmanager.common | 43 +++++---- modemmanager/files/modemmanager.init | 4 + modemmanager/files/modemmanager.proto | 21 ++-- .../files/usr/sbin/ModemManager-wrapper | 0 .../001-plugins-Fix-port-enums-includes.patch | 88 +++++++++++++++++ ...-meson-Fix-daemon-enums-dependencies.patch | 96 +++++++++++++++++++ 10 files changed, 309 insertions(+), 117 deletions(-) mode change 100644 => 100755 modemmanager/files/modemmanager.init mode change 100755 => 100644 modemmanager/files/usr/sbin/ModemManager-wrapper create mode 100644 modemmanager/patches/001-plugins-Fix-port-enums-includes.patch create mode 100644 modemmanager/patches/002-build-meson-Fix-daemon-enums-dependencies.patch diff --git a/libqmi/Config.in b/libqmi/Config.in index 6f35b7453..7dfa7ca52 100644 --- a/libqmi/Config.in +++ b/libqmi/Config.in @@ -13,4 +13,19 @@ config LIBQMI_WITH_QRTR_GLIB help Compile libqmi with QRTR support +choice + prompt "Select QMI message collection to build" + default LIBQMI_COLLECTION_BASIC + + config LIBQMI_COLLECTION_MINIMAL + depends on !MODEMMANAGER_WITH_QMI + bool "minimal" + + config LIBQMI_COLLECTION_BASIC + bool "basic (default)" + + config LIBQMI_COLLECTION_FULL + bool "full" +endchoice + endmenu diff --git a/libqmi/Makefile b/libqmi/Makefile index d3ebdeecd..603084cad 100644 --- a/libqmi/Makefile +++ b/libqmi/Makefile @@ -8,20 +8,23 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libqmi -PKG_VERSION:=1.30.4 +PKG_SOURCE_VERSION:=1.30.4 PKG_RELEASE:=$(AUTORELEASE) -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=https://www.freedesktop.org/software/libqmi -PKG_HASH:=00d7da30a4f8d1185f37cba289cfaf1dfcd04a58f2f76d6acfdf5b85312d6ed6 +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/libqmi.git +PKG_MIRROR_HASH:=537eae29c36aba9757afd86e48b91c37c3fe3232037ad11fdd426297f6040a6b PKG_MAINTAINER:=Nicholas Smith PKG_INSTALL:=1 -PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk +include $(INCLUDE_DIR)/meson.mk + +TARGET_CFLAGS += -ffunction-sections -fdata-sections -fno-merge-all-constants -fmerge-constants +TARGET_LDFLAGS += -Wl,--gc-sections define Package/libqmi/config source "$(SOURCE)/Config.in" @@ -59,28 +62,16 @@ define Package/libqmi-utils/description Utils to talk to QMI enabled modems endef -CONFIGURE_ARGS += \ - --disable-static \ - --disable-gtk-doc \ - --disable-gtk-doc-html \ - --disable-gtk-doc-pdf \ - --disable-silent-rules \ - --enable-firmware-update \ - --enable-more-warnings=yes \ - --without-udev \ - --without-udev-base-dir - -ifeq ($(CONFIG_LIBQMI_WITH_MBIM_QMUX),y) - CONFIGURE_ARGS += --enable-mbim-qmux -else - CONFIGURE_ARGS += --disable-mbim-qmux -endif - -ifeq ($(CONFIG_LIBQMI_WITH_QRTR_GLIB),y) - CONFIGURE_ARGS += --enable-qrtr -else - CONFIGURE_ARGS += --disable-qrtr -endif +MESON_ARGS += \ + -Dudev=false \ + -Dintrospection=false \ + -Dman=false \ + -Dbash_completion=false \ + -Db_lto=true \ + -Dmbim_qmux=$(if $(CONFIG_LIBQMI_WITH_MBIM_QMUX),true,false) \ + -Dqrtr=$(if $(CONFIG_LIBQMI_WITH_QRTR_GLIB),true,false) \ + -Dcollection=$(if $(CONFIG_LIBQMI_COLLECTION_MINIMAL),minimal\ + ,$(if $(CONFIG_LIBQMI_COLLECTION_BASIC),basic,full)) define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include @@ -100,12 +91,15 @@ define Build/InstallDev endef define Package/libqmi/install - $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DIR) \ + $(1)/usr/lib \ + $(1)/usr/libexec + $(CP) \ $(PKG_INSTALL_DIR)/usr/lib/libqmi*.so.* \ $(1)/usr/lib/ - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/qmi-proxy $(1)/usr/lib/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/libexec/qmi-proxy $(1)/usr/libexec/ endef define Package/qmi-utils/install diff --git a/modemmanager/Config.in b/modemmanager/Config.in index 283a9e10a..ebcb60dbc 100644 --- a/modemmanager/Config.in +++ b/modemmanager/Config.in @@ -1,21 +1,30 @@ menu "Configuration" -depends on PACKAGE_modemmanager + depends on PACKAGE_modemmanager - config MODEMMANAGER_WITH_MBIM - bool "Include MBIM support" - default y - help - Compile ModemManager with MBIM support +config MODEMMANAGER_WITH_MBIM + bool "Include MBIM support" + default y + help + Compile ModemManager with MBIM support - config MODEMMANAGER_WITH_QMI - bool "Include QMI support" - default y - help - Compile ModemManager with QMI support +config MODEMMANAGER_WITH_QMI + bool "Include QMI support" + default y + help + Compile ModemManager with QMI support + +config MODEMMANAGER_WITH_QRTR + bool "Include QRTR support" + default y + depends on MODEMMANAGER_WITH_QMI + select LIBQMI_WITH_QRTR_GLIB + help + Compile ModemManager with QRTR support + +config MODEMMANAGER_WITH_AT_COMMAND_VIA_DBUS + bool "Allow AT commands via DBus" + default n + help + Compile ModemManager allowing AT commands without debug flag - config MODEMMANAGER_WITH_AT_COMMAND_VIA_DBUS - bool "Allow AT commands via DBus" - default n - help - Compile ModemManager allowing AT commands without debug flag endmenu diff --git a/modemmanager/Makefile b/modemmanager/Makefile index 3eb780398..99b4dec0c 100644 --- a/modemmanager/Makefile +++ b/modemmanager/Makefile @@ -8,23 +8,26 @@ include $(TOPDIR)/rules.mk PKG_NAME:=modemmanager -PKG_VERSION:=1.18.6 -PKG_RELEASE:=1 +PKG_SOURCE_VERSION:=1.18.6 +PKG_RELEASE:=$(AUTORELEASE) -PKG_SOURCE:=ModemManager-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=https://www.freedesktop.org/software/ModemManager -PKG_HASH:=d4f804b31cf504239c5f1d4973c62095c00cba1ee9abb503718dac6d146a470a -PKG_BUILD_DIR:=$(BUILD_DIR)/ModemManager-$(PKG_VERSION) +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git +PKG_MIRROR_HASH:=72f1a865153745d05c482ed3a77f2045d24387f1f9a37177fe7bc35ab7663765 -PKG_MAINTAINER:=Nicholas Smith +PKG_MAINTAINER:=Nicholas Smith PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=COPYING PKG_INSTALL:=1 -PKG_BUILD_PARALLEL:=1 +PKG_BUILD_DEPENDS:=glib2/host libxslt/host include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk +include $(INCLUDE_DIR)/meson.mk + +TARGET_CFLAGS += -ffunction-sections -fdata-sections -fno-merge-all-constants -fmerge-constants +TARGET_LDFLAGS += -Wl,--gc-sections define Package/modemmanager/config source "$(SOURCE)/Config.in" @@ -41,7 +44,8 @@ define Package/modemmanager +dbus \ +ppp \ +MODEMMANAGER_WITH_MBIM:libmbim \ - +MODEMMANAGER_WITH_QMI:libqmi + +MODEMMANAGER_WITH_QMI:libqmi \ + +MODEMMANAGER_WITH_QRTR:libqrtr-glib endef define Package/modemmanager/description @@ -50,35 +54,21 @@ define Package/modemmanager/description Select Utilities/usb-modeswitch if needed. endef -CONFIGURE_ARGS += \ - --without-polkit \ - --without-udev \ - --without-systemdsystemunitdir \ - --disable-rpath \ - --disable-gtk-doc - -ifeq ($(CONFIG_MODEMMANAGER_WITH_AT_COMMAND_VIA_DBUS),y) - CONFIGURE_ARGS += --with-at-command-via-dbus -endif - -ifdef CONFIG_MODEMMANAGER_WITH_MBIM - CONFIGURE_ARGS += --with-mbim -else - CONFIGURE_ARGS += --without-mbim -endif - -ifdef CONFIG_MODEMMANAGER_WITH_QMI - CONFIGURE_ARGS += --with-qmi -else - CONFIGURE_ARGS += --without-qmi -endif - -define Build/Prepare - $(call Build/Prepare/Default) - ( cd "$(PKG_BUILD_DIR)"; \ - printf "all:\ninstall:\n" >po/Makefile.in.in; \ - ) -endef +MESON_ARGS += \ + -Dudev=false \ + -Dudevdir=/lib/udev \ + -Dsystemdsystemunitdir=no \ + -Dsystemd_suspend_resume=false \ + -Dsystemd_journal=false \ + -Dpolkit=no \ + -Dintrospection=false \ + -Dman=false \ + -Dbash_completion=false \ + -Db_lto=true \ + -Dmbim=$(if $(CONFIG_MODEMMANAGER_WITH_MBIM),true,false) \ + -Dqmi=$(if $(CONFIG_MODEMMANAGER_WITH_QMI),true,false) \ + -Dqrtr=$(if $(CONFIG_MODEMMANAGER_WITH_QRTR),true,false) \ + -Dat_command_via_dbus=$(if $(CONFIG_MODEMMANAGER_WITH_AT_COMMAND_VIA_DBUS),true,false) define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include/ModemManager diff --git a/modemmanager/files/modemmanager.common b/modemmanager/files/modemmanager.common index a439179de..6367eb32b 100644 --- a/modemmanager/files/modemmanager.common +++ b/modemmanager/files/modemmanager.common @@ -20,7 +20,8 @@ MODEMMANAGER_EVENTS_CACHE="${MODEMMANAGER_RUNDIR}/events.cache" # Common logging mm_log() { - [ "$(uci -q get openmptcprouter.settings.debug)" = "true" ] && logger -t "ModemManager" "hotplug: $*" + local level="$1"; shift + logger -p "daemon.${level}" -t "ModemManager[$$]" "hotplug: $*" } ################################################################################ @@ -39,14 +40,14 @@ mm_find_physdev_sysfs_path() { # avoid infinite loops iterating [ -z "${tmp_path}" ] || [ "${tmp_path}" = "/" ] && return - # for USB devices, the physical device will be that with a idVendor - # and idProduct pair of files + # For USB devices, the physical device will be that with a idVendor + # and idProduct pair of files [ -f "${tmp_path}"/idVendor ] && [ -f "${tmp_path}"/idProduct ] && { tmp_path=$(readlink -f "$tmp_path") echo "${tmp_path}" return } - + # For PCI devices, the physical device will be that with a vendor # and device pair of files [ -f "${tmp_path}"/vendor ] && [ -f "${tmp_path}"/device ] && { @@ -169,7 +170,7 @@ mm_wait_for_modem() { while [ $n -ge 0 ]; do [ -d "${sysfspath}" ] || { - mm_log "error: ignoring modem detection request: no device at ${sysfspath}" + mm_log "error" "ignoring modem detection request: no device at ${sysfspath}" proto_set_available "${cfg}" 0 return 1 } @@ -177,10 +178,10 @@ mm_wait_for_modem() { # Check if the modem exists at the given sysfs path if ! mmcli -m "${sysfspath}" > /dev/null 2>&1 then - mm_log "error: modem not detected at sysfs path" + mm_log "error" "modem not detected at sysfs path" else - mm_log "modem exported successfully at ${sysfspath}" - mm_log "setting interface '${cfg}' as available" + mm_log "info" "modem exported successfully at ${sysfspath}" + mm_log "info" "setting interface '${cfg}' as available" proto_set_available "${cfg}" 1 return 0 fi @@ -189,7 +190,7 @@ mm_wait_for_modem() { n=$((n-step)) done - mm_log "error: timed out waiting for the modem to get exported at ${sysfspath}" + mm_log "error" "timed out waiting for the modem to get exported at ${sysfspath}" proto_set_available "${cfg}" 0 return 2 } @@ -201,7 +202,7 @@ mm_report_modem_wait() { parent_sysfspath=$(mm_find_physdev_sysfs_path "$sysfspath") [ -n "${parent_sysfspath}" ] || { - mm_log "error: parent device sysfspath not found" + mm_log "error" "parent device sysfspath not found" return } @@ -212,23 +213,23 @@ mm_report_modem_wait() { cfg=$(mm_get_modem_config "${parent_sysfspath}") if [ -n "${cfg}" ]; then - mm_log "interface '${cfg}' is set to configure device '${parent_sysfspath}'" - mm_log "now waiting for modem at sysfs path ${parent_sysfspath}" + mm_log "info" "interface '${cfg}' is set to configure device '${parent_sysfspath}'" + mm_log "info" "now waiting for modem at sysfs path ${parent_sysfspath}" mm_set_modem_wait_status "${parent_sysfspath}" "processed" # Launch subshell for the explicit wait ( mm_wait_for_modem "${cfg}" "${parent_sysfspath}" ) > /dev/null 2>&1 & else - mm_log "no need to wait for modem at sysfs path ${parent_sysfspath}" + mm_log "info" "no need to wait for modem at sysfs path ${parent_sysfspath}" mm_set_modem_wait_status "${parent_sysfspath}" "ignored" fi ;; "processed") - mm_log "already waiting for modem at sysfs path ${parent_sysfspath}" + mm_log "info" "already waiting for modem at sysfs path ${parent_sysfspath}" ;; "ignored") ;; *) - mm_log "error: unknown status read for device at sysfs path ${parent_sysfspath}" + mm_log "error" "unknown status read for device at sysfs path ${parent_sysfspath}" ;; esac } @@ -258,7 +259,7 @@ mm_cleanup_interface_by_sysfspath() { cfg=$(mm_get_modem_config "$dev") [ -n "${cfg}" ] || return - mm_log "setting interface '$cfg' as unavailable" + mm_log "info" "setting interface '$cfg' as unavailable" proto_set_available "${cfg}" 0 } @@ -286,7 +287,7 @@ mm_report_event() { esac # Report the event - mm_log "event reported: action=${action}, name=${name}, subsystem=${subsystem}" + mm_log "debug" "event reported: action=${action}, name=${name}, subsystem=${subsystem}" mmcli --report-kernel-event="action=${action},name=${name},subsystem=${subsystem}" 1>/dev/null 2>&1 & # Wait for added modem if a sysfspath is given @@ -302,7 +303,7 @@ mm_report_event_from_cache_line() { subsystem=$(echo "${event_line}" | awk -F ',' '{ print $3 }') sysfspath=$(echo "${event_line}" | awk -F ',' '{ print $4 }') - mm_log "cached event found: action=${action}, name=${name}, subsystem=${subsystem}, sysfspath=${sysfspath}" + mm_log "debug" "cached event found: action=${action}, name=${name}, subsystem=${subsystem}, sysfspath=${sysfspath}" mm_report_event "${action}" "${name}" "${subsystem}" "${sysfspath}" } @@ -317,11 +318,11 @@ mm_report_events_from_cache() { # Wait for ModemManager to be available in the bus while [ $n -ge 0 ]; do sleep $step - mm_log "checking if ModemManager is available..." + mm_log "info" "checking if ModemManager is available..." if ! mmcli -L >/dev/null 2>&1 then - mm_log "ModemManager not yet available" + mm_log "info" "ModemManager not yet available" else mmrunning=1 break @@ -330,7 +331,7 @@ mm_report_events_from_cache() { done [ ${mmrunning} -eq 1 ] || { - mm_log "error: couldn't report initial kernel events: ModemManager not running" + mm_log "error" "couldn't report initial kernel events: ModemManager not running" return } diff --git a/modemmanager/files/modemmanager.init b/modemmanager/files/modemmanager.init old mode 100644 new mode 100755 index a3f6c1b12..7f014dc56 --- a/modemmanager/files/modemmanager.init +++ b/modemmanager/files/modemmanager.init @@ -4,6 +4,8 @@ USE_PROCD=1 START=70 +LOG_LEVEL="INFO" + stop_service() { # Load common utils . /usr/share/ModemManager/modemmanager.common @@ -28,6 +30,8 @@ start_service() { . /usr/share/ModemManager/modemmanager.common procd_open_instance procd_set_param command /usr/sbin/ModemManager-wrapper + procd_append_param command --log-level="$LOG_LEVEL" + [ "$LOG_LEVEL" = "DEBUG" ] && procd_append_param command --debug procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}" procd_set_param pidfile "${MODEMMANAGER_PID_FILE}" procd_close_instance diff --git a/modemmanager/files/modemmanager.proto b/modemmanager/files/modemmanager.proto index 0e050e7b9..d24910b98 100755 --- a/modemmanager/files/modemmanager.proto +++ b/modemmanager/files/modemmanager.proto @@ -197,7 +197,6 @@ modemmanager_connected_method_dhcp_ipv4() { local interface="$1" local wwan="$2" local metric="$3" - local defaultroute="$4" proto_init_update "${wwan}" 1 proto_set_keep 1 @@ -223,7 +222,6 @@ modemmanager_connected_method_static_ipv4() { local dns1="$7" local dns2="$8" local metric="$9" - local defaultroute="$10" local mask="" @@ -244,9 +242,8 @@ modemmanager_connected_method_static_ipv4() { proto_set_keep 1 echo "adding IPv4 address ${address}, netmask ${mask}" proto_add_ipv4_address "${address}" "${mask}" - [ -n "${gateway}" ] && [ "${defaultroute}" != 0 ] && { + [ -n "${gateway}" ] && { echo "adding default IPv4 route via ${gateway}" - logger -t "modemmanager.proto" "adding default IPv4 route via ${gateway} ${address}" proto_add_ipv4_route "0.0.0.0" "0" "${gateway}" "${address}" } [ -n "${dns1}" ] && { @@ -265,7 +262,6 @@ modemmanager_connected_method_dhcp_ipv6() { local interface="$1" local wwan="$2" local metric="$3" - local defaultroute="$4" proto_init_update "${wwan}" 1 proto_set_keep 1 @@ -292,7 +288,6 @@ modemmanager_connected_method_static_ipv6() { local dns1="$7" local dns2="$8" local metric="$9" - local defaultroute="$10" [ -n "${address}" ] || { proto_notify_error "${interface}" ADDRESS_MISSING @@ -311,7 +306,7 @@ modemmanager_connected_method_static_ipv6() { echo "adding IPv6 address ${address}, prefix ${prefix}" proto_add_ipv6_address "${address}" "128" proto_add_ipv6_prefix "${address}/${prefix}" - [ -n "${gateway}" ] && [ "$defaultroute" != 0 ] && { + [ -n "${gateway}" ] && { echo "adding default IPv6 route via ${gateway}" proto_add_ipv6_route "${gateway}" "128" proto_add_ipv6_route "::0" "0" "${gateway}" "" "" "${address}/${prefix}" @@ -362,9 +357,9 @@ proto_modemmanager_setup() { local device apn allowedauth username password pincode iptype metric signalrate - local address prefix gateway mtu dns1 dns2 defaultroute + local address prefix gateway mtu dns1 dns2 - json_get_vars device apn allowedauth username password pincode iptype metric signalrate defaultroute + json_get_vars device apn allowedauth username password pincode iptype metric signalrate # validate sysfs path given in config [ -n "${device}" ] || { @@ -452,7 +447,7 @@ proto_modemmanager_setup() { echo "IPv4 connection setup required in interface ${interface}: ${bearermethod_ipv4}" case "${bearermethod_ipv4}" in "dhcp") - modemmanager_connected_method_dhcp_ipv4 "${interface}" "${beareriface}" "${metric}" "${defaultroute}" + modemmanager_connected_method_dhcp_ipv4 "${interface}" "${beareriface}" "${metric}" ;; "static") address=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.address") @@ -461,7 +456,7 @@ proto_modemmanager_setup() { mtu=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.mtu") dns1=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.dns.value\[1\]") dns2=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv4-config.dns.value\[2\]") - modemmanager_connected_method_static_ipv4 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}" "${defaultroute}" + modemmanager_connected_method_static_ipv4 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}" ;; "ppp") modemmanager_connected_method_ppp_ipv4 "${interface}" "${beareriface}" "${username}" "${password}" "${allowedauth}" @@ -479,7 +474,7 @@ proto_modemmanager_setup() { echo "IPv6 connection setup required in interface ${interface}: ${bearermethod_ipv6}" case "${bearermethod_ipv6}" in "dhcp") - modemmanager_connected_method_dhcp_ipv6 "${interface}" "${beareriface}" "${metric}" "${defaultroute}" + modemmanager_connected_method_dhcp_ipv6 "${interface}" "${beareriface}" "${metric}" ;; "static") address=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.address") @@ -488,7 +483,7 @@ proto_modemmanager_setup() { mtu=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.mtu") dns1=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.dns.value\[1\]") dns2=$(modemmanager_get_field "${bearerstatus}" "bearer.ipv6-config.dns.value\[2\]") - modemmanager_connected_method_static_ipv6 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}" "${defaultroute}" + modemmanager_connected_method_static_ipv6 "${interface}" "${beareriface}" "${address}" "${prefix}" "${gateway}" "${mtu}" "${dns1}" "${dns2}" "${metric}" ;; "ppp") proto_notify_error "${interface}" "unsupported method" diff --git a/modemmanager/files/usr/sbin/ModemManager-wrapper b/modemmanager/files/usr/sbin/ModemManager-wrapper old mode 100755 new mode 100644 diff --git a/modemmanager/patches/001-plugins-Fix-port-enums-includes.patch b/modemmanager/patches/001-plugins-Fix-port-enums-includes.patch new file mode 100644 index 000000000..0b54cb22d --- /dev/null +++ b/modemmanager/patches/001-plugins-Fix-port-enums-includes.patch @@ -0,0 +1,88 @@ +--- a/plugins/broadmobi/mm-plugin-broadmobi.c ++++ b/plugins/broadmobi/mm-plugin-broadmobi.c +@@ -19,7 +19,6 @@ + #define _LIBMM_INSIDE_MM + #include + +-#include "mm-port-enums-types.h" + #include "mm-log-object.h" + #include "mm-plugin-broadmobi.h" + #include "mm-broadband-modem.h" +--- a/plugins/dlink/mm-plugin-dlink.c ++++ b/plugins/dlink/mm-plugin-dlink.c +@@ -19,7 +19,6 @@ + #define _LIBMM_INSIDE_MM + #include + +-#include "mm-port-enums-types.h" + #include "mm-log-object.h" + #include "mm-plugin-dlink.h" + #include "mm-broadband-modem.h" +--- a/plugins/meson.build ++++ b/plugins/meson.build +@@ -461,7 +461,7 @@ if plugins_options['huawei'] + plugins += {'plugin-huawei': { + 'plugin': true, + 'helper': {'sources': files('huawei/mm-modem-helpers-huawei.c'), 'include_directories': plugins_incs + [huawei_inc], 'c_args': common_c_args + ['-DMM_MODULE_NAME="huawei"']}, +- 'module': {'sources': sources + enums_sources, 'include_directories': plugins_incs + [huawei_inc], 'c_args': common_c_args + ['-DMM_MODULE_NAME="huawei"']}, ++ 'module': {'sources': sources + enums_sources + port_enums_sources, 'include_directories': plugins_incs + [huawei_inc], 'c_args': common_c_args + ['-DMM_MODULE_NAME="huawei"']}, + 'test': {'sources': files('huawei/tests/test-modem-helpers-huawei.c') + enums_sources, 'include_directories': huawei_inc, 'dependencies': libhelpers_dep}, + }} + +--- a/plugins/telit/mm-plugin-telit.c ++++ b/plugins/telit/mm-plugin-telit.c +@@ -21,7 +21,6 @@ + #define _LIBMM_INSIDE_MM + #include + +-#include "mm-port-enums-types.h" + #include "mm-log-object.h" + #include "mm-modem-helpers.h" + #include "mm-plugin-telit.h" +--- a/plugins/tplink/mm-plugin-tplink.c ++++ b/plugins/tplink/mm-plugin-tplink.c +@@ -19,7 +19,6 @@ + #define _LIBMM_INSIDE_MM + #include + +-#include "mm-port-enums-types.h" + #include "mm-log-object.h" + #include "mm-plugin-tplink.h" + #include "mm-broadband-modem.h" +--- a/src/meson.build ++++ b/src/meson.build +@@ -147,15 +147,15 @@ endif + + enums_types = 'mm-port-enums-types' + +-enums_sources = [] +-enums_sources += gnome.mkenums( ++port_enums_sources = [] ++port_enums_sources += gnome.mkenums( + enums_types + '.c', + sources: headers, + c_template: build_aux_dir / enums_types + '.c.template', + fhead: '#include "mm-port-enums-types.h"', + ) + +-enums_sources += gnome.mkenums( ++port_enums_sources += gnome.mkenums( + enums_types + '.h', + sources: headers, + h_template: build_aux_dir / enums_types + '.h.template', +@@ -165,13 +165,13 @@ enums_sources += gnome.mkenums( + + libport = static_library( + 'port', +- sources: sources + enums_sources, ++ sources: sources + port_enums_sources, + include_directories: top_inc, + dependencies: deps + private_deps, + ) + + libport_dep = declare_dependency( +- sources: enums_sources[1], ++ sources: port_enums_sources[1], + include_directories: '.', + dependencies: deps, + link_with: libport, diff --git a/modemmanager/patches/002-build-meson-Fix-daemon-enums-dependencies.patch b/modemmanager/patches/002-build-meson-Fix-daemon-enums-dependencies.patch new file mode 100644 index 000000000..8ca5cb835 --- /dev/null +++ b/modemmanager/patches/002-build-meson-Fix-daemon-enums-dependencies.patch @@ -0,0 +1,96 @@ +--- a/plugins/meson.build ++++ b/plugins/meson.build +@@ -88,7 +88,7 @@ if plugins_shared['icera'] + plugins += {'shared-icera': { + 'plugin': false, + 'helper': {'sources': files('icera/mm-modem-helpers-icera.c'), 'include_directories': plugins_incs, 'c_args': common_c_args}, +- 'module': {'sources': sources, 'include_directories': plugins_incs, 'c_args': common_c_args}, ++ 'module': {'sources': sources + daemon_enums_sources, 'include_directories': plugins_incs, 'c_args': common_c_args}, + 'test': {'sources': files('icera/tests/test-modem-helpers-icera.c'), 'include_directories': plugins_incs + [icera_inc], 'dependencies': libhelpers_dep}, + }} + endif +@@ -185,7 +185,7 @@ if plugins_shared['telit'] + plugins += {'shared-telit': { + 'plugin': false, + 'helper': {'sources': files('telit/mm-modem-helpers-telit.c'), 'include_directories': plugins_incs, 'c_args': common_c_args}, +- 'module': {'sources': sources, 'include_directories': plugins_incs + [telit_inc], 'c_args': common_c_args}, ++ 'module': {'sources': sources + daemon_enums_sources, 'include_directories': plugins_incs + [telit_inc], 'c_args': common_c_args}, + 'test': {'sources': files('telit/tests/test-mm-modem-helpers-telit.c'), 'include_directories': telit_inc, 'dependencies': libmm_test_common_dep}, + }} + endif +@@ -285,7 +285,7 @@ if plugins_options['cinterion'] + plugins += {'plugin-cinterion': { + 'plugin': true, + 'helper': {'sources': files('cinterion/mm-modem-helpers-cinterion.c'), 'include_directories': plugins_incs, 'c_args': common_c_args}, +- 'module': {'sources': sources, 'include_directories': plugins_incs, 'c_args': common_c_args}, ++ 'module': {'sources': sources + daemon_enums_sources, 'include_directories': plugins_incs, 'c_args': common_c_args}, + 'test': {'sources': files('cinterion/tests/test-modem-helpers-cinterion.c'), 'include_directories': plugins_incs + [include_directories('cinterion')], 'dependencies': libport_dep}, + }} + +@@ -460,8 +460,8 @@ if plugins_options['huawei'] + + plugins += {'plugin-huawei': { + 'plugin': true, +- 'helper': {'sources': files('huawei/mm-modem-helpers-huawei.c'), 'include_directories': plugins_incs + [huawei_inc], 'c_args': common_c_args + ['-DMM_MODULE_NAME="huawei"']}, +- 'module': {'sources': sources + enums_sources + port_enums_sources, 'include_directories': plugins_incs + [huawei_inc], 'c_args': common_c_args + ['-DMM_MODULE_NAME="huawei"']}, ++ 'helper': {'sources': files('huawei/mm-modem-helpers-huawei.c') + daemon_enums_sources, 'include_directories': plugins_incs + [huawei_inc], 'c_args': common_c_args + ['-DMM_MODULE_NAME="huawei"']}, ++ 'module': {'sources': sources + enums_sources + port_enums_sources + daemon_enums_sources, 'include_directories': plugins_incs + [huawei_inc], 'c_args': common_c_args + ['-DMM_MODULE_NAME="huawei"']}, + 'test': {'sources': files('huawei/tests/test-modem-helpers-huawei.c') + enums_sources, 'include_directories': huawei_inc, 'dependencies': libhelpers_dep}, + }} + +@@ -534,7 +534,7 @@ if plugins_options['mbm'] + plugins += {'plugin-ericsson-mbm': { + 'plugin': true, + 'helper': {'sources': files('mbm/mm-modem-helpers-mbm.c'), 'include_directories': plugins_incs, 'c_args': common_c_args + ['-DMM_MODULE_NAME="ericsson-mbm"']}, +- 'module': {'sources': sources, 'include_directories': plugins_incs, 'c_args': common_c_args + ['-DMM_MODULE_NAME="ericsson-mbm"']}, ++ 'module': {'sources': sources + daemon_enums_sources, 'include_directories': plugins_incs, 'c_args': common_c_args + ['-DMM_MODULE_NAME="ericsson-mbm"']}, + 'test': {'sources': files('mbm/tests/test-modem-helpers-mbm.c'), 'include_directories': plugins_incs + [include_directories('mbm')], 'dependencies': libhelpers_dep}, + }} + +@@ -644,7 +644,7 @@ if plugins_options['option-hso'] + + plugins += {'plugin-option-hso': { + 'plugin': true, +- 'module': {'sources': sources, 'include_directories': plugins_incs, 'c_args': '-DMM_MODULE_NAME="option-hso"'}, ++ 'module': {'sources': sources + daemon_enums_sources, 'include_directories': plugins_incs, 'c_args': '-DMM_MODULE_NAME="option-hso"'}, + }} + endif + +@@ -852,7 +852,7 @@ if plugins_options['ublox'] + plugins += {'plugin-ublox': { + 'plugin': true, + 'helper': {'sources': files('ublox/mm-modem-helpers-ublox.c'), 'include_directories': plugins_incs, 'c_args': common_c_args}, +- 'module': {'sources': sources, 'include_directories': plugins_incs + [ublox_inc], 'c_args': common_c_args}, ++ 'module': {'sources': sources + daemon_enums_sources, 'include_directories': plugins_incs + [ublox_inc], 'c_args': common_c_args}, + 'test': {'sources': files('ublox/tests/test-modem-helpers-ublox.c'), 'include_directories': ublox_inc, 'dependencies': libmm_test_common_dep}, + }} + +--- a/src/meson.build ++++ b/src/meson.build +@@ -225,14 +225,15 @@ sources = files( + + enums_types = 'mm-daemon-enums-types' + +-sources += gnome.mkenums( ++daemon_enums_sources = [] ++daemon_enums_sources += gnome.mkenums( + enums_types + '.c', + sources: headers, + c_template: build_aux_dir / enums_types + '.c.template', + fhead: '#include "mm-daemon-enums-types.h"', + ) + +-sources += gnome.mkenums( ++daemon_enums_sources += gnome.mkenums( + enums_types + '.h', + sources: headers, + h_template: build_aux_dir / enums_types + '.h.template', +@@ -296,7 +297,7 @@ endif + + executable( + 'ModemManager', +- sources: sources, ++ sources: sources + daemon_enums_sources, + include_directories: top_inc, + dependencies: deps, + c_args: c_args,