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