1################################################################################
2#
3# libcamera
4#
5################################################################################
6
7LIBCAMERA_SITE = https://git.linuxtv.org/libcamera.git
8LIBCAMERA_VERSION = v0.2.0
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	-Dpycamera=disabled \
23	-Dwerror=false
24LIBCAMERA_INSTALL_STAGING = YES
25LIBCAMERA_LICENSE = \
26	LGPL-2.1+ (library), \
27	GPL-2.0+ (utils), \
28	MIT (qcam/assets/feathericons), \
29	BSD-2-Clause (raspberrypi), \
30	GPL-2.0 with Linux-syscall-note or BSD-3-Clause (linux kernel headers), \
31	CC0-1.0 (meson build system), \
32	CC-BY-SA-4.0 (doc)
33LIBCAMERA_LICENSE_FILES = \
34	LICENSES/LGPL-2.1-or-later.txt \
35	LICENSES/GPL-2.0-or-later.txt \
36	LICENSES/MIT.txt \
37	LICENSES/BSD-2-Clause.txt \
38	LICENSES/GPL-2.0-only.txt \
39	LICENSES/Linux-syscall-note.txt \
40	LICENSES/BSD-3-Clause.txt \
41	LICENSES/CC0-1.0.txt \
42	LICENSES/CC-BY-SA-4.0.txt
43
44ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_7),y)
45LIBCAMERA_CXXFLAGS = -faligned-new
46endif
47
48ifeq ($(BR2_PACKAGE_LIBCAMERA_V4L2),y)
49LIBCAMERA_CONF_OPTS += -Dv4l2=true
50else
51LIBCAMERA_CONF_OPTS += -Dv4l2=false
52endif
53
54LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_IMX8_ISI) += imx8-isi
55LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_IPU3) += ipu3
56LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_RKISP1) += rkisp1
57ifeq ($(BR2_PACKAGE_LIBCAMERA_PIPELINE_RPI_VC4),y)
58LIBCAMERA_PIPELINES-y += rpi/vc4
59LIBCAMERA_DEPENDENCIES += boost
60endif
61LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_SIMPLE) += simple
62LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_UVCVIDEO) += uvcvideo
63LIBCAMERA_PIPELINES-$(BR2_PACKAGE_LIBCAMERA_PIPELINE_VIMC) += vimc
64
65LIBCAMERA_CONF_OPTS += -Dpipelines=$(subst $(space),$(comma),$(LIBCAMERA_PIPELINES-y))
66
67ifeq ($(BR2_PACKAGE_LIBCAMERA_COMPLIANCE),y)
68LIBCAMERA_DEPENDENCIES += gtest libevent
69LIBCAMERA_CONF_OPTS += -Dlc-compliance=enabled
70else
71LIBCAMERA_CONF_OPTS += -Dlc-compliance=disabled
72endif
73
74# gstreamer-video-1.0, gstreamer-allocators-1.0
75ifeq ($(BR2_PACKAGE_GSTREAMER1)$(BR2_PACKAGE_GST1_PLUGINS_BASE),yy)
76LIBCAMERA_CONF_OPTS += -Dgstreamer=enabled
77LIBCAMERA_DEPENDENCIES += gstreamer1 gst1-plugins-base
78endif
79
80ifeq ($(BR2_PACKAGE_QT5BASE_WIDGETS),y)
81LIBCAMERA_CONF_OPTS += -Dqcam=enabled
82LIBCAMERA_DEPENDENCIES += qt5base
83ifeq ($(BR2_PACKAGE_QT5TOOLS_LINGUIST_TOOLS),y)
84LIBCAMERA_DEPENDENCIES += qt5tools
85endif
86else
87LIBCAMERA_CONF_OPTS += -Dqcam=disabled
88endif
89
90ifeq ($(BR2_PACKAGE_LIBEVENT),y)
91LIBCAMERA_CONF_OPTS += -Dcam=enabled
92LIBCAMERA_DEPENDENCIES += libevent
93else
94LIBCAMERA_CONF_OPTS += -Dcam=disabled
95endif
96
97ifeq ($(BR2_PACKAGE_TIFF),y)
98LIBCAMERA_DEPENDENCIES += tiff
99endif
100
101ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
102LIBCAMERA_CONF_OPTS += -Dudev=enabled
103LIBCAMERA_DEPENDENCIES += udev
104else
105LIBCAMERA_CONF_OPTS += -Dudev=disabled
106endif
107
108ifeq ($(BR2_PACKAGE_LTTNG_LIBUST),y)
109LIBCAMERA_CONF_OPTS += -Dtracing=enabled
110LIBCAMERA_DEPENDENCIES += lttng-libust
111else
112LIBCAMERA_CONF_OPTS += -Dtracing=disabled
113endif
114
115ifeq ($(BR2_PACKAGE_LIBEXECINFO),y)
116LIBCAMERA_DEPENDENCIES += libexecinfo
117LIBCAMERA_LDFLAGS = $(TARGET_LDFLAGS) -lexecinfo
118endif
119
120# Open-Source IPA shlibs need to be signed in order to be runnable within the
121# same process, otherwise they are deemed Closed-Source and run in another
122# process and communicate over IPC.
123# Buildroot sanitizes RPATH in a post build process. meson gets rid of rpath
124# while installing so we don't need to do it manually here.
125# Buildroot may strip symbols, so we need to do the same before signing
126# otherwise the signature won't match the shlib on the rootfs. Since meson
127# install target is signing the shlibs, we need to strip them before.
128LIBCAMERA_STRIP_FIND_CMD = \
129	find $(@D)/build/src/ipa \
130	$(if $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES)), \
131		-not \( $(call findfileclauses,$(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) ) \
132	-type f -name 'ipa_*.so' -print0
133
134define LIBCAMERA_BUILD_STRIP_IPA_SO
135	$(LIBCAMERA_STRIP_FIND_CMD) | xargs --no-run-if-empty -0 $(STRIPCMD)
136endef
137
138LIBCAMERA_POST_BUILD_HOOKS += LIBCAMERA_BUILD_STRIP_IPA_SO
139
140$(eval $(meson-package))
141