Skip to content

Commit 6f45325

Browse files
carlodrihmaarrfk
andauthored
add libcamera and related recipes (#29477)
* attempt to build libcamera * try newer stdlib version * try newer stdlib version * Update recipes/libcamera/build.sh Co-authored-by: Mark Harfouche <[email protected]> * build on linux_64 only for now * move some deps to host * Update recipes/libcamera/build.sh Co-authored-by: Mark Harfouche <[email protected]> * Update recipes/libcamera/meta.yaml Co-authored-by: Mark Harfouche <[email protected]> * Update recipes/libcamera/meta.yaml Co-authored-by: Mark Harfouche <[email protected]> * Update recipes/libcamera/meta.yaml Co-authored-by: Mark Harfouche <[email protected]> * Update recipes/libcamera/meta.yaml Co-authored-by: Mark Harfouche <[email protected]> * Update recipes/libcamera/build.sh Co-authored-by: Mark Harfouche <[email protected]> * Update recipes/libcamera/meta.yaml Co-authored-by: Mark Harfouche <[email protected]> * Update recipes/libcamera/meta.yaml Co-authored-by: Mark Harfouche <[email protected]> * add memfd patch * fix patch * use LF not CRLF * Update recipes/libcamera/meta.yaml Co-authored-by: Mark Harfouche <[email protected]> * fix license stuff * licenses is a folder.. * try another test * add libcamera-rpi * try fixing download url * remove leftover * add forgotten build script * nothing to test there... * add pidng recipe * fix maintainer name * fix recipe * skip windows for now * fix duplicate buildtype arg * try fixing gstreamer * add patch for unused variables * ignore unused variables for now until raspberrypi/libpisp#43 is merged and libpsp is bumped... * param is cpp_args * try to fix glib errors * remove extra glib * move pidng to separate recipe * first attempt at build variants * maybe this works * try fixing indentation * fix leftover from previous recipe * fix download url of libcamera-rpi * fix name and version of main package * add different build strings * do not fail if MESON_ARGS is unset * remove undefined component in build string * or even better * do I really need to repeat the common deps? * Naturally exclusive variant * try to fix tests * Update recipes/libcamera/meta.yaml Co-authored-by: Mark Harfouche <[email protected]> * fix run requirement for libcamera-rpi * build full python matrix * document some choices Co-authored-by: Mark Harfouche <[email protected]> * add xref with rpi fork conversation * install upstream variant by default * build rpi variant only on aarch64 Co-authored-by: Mark Harfouche <[email protected]> * try testing also libcamerify on rpi * add aarch64 builds --------- Co-authored-by: Mark Harfouche <[email protected]>
1 parent 1ea32f5 commit 6f45325

File tree

5 files changed

+178
-0
lines changed

5 files changed

+178
-0
lines changed

recipes/libcamera/build.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
set -xeo pipefail
3+
4+
rm -f subprojects/gtest.wrap
5+
EXTRA_MESON_ARGS=""
6+
if [[ ${variant} == "rpi" ]]; then
7+
EXTRA_MESON_ARGS="${EXTRA_MESON_ARGS} -Dpycamera=enabled"
8+
EXTRA_MESON_ARGS="${EXTRA_MESON_ARGS} -Dpipelines=rpi/vc4,rpi/pisp"
9+
EXTRA_MESON_ARGS="${EXTRA_MESON_ARGS} -Dipas=rpi/vc4,rpi/pisp"
10+
EXTRA_MESON_ARGS="${EXTRA_MESON_ARGS} -Dv4l2=true"
11+
EXTRA_MESON_ARGS="${EXTRA_MESON_ARGS} -Dgstreamer=enabled"
12+
EXTRA_MESON_ARGS="${EXTRA_MESON_ARGS} -Dtest=false"
13+
EXTRA_MESON_ARGS="${EXTRA_MESON_ARGS} -Dlc-compliance=disabled"
14+
EXTRA_MESON_ARGS="${EXTRA_MESON_ARGS} -Dcam=disabled"
15+
EXTRA_MESON_ARGS="${EXTRA_MESON_ARGS} -Dqcam=disabled"
16+
17+
# the latter two are needed to avoid build errors with GCC,
18+
# see https://github.com/raspberrypi/libpisp/pull/43
19+
EXTRA_MESON_ARGS="${EXTRA_MESON_ARGS} -Dc_args=-Wno-unused-parameter"
20+
EXTRA_MESON_ARGS="${EXTRA_MESON_ARGS} -Dcpp_args=-Wno-unused-parameter"
21+
fi
22+
23+
meson setup build ${MESON_ARGS} \
24+
-Ddocumentation=disabled \
25+
${EXTRA_MESON_ARGS}
26+
27+
ninja -C build install
28+

recipes/libcamera/conda-forge.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
provider:
2+
linux_aarch64: default
3+
build_platform:
4+
linux_aarch64: linux_64
5+
conda_build:
6+
pkg_format: '2'
7+
conda_forge_output_validation: true
8+
test: native_and_emulated
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
variant:
2+
- upstream
3+
- rpi_fork
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
diff --git a/src/libcamera/base/memfd.cpp b/src/libcamera/base/memfd.cpp
2+
index ed0b299b..10469a7f 100644
3+
--- a/src/libcamera/base/memfd.cpp
4+
+++ b/src/libcamera/base/memfd.cpp
5+
@@ -12,6 +12,7 @@
6+
#include <sys/mman.h>
7+
#include <sys/syscall.h>
8+
#include <unistd.h>
9+
+#include <linux/memfd.h>
10+
11+
#include <libcamera/base/log.h>

recipes/libcamera/meta.yaml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{% set libcamera_version = "0.4.0" %}
2+
{% set libcamera_rpi_version = "0.4.0+rpt20250213" %}
3+
{% set rpi_url_safe_version = libcamera_rpi_version | urlencode %}
4+
{% set build = 0 %}
5+
6+
{% if variant == "upstream" %}
7+
# install upstream variant by dafault
8+
{% set build = build + 100 %}
9+
{% endif %}
10+
11+
package:
12+
name: libcamera
13+
version: {{ libcamera_version }}
14+
15+
source:
16+
{% if variant == "upstream" %}
17+
# libcamera does not offer tar balls
18+
git_url: https://git.libcamera.org/libcamera/libcamera.git
19+
git_rev: v{{ libcamera_version }}
20+
{% elif variant == "rpi_fork" %}
21+
# In conversations with upstream
22+
# https://github.com/raspberrypi/libcamera/issues/251
23+
# We found that they attempt to maintain ABI compatibility
24+
# Thus we build Raspberry-Pi specific modifications as as a variant instead of a separate package
25+
url: https://github.com/raspberrypi/libcamera/releases/download/v{{ rpi_url_safe_version }}/libcamera-{{ rpi_url_safe_version }}.tar.xz
26+
sha256: 764b9b2ab16dbc4e90cd858cd2019be76e087e093bbdd08048d87d0a704f8e28
27+
{% endif %}
28+
patches:
29+
- memfd_symbols.patch
30+
31+
build:
32+
number: {{ build }}
33+
skip: true # [not linux]
34+
{% if variant == "rpi_fork" %}
35+
skip: true # [not aarch64]
36+
{% endif %}
37+
string: "py{{ CONDA_PY }}_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}_{{ variant }}"
38+
39+
requirements:
40+
build:
41+
- python # [build_platform != target_platform]
42+
- cross-python_{{ target_platform }} # [build_platform != target_platform]
43+
- qt6-main # [build_platform != target_platform]
44+
- cmake
45+
- ninja
46+
- meson
47+
# Needed for some build processes???
48+
- ply
49+
- pyyaml
50+
- jinja2
51+
- pkg-config
52+
- {{ compiler('cxx') }}
53+
- {{ compiler('c') }}
54+
- {{ stdlib('c') }}
55+
host:
56+
- libgl-devel
57+
- python
58+
- pybind11
59+
- jinja2
60+
- libudev
61+
- libudev1
62+
- gstreamer
63+
- libevent
64+
- libdrm
65+
- libtiff
66+
- qt6-main
67+
- libdrm
68+
- libjpeg-turbo
69+
- yaml
70+
- libunwind
71+
- sdl2
72+
- openssl
73+
- libboost-devel
74+
- pyyaml
75+
- ply
76+
run:
77+
- python
78+
test:
79+
commands:
80+
- test -f $PREFIX/lib/libcamera.so
81+
- test -f $PREFIX/include/libcamera/libcamera/libcamera.h
82+
83+
outputs:
84+
- name: libcamera
85+
test:
86+
commands:
87+
- cam -l
88+
- name: libcamera-rpi
89+
build:
90+
skip: true # [variant == "upstream"]
91+
string: "py{{ CONDA_PY }}_h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}_{{ variant }}"
92+
requirements:
93+
# Add python as build/host dependency to get the full python matrix out of this.
94+
build:
95+
- python # [build_platform != target_platform]
96+
- cross-python_{{ target_platform }} # [build_platform != target_platform]
97+
host:
98+
- python
99+
run:
100+
- python
101+
# I wish we could pin exact... but I think with the python build matrix
102+
# It makes things complicated.
103+
# - libcamera {{ libcamera_version }} *_{{ PKG_BUILDNUM }}_{{ variant }}
104+
- {{ pin_subpackage('libcamera', exact=True) }}
105+
test:
106+
commands:
107+
- libcamerify --help
108+
109+
110+
about:
111+
home: https://libcamera.org/index.html
112+
summary: An open source camera stack and framework for Linux, Android, and ChromeOS
113+
license: >
114+
LGPL-2.1-or-later
115+
AND BSD-2-Clause
116+
AND BSD-3-Clause
117+
AND MIT
118+
AND Apache-2.0
119+
AND CC0-1.0
120+
AND CC-BY-SA-4.0
121+
AND CC-BY-4.0
122+
license_file: LICENSES/
123+
doc_url: https://libcamera.org/introduction.html
124+
dev_url: https://git.libcamera.org/libcamera/libcamera.git/
125+
126+
extra:
127+
recipe-maintainers:
128+
- carlodri

0 commit comments

Comments
 (0)