6320c240164ff8f13c15d85e5d9f535cc8a7878d
[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_libgpiodcxx),)
30 CONFIGURE_ARGS += --enable-bindings-cxx
31 else
32 CONFIGURE_ARGS += --disable-bindings-cxx
33 endif
34
35 ifneq ($(CONFIG_PACKAGE_gpiod-tools),)
36 CONFIGURE_ARGS += --enable-tools
37 endif
38
39 PYTHON3_PKG_SETUP_DIR:=bindings/python
40 TARGET_CPPFLAGS+=-I$(PKG_BUILD_DIR)/include
41 TARGET_LDFLAGS+=-L$(PKG_BUILD_DIR)/lib/.libs
42
43 define Package/libgpiod
44 SECTION:=libs
45 CATEGORY:=Libraries
46 URL:=https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
47 TITLE:=Library for interacting with Linux's GPIO character device
48 KCONFIG:= \
49 CONFIG_GPIO_CDEV=y
50 DEPENDS:=@GPIO_SUPPORT
51 endef
52
53 define Package/libgpiod/description
54 C library for interacting with the linux GPIO character device
55 (gpiod stands for GPIO device).
56 endef
57
58 define Package/gpiod-tools
59 SECTION:=utils
60 CATEGORY:=Utilities
61 TITLE:=Tools for interacting with GPIO pins
62 DEPENDS:=+libgpiod
63 endef
64
65 define Package/gpiod-tools/description
66 Tools for interacting with the linux GPIO character device
67 (gpiod stands for GPIO device).
68 endef
69
70 define Package/libgpiodcxx
71 SECTION:=libs
72 CATEGORY:=Libraries
73 URL:=https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
74 TITLE:=C++ binding for libgpiod
75 DEPENDS:=+libstdcpp +libgpiod
76 endef
77
78 define Package/libgpiodcxx/description
79 This package contains the C++ binding for libgpiod.
80 endef
81
82 define Package/python3-gpiod
83 SECTION:=lang
84 CATEGORY:=Languages
85 SUBMENU:=Python
86 TITLE:=Python bindings for libgpiod
87 URL:=https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
88 DEPENDS:=+python3-light +libgpiod
89 endef
90
91 define Package/python3-gpiod/description
92 This package contains the Python bindings for libgpiod.
93 endef
94
95 define Build/Configure
96 $(call Build/Configure/Default)
97 ifneq ($(CONFIG_PACKAGE_python3-gpiod),)
98 $(call Py3Build/Configure)
99 endif
100 endef
101
102 define Build/Compile
103 $(call Build/Compile/Default)
104 ifneq ($(CONFIG_PACKAGE_python3-gpiod),)
105 $(call Py3Build/Compile)
106 endif
107 endef
108
109 define Build/InstallDev
110 $(INSTALL_DIR) $(1)/usr/include
111 $(CP) $(PKG_INSTALL_DIR)/usr/include/gpiod.h $(1)/usr/include/
112
113 $(INSTALL_DIR) $(1)/usr/lib
114 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgpiod.{so*,a} $(1)/usr/lib/
115
116 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
117 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libgpiod.pc $(1)/usr/lib/pkgconfig/
118
119 ifneq ($(CONFIG_PACKAGE_libgpiodcxx),)
120 $(CP) $(PKG_INSTALL_DIR)/usr/include/gpiodcxx $(1)/usr/include/
121 $(CP) $(PKG_INSTALL_DIR)/usr/include/gpiod.hpp $(1)/usr/include/
122
123 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgpiodcxx.{so*,a} $(1)/usr/lib/
124
125 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libgpiodcxx.pc $(1)/usr/lib/pkgconfig/
126 endif
127
128 ifneq ($(CONFIG_PACKAGE_python3-gpiod),)
129 $(INSTALL_DIR) $(1)$(PYTHON3_PKG_DIR)
130 $(CP) $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/* $(1)$(PYTHON3_PKG_DIR)
131 endif
132 endef
133
134 define Package/libgpiod/install
135 $(INSTALL_DIR) $(1)/usr/lib
136 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgpiod.so.* $(1)/usr/lib/
137 endef
138
139 define Package/libgpiodcxx/install
140 $(INSTALL_DIR) $(1)/usr/lib
141 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgpiodcxx.so.* $(1)/usr/lib/
142 endef
143
144 define Package/gpiod-tools/install
145 $(INSTALL_DIR) $(1)/usr/bin
146 $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
147 endef
148
149 define Py3Package/python3-gpiod/install
150 # this empty define prevent installing tools from /usr/bin
151 endef
152
153 $(eval $(call BuildPackage,libgpiod))
154 $(eval $(call BuildPackage,libgpiodcxx))
155 $(eval $(call BuildPackage,gpiod-tools))
156 $(eval $(call Py3Package,python3-gpiod))
157 $(eval $(call BuildPackage,python3-gpiod))
158 $(eval $(call BuildPackage,python3-gpiod-src))