libqmi: switch to meson build tools
authorMaxim Anisimov <maxim.anisimov.ua@gmail.com>
Sat, 26 Mar 2022 09:04:26 +0000 (12:04 +0300)
committerFlorian Eckert <fe@dev.tdt.de>
Fri, 2 Dec 2022 10:39:13 +0000 (11:39 +0100)
Using https://gitlab.freedesktop.org/mobile-broadband/libqmi.git to download the source code.
Enabled lto and additional gcc flags for perfomance and less size.
Added support for selecting qmi message collection.
Selected basic qmi message collection by default (modemmanager requires it).
Modified to use meson as upstream has abandoned autotools.
Removed BUILD_PARALLEL options. These are default with ninja/meson.

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
(cherry picked from commit f7cbd445408756b7a44764080063a9a4158988ed)
(cherry picked from commit 1683d7c96373948d4c25266f9aaedcf85f13695e)

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Update meson include dir for branch openwrt-21.02.

libs/libqmi/Config.in
libs/libqmi/Makefile

index 6f35b74539b1962ea9a744528bd401a8db2cf8fc..7dfa7ca524c7bdc82227c6d7862e00dda79b3da7 100644 (file)
@@ -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
index e7ef205e6a13990cf4313f088eaaf77748491824..341363c9085a43470e91cba061fe6dd9cb10e063 100644 (file)
@@ -11,17 +11,22 @@ PKG_NAME:=libqmi
 PKG_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_SOURCE_VERSION:=$(PKG_VERSION)
+PKG_MIRROR_HASH:=537eae29c36aba9757afd86e48b91c37c3fe3232037ad11fdd426297f6040a6b
 
 PKG_MAINTAINER:=Nicholas Smith <nicholas@nbembedded.com>
 
 PKG_INSTALL:=1
-PKG_BUILD_PARALLEL:=1
+PKG_BUILD_DEPENDS:=python3/host
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/nls.mk
+include ../../devel/meson/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,26 +64,31 @@ 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 \
-       --without-udev \
-       --without-udev-base-dir
+MESON_ARGS += \
+       -Dudev=false \
+       -Dintrospection=false \
+       -Dman=false \
+       -Dbash_completion=false \
+       -Db_lto=true
 
 ifeq ($(CONFIG_LIBQMI_WITH_MBIM_QMUX),y)
-       CONFIGURE_ARGS += --enable-mbim-qmux
+       MESON_ARGS += -Dmbim_qmux=true
 else
-       CONFIGURE_ARGS += --disable-mbim-qmux
+       MESON_ARGS += -Dmbim_qmux=false
 endif
 
 ifeq ($(CONFIG_LIBQMI_WITH_QRTR_GLIB),y)
-       CONFIGURE_ARGS += --enable-qrtr
+       MESON_ARGS += -Dqrtr=true
+else
+       MESON_ARGS += -Dqrtr=false
+endif
+
+ifeq ($(CONFIG_LIBQMI_COLLECTION_MINIMAL),y)
+       MESON_ARGS += -Dcollection=minimal
+else ifeq ($(CONFIG_LIBQMI_COLLECTION_BASIC),y)
+       MESON_ARGS += -Dcollection=basic
 else
-       CONFIGURE_ARGS += --disable-qrtr
+       MESON_ARGS += -Dcollection=full
 endif
 
 define Build/InstallDev
@@ -99,12 +109,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