Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
juergenpabel committed Sep 11, 2024
1 parent 5feab67 commit 0b7f444
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
obs-plugin-backgroundremoval*

43 changes: 43 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ARG PACKAGE_NAME=obs-backgroundremoval
ARG PACKAGE_VERSION=1.1.13

ENV CPU_ARCH=x86_64
ENV DEBIAN_FRONTEND=noninteractive


FROM debian:bookworm

RUN set -eux \
&& apt-get --yes update \
&& apt-get --yes install --no-install-recommends \
build-essential \
ca-certificates \
cmake \
curl \
libcurl4-openssl-dev \
git \
libobs-dev \
libonnx-dev \
libopencv-dev \
libsimde-dev \
wget \
&& rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/locaal-ai/obs-backgroundremoval.git \
&& cd obs-backgroundremoval \
&& git checkout ${PACKAGE_VERSION} \
&& mkdir build \
&& cd build \
&& cmake .. \
&& cmake --build . \
&& cmake --install . \
&& mkdir --parents /build

VOLUME [ "/build" ]

CMD set -eux \
&& mkdir --parents /build/usr/lib/${CPU_ARCH}-linux-gnu/obs-plugins/ \
&& cp --force /usr/local/lib/obs-plugins/obs-backgroundremoval.so /build/usr/lib/${CPU_ARCH}-linux-gnu/obs-plugins/ \
&& cp --force /usr/local/lib/obs-plugins/obs-backgroundremoval/libonnxruntime.so* /build/usr/lib/${CPU_ARCH}-linux-gnu/ \
&& mkdir --parents /build/usr/share/obs/obs-plugins/obs-backgroundremoval/ \
&& cp --force --recursive /usr/local/share/obs/obs-plugins/obs-backgroundremoval/* /build/usr/share/obs/obs-plugins/obs-backgroundremoval/
36 changes: 36 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh

DEB_NAME=obs-plugin-backgroundremoval
DEB_VERSION=${1:-1.1.13}
DEB_ARCH=`dpkg --print-architecture`

dpkg -s podman 2>/dev/null >/dev/null
if [ $? -ne 0 ]; then
echo "ERROR: 'podman' not installed, please install like so and re-run this script:"
echo " sudo apt install -y podman"
exit 1
fi

if [ -d ./build ]; then
rm -rf "./build"
fi
mkdir ./build

podman build --build-arg PACKAGE_VERSION="${DEB_VERSION}" --tag "${DEB_NAME}:${DEB_VERSION}" .
podman run --env CPU_ARCH=`uname -m` --interactive --tty --rm --volume "${PWD}/build:/build" "${DEB_NAME}:${DEB_VERSION}"

if [ -d "./${DEB_NAME}_${DEB_VERSION}" ]; then
rm -rf "./${DEB_NAME}_${DEB_VERSION}/"
fi
mkdir --parents "./${DEB_NAME}_${DEB_VERSION}/DEBIAN"
cat << EOF > "./${DEB_NAME}_${DEB_VERSION}/DEBIAN/control"
Package: ${DEB_NAME}
Version: ${DEB_VERSION}
Architecture: ${DEB_ARCH}
Depends: obs-studio
Maintainer: Juergen Pabel <[email protected]>
Description: OBS Studio plugin backgroundremoval
EOF

(cd ./build ; tar cf - .) | (cd "./${DEB_NAME}_${DEB_VERSION}" ; tar xf -)
dpkg-deb --root-owner-group --build "${DEB_NAME}_${DEB_VERSION}" && dpkg-name -o -s . "./${DEB_NAME}_${DEB_VERSION}.deb"

0 comments on commit 0b7f444

Please sign in to comment.