From 2cbe1d7e6645f61dc4786b0f432f6874a7149570 Mon Sep 17 00:00:00 2001 From: Thies Moeller Date: Fri, 12 Jul 2024 15:28:13 +0200 Subject: [PATCH 01/11] Add missing rpath for python bindings --- bindings/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/meson.build b/bindings/meson.build index 64181824..190af5f0 100644 --- a/bindings/meson.build +++ b/bindings/meson.build @@ -27,6 +27,7 @@ incdir = include_directories('include') pymeta = py3.extension_module('pygstpylon', pygstpylon_sources, install : true, + install_rpath : pylon_rpath, cpp_args: ['-DHAVE_CONFIG_H=1'], include_directories : [configinc, incdir], gnu_symbol_visibility: 'inlineshidden', From de209eced899ae8a91272c5102768a770db8c11f Mon Sep 17 00:00:00 2001 From: Thies Moeller Date: Fri, 12 Jul 2024 09:45:55 +0200 Subject: [PATCH 02/11] Add debian packaging support Building for NVIDIA requires setting DEB_BUILD_PROFILES=nvidia PYLON_ROOT=/opt/pylon dpkg-buildpackage -us -uc -rfakeroot Co-authored-by: Patrick Thomas --- packaging/debian/changelog | 5 ++ packaging/debian/control | 37 +++++++++ packaging/debian/copyright | 27 +++++++ packaging/debian/gst-plugin-pylon-dev.install | 2 + packaging/debian/gst-plugin-pylon.install | 3 + packaging/debian/gst-plugin-pylon.postinst | 4 + packaging/debian/gst-plugin-pylon.postrm | 4 + packaging/debian/python3-pygstpylon.install | 1 + packaging/debian/rules | 51 ++++++++++++ packaging/debian/source/format | 1 + tools/patch_deb_changelog.sh | 79 +++++++++++++++++++ 11 files changed, 214 insertions(+) create mode 100644 packaging/debian/changelog create mode 100644 packaging/debian/control create mode 100644 packaging/debian/copyright create mode 100644 packaging/debian/gst-plugin-pylon-dev.install create mode 100644 packaging/debian/gst-plugin-pylon.install create mode 100755 packaging/debian/gst-plugin-pylon.postinst create mode 100755 packaging/debian/gst-plugin-pylon.postrm create mode 100644 packaging/debian/python3-pygstpylon.install create mode 100755 packaging/debian/rules create mode 100644 packaging/debian/source/format create mode 100755 tools/patch_deb_changelog.sh diff --git a/packaging/debian/changelog b/packaging/debian/changelog new file mode 100644 index 00000000..086871e9 --- /dev/null +++ b/packaging/debian/changelog @@ -0,0 +1,5 @@ +gst-plugin-pylon (0.7.2) unstable; urgency=medium + + * Refer to Package Release Notes for details: https://github.com/basler/gst-plugin-pylon/blob/main/CHANGELOG.md + + -- Basler AG Tue, 09 Jul 2024 12:00:00 +0000 diff --git a/packaging/debian/control b/packaging/debian/control new file mode 100644 index 00000000..c734f847 --- /dev/null +++ b/packaging/debian/control @@ -0,0 +1,37 @@ +Source: gst-plugin-pylon +Section: video +Priority: optional +Maintainer: Basler AG +Build-Depends: debhelper-compat (= 11), + dh-python, cmake, + python3-pip, + python3-setuptools, + pybind11-dev, + python3-dev, + libgstreamer1.0-dev, + libgstreamer-plugins-base1.0-dev, + pylon (= 7.5.0.15658-deb0), + deepstream-6.3 | deepstream-6.4 | deepstream-7.0 +Standards-Version: 4.5.0 +Homepage: https://github.com/basler/gst-plugin-pylon + +Package: gst-plugin-pylon +Architecture: any +Depends: libc6, pylon (= 7.5.0.15658-deb0), ${misc:Depends}, gstreamer1.0-plugins-base, deepstream-6.3 | deepstream-6.4 | deepstream-7.0 +Description: GStreamer plugin for Basler cameras + This plugin allows the use of any Basler 2D camera (supported by Basler pylon + Camera Software Suite) as a source element in a GStreamer pipeline. + +Package: gst-plugin-pylon-dev +Architecture: any +Depends: pylon (= 7.5.0.15658-deb0), ${misc:Depends}, gst-plugin-pylon +Description: Development files for GStreamer plugin for Basler cameras + This package contains the development files for the GStreamer plugin for + Basler cameras. + +Package: python3-pygstpylon +Architecture: any +Depends: libc6, python3, pylon (= 7.5.0.15658-deb0), ${misc:Depends}, gst-plugin-pylon, deepstream-6.3 | deepstream-6.4 | deepstream-7.0 +Description: Python module to access pylon specific gstreamer metadata. + The python module pygstpylon allows to extract pylon specific metadata + from a buffer. diff --git a/packaging/debian/copyright b/packaging/debian/copyright new file mode 100644 index 00000000..08ba7dd7 --- /dev/null +++ b/packaging/debian/copyright @@ -0,0 +1,27 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: gst-plugin-pylon +Source: https://github.com/basler/gst-plugin-pylon + +Files: * +Copyright (C) 2022-2024 Basler AG +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packaging/debian/gst-plugin-pylon-dev.install b/packaging/debian/gst-plugin-pylon-dev.install new file mode 100644 index 00000000..10f26865 --- /dev/null +++ b/packaging/debian/gst-plugin-pylon-dev.install @@ -0,0 +1,2 @@ +usr/include/gstreamer-1.0/gst/pylon/gstpylonmeta.h +usr/lib/*/pkgconfig/gstpylon-1.0.pc diff --git a/packaging/debian/gst-plugin-pylon.install b/packaging/debian/gst-plugin-pylon.install new file mode 100644 index 00000000..cc49ffac --- /dev/null +++ b/packaging/debian/gst-plugin-pylon.install @@ -0,0 +1,3 @@ +usr/lib/*/*.so +usr/lib/*/gstreamer-1.0/* + diff --git a/packaging/debian/gst-plugin-pylon.postinst b/packaging/debian/gst-plugin-pylon.postinst new file mode 100755 index 00000000..c3292bd2 --- /dev/null +++ b/packaging/debian/gst-plugin-pylon.postinst @@ -0,0 +1,4 @@ +#!/bin/bash +set -e +# Post-installation script +ldconfig diff --git a/packaging/debian/gst-plugin-pylon.postrm b/packaging/debian/gst-plugin-pylon.postrm new file mode 100755 index 00000000..c3292bd2 --- /dev/null +++ b/packaging/debian/gst-plugin-pylon.postrm @@ -0,0 +1,4 @@ +#!/bin/bash +set -e +# Post-installation script +ldconfig diff --git a/packaging/debian/python3-pygstpylon.install b/packaging/debian/python3-pygstpylon.install new file mode 100644 index 00000000..3272cd65 --- /dev/null +++ b/packaging/debian/python3-pygstpylon.install @@ -0,0 +1 @@ +usr/lib/python3/dist-packages/* diff --git a/packaging/debian/rules b/packaging/debian/rules new file mode 100755 index 00000000..1bcd7403 --- /dev/null +++ b/packaging/debian/rules @@ -0,0 +1,51 @@ +#!/usr/bin/make -f + +# uncomment for verbose logging +export DH_VERBOSE = 1 + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed +export DEB_MESON_OPTIONS = -Dpython-bindings=enabled + +# Path to the virtual environment +VENV_DIR := $(CURDIR)/debian/venv +MESON_BIN := $(VENV_DIR)/bin/meson +NINJA_BIN := $(VENV_DIR)/bin/ninja + +# Ensure the virtual environment is set up and Meson/Ninja are installed +$(MESON_BIN) $(NINJA_BIN): + python3 -m venv $(VENV_DIR) --without-pip --system-site-packages + $(VENV_DIR)/bin/python -m pip install meson ninja + +%: $(MESON_BIN) $(NINJA_BIN) + dh $@ --with python3 --buildsystem=meson + +override_dh_auto_configure: $(MESON_BIN) $(NINJA_BIN) + PATH=$(VENV_DIR)/bin:$$PATH $(MESON_BIN) setup $(CURDIR) $(CURDIR)/debian/build --prefix=/usr $(DEB_MESON_OPTIONS) + +override_dh_auto_build: $(MESON_BIN) $(NINJA_BIN) + cd $(CURDIR)/debian/build && PATH=$(VENV_DIR)/bin:$$PATH $(NINJA_BIN) + +override_dh_auto_test: $(MESON_BIN) $(NINJA_BIN) + if echo "$(DEB_BUILD_PROFILES)" | grep -q "nvidia"; then \ + if [ ! -f /proc/device-tree/compatible ] || ! grep -q "nvidia" /proc/device-tree/compatible; then \ + echo "Skipping tests: NVIDIA profile detected but not running on NVIDIA hardware"; \ + exit 0; \ + fi; \ + fi; \ + echo "Running tests"; \ + cd $(CURDIR)/debian/build && PATH=$(VENV_DIR)/bin:$$PATH $(NINJA_BIN) test; + +override_dh_auto_install: $(MESON_BIN) $(NINJA_BIN) + cd $(CURDIR)/debian/build && DESTDIR=$(CURDIR)/debian/tmp PATH=$(VENV_DIR)/bin:$$PATH $(NINJA_BIN) install + +# handle pylon libs versioning and rpath +override_dh_shlibdeps: + dh_shlibdeps -a -l/opt/pylon/lib -- --ignore-missing-info + +# Clean up the virtual environment +override_dh_clean: + dh_clean + rm -rf $(VENV_DIR) + diff --git a/packaging/debian/source/format b/packaging/debian/source/format new file mode 100644 index 00000000..89ae9db8 --- /dev/null +++ b/packaging/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/tools/patch_deb_changelog.sh b/tools/patch_deb_changelog.sh new file mode 100755 index 00000000..9fdf17a9 --- /dev/null +++ b/tools/patch_deb_changelog.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +# Function to parse the L4T version string and format it +parse_nvidia_version() { + local version_string="$1" + local major minor revision date formatted_date + + # Extract major version (e.g., 35) + major=$(echo "$version_string" | grep -oP '(?<=# R)[0-9]+') + + # Extract minor version and revision (e.g., 4.1) + minor_revision=$(echo "$version_string" | grep -oP '(?<=REVISION: )[0-9]+\.[0-9]+') + minor=$(echo "$minor_revision" | cut -d. -f1) + revision=$(echo "$minor_revision" | cut -d. -f2) + + # Extract date (e.g., Tue Aug 1 19:57:35 UTC 2023) + date=$(echo "$version_string" | grep -oP '(?<=DATE: ).*') + + # Format date (e.g., 20230801195735) + formatted_date=$(date -d "$date" +'%Y%m%d%H%M%S') + + # Combine into desired format (e.g., 35.4.1-20230801195735) + echo "${major}.${minor}.${revision}-${formatted_date}" +} + +# Function to detect the platform version from /etc/os-release +detect_os_version() { + if [[ -f /etc/os-release ]]; then + . /etc/os-release + echo "${ID}-${VERSION_ID}" + else + echo "unknown" + fi +} + +# Extract L4T version information from /etc/nv_tegra_release +if [[ -f /etc/nv_tegra_release ]]; then + nvidia_version_string=$(head -n 1 /etc/nv_tegra_release) + PLATFORM_VERSION=$(parse_nvidia_version "$nvidia_version_string") +else + PLATFORM_VERSION=$(detect_os_version) +fi + +echo "Platform version is: $PLATFORM_VERSION" + +changelog_file="packaging/debian/changelog" + +# Check if the changelog file exists +if [ ! -f "$changelog_file" ]; then + echo "Error: Changelog file '$changelog_file' not found." + exit 1 +fi + +# Create a temporary file +temp_file=$(mktemp) + +# Extract the current version from the changelog +current_version=$(head -n 1 "$changelog_file" | sed -n 's/.*(\(.*\)).*/\1/p') + +# Remove any existing suffix and create the new version with the platform and version suffix +base_version=$(echo "$current_version" | sed 's/-1~.*//') +new_version="${base_version}-1~${PLATFORM_VERSION}" + +# Replace the version in the first line of the changelog +sed "1s/(${current_version})/(${new_version})/" "$changelog_file" > "$temp_file" + +# Check if sed command was successful +if [ $? -ne 0 ]; then + echo "Error: Failed to modify the changelog." + rm "$temp_file" + exit 1 +fi + +# Replace the original file with the modified version +mv "$temp_file" "$changelog_file" + +echo "Changelog updated successfully to version ${new_version}" + + From 176fc6671f973797954b717b82021af134dd3cd2 Mon Sep 17 00:00:00 2001 From: Thies Moeller Date: Mon, 22 Jul 2024 13:12:37 +0200 Subject: [PATCH 03/11] add github actions to build debian and ubuntu packages --- .github/workflows/build_config.json | 9 +- .github/workflows/deb.yml | 132 ++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deb.yml diff --git a/.github/workflows/build_config.json b/.github/workflows/build_config.json index f18bd16d..c529313c 100644 --- a/.github/workflows/build_config.json +++ b/.github/workflows/build_config.json @@ -1,15 +1,18 @@ { "linux-x86_64": { "targets": ["ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04"], - "pylon_sdks": ["7.4.0.14900", "7.5.0.15658"] + "pylon_sdks": ["7.4.0.14900", "7.5.0.15658"], + "pylon_sdk_packaging": "7.5.0.15658" }, "linux-aarch64": { "targets": ["ubuntu18.04", "ubuntu20.04", "ubuntu22.04"], - "pylon_sdks": ["6.2.0.21487", "7.4.0.14900", "7.5.0.15658"] + "pylon_sdks": ["6.2.0.21487", "7.4.0.14900", "7.5.0.15658"], + "pylon_sdk_packaging": "7.5.0.15658" }, "windows": { "targets": ["windows-2019", "windows-2022"], - "pylon_sdks": ["7.4.0.14900", "7.5.0.15658"] + "pylon_sdks": ["7.4.0.14900", "7.5.0.15658"], + "pylon_sdk_packaging": "7.5.0.15658" }, "macos": { "targets": ["macos-12", "macos-13", "macos-14"], diff --git a/.github/workflows/deb.yml b/.github/workflows/deb.yml new file mode 100644 index 00000000..a4f957c4 --- /dev/null +++ b/.github/workflows/deb.yml @@ -0,0 +1,132 @@ +name: Build Debian Packages +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - uses: jfrog/setup-jfrog-cli@v3 + env: + JF_URL: ${{ secrets.SDK_URL }} + JF_ACCESS_TOKEN: ${{ secrets.SDK_TOKEN }} + + - name: Checkout repository + uses: actions/checkout@v2 + + # login + - run: | + jf c add --url=$JF_URL --access-token=$JF_ACCESS_TOKEN --interactive=false + + # download· + - name: Download files from Artifactory + id: get_matrix + run: | + set +x + set -e + build_config=$(cat .github/workflows/build_config.json) + for os in $(echo $build_config | jq -r 'keys[]'); do + for pylon_sdk in $(echo $build_config | jq -r --arg os "$os" '.[$os].pylon_sdk_packaging'); do + if [[ $os == "linux-x86_64" ]]; then + jf rt dl --flat --props "pylon_architecture=x86_64;pylon_os=linux;pylon_version=$pylon_sdk;pylon_packaging=deb" "pylon-sdks-generic/*" ./linux_x86_64_sdk/ + elif [[ $os == "linux-aarch64" ]]; then + jf rt dl --flat --props "pylon_architecture=aarch64;pylon_os=linux;pylon_version=$pylon_sdk;pylon_packaging=deb" "pylon-sdks-generic/*" ./linux_aarch64_sdk/ + fi + done + done + + - name: Upload Pylon SDK for Linux aarch64 + uses: actions/upload-artifact@v4 + with: + name: Linux_aarch64_packaging_Pylon + path: linux_aarch64_sdk + + - name: Upload Pylon SDK for Linux x86_64 + uses: actions/upload-artifact@v4 + with: + name: Linux_x86_64_packaging_Pylon + path: linux_x86_64_sdk + + build_deb: + runs-on: ubuntu-latest + needs: setup + strategy: + fail-fast: false + matrix: + os: + - ubuntu:24.04 + - ubuntu:22.04 + - ubuntu:20.04 + - debian:bookworm + - debian:bullseye + arch: ["arm64", "amd64"] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download x86_64 + if: matrix.arch == 'amd64' + uses: actions/download-artifact@v4 + with: + name: Linux_x86_64_packaging_Pylon + path: pylon-installer + + - name: Download aarch64 + if: matrix.arch == 'arm64' + uses: actions/download-artifact@v4 + with: + name: Linux_aarch64_packaging_Pylon + path: pylon-installer + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: linux/amd64, linux/arm64 + + - name: Set sanitized OS name + id: sanitize_os + run: | + SANITIZED_OS=$(echo ${{ matrix.os }} | sed 's/:/./g') + echo "SANITIZED_OS=$SANITIZED_OS" >> $GITHUB_ENV + + - name: Build Debian Package + uses: jtdor/build-deb-action@v1 + env: + DEB_BUILD_OPTIONS: noautodbgsym + with: + setup-hook: | + ln -sfn packaging/debian + apt-get update + cd /pylon-installer && tar -xvf *.tar.gz && apt-get install -y ./*.deb + docker-image: ${{ matrix.arch == 'arm64' && format('arm64v8/{0}', matrix.os) || format('{0}', matrix.os) }} + extra-docker-args: -v ${{ github.workspace }}/pylon-installer:/pylon-installer -e PYLON_ROOT=/opt/pylon + buildpackage-opts: --build=binary --no-sign + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: debian-packages-${{ env.SANITIZED_OS }}-${{ matrix.arch }} + path: debian/artifacts/ + + + + cleanup: + if: always() + needs: [ + setup, + build_deb + ] + runs-on: ubuntu-latest + steps: + - uses: geekyeggo/delete-artifact@v5 + continue-on-error: true + with: + name: | + Linux_x86_64_packaging_Pylon + Linux_aarch64_packaging_Pylon + From b9ae440c6f19991212002c190ad5b8124af94518 Mon Sep 17 00:00:00 2001 From: Thies Moeller Date: Tue, 23 Jul 2024 17:19:15 +0200 Subject: [PATCH 04/11] github update action versions --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/deb.yml | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cef3b7d5..efbd329a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,13 +13,13 @@ jobs: setup: runs-on: ubuntu-latest steps: - - uses: jfrog/setup-jfrog-cli@v3 + - uses: jfrog/setup-jfrog-cli@v4 env: JF_URL: ${{ secrets.SDK_URL }} JF_ACCESS_TOKEN: ${{ secrets.SDK_TOKEN }} - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 # login - run: | @@ -107,7 +107,7 @@ jobs: runs-on: ${{ matrix.os }} name: Build gstreamer for ${{ matrix.pylon_sdk }} on ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: name: Windows_Pylon @@ -181,7 +181,7 @@ jobs: runs-on: ubuntu-latest name: Build pylon ${{ matrix.pylon_sdk }} on ${{ matrix.os }}-aarch64 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: name: Linux_aarch64_Pylon @@ -265,7 +265,7 @@ jobs: runs-on: ${{ matrix.os }} name: Build pylon ${{ matrix.pylon_sdk }} on ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: diff --git a/.github/workflows/deb.yml b/.github/workflows/deb.yml index a4f957c4..dc4f0cd7 100644 --- a/.github/workflows/deb.yml +++ b/.github/workflows/deb.yml @@ -11,13 +11,13 @@ jobs: setup: runs-on: ubuntu-latest steps: - - uses: jfrog/setup-jfrog-cli@v3 + - uses: jfrog/setup-jfrog-cli@v4 env: JF_URL: ${{ secrets.SDK_URL }} JF_ACCESS_TOKEN: ${{ secrets.SDK_TOKEN }} - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 # login - run: | @@ -84,7 +84,7 @@ jobs: path: pylon-installer - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 with: platforms: linux/amd64, linux/arm64 @@ -108,7 +108,7 @@ jobs: buildpackage-opts: --build=binary --no-sign - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: debian-packages-${{ env.SANITIZED_OS }}-${{ matrix.arch }} path: debian/artifacts/ From 3cf46a587442f9f62a10f8d5680059d2a4d90d6e Mon Sep 17 00:00:00 2001 From: Thies Moeller Date: Mon, 29 Jul 2024 17:49:28 +0200 Subject: [PATCH 05/11] patch debian package name depending on platform --- .github/workflows/deb.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deb.yml b/.github/workflows/deb.yml index dc4f0cd7..80c49071 100644 --- a/.github/workflows/deb.yml +++ b/.github/workflows/deb.yml @@ -102,7 +102,9 @@ jobs: setup-hook: | ln -sfn packaging/debian apt-get update - cd /pylon-installer && tar -xvf *.tar.gz && apt-get install -y ./*.deb + (cd /pylon-installer && tar -xvf *.tar.gz && apt-get install -y ./*.deb) + # patch version to contain platform info + tools/patch_deb_changelog.sh docker-image: ${{ matrix.arch == 'arm64' && format('arm64v8/{0}', matrix.os) || format('{0}', matrix.os) }} extra-docker-args: -v ${{ github.workspace }}/pylon-installer:/pylon-installer -e PYLON_ROOT=/opt/pylon buildpackage-opts: --build=binary --no-sign From 14b4175a61ea1110ec923d7482af07f535063126 Mon Sep 17 00:00:00 2001 From: Thies Moeller Date: Mon, 29 Jul 2024 17:42:32 +0200 Subject: [PATCH 06/11] update pybind11 --- .gitignore | 2 +- subprojects/pybind11.wrap | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index c2dd13e0..7f0ef3e3 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,4 @@ __pycache__ # subprojects subprojects/packagecache -subprojects/pybind11-2.10.3 +subprojects/pybind11-* diff --git a/subprojects/pybind11.wrap b/subprojects/pybind11.wrap index 82ac1760..3b348ff7 100644 --- a/subprojects/pybind11.wrap +++ b/subprojects/pybind11.wrap @@ -1,12 +1,13 @@ [wrap-file] -directory = pybind11-2.10.0 -source_url = https://github.com/pybind/pybind11/archive/refs/tags/v2.10.0.tar.gz -source_filename = pybind11-2.10.0.tar.gz -source_hash = eacf582fa8f696227988d08cfc46121770823839fe9e301a20fbce67e7cd70ec -patch_filename = pybind11_2.10.0-1_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/pybind11_2.10.0-1/get_patch -patch_hash = ebb87b55ef4a32cc8627b90f091df2c9f39899f7bc5447a4657b662340497c27 -wrapdb_version = 2.10.0-1 +directory = pybind11-2.13.1 +source_url = https://github.com/pybind/pybind11/archive/refs/tags/v2.13.1.tar.gz +source_filename = pybind11-2.13.1.tar.gz +source_hash = 51631e88960a8856f9c497027f55c9f2f9115cafb08c0005439838a05ba17bfc +patch_filename = pybind11_2.13.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/pybind11_2.13.1-1/get_patch +patch_hash = aaef1c31f7d0fcca1220e59d6d5080602a83f32a3118620ca1810e063bb35264 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/pybind11_2.13.1-1/pybind11-2.13.1.tar.gz +wrapdb_version = 2.13.1-1 [provide] pybind11 = pybind11_dep From 373eb94677b88e7f98d626f130ff7cd30e30c222 Mon Sep 17 00:00:00 2001 From: Thies Moeller Date: Mon, 29 Jul 2024 13:29:20 +0200 Subject: [PATCH 07/11] add ubuntu 22.04 workaround also for aarch64 --- tests/check/meson.build | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/check/meson.build b/tests/check/meson.build index fc2f9328..c45849d7 100644 --- a/tests/check/meson.build +++ b/tests/check/meson.build @@ -27,9 +27,13 @@ else endif -## workaround for ubuntu 22.04 x86_64 +## workaround for gstreamer isssue on e.g. Ubuntu 22.04 x86_64 and aarch6 if gst_plugin_scanner_dir != '' and not fs.exists(gst_plugin_scanner_dir) - gst_plugin_scanner_dir = '/usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/' + if host_machine.cpu_family() == 'x86_64' + gst_plugin_scanner_dir = '/usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/' + elif host_machine.cpu_family() == 'aarch64' + gst_plugin_scanner_dir = '/usr/lib/aarch64-linux-gnu/gstreamer1.0/gstreamer-1.0/' + endif endif ## From 132c55f2cc8c1287a052b453e48c911283e18da6 Mon Sep 17 00:00:00 2001 From: Thies Moeller Date: Tue, 16 Jul 2024 14:45:23 +0200 Subject: [PATCH 08/11] fix pedantic warnings shown by dpkg-buildpackage warning level --- tests/check/generic/states.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/check/generic/states.c b/tests/check/generic/states.c index a08c19a6..d4d619f3 100644 --- a/tests/check/generic/states.c +++ b/tests/check/generic/states.c @@ -132,7 +132,7 @@ GST_START_TEST(test_state_changes_up_and_down_seq) { } } -GST_END_TEST; +GST_END_TEST GST_START_TEST(test_state_changes_up_seq) { GstElement *element; @@ -164,7 +164,7 @@ GST_START_TEST(test_state_changes_up_seq) { } } -GST_END_TEST; +GST_END_TEST GST_START_TEST(test_state_changes_down_seq) { GstElement *element; @@ -200,7 +200,7 @@ GST_START_TEST(test_state_changes_down_seq) { } } -GST_END_TEST; +GST_END_TEST static Suite *states_suite(void) { Suite *s = suite_create("states_good"); @@ -215,4 +215,4 @@ static Suite *states_suite(void) { return s; } -GST_CHECK_MAIN(states); +GST_CHECK_MAIN(states) From 363be15a10cc8fd7c885db8b1cc283be9e73fa46 Mon Sep 17 00:00:00 2001 From: Thies Moeller Date: Mon, 29 Jul 2024 15:44:59 +0200 Subject: [PATCH 09/11] skip nvmm setup in case of no device found --- ext/pylon/gstpylonsrc.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ext/pylon/gstpylonsrc.cpp b/ext/pylon/gstpylonsrc.cpp index 1d5a5ed8..dd7d2e35 100644 --- a/ext/pylon/gstpylonsrc.cpp +++ b/ext/pylon/gstpylonsrc.cpp @@ -782,10 +782,13 @@ static gboolean gst_pylon_src_start(GstBaseSrc *src) { self->device_serial_number, self->device_index, self->enable_correction, &error); #ifdef NVMM_ENABLED - gst_pylon_set_nvsurface_layout( - self->pylon, - static_cast(self->nvsurface_layout)); - gst_pylon_set_gpu_id(self->pylon, self->gpu_id); + /* setup nvbufsurface if a new device has been created */ + if(self->pylon){ + gst_pylon_set_nvsurface_layout( + self->pylon, + static_cast(self->nvsurface_layout)); + gst_pylon_set_gpu_id(self->pylon, self->gpu_id); + } #endif GST_OBJECT_UNLOCK(self); From 7b7c88ead8d333efc329f690d1bba44933aadd3e Mon Sep 17 00:00:00 2001 From: Thies Moeller Date: Mon, 15 Jul 2024 20:24:33 +0200 Subject: [PATCH 10/11] update project version --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 81f28949..2f757c8f 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('gst-plugin-pylon', 'c', 'cpp', - version : '0.7.0', + version : '0.7.2', meson_version : '>= 0.61', default_options : [ 'warning_level=1', 'buildtype=debugoptimized' ]) From 2eb2136d670b90c5148bdb371265fae76429da68 Mon Sep 17 00:00:00 2001 From: Thies Moeller Date: Mon, 15 Jul 2024 18:50:14 +0200 Subject: [PATCH 11/11] Update Readme and Changelog Reference of PYLON_ROOT var in README --- CHANGELOG.md | 12 +++++++++++ README.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 061dd519..8d01b963 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ # Changelog All notable changes to this project will be documented in this file. +## [0.7.2] - 2024-07-12 +### Changed +- add debian packaging + * CI builds for std x86/aarch64 ubuntu and debian targets + * Building deb packates for NVIDIA Jetson is documented in the README + +### Fixed +- workaround for failed tests for Ubuntu 22.04 + * fixes #111 +- fix nvmm error if no camera connected + * fixes #88 + ## [0.7.1] - 2024-06-06 ### Changed - check for cuda version >= 11 to enable nvmm code diff --git a/README.md b/README.md index 8a7e79ec..810994aa 100644 --- a/README.md +++ b/README.md @@ -351,6 +351,8 @@ Installing Basler pylon SDK will also install the Basler pylon viewer. You shoul The differences in the build steps for [Linux](#Linux), [Windows](#Windows) and [macos](#macOS) are described in the next sections. +Building debian packages locally is described in the sections [Debian/Ubuntu](#debian-packaging) and [Nvidia Jetson](#debian-nvidia-packaging) + ## Linux Make sure the dependencies are properly installed. In Debian-based systems you can run the following commands: @@ -410,6 +412,59 @@ Finally, test for proper installation: gst-inspect-1.0 pylonsrc ``` +## Linux package building + +### Debian Packaging + +Install the pylon and codemeter debian packages. They will install into `/opt/pylon` + +Install the platform dependencies: + +``` +sudo apt-get install cmake meson ninja-build debhelper dh-python \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-python3-plugin-loader \ + python3 python3-dev python3-pip python3-setuptools pybind11-dev +``` + +Prepare the build setup ( from main project folder ): + +``` +ln -sfn packaging/debian +tools/patch_deb_changelog.sh +``` + +Build the debian packages + +``` +PYLON_ROOT=/opt/pylon dpkg-buildpackage -us -uc -rfakeroot +``` + +### Debian NVIDIA Packaging + +Install the pylon and codemeter debian packages. They will install into `/opt/pylon` + +Install the platform dependencies: + +``` +sudo apt-get install cmake meson ninja-build debhelper dh-python \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-python3-plugin-loader \ + python3 python3-dev python3-pip python3-setuptools pybind11-dev \ + deepstream-6.3 # depending on platform deepstream-6.4 or deepstream-7.0 +``` + +Prepare the build setup ( from main project folder ): + +``` +ln -sfn packaging/debian +tools/patch_deb_changelog.sh +``` + +Build the debian packages using the nvidia profile + +``` +DEB_BUILD_PROFILES=nvidia PYLON_ROOT=/opt/pylon dpkg-buildpackage -us -uc -rfakeroot +``` + ### Integrating with GStreamer monorepo The monorepo is a top-level repository that integrates and builds all @@ -464,15 +519,15 @@ meson setup builddir --prefix /usr/ --werror --buildtype=debug -Dgobject-cast-ch ``` ### Cross compilation for linux targets -#### NVIDIA Jetson Jetpack -TBD #### YOCTO recipe A reference yocto recipe for honister is available in the [meta-basler-tools](https://github.com/basler/meta-basler-tools/tree/honister/recipes-multimedia/gstreamer) -on github. This recipe still needs a backport patch due to the version of meson tool in honister. +on github. Builds on yocto kirkstone and later work without the patch. +( This recipe still needs a backport patch due to the version of meson tool in honister. ) + ## Windows Install the dependencies: