diff --git a/.dockerignore b/.dockerignore index 98f7644..b1e0e60 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,6 @@ -*.o -/deps -/prefix -/mtxrpicam_* +/build +/subprojects/* +!/subprojects/packagefiles +!/subprojects/freetype.wrap +!/subprojects/libcamera.wrap +!/subprojects/x264.wrap diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 59c916b..6c8423c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,11 +14,11 @@ jobs: - run: make -f utils.mk build_32 - - run: tar -czf mtxrpicam_32.tar.gz mtxrpicam_32 + - run: cd build && tar -czf mtxrpicam_32.tar.gz mtxrpicam_32 - uses: actions/upload-artifact@v4 with: - path: mtxrpicam_32.tar.gz + path: build/mtxrpicam_32.tar.gz name: mtxrpicam_32.tar.gz build_64: @@ -29,11 +29,11 @@ jobs: - run: make -f utils.mk build_64 - - run: tar -czf mtxrpicam_64.tar.gz mtxrpicam_64 + - run: cd build && tar -czf mtxrpicam_64.tar.gz mtxrpicam_64 - uses: actions/upload-artifact@v4 with: - path: mtxrpicam_64.tar.gz + path: build/mtxrpicam_64.tar.gz name: mtxrpicam_64.tar.gz github_release: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ad6d0a5..36ebf5a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,11 +15,11 @@ jobs: - run: make -f utils.mk build_32 - - run: tar -czf mtxrpicam_32.tar.gz mtxrpicam_32 + - run: cd build && tar -czf mtxrpicam_32.tar.gz mtxrpicam_32 - uses: actions/upload-artifact@v4 with: - path: mtxrpicam_32.tar.gz + path: build/mtxrpicam_32.tar.gz name: mtxrpicam_32.tar.gz build_64: @@ -30,11 +30,11 @@ jobs: - run: make -f utils.mk build_64 - - run: tar -czf mtxrpicam_64.tar.gz mtxrpicam_64 + - run: cd build && tar -czf mtxrpicam_64.tar.gz mtxrpicam_64 - uses: actions/upload-artifact@v4 with: - path: mtxrpicam_64.tar.gz + path: build/mtxrpicam_64.tar.gz name: mtxrpicam_64.tar.gz test_bullseye_32: @@ -47,9 +47,9 @@ jobs: - uses: actions/download-artifact@v4 with: name: mtxrpicam_32.tar.gz - path: . + path: build/ - - run: tar xvf mtxrpicam_32.tar.gz + - run: cd build && tar xvf mtxrpicam_32.tar.gz - run: make -f utils.mk test_bullseye_32 @@ -63,9 +63,9 @@ jobs: - uses: actions/download-artifact@v4 with: name: mtxrpicam_64.tar.gz - path: . + path: build/ - - run: tar xvf mtxrpicam_64.tar.gz + - run: cd build && tar xvf mtxrpicam_64.tar.gz - run: make -f utils.mk test_bullseye_64 @@ -79,9 +79,9 @@ jobs: - uses: actions/download-artifact@v4 with: name: mtxrpicam_32.tar.gz - path: . + path: build/ - - run: tar xvf mtxrpicam_32.tar.gz + - run: cd build && tar xvf mtxrpicam_32.tar.gz - run: make -f utils.mk test_bookworm_32 @@ -95,8 +95,8 @@ jobs: - uses: actions/download-artifact@v4 with: name: mtxrpicam_64.tar.gz - path: . + path: build/ - - run: tar xvf mtxrpicam_64.tar.gz + - run: cd build && tar xvf mtxrpicam_64.tar.gz - run: make -f utils.mk test_bookworm_64 diff --git a/.gitignore b/.gitignore index 98f7644..b1e0e60 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ -*.o -/deps -/prefix -/mtxrpicam_* +/build +/subprojects/* +!/subprojects/packagefiles +!/subprojects/freetype.wrap +!/subprojects/libcamera.wrap +!/subprojects/x264.wrap diff --git a/Makefile b/Makefile deleted file mode 100644 index 224d093..0000000 --- a/Makefile +++ /dev/null @@ -1,206 +0,0 @@ -ifeq ($(shell gcc -dumpmachine),aarch64-linux-gnu) - OUT_DIR = mtxrpicam_64 -else - OUT_DIR = mtxrpicam_32 -endif - -all: \ - $(OUT_DIR)/exe \ - $(OUT_DIR)/ipa_conf \ - $(OUT_DIR)/ipa_module \ - $(OUT_DIR)/libcamera.so.9.9 \ - $(OUT_DIR)/libcamera-base.so.9.9 - -################################################# -# openssl - -OPENSSL_REPO = https://github.com/openssl/openssl -OPENSSL_TAG = openssl-3.3.1 - -OPENSSL_TARGET = prefix/lib/libcrypto.a - -deps/openssl: - git clone -b $(OPENSSL_TAG) --depth=1 $(OPENSSL_REPO) $@ - -$(OPENSSL_TARGET): deps/openssl - cd $< \ - && ./Configure \ - --prefix=$(PWD)/prefix \ - no-shared \ - no-threads \ - no-quic \ - no-uplink \ - no-tests \ - && make -j$$(nproc) \ - && make install_sw - -################################################# -# libcamera - -LIBCAMERA_REPO = https://github.com/raspberrypi/libcamera -LIBCAMERA_TAG = v0.3.0+rpt20240617 - -LIBCAMERA_TARGET = prefix/lib/libcamera.so - -deps/libcamera: - git clone -b $(LIBCAMERA_TAG) --depth=1 $(LIBCAMERA_REPO) $@ - -$(LIBCAMERA_TARGET): deps/libcamera $(OPENSSL_TARGET) - cd $< \ - && echo "0.3.0+mediamtx" > .tarball-version \ - && patch -p1 < ../../libcamera.patch \ - && PKG_CONFIG_PATH=$(PWD)/prefix/lib/pkgconfig \ - meson setup build \ - --prefix=$(PWD)/prefix \ - --buildtype=release \ - -Dwrap_mode=forcefallback \ - -Dlc-compliance=disabled \ - -Dipas=rpi/vc4 \ - -Dpipelines=rpi/vc4 \ - -Dcam=disabled \ - -Ddocumentation=disabled \ - -Dgstreamer=disabled \ - -Dpycamera=disabled \ - -Dqcam=disabled \ - -Dtracing=disabled \ - -Dudev=disabled \ - && ninja -C build install - -$(OUT_DIR)/ipa_conf: $(LIBCAMERA_TARGET) - mkdir -p $(OUT_DIR) - cp -r $(PWD)/prefix/share/libcamera/ipa $@ - -$(OUT_DIR)/ipa_module: $(LIBCAMERA_TARGET) - mkdir -p $(OUT_DIR) - cp -r $(PWD)/prefix/lib/libcamera $@ - -$(OUT_DIR)/libcamera.so.9.9: $(LIBCAMERA_TARGET) - mkdir -p $(OUT_DIR) - cp $(PWD)/prefix/lib/libcamera.so.9.9 $@ - -$(OUT_DIR)/libcamera-base.so.9.9: $(LIBCAMERA_TARGET) - mkdir -p $(OUT_DIR) - cp $(PWD)/prefix/lib/libcamera-base.so.9.9 $@ - -################################################# -# libfreetype - -FREETYPE_REPO = https://github.com/freetype/freetype -FREETYPE_BRANCH = VER-2-11-1 - -FREETYPE_TARGET = prefix/lib/libfreetype.a - -deps/freetype: - git clone -b $(FREETYPE_BRANCH) --depth=1 $(FREETYPE_REPO) $@ - -$(FREETYPE_TARGET): deps/freetype - cd $< \ - && cmake -B build \ - -DCMAKE_INSTALL_PREFIX:PATH=$(PWD)/prefix \ - -D CMAKE_BUILD_TYPE=Release \ - -D BUILD_SHARED_LIBS=false \ - -D FT_DISABLE_ZLIB=TRUE \ - -D FT_DISABLE_BZIP2=TRUE \ - -D FT_DISABLE_PNG=TRUE \ - -D FT_DISABLE_HARFBUZZ=TRUE \ - -D FT_DISABLE_BROTLI=TRUE \ - && make -C build -j$$(nproc) \ - && make -C build install - -################################################# -# x264 - -X264_REPO = https://code.videolan.org/videolan/x264 -X264_COMMIT = 31e19f92f00c7003fa115047ce50978bc98c3a0d - -X264_TARGET = prefix/lib/libx264.a - -deps/x264: - git clone $(X264_REPO) $@ - cd $@ && git checkout $(X264_COMMIT) - -$(X264_TARGET): deps/x264 - cd $< \ - && ./configure \ - --prefix=$(PWD)/prefix \ - --enable-static \ - --enable-strip \ - --disable-cli \ - && make -j$(nproc) \ - && make install - -################################################# -# text font - -TEXT_FONT_URL = https://github.com/IBM/plex/raw/v6.4.2/IBM-Plex-Mono/fonts/complete/ttf/IBMPlexMono-Medium.ttf -TEXT_FONT_SHA256 = 0bede3debdea8488bbb927f8f0650d915073209734a67fe8cd5a3320b572511c - -TEXT_FONT_TARGET = deps/text_font.h - -deps/text_font.ttf: - mkdir -p deps - wget -O $@.tmp $(TEXT_FONT_URL) - H=$$(sha256sum $@.tmp | awk '{ print $$1 }'); [ "$$H" = "$(TEXT_FONT_SHA256)" ] || { echo "hash mismatch; got $$H, expected $(TEXT_FONT_SHA256)"; exit 1; } - mv $@.tmp $@ - -$(TEXT_FONT_TARGET): deps/text_font.ttf - xxd --include $< > $@ - -################################################# -# exe - -CFLAGS = \ - -Ofast \ - -Werror \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -Wno-unused-result \ - $$(PKG_CONFIG_PATH=$(PWD)/prefix/lib/pkgconfig pkg-config --cflags freetype2) \ - $$(PKG_CONFIG_PATH=$(PWD)/prefix/lib/pkgconfig pkg-config --cflags x264) - -CXXFLAGS = \ - -Ofast \ - -Werror \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -Wno-unused-result \ - -std=c++17 \ - $$(PKG_CONFIG_PATH=$(PWD)/prefix/lib/pkgconfig pkg-config --cflags libcamera) - -LDFLAGS = \ - -s \ - -pthread \ - $$(PKG_CONFIG_PATH=$(PWD)/prefix/lib/pkgconfig pkg-config --libs libcamera) \ - $$(PKG_CONFIG_PATH=$(PWD)/prefix/lib/pkgconfig pkg-config --libs freetype2) \ - $$(PKG_CONFIG_PATH=$(PWD)/prefix/lib/pkgconfig pkg-config --libs x264) - -OBJS = \ - base64.o \ - camera.o \ - encoder.o \ - encoder_hard_h264.o \ - encoder_soft_h264.o \ - main.o \ - parameters.o \ - pipe.o \ - sensor_mode.o \ - text.o \ - window.o - -DEPENDENCIES = \ - $(LIBCAMERA_TARGET) \ - $(FREETYPE_TARGET) \ - $(X264_TARGET) \ - $(TEXT_FONT_TARGET) - -%.o: %.c $(DEPENDENCIES) - $(CC) $(CFLAGS) -c $< -o $@ - -%.o: %.cpp $(DEPENDENCIES) - $(CXX) $(CXXFLAGS) -c $< -o $@ - -$(OUT_DIR)/exe: $(OBJS) - mkdir -p $(OUT_DIR) - $(CXX) $^ $(LDFLAGS) -o $@ diff --git a/README.md b/README.md index 18740bd..914ccf7 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,11 @@ This is embedded into all MediaMTX releases and shouldn't normally be downloaded ```sh sudo apt install -y \ g++ \ - make \ xxd \ wget \ git \ cmake \ meson \ - patch \ pkg-config \ python3-jinja2 \ python3-yaml \ @@ -31,10 +29,10 @@ This is embedded into all MediaMTX releases and shouldn't normally be downloaded 3. Build: ```sh - make -j$(nproc) + meson setup build && DESTDIR=./prefix ninja -C build install ``` - This will produce the `mtxrpicam_32` or `mtxrpicam_64` folder (depending on the architecture). + This will produce the `build/mtxrpicam_32` or `build/mtxrpicam_64` folder (depending on the architecture). ## Cross-compile @@ -48,7 +46,7 @@ This is embedded into all MediaMTX releases and shouldn't normally be downloaded make -f utils.mk build ``` - This will produce the `mtxrpicam_32` and `mtxrpicam_64` folders. + This will produce the `build/mtxrpicam_32` and `build/mtxrpicam_64` folders. ## Install @@ -56,7 +54,7 @@ This is embedded into all MediaMTX releases and shouldn't normally be downloaded 2. Run `go generate ./...` -3. Copy `mtxrpicam_32` and/or `mtxrpicam_64` inside `internal/staticsources/rpicamera/` +3. Copy `build/mtxrpicam_32` and/or `build/mtxrpicam_64` inside `internal/staticsources/rpicamera/` 4. Compile MediaMTX diff --git a/encoder.c b/encoder.c index 2d8c0d7..1d48cc1 100644 --- a/encoder.c +++ b/encoder.c @@ -5,6 +5,7 @@ #include #include #include +#include #include diff --git a/libcamera.patch b/libcamera.patch deleted file mode 100644 index 45053d0..0000000 --- a/libcamera.patch +++ /dev/null @@ -1,59 +0,0 @@ -diff --git a/meson.build b/meson.build -index 58bb9893..41fc661f 100644 ---- a/meson.build -+++ b/meson.build -@@ -2,7 +2,7 @@ - - project('libcamera', 'c', 'cpp', - meson_version : '>= 0.60', -- version : '0.3.0', -+ version : '9.9.9', - default_options : [ - 'werror=true', - 'warning_level=2', -diff --git a/src/ipa/meson.build b/src/ipa/meson.build -index 0ad4631d..101b41ad 100644 ---- a/src/ipa/meson.build -+++ b/src/ipa/meson.build -@@ -8,12 +8,9 @@ ipa_install_dir = libcamera_libdir - ipa_data_dir = libcamera_datadir / 'ipa' - ipa_sysconf_dir = libcamera_sysconfdir / 'ipa' - --config_h.set('IPA_CONFIG_DIR', -- '"' + get_option('prefix') / ipa_sysconf_dir + -- ':' + get_option('prefix') / ipa_data_dir + '"') -+config_h.set('IPA_CONFIG_DIR', '"./ipa_conf"') - --config_h.set('IPA_MODULE_DIR', -- '"' + get_option('prefix') / ipa_install_dir + '"') -+config_h.set('IPA_MODULE_DIR', '"./ipa_module"') - - summary({ - 'IPA_CONFIG_DIR' : config_h.get('IPA_CONFIG_DIR'), -diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build -index 89504cee..20c588cb 100644 ---- a/src/libcamera/meson.build -+++ b/src/libcamera/meson.build -@@ -61,7 +61,7 @@ includes = [ - - libcamera_deps = [] - --libatomic = cc.find_library('atomic', required : false) -+libatomic = cc.find_library('atomic', required : true, static : true) - libthreads = dependency('threads') - - subdir('base') -diff --git a/src/libcamera/proxy/worker/meson.build b/src/libcamera/proxy/worker/meson.build -index aa4d9cd7..31b994a9 100644 ---- a/src/libcamera/proxy/worker/meson.build -+++ b/src/libcamera/proxy/worker/meson.build -@@ -24,8 +24,7 @@ foreach mojom : ipa_mojoms - dependencies : libcamera_private) - endforeach - --config_h.set('IPA_PROXY_DIR', -- '"' + get_option('prefix') / proxy_install_dir + '"') -+config_h.set('IPA_PROXY_DIR', '"/dev/null"') - - summary({ - 'IPA_PROXY_DIR' : config_h.get('IPA_PROXY_DIR'), diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..a5bbdd6 --- /dev/null +++ b/meson.build @@ -0,0 +1,115 @@ +project( + 'mediamtx-rpicamera', + 'c', 'cpp', + version : '1.0.0', + meson_version : '>=1.0.0', + default_options: [ + # 'c_std=c18', + 'cpp_std=c++17', + 'buildtype=release', + 'strip=true', + 'prefix=/' + ] +) + +c_args = [ + '-Ofast', + '-Werror', + '-Wall', + '-Wextra', + '-Wno-unused-parameter', + '-Wno-unused-result' +] + +cpp_args = [ + '-Ofast', + '-Werror', + '-Wall', + '-Wextra', + '-Wno-unused-parameter', + '-Wno-unused-result' +] + +add_project_arguments(c_args, language : 'c') +add_project_arguments(cpp_args, language : 'cpp') + +x264 = subproject( + 'x264', + default_options : [ + 'default_library=static', + 'cli=false', + 'strip=true', + 'interlaced=false', + 'bit-depth=8', + 'chroma-format=all' + ]) +x264_dep = x264.get_variable('libx264_dep') + +libcamera = subproject( + 'libcamera', + default_options : [ + 'buildtype=release', + 'strip=true', + 'wrap_mode=forcefallback', + 'lc-compliance=disabled', + 'ipas=rpi/vc4', + 'pipelines=rpi/vc4', + 'cam=disabled', + 'documentation=disabled', + 'gstreamer=disabled', + 'pycamera=disabled', + 'qcam=disabled', + 'tracing=disabled', + 'udev=disabled' + ]) +libcamera_dep = libcamera.get_variable('libcamera_public') + +cmake = import('cmake') +freetype_vars = cmake.subproject_options() +freetype_vars.add_cmake_defines({ + 'CMAKE_BUILD_TYPE': 'Release', + 'BUILD_SHARED_LIBS': false, + 'FT_DISABLE_ZLIB': true, + 'FT_DISABLE_BZIP2': true, + 'FT_DISABLE_PNG': true, + 'FT_DISABLE_HARFBUZZ': true, + 'FT_DISABLE_BROTLI': true +}) +freetype = cmake.subproject('freetype', options : freetype_vars) +freetype_dep = freetype.dependency('freetype') + +dependencies = [ + x264_dep, + libcamera_dep, + freetype_dep +] + +text_font = custom_target( + 'text_font.h', + output : 'text_font.h', + command : ['./text_font.sh'] +) + +sources = [ + 'base64.c', + 'camera.cpp', + 'encoder_hard_h264.c', + 'encoder_soft_h264.c', + 'encoder.c', + 'main.c', + 'parameters.c', + 'pipe.c', + 'sensor_mode.c', + 'text.c', + 'window.c', + text_font +] + +mtxrpicam = executable( + 'mtxrpicam', + sources, + dependencies : dependencies, + install : true +) + +meson.add_install_script('post_install.sh') diff --git a/post_install.sh b/post_install.sh new file mode 100755 index 0000000..4ec074f --- /dev/null +++ b/post_install.sh @@ -0,0 +1,16 @@ +#!/bin/sh -e + +MACHINE=$(gcc -dumpmachine) + +if [ "$MACHINE" = "aarch64-linux-gnu" ]; then + OUT_DIR="mtxrpicam_64" +else + OUT_DIR="mtxrpicam_32" +fi + +mkdir -p $OUT_DIR +cp -r ${DESTDIR}/${MESON_INSTALL_PREFIX}/share/libcamera/ipa $OUT_DIR/ipa_conf +cp -r ${DESTDIR}/${MESON_INSTALL_PREFIX}/lib/libcamera $OUT_DIR/ipa_module +cp ${DESTDIR}/${MESON_INSTALL_PREFIX}/lib/libcamera-base.so.9.9 $OUT_DIR/ +cp ${DESTDIR}/${MESON_INSTALL_PREFIX}/lib/libcamera.so.9.9 $OUT_DIR/ +cp ${DESTDIR}/${MESON_INSTALL_PREFIX}/bin/mtxrpicam $OUT_DIR/ diff --git a/subprojects/freetype.wrap b/subprojects/freetype.wrap new file mode 100644 index 0000000..4e22e14 --- /dev/null +++ b/subprojects/freetype.wrap @@ -0,0 +1,4 @@ +[wrap-git] +url = https://github.com/freetype/freetype +# VER-2-11-1 +revision = 3f83daeecb1a78d851b660eed025eeba362c0e4a diff --git a/subprojects/libcamera.wrap b/subprojects/libcamera.wrap new file mode 100644 index 0000000..68a5020 --- /dev/null +++ b/subprojects/libcamera.wrap @@ -0,0 +1,5 @@ +[wrap-git] +url = https://github.com/raspberrypi/libcamera +# v0.3.0+rpt20240617 +revision = 6ddd79b5bdbedc1f61007aed35391f1559f9e29a +diff_files = libcamera.patch diff --git a/subprojects/packagefiles/libcamera.patch b/subprojects/packagefiles/libcamera.patch new file mode 100644 index 0000000..2e864b3 --- /dev/null +++ b/subprojects/packagefiles/libcamera.patch @@ -0,0 +1,115 @@ +diff --git a/.tarball_version b/.tarball_version +new file mode 100644 +index 00000000..d5df1ce3 +--- /dev/null ++++ b/.tarball_version +@@ -0,0 +1 @@ ++0.3.0+mediamtx +diff --git a/meson.build b/meson.build +index 58bb9893..41fc661f 100644 +--- a/meson.build ++++ b/meson.build +@@ -2,7 +2,7 @@ + + project('libcamera', 'c', 'cpp', + meson_version : '>= 0.60', +- version : '0.3.0', ++ version : '9.9.9', + default_options : [ + 'werror=true', + 'warning_level=2', +diff --git a/src/ipa/meson.build b/src/ipa/meson.build +index 0ad4631d..101b41ad 100644 +--- a/src/ipa/meson.build ++++ b/src/ipa/meson.build +@@ -8,12 +8,9 @@ ipa_install_dir = libcamera_libdir + ipa_data_dir = libcamera_datadir / 'ipa' + ipa_sysconf_dir = libcamera_sysconfdir / 'ipa' + +-config_h.set('IPA_CONFIG_DIR', +- '"' + get_option('prefix') / ipa_sysconf_dir + +- ':' + get_option('prefix') / ipa_data_dir + '"') ++config_h.set('IPA_CONFIG_DIR', '"./ipa_conf"') + +-config_h.set('IPA_MODULE_DIR', +- '"' + get_option('prefix') / ipa_install_dir + '"') ++config_h.set('IPA_MODULE_DIR', '"./ipa_module"') + + summary({ + 'IPA_CONFIG_DIR' : config_h.get('IPA_CONFIG_DIR'), +diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build +index 89504cee..be183929 100644 +--- a/src/libcamera/meson.build ++++ b/src/libcamera/meson.build +@@ -61,7 +61,7 @@ includes = [ + + libcamera_deps = [] + +-libatomic = cc.find_library('atomic', required : false) ++libatomic = cc.find_library('atomic', required : true, static : true) + libthreads = dependency('threads') + + subdir('base') +@@ -82,24 +82,9 @@ endif + libudev = dependency('libudev', required : get_option('udev')) + libyaml = dependency('yaml-0.1', required : false) + +-# Use one of gnutls or libcrypto (provided by OpenSSL), trying gnutls first. +-libcrypto = dependency('gnutls', required : false) +-if libcrypto.found() +- config_h.set('HAVE_GNUTLS', 1) +-else +- libcrypto = dependency('libcrypto', required : false) +- if libcrypto.found() +- config_h.set('HAVE_CRYPTO', 1) +- endif +-endif +- +-if not libcrypto.found() +- warning('Neither gnutls nor libcrypto found, all IPA modules will be isolated') +- summary({'IPA modules signed with': 'None (modules will run isolated)'}, +- section : 'Configuration') +-else +- summary({'IPA modules signed with' : libcrypto.name()}, section : 'Configuration') +-endif ++libcrypto_proj = subproject('openssl', default_options : [ 'c_std=none', 'default_library=static' ]) ++libcrypto = libcrypto_proj.get_variable('libcrypto_dep') ++config_h.set('HAVE_CRYPTO', 1) + + if liblttng.found() + tracing_enabled = true +diff --git a/src/libcamera/proxy/worker/meson.build b/src/libcamera/proxy/worker/meson.build +index aa4d9cd7..31b994a9 100644 +--- a/src/libcamera/proxy/worker/meson.build ++++ b/src/libcamera/proxy/worker/meson.build +@@ -24,8 +24,7 @@ foreach mojom : ipa_mojoms + dependencies : libcamera_private) + endforeach + +-config_h.set('IPA_PROXY_DIR', +- '"' + get_option('prefix') / proxy_install_dir + '"') ++config_h.set('IPA_PROXY_DIR', '"/dev/null"') + + summary({ + 'IPA_PROXY_DIR' : config_h.get('IPA_PROXY_DIR'), +diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap +new file mode 100644 +index 00000000..873d5510 +--- /dev/null ++++ b/subprojects/openssl.wrap +@@ -0,0 +1,15 @@ ++[wrap-file] ++directory = openssl-3.0.8 ++source_url = https://www.openssl.org/source/openssl-3.0.8.tar.gz ++source_filename = openssl-3.0.8.tar.gz ++source_hash = 6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e ++patch_filename = openssl_3.0.8-3_patch.zip ++patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.8-3/get_patch ++patch_hash = 300da189e106942347d61a4a4295aa2edbcf06184f8d13b4cee0bed9fb936963 ++source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-3/openssl-3.0.8.tar.gz ++wrapdb_version = 3.0.8-3 ++ ++[provide] ++libcrypto = libcrypto_dep ++libssl = libssl_dep ++openssl = openssl_dep diff --git a/subprojects/x264.wrap b/subprojects/x264.wrap new file mode 100644 index 0000000..8e90611 --- /dev/null +++ b/subprojects/x264.wrap @@ -0,0 +1,3 @@ +[wrap-git] +url = https://gitlab.freedesktop.org/gstreamer/meson-ports/x264 +revision = ecc833a37945073a779b42b1a9f20c4454a62fbb diff --git a/text.c b/text.c index 261f1a3..fd7e50e 100644 --- a/text.c +++ b/text.c @@ -3,7 +3,7 @@ #include #include FT_FREETYPE_H -#include "deps/text_font.h" +#include "text_font.h" #include "text.h" @@ -43,8 +43,8 @@ bool text_create(const parameters_t *params, text_t **text) { error = FT_New_Memory_Face( textp->library, - deps_text_font_ttf, - sizeof(deps_text_font_ttf), + text_font_ttf, + sizeof(text_font_ttf), 0, &textp->face); if (error) { diff --git a/text_font.sh b/text_font.sh new file mode 100755 index 0000000..3f6c654 --- /dev/null +++ b/text_font.sh @@ -0,0 +1,5 @@ +#!/bin/sh -e + +wget -O text_font.ttf https://github.com/IBM/plex/raw/v6.4.2/IBM-Plex-Mono/fonts/complete/ttf/IBMPlexMono-Medium.ttf + +xxd --include text_font.ttf > text_font.h diff --git a/utils.mk b/utils.mk index 4484a54..86223b5 100644 --- a/utils.mk +++ b/utils.mk @@ -28,26 +28,25 @@ FROM $(BULLSEYE_32_IMAGE) AS build COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static RUN apt update && apt install -y --no-install-recommends \ g++ \ - make \ xxd \ wget \ git \ cmake \ meson \ - patch \ pkg-config \ python3-jinja2 \ python3-yaml \ python3-ply WORKDIR /s COPY . . -RUN make -j$$(nproc) +RUN meson setup build && DESTDIR=./prefix ninja -C build install endef export DOCKERFILE_BUILD_32 build_32: enable_multiarch echo "$$DOCKERFILE_BUILD_32" | docker build . -f - -t build32 - docker run --rm -v $(PWD):/o build32 sh -c "rm -rf /o/mtxrpicam_32 && mv /s/mtxrpicam_32 /o/" + mkdir -p build + docker run --rm -v $(PWD):/o build32 sh -c "rm -rf /o/build/mtxrpicam_32 && mv /s/build/mtxrpicam_32 /o/build/" define DOCKERFILE_BUILD_64 FROM multiarch/qemu-user-static:x86_64-aarch64 AS qemu @@ -68,13 +67,14 @@ RUN apt update && apt install -y --no-install-recommends \ python3-ply WORKDIR /s COPY . . -RUN make -j$$(nproc) +RUN meson setup build && DESTDIR=./prefix ninja -C build install endef export DOCKERFILE_BUILD_64 build_64: enable_multiarch echo "$$DOCKERFILE_BUILD_64" | docker build . -f - -t build64 - docker run --rm -v $(PWD):/o build64 sh -c "rm -rf /o/mtxrpicam_64 && mv /s/mtxrpicam_64 /o/" + mkdir -p build + docker run --rm -v $(PWD):/o build64 sh -c "rm -rf /o/build/mtxrpicam_64 && mv /s/build/mtxrpicam_64 /o/build/" define DOCKERFILE_TEST_BULLSEYE_32 FROM multiarch/qemu-user-static:x86_64-arm AS qemu @@ -85,7 +85,7 @@ export DOCKERFILE_TEST_BULLSEYE_32 test_bullseye_32: enable_multiarch echo "$$DOCKERFILE_TEST_BULLSEYE_32" | docker build . -f - -t test_bullseye_32 - docker run --rm --platform=linux/arm/v6 -v $(PWD):/s -w /s/mtxrpicam_32 test_bullseye_32 bash -c "LD_LIBRARY_PATH=. TEST=1 ./exe" + docker run --rm --platform=linux/arm/v6 -v $(PWD):/s -w /s/build/mtxrpicam_32 test_bullseye_32 bash -c "LD_LIBRARY_PATH=. TEST=1 ./mtxrpicam" define DOCKERFILE_TEST_BULLSEYE_64 FROM multiarch/qemu-user-static:x86_64-aarch64 AS qemu @@ -96,7 +96,7 @@ export DOCKERFILE_TEST_BULLSEYE_64 test_bullseye_64: enable_multiarch echo "$$DOCKERFILE_TEST_BULLSEYE_64" | docker build . -f - -t test_bullseye_64 - docker run --rm --platform=linux/arm64/v8 -v $(PWD):/s -w /s/mtxrpicam_64 test_bullseye_64 bash -c "LD_LIBRARY_PATH=. TEST=1 ./exe" + docker run --rm --platform=linux/arm64/v8 -v $(PWD):/s -w /s/build/mtxrpicam_64 test_bullseye_64 bash -c "LD_LIBRARY_PATH=. TEST=1 ./mtxrpicam" define DOCKERFILE_TEST_BOOKWORM_32 FROM multiarch/qemu-user-static:x86_64-arm AS qemu @@ -107,7 +107,7 @@ export DOCKERFILE_TEST_BOOKWORM_32 test_bookworm_32: enable_multiarch echo "$$DOCKERFILE_TEST_BOOKWORM_32" | docker build . -f - -t test_bookworm_32 - docker run --rm --platform=linux/arm/v6 -v $(PWD):/s -w /s/mtxrpicam_32 test_bookworm_32 bash -c "LD_LIBRARY_PATH=. TEST=1 ./exe" + docker run --rm --platform=linux/arm/v6 -v $(PWD):/s -w /s/build/mtxrpicam_32 test_bookworm_32 bash -c "LD_LIBRARY_PATH=. TEST=1 ./mtxrpicam" define DOCKERFILE_TEST_BOOKWORM_64 FROM multiarch/qemu-user-static:x86_64-aarch64 AS qemu @@ -118,4 +118,4 @@ export DOCKERFILE_TEST_BOOKWORM_64 test_bookworm_64: enable_multiarch echo "$$DOCKERFILE_TEST_BOOKWORM_64" | docker build . -f - -t test_bookworm_64 - docker run --rm --platform=linux/arm64/v8 -v $(PWD):/s -w /s/mtxrpicam_64 test_bookworm_64 bash -c "LD_LIBRARY_PATH=. TEST=1 ./exe" + docker run --rm --platform=linux/arm64/v8 -v $(PWD):/s -w /s/build/mtxrpicam_64 test_bookworm_64 bash -c "LD_LIBRARY_PATH=. TEST=1 ./mtxrpicam"