diff mbox

[OpenWrt-Devel,RESEND] libnl: split libnl into smaller libraries

Message ID 1442996228-29877-1-git-send-email-ardeleanalex@gmail.com
State Accepted
Headers show

Commit Message

Alexandru Ardelean Sept. 23, 2015, 8:17 a.m. UTC
From: Alexandru Ardelean <aa@ocedo.com>

Some modules may require only libnl-genl, some
libnl-route and fewer would require libnl-nf.

This patch splits the entire libnl package into smaller
more granular libs that can be installed individually as required.

Also added libnl*.so symlinks for convenience.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
---
 package/libs/libnl/Makefile | 101 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 88 insertions(+), 13 deletions(-)

Comments

Rick Farina Oct. 1, 2015, 4:33 p.m. UTC | #1
At least aircrack-ng wants genl as well as core.  Please feel free to
fix aircrack-ng to dep properly when you make this change.

Thanks,
Zero_Chaos (openwrt maintainer of aircrack-ng)

On 09/23/2015 04:17 AM, Alexandru Ardelean wrote:
> From: Alexandru Ardelean <aa@ocedo.com>
> 
> Some modules may require only libnl-genl, some
> libnl-route and fewer would require libnl-nf.
> 
> This patch splits the entire libnl package into smaller
> more granular libs that can be installed individually as required.
> 
> Also added libnl*.so symlinks for convenience.
> 
> Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
> ---
>  package/libs/libnl/Makefile | 101 ++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 88 insertions(+), 13 deletions(-)
> 
> diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile
> index 995fda2..857bbe2 100644
> --- a/package/libs/libnl/Makefile
> +++ b/package/libs/libnl/Makefile
> @@ -18,16 +18,61 @@ PKG_LICENSE:=LGPL-2.1
>  
>  include $(INCLUDE_DIR)/package.mk
>  
> -define Package/libnl
> +define Package/libnl/default
>    SECTION:=libs
>    CATEGORY:=Libraries
> -  TITLE:=netlink socket library
> -  DEPENDS:=+libpthread
>    URL:=http://people.suug.ch/~tgr/libnl/
>  endef
>  
> +define Package/libnl-core
> +$(call Package/libnl/default)
> +  TITLE:=Core Netlink Library
> +  DEPENDS:=+libpthread
> +endef
> +
> +define Package/libnl-genl
> +$(call Package/libnl/default)
> +  TITLE:=Generic Netlink Library
> +  DEPENDS:=+libnl-core
> +endef
> +
> +define Package/libnl-route
> +$(call Package/libnl/default)
> +  TITLE:=Routing Netlink Library
> +  DEPENDS:=+libnl-core
> +endef
> +
> +define Package/libnl-nf
> +$(call Package/libnl/default)
> +  TITLE:=Netfilter Netlink Library
> +  DEPENDS:=+libnl-route
> +endef
> +
> +define Package/libnl
> +$(call Package/libnl/default)
> +  TITLE:=Full Netlink Library
> +  DEPENDS:=+libnl-genl +libnl-route +libnl-nf
> +endef
> +
> +define Package/libnl-core/description
> + Common code for all netlink libraries
> +endef
> +
> +define Package/libnl-genl/description
> + Generic Netlink Library Functions
> +endef
> +
> +define Package/libnl-route/description
> + Routing Netlink Library Functions
> +endef
> +
> +define Package/libnl-nf/description
> + Netfilter Netlink Library Functions
> +endef
> +
>  define Package/libnl/description
> - This package contains a library for applications dealing with netlink sockets
> + Socket handling, connection management, sending and receiving of data,
> + message construction and parsing, object caching system, etc.
>  endef
>  
>  TARGET_CFLAGS += -ffunction-sections $(FPIC)
> @@ -40,18 +85,48 @@ define Build/Compile
>  endef
>  
>  define Build/InstallDev
> -	$(INSTALL_DIR) $(1)
> -	$(CP) $(PKG_INSTALL_DIR)/* $(1)/
> -	mkdir -p $(1)/usr/include/libnl
> -	$(CP) $(PKG_BUILD_DIR)/include/linux $(1)/usr/include/libnl/
> +	$(INSTALL_DIR) $(1)/usr/include/libnl $(1)/usr/lib/pkgconfig
> +	$(CP) $(PKG_INSTALL_DIR)/usr/include/libnl3/* $(1)/usr/include/libnl/
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
> +
> +	# Copy symlinks
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so $(1)/usr/lib/libnl.so
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so $(1)/usr/lib/libnl-genl.so
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so $(1)/usr/lib/libnl-nf.so
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so $(1)/usr/lib/libnl-route.so
>  endef
>  
> -define Package/libnl/install
> +define Package/libnl-core/install
> +	$(INSTALL_DIR) $(1)/usr/lib
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so* $(1)/usr/lib/
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so $(1)/usr/lib/libnl.so
> +endef
> +
> +define Package/libnl-genl/install
>  	$(INSTALL_DIR) $(1)/usr/lib
> -	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so.* $(1)/usr/lib/
> -	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so.* $(1)/usr/lib/
> -	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so.* $(1)/usr/lib/
> -	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so.* $(1)/usr/lib/
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so* $(1)/usr/lib/
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so $(1)/usr/lib/libnl-genl.so
> +endef
> +
> +define Package/libnl-route/install
> +	$(INSTALL_DIR) $(1)/usr/lib
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so* $(1)/usr/lib/
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so $(1)/usr/lib/libnl-route.so
> +endef
> +
> +define Package/libnl-nf/install
> +	$(INSTALL_DIR) $(1)/usr/lib
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so* $(1)/usr/lib/
> +	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so $(1)/usr/lib/libnl-nf.so
> +endef
> +
> +define Package/libnl/install
> +	:
>  endef
>  
> +$(eval $(call BuildPackage,libnl-core))
> +$(eval $(call BuildPackage,libnl-genl))
> +$(eval $(call BuildPackage,libnl-route))
> +$(eval $(call BuildPackage,libnl-nf))
>  $(eval $(call BuildPackage,libnl))
>
Alexandru Ardelean Oct. 1, 2015, 4:43 p.m. UTC | #2
Sure, will do.
Was going to open up some suggestions in that directions.

I also want to look into the part where other modules can build against
libnl (instead of libnl-tiny), when libnl selected.
Not sure how elegant that would become, but I'll look into it.


On Thu, Oct 1, 2015 at 7:33 PM, Rick Farina <sidhayn@gmail.com> wrote:

> At least aircrack-ng wants genl as well as core.  Please feel free to
> fix aircrack-ng to dep properly when you make this change.
>
> Thanks,
> Zero_Chaos (openwrt maintainer of aircrack-ng)
>
> On 09/23/2015 04:17 AM, Alexandru Ardelean wrote:
> > From: Alexandru Ardelean <aa@ocedo.com>
> >
> > Some modules may require only libnl-genl, some
> > libnl-route and fewer would require libnl-nf.
> >
> > This patch splits the entire libnl package into smaller
> > more granular libs that can be installed individually as required.
> >
> > Also added libnl*.so symlinks for convenience.
> >
> > Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
> > ---
> >  package/libs/libnl/Makefile | 101
> ++++++++++++++++++++++++++++++++++++++------
> >  1 file changed, 88 insertions(+), 13 deletions(-)
> >
> > diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile
> > index 995fda2..857bbe2 100644
> > --- a/package/libs/libnl/Makefile
> > +++ b/package/libs/libnl/Makefile
> > @@ -18,16 +18,61 @@ PKG_LICENSE:=LGPL-2.1
> >
> >  include $(INCLUDE_DIR)/package.mk
> >
> > -define Package/libnl
> > +define Package/libnl/default
> >    SECTION:=libs
> >    CATEGORY:=Libraries
> > -  TITLE:=netlink socket library
> > -  DEPENDS:=+libpthread
> >    URL:=http://people.suug.ch/~tgr/libnl/
> >  endef
> >
> > +define Package/libnl-core
> > +$(call Package/libnl/default)
> > +  TITLE:=Core Netlink Library
> > +  DEPENDS:=+libpthread
> > +endef
> > +
> > +define Package/libnl-genl
> > +$(call Package/libnl/default)
> > +  TITLE:=Generic Netlink Library
> > +  DEPENDS:=+libnl-core
> > +endef
> > +
> > +define Package/libnl-route
> > +$(call Package/libnl/default)
> > +  TITLE:=Routing Netlink Library
> > +  DEPENDS:=+libnl-core
> > +endef
> > +
> > +define Package/libnl-nf
> > +$(call Package/libnl/default)
> > +  TITLE:=Netfilter Netlink Library
> > +  DEPENDS:=+libnl-route
> > +endef
> > +
> > +define Package/libnl
> > +$(call Package/libnl/default)
> > +  TITLE:=Full Netlink Library
> > +  DEPENDS:=+libnl-genl +libnl-route +libnl-nf
> > +endef
> > +
> > +define Package/libnl-core/description
> > + Common code for all netlink libraries
> > +endef
> > +
> > +define Package/libnl-genl/description
> > + Generic Netlink Library Functions
> > +endef
> > +
> > +define Package/libnl-route/description
> > + Routing Netlink Library Functions
> > +endef
> > +
> > +define Package/libnl-nf/description
> > + Netfilter Netlink Library Functions
> > +endef
> > +
> >  define Package/libnl/description
> > - This package contains a library for applications dealing with netlink
> sockets
> > + Socket handling, connection management, sending and receiving of data,
> > + message construction and parsing, object caching system, etc.
> >  endef
> >
> >  TARGET_CFLAGS += -ffunction-sections $(FPIC)
> > @@ -40,18 +85,48 @@ define Build/Compile
> >  endef
> >
> >  define Build/InstallDev
> > -     $(INSTALL_DIR) $(1)
> > -     $(CP) $(PKG_INSTALL_DIR)/* $(1)/
> > -     mkdir -p $(1)/usr/include/libnl
> > -     $(CP) $(PKG_BUILD_DIR)/include/linux $(1)/usr/include/libnl/
> > +     $(INSTALL_DIR) $(1)/usr/include/libnl $(1)/usr/lib/pkgconfig
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/include/libnl3/*
> $(1)/usr/include/libnl/
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc
> $(1)/usr/lib/pkgconfig
> > +
> > +     # Copy symlinks
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so $(1)/usr/lib/libnl.so
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so
> $(1)/usr/lib/libnl-genl.so
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so
> $(1)/usr/lib/libnl-nf.so
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so
> $(1)/usr/lib/libnl-route.so
> >  endef
> >
> > -define Package/libnl/install
> > +define Package/libnl-core/install
> > +     $(INSTALL_DIR) $(1)/usr/lib
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so* $(1)/usr/lib/
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so $(1)/usr/lib/libnl.so
> > +endef
> > +
> > +define Package/libnl-genl/install
> >       $(INSTALL_DIR) $(1)/usr/lib
> > -     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so.* $(1)/usr/lib/
> > -     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so.* $(1)/usr/lib/
> > -     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so.* $(1)/usr/lib/
> > -     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so.* $(1)/usr/lib/
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so* $(1)/usr/lib/
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so
> $(1)/usr/lib/libnl-genl.so
> > +endef
> > +
> > +define Package/libnl-route/install
> > +     $(INSTALL_DIR) $(1)/usr/lib
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so* $(1)/usr/lib/
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so
> $(1)/usr/lib/libnl-route.so
> > +endef
> > +
> > +define Package/libnl-nf/install
> > +     $(INSTALL_DIR) $(1)/usr/lib
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so* $(1)/usr/lib/
> > +     $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so
> $(1)/usr/lib/libnl-nf.so
> > +endef
> > +
> > +define Package/libnl/install
> > +     :
> >  endef
> >
> > +$(eval $(call BuildPackage,libnl-core))
> > +$(eval $(call BuildPackage,libnl-genl))
> > +$(eval $(call BuildPackage,libnl-route))
> > +$(eval $(call BuildPackage,libnl-nf))
> >  $(eval $(call BuildPackage,libnl))
> >
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
diff mbox

Patch

diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile
index 995fda2..857bbe2 100644
--- a/package/libs/libnl/Makefile
+++ b/package/libs/libnl/Makefile
@@ -18,16 +18,61 @@  PKG_LICENSE:=LGPL-2.1
 
 include $(INCLUDE_DIR)/package.mk
 
-define Package/libnl
+define Package/libnl/default
   SECTION:=libs
   CATEGORY:=Libraries
-  TITLE:=netlink socket library
-  DEPENDS:=+libpthread
   URL:=http://people.suug.ch/~tgr/libnl/
 endef
 
+define Package/libnl-core
+$(call Package/libnl/default)
+  TITLE:=Core Netlink Library
+  DEPENDS:=+libpthread
+endef
+
+define Package/libnl-genl
+$(call Package/libnl/default)
+  TITLE:=Generic Netlink Library
+  DEPENDS:=+libnl-core
+endef
+
+define Package/libnl-route
+$(call Package/libnl/default)
+  TITLE:=Routing Netlink Library
+  DEPENDS:=+libnl-core
+endef
+
+define Package/libnl-nf
+$(call Package/libnl/default)
+  TITLE:=Netfilter Netlink Library
+  DEPENDS:=+libnl-route
+endef
+
+define Package/libnl
+$(call Package/libnl/default)
+  TITLE:=Full Netlink Library
+  DEPENDS:=+libnl-genl +libnl-route +libnl-nf
+endef
+
+define Package/libnl-core/description
+ Common code for all netlink libraries
+endef
+
+define Package/libnl-genl/description
+ Generic Netlink Library Functions
+endef
+
+define Package/libnl-route/description
+ Routing Netlink Library Functions
+endef
+
+define Package/libnl-nf/description
+ Netfilter Netlink Library Functions
+endef
+
 define Package/libnl/description
- This package contains a library for applications dealing with netlink sockets
+ Socket handling, connection management, sending and receiving of data,
+ message construction and parsing, object caching system, etc.
 endef
 
 TARGET_CFLAGS += -ffunction-sections $(FPIC)
@@ -40,18 +85,48 @@  define Build/Compile
 endef
 
 define Build/InstallDev
-	$(INSTALL_DIR) $(1)
-	$(CP) $(PKG_INSTALL_DIR)/* $(1)/
-	mkdir -p $(1)/usr/include/libnl
-	$(CP) $(PKG_BUILD_DIR)/include/linux $(1)/usr/include/libnl/
+	$(INSTALL_DIR) $(1)/usr/include/libnl $(1)/usr/lib/pkgconfig
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/libnl3/* $(1)/usr/include/libnl/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
+
+	# Copy symlinks
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so $(1)/usr/lib/libnl.so
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so $(1)/usr/lib/libnl-genl.so
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so $(1)/usr/lib/libnl-nf.so
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so $(1)/usr/lib/libnl-route.so
 endef
 
-define Package/libnl/install
+define Package/libnl-core/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so* $(1)/usr/lib/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so $(1)/usr/lib/libnl.so
+endef
+
+define Package/libnl-genl/install
 	$(INSTALL_DIR) $(1)/usr/lib
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so.* $(1)/usr/lib/
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so.* $(1)/usr/lib/
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so.* $(1)/usr/lib/
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so.* $(1)/usr/lib/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so* $(1)/usr/lib/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so $(1)/usr/lib/libnl-genl.so
+endef
+
+define Package/libnl-route/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so* $(1)/usr/lib/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so $(1)/usr/lib/libnl-route.so
+endef
+
+define Package/libnl-nf/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so* $(1)/usr/lib/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so $(1)/usr/lib/libnl-nf.so
+endef
+
+define Package/libnl/install
+	:
 endef
 
+$(eval $(call BuildPackage,libnl-core))
+$(eval $(call BuildPackage,libnl-genl))
+$(eval $(call BuildPackage,libnl-route))
+$(eval $(call BuildPackage,libnl-nf))
 $(eval $(call BuildPackage,libnl))