xref: /OK3568_Linux_fs/buildroot/package/libcamera/libcamera.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# libcamera
4#
5################################################################################
6
7LIBCAMERA_SITE = https://git.linuxtv.org/libcamera.git
8LIBCAMERA_VERSION = ba6435930f08e802cffc688d90f156a8959a0f86
9LIBCAMERA_SITE_METHOD = git
10LIBCAMERA_DEPENDENCIES = \
11	host-openssl \
12	host-pkgconf \
13	host-python-jinja2 \
14	host-python-ply \
15	host-python-pyyaml \
16	libyaml \
17	gnutls
18LIBCAMERA_CONF_OPTS = \
19	-Dandroid=disabled \
20	-Ddocumentation=disabled \
21	-Dtest=false \
22	-Dwerror=false
23LIBCAMERA_INSTALL_STAGING = YES
24LIBCAMERA_LICENSE = \
25	LGPL-2.1+ (library), \
26	GPL-2.0+ (utils), \
27	MIT (qcam/assets/feathericons), \
28	BSD-2-Clause (raspberrypi), \
29	GPL-2.0 with Linux-syscall-note or BSD-3-Clause (linux kernel headers), \
30	CC0-1.0 (meson build system), \
31	CC-BY-SA-4.0 (doc)
32LIBCAMERA_LICENSE_FILES = \
33	LICENSES/LGPL-2.1-or-later.txt \
34	LICENSES/GPL-2.0-or-later.txt \
35	LICENSES/MIT.txt \
36	LICENSES/BSD-2-Clause.txt \
37	LICENSES/GPL-2.0-only.txt \
38	LICENSES/Linux-syscall-note.txt \
39	LICENSES/BSD-3-Clause.txt \
40	LICENSES/CC0-1.0.txt \
41	LICENSES/CC-BY-SA-4.0.txt
42
43ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_7),y)
44LIBCAMERA_CXXFLAGS = -faligned-new
45endif
46
47ifeq ($(BR2_PACKAGE_LIBCAMERA_V4L2),y)
48LIBCAMERA_CONF_OPTS += -Dv4l2=true
49else
50LIBCAMERA_CONF_OPTS += -Dv4l2=false
51endif
52
53LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_IPU3) += ipu3
54ifeq ($(BR2_PACKAGE_LIBCAMERA_PIPELINE_RASPBERRYPI),y)
55LIBCAMERA_PIPELINES-y += raspberrypi
56LIBCAMERA_DEPENDENCIES += boost
57endif
58LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_RKISP1) += rkisp1
59LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_SIMPLE) += simple
60LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_UVCVIDEO) += uvcvideo
61LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_VIMC) += vimc
62LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_CUSTOM) += custom
63
64LIBCAMERA_CONF_OPTS += -Dpipelines=$(subst $(space),$(comma),$(LIBCAMERA_PIPELINES-y))
65
66ifeq ($(BR2_PACKAGE_LIBCAMERA_COMPLIANCE),y)
67LIBCAMERA_DEPENDENCIES += gtest libevent
68LIBCAMERA_CONF_OPTS += -Dlc-compliance=enabled
69else
70LIBCAMERA_CONF_OPTS += -Dlc-compliance=disabled
71endif
72
73# gstreamer-video-1.0, gstreamer-allocators-1.0
74ifeq ($(BR2_PACKAGE_LIBCAMERA_GST),y)
75LIBCAMERA_CONF_OPTS += -Dgstreamer=enabled
76LIBCAMERA_DEPENDENCIES += gstreamer1 gst1-plugins-base libglib2
77endif
78
79ifeq ($(BR2_PACKAGE_QT5BASE_WIDGETS),y)
80LIBCAMERA_CONF_OPTS += -Dqcam=enabled
81LIBCAMERA_DEPENDENCIES += qt5base
82ifeq ($(BR2_PACKAGE_QT5TOOLS_LINGUIST_TOOLS),y)
83LIBCAMERA_DEPENDENCIES += qt5tools
84endif
85else
86LIBCAMERA_CONF_OPTS += -Dqcam=disabled
87endif
88
89ifeq ($(BR2_PACKAGE_LIBEVENT),y)
90LIBCAMERA_CONF_OPTS += -Dcam=enabled
91LIBCAMERA_DEPENDENCIES += libevent
92else
93LIBCAMERA_CONF_OPTS += -Dcam=disabled
94endif
95
96ifeq ($(BR2_PACKAGE_TIFF),y)
97LIBCAMERA_DEPENDENCIES += tiff
98endif
99
100ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
101LIBCAMERA_DEPENDENCIES += udev
102endif
103
104ifeq ($(BR2_PACKAGE_LTTNG_LIBUST),y)
105LIBCAMERA_CONF_OPTS += -Dtracing=enabled
106LIBCAMERA_DEPENDENCIES += lttng-libust
107else
108LIBCAMERA_CONF_OPTS += -Dtracing=disabled
109endif
110
111ifeq ($(BR2_PACKAGE_LIBEXECINFO),y)
112LIBCAMERA_DEPENDENCIES += libexecinfo
113LIBCAMERA_LDFLAGS = $(TARGET_LDFLAGS) -lexecinfo
114endif
115
116# Open-Source IPA shlibs need to be signed in order to be runnable within the
117# same process, otherwise they are deemed Closed-Source and run in another
118# process and communicate over IPC.
119# Buildroot sanitizes RPATH in a post build process. meson gets rid of rpath
120# while installing so we don't need to do it manually here.
121# Buildroot may strip symbols, so we need to do the same before signing
122# otherwise the signature won't match the shlib on the rootfs. Since meson
123# install target is signing the shlibs, we need to strip them before.
124LIBCAMERA_STRIP_FIND_CMD = \
125	find $(@D)/build/src/ipa \
126	$(if $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES)), \
127		-not \( $(call findfileclauses,$(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) ) \
128	-type f -name 'ipa_*.so' -print0
129
130define LIBCAMERA_BUILD_STRIP_IPA_SO
131	$(LIBCAMERA_STRIP_FIND_CMD) | xargs --no-run-if-empty -0 $(STRIPCMD)
132endef
133
134LIBCAMERA_POST_BUILD_HOOKS += LIBCAMERA_BUILD_STRIP_IPA_SO
135
136ifeq ($(BR2_PACKAGE_LIBCAMERA_PIPELINE_CUSTOM),y)
137define LIBCAMERA_INSTALL_TARGET_CUSTOM_ENV
138	$(INSTALL) -D -m 0644 $(LIBCAMERA_PKGDIR)/libcamera.sh \
139		$(TARGET_DIR)/etc/profile.d/libcamera.sh
140	$(SED) 's/\(DRIVERS=\).*/\1${BR2_PACKAGE_LIBCAMERA_CUSTOM_DRIVERS}/' \
141		$(TARGET_DIR)/etc/profile.d/libcamera.sh
142	$(SED) 's/\(DEFAULT=\).*/\1${BR2_PACKAGE_LIBCAMERA_CUSTOM_DEFAULT_ENTITY}/' \
143		$(TARGET_DIR)/etc/profile.d/libcamera.sh
144	$(SED) 's/\(FORMAT=\).*/\1${BR2_PACKAGE_LIBCAMERA_CUSTOM_FORMAT}/' \
145		$(TARGET_DIR)/etc/profile.d/libcamera.sh
146	$(SED) 's/\(BUF_CNT=\).*/\1${BR2_PACKAGE_LIBCAMERA_CUSTOM_BUFFER_COUNT}/' \
147		$(TARGET_DIR)/etc/profile.d/libcamera.sh
148endef
149LIBCAMERA_POST_INSTALL_TARGET_HOOKS += LIBCAMERA_INSTALL_TARGET_CUSTOM_ENV
150endif
151
152$(eval $(meson-package))
153