libgpiod: update to 2.0
[feed/packages.git] / libs / libgpiod / Makefile
1 #
2 # Copyright (C) 2018-2019 Michael Heimpold <mhei@heimpold.de>
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=libgpiod
11 PKG_VERSION:=2.0
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=@KERNEL/software/libs/libgpiod/
16 PKG_HASH:=f74cbf82038b3cb98ebeb25bce55ee2553be28194002d2a9889b9268cce2dd07
17
18 PKG_MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
19 PKG_LICENSE:=LGPL-2.1-or-later
20 PKG_LICENSE_FILES:=COPYING
21
22 PKG_INSTALL:=1
23 PKG_BUILD_PARALLEL:=1
24 PYTHON3_PKG_BUILD:=0
25
26 include $(INCLUDE_DIR)/package.mk
27 include ../../lang/python/python3-package.mk
28
29 ifneq ($(CONFIG_PACKAGE_gpiod-tools),)
30 CONFIGURE_ARGS += --enable-tools
31 endif
32
33 PYTHON3_PKG_SETUP_DIR:=bindings/python
34 TARGET_CPPFLAGS+=-I$(PKG_BUILD_DIR)/include
35 TARGET_LDFLAGS+=-L$(PKG_BUILD_DIR)/lib/.libs
36
37 define Package/libgpiod
38 SECTION:=libs
39 CATEGORY:=Libraries
40 URL:=https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
41 TITLE:=Library for interacting with Linux's GPIO character device
42 KCONFIG:= \
43 CONFIG_GPIO_CDEV=y
44 DEPENDS:=@GPIO_SUPPORT
45 endef
46
47 define Package/libgpiod/description
48 C library for interacting with the linux GPIO character device
49 (gpiod stands for GPIO device).
50 endef
51
52 define Package/gpiod-tools
53 SECTION:=utils
54 CATEGORY:=Utilities
55 TITLE:=Tools for interacting with GPIO pins
56 DEPENDS:=+libgpiod
57 endef
58
59 define Package/gpiod-tools/description
60 Tools for interacting with the linux GPIO character device
61 (gpiod stands for GPIO device).
62 endef
63
64 define Package/python3-gpiod
65 SECTION:=lang
66 CATEGORY:=Languages
67 SUBMENU:=Python
68 TITLE:=Python bindings for libgpiod
69 URL:=https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
70 DEPENDS:=+python3-light +libgpiod
71 endef
72
73 define Package/python3-gpiod/description
74 This package contains the Python bindings for libgpiod.
75 endef
76
77 define Build/Configure
78 $(call Build/Configure/Default)
79 ifneq ($(CONFIG_PACKAGE_python3-gpiod),)
80 $(call Py3Build/Configure)
81 endif
82 endef
83
84 define Build/Compile
85 $(call Build/Compile/Default)
86 ifneq ($(CONFIG_PACKAGE_python3-gpiod),)
87 $(call Py3Build/Compile)
88 endif
89 endef
90
91 define Build/InstallDev
92 $(INSTALL_DIR) $(1)/usr/include
93 $(CP) $(PKG_INSTALL_DIR)/usr/include/gpiod.h $(1)/usr/include/
94
95 $(INSTALL_DIR) $(1)/usr/lib
96 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgpiod.{so*,a} $(1)/usr/lib/
97
98 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
99 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libgpiod.pc $(1)/usr/lib/pkgconfig/
100
101 ifneq ($(CONFIG_PACKAGE_python3-gpiod),)
102 $(INSTALL_DIR) $(1)$(PYTHON3_PKG_DIR)
103 $(CP) $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/* $(1)$(PYTHON3_PKG_DIR)
104 endif
105 endef
106
107 define Package/libgpiod/install
108 $(INSTALL_DIR) $(1)/usr/lib
109 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgpiod.so.* $(1)/usr/lib/
110 endef
111
112 define Package/gpiod-tools/install
113 $(INSTALL_DIR) $(1)/usr/bin
114 $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
115 endef
116
117 define Py3Package/python3-gpiod/install
118 # this empty define prevent installing tools from /usr/bin
119 endef
120
121 $(eval $(call BuildPackage,libgpiod))
122 $(eval $(call BuildPackage,gpiod-tools))
123 $(eval $(call Py3Package,python3-gpiod))
124 $(eval $(call BuildPackage,python3-gpiod))
125 $(eval $(call BuildPackage,python3-gpiod-src))