libdrm: split into sub-packages
authorDaniel Golle <daniel@makrotopia.org>
Sun, 24 Nov 2024 23:41:02 +0000 (00:41 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Fri, 29 Nov 2024 01:18:17 +0000 (01:18 +0000)
Instead of build-time configuration just build sub-packages, so
users can select what ever is needed on their hardware and we also
won't need to set the package non-shared.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libs/libdrm/Config.in [deleted file]
libs/libdrm/Makefile

diff --git a/libs/libdrm/Config.in b/libs/libdrm/Config.in
deleted file mode 100644 (file)
index b2e7d4f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-menu "Select libdrm build options"
-               depends on PACKAGE_libdrm
-
-config LIBDRM_INTEL
-       bool "Intel support"
-       default y
-       depends on x86_64 || i386
-       help
-               Installs the Intel driver.
-
-config LIBDRM_NOUVEAU
-       bool "Nouveau support"
-       default y
-       depends on x86_64 || i386 || TARGET_tegra
-       help
-               Installs the Nouveau driver.
-
-config LIBDRM_RADEON
-       bool "Radeon support"
-       default y
-       depends on x86_64 || i386
-       help
-               Installs the Radeon driver.
-
-endmenu
index e48fce9eeed1ff23247db08906305c7f8c167250..fa63022bc51ff2f0a75fa866d5b574393a147798 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2016 OpenWrt.org
+# Copyright (C) 2007-2024 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libdrm
 PKG_VERSION:=2.4.123
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://dri.freedesktop.org/libdrm
@@ -17,43 +17,137 @@ PKG_MAINTAINER:=Lucian Cristian <lucian.cristian@gmail.com>
 PKG_LICENSE:=BSD-3-Clause
 
 PKG_CONFIG_DEPENDS:= \
-       CONFIG_LIBDRM_INTEL \
-       CONFIG_LIBDRM_NOUVEAU \
-       CONFIG_LIBDRM_RADEON
+       CONFIG_PACKAGE_libdrm-amdgpu \
+       CONFIG_PACKAGE_libdrm-etnaviv \
+       CONFIG_PACKAGE_libdrm-intel \
+       CONFIG_PACKAGE_libdrm-nouveau \
+       CONFIG_PACKAGE_libdrm-omap \
+       CONFIG_PACKAGE_libdrm-radeon \
+       CONFIG_PACKAGE_libdrm-tegra
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/meson.mk
 
-define Package/libdrm
+define Package/libdrm/Default
   SECTION:=libs
   CATEGORY:=Libraries
-  DEPENDS:=+LIBDRM_INTEL:libpciaccess
+  SUBMENU:=Video
   TITLE:=libdrm
   URL:=https://dri.freedesktop.org/
 endef
 
-define Package/libdrm/description
+define Package/libdrm/description/Default
   LIBDRM is the cross-driver middleware which allows user-space applications
   (such as Mesa and 2D drivers) to communicate with the Kernel by the means
   of the DRI protocol.
 endef
 
-define Package/libdrm/config
-       source "$(SOURCE)/Config.in"
+define Package/libdrm
+$(call Package/libdrm/Default)
+  TITLE+= common library
+endef
+
+define Package/libdrm/description
+$(call Package/libdrm/description/Default)
+endef
+
+define Package/libdrm-amdgpu
+$(call Package/libdrm/Default)
+  TITLE+= for AMD GPUs
+  DEPENDS:=+libdrm
+endef
+
+define Package/libdrm-amdgpu/description
+$(call Package/libdrm/description/Default)
+
+This package provides the library with functions for AMD GPUs.
+endef
+
+define Package/libdrm-etnaviv
+$(call Package/libdrm/Default)
+  TITLE+= for Vivante GPUs
+  DEPENDS:=+libdrm @(arm||aarch64||mips||mipsel||mips64||mips64el)
+endef
+
+define Package/libdrm-etnaviv/description
+$(call Package/libdrm/description/Default)
+
+This package provides the library with functions for Vivante GPUs.
+endef
+
+define Package/libdrm-intel
+$(call Package/libdrm/Default)
+  TITLE+= for Intel integrated GPUs
+  DEPENDS:=+libdrm +libpciaccess @(x86||x86_64)
+
+endef
+
+define Package/libdrm-intel/description
+$(call Package/libdrm/description/Default)
+
+This package provides the library with functions for GPUs integrated into Intel's CPUs.
+endef
+
+define Package/libdrm-nouveau
+$(call Package/libdrm/Default)
+  TITLE+= for nVidia GPUs
+  DEPENDS:=+libdrm
+endef
+
+define Package/libdrm-nouveau/description
+$(call Package/libdrm/description/Default)
+
+This package provides the library with functions for nVidia GPUs.
+endef
+
+define Package/libdrm-omap
+$(call Package/libdrm/Default)
+  TITLE+= for TI OMAP SoCs
+  DEPENDS:=+libdrm @(arm||aarch64)
+endef
+
+define Package/libdrm-omap/description
+$(call Package/libdrm/description/Default)
+
+This package provides the library with functions for TI OMAP SoCs.
+endef
+
+define Package/libdrm-radeon
+$(call Package/libdrm/Default)
+  TITLE+= for AMD/ATI Radeon GPUs
+  DEPENDS:=+libdrm
+endef
+
+define Package/libdrm-radeon/description
+$(call Package/libdrm/description/Default)
+
+This package provides the library with functions for AMD/ATI Radeon GPUs.
+endef
+
+define Package/libdrm-tegra
+$(call Package/libdrm/Default)
+  TITLE+= for nVidia Tegra SoCs
+  DEPENDS:=+libdrm @(arm||aarch64)
+endef
+
+define Package/libdrm-tegra/description
+$(call Package/libdrm/description/Default)
+
+This package provides the library with functions for nVidia Tegra SoCs.
 endef
 
 MESON_ARGS += \
-       -Dintel=$(if $(CONFIG_LIBDRM_INTEL),en,dis)abled \
-       -Dradeon=$(if $(CONFIG_LIBDRM_RADEON),en,dis)abled \
-       -Damdgpu=disabled \
-       -Dnouveau=$(if $(CONFIG_LIBDRM_NOUVEAU),en,dis)abled \
+       -Dintel=$(if $(CONFIG_PACKAGE_libdrm-intel),en,dis)abled \
+       -Damdgpu=$(if $(CONFIG_PACKAGE_libdrm-amdgpu),en,dis)abled \
+       -Dnouveau=$(if $(CONFIG_PACKAGE_libdrm-nouveau),en,dis)abled \
        -Dvmwgfx=disabled \
-       -Domap=disabled \
+       -Domap=$(if $(CONFIG_PACKAGE_libdrm-omap),en,dis)abled  \
        -Dexynos=disabled \
        -Dfreedreno=disabled \
-       -Dtegra=disabled \
-       -Dvc4=disabled \
-       -Detnaviv=disabled \
+       -Dradeon=$(if $(CONFIG_PACKAGE_libdrm-radeon),en,dis)abled \
+       -Dtegra=$(if $(CONFIG_PACKAGE_libdrm-tegra),en,dis)abled \
+       -Dvc4=$(if $(CONFIG_arm)$(CONFIG_aarch64),en,dis)abled \
+       -Detnaviv=$(if $(CONFIG_PACKAGE_libdrm-etnaviv),en,dis)abled  \
        -Dcairo-tests=disabled \
        -Dman-pages=disabled \
        -Dvalgrind=disabled \
@@ -72,7 +166,51 @@ endef
 
 define Package/libdrm/install
        $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdrm.so.* $(1)/usr/lib/
+endef
+
+define Package/libdrm-amdgpu/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdrm_amdgpu.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/share/libdrm
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/libdrm/amdgpu.ids $(1)/usr/share/libdrm
+endef
+
+define Package/libdrm-etnaviv/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdrm_etnaviv.so.* $(1)/usr/lib/
+endef
+
+define Package/libdrm-intel/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdrm_intel.so.* $(1)/usr/lib/
+endef
+
+define Package/libdrm-nouveau/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdrm_nouveau.so.* $(1)/usr/lib/
+endef
+
+define Package/libdrm-omap/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdrm_omap.so.* $(1)/usr/lib/
+endef
+
+define Package/libdrm-radeon/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdrm_radeon.so.* $(1)/usr/lib/
+endef
+
+define Package/libdrm-tegra/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdrm_tegra.so.* $(1)/usr/lib/
 endef
 
 $(eval $(call BuildPackage,libdrm))
+$(eval $(call BuildPackage,libdrm-amdgpu))
+$(eval $(call BuildPackage,libdrm-etnaviv))
+$(eval $(call BuildPackage,libdrm-intel))
+$(eval $(call BuildPackage,libdrm-nouveau))
+$(eval $(call BuildPackage,libdrm-omap))
+$(eval $(call BuildPackage,libdrm-radeon))
+$(eval $(call BuildPackage,libdrm-tegra))