Skip to content

Commit

Permalink
Prepare for arm64 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
ehfd authored Mar 22, 2024
1 parent bfddd72 commit 639cf3e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ case ${DESKTOP:-XFCE} in
esac

# Source gstreamer environment
source /opt/gstreamer/gst-env
. /opt/gstreamer/gst-env

# Start turnserver
${SCRIPT_DIR}/start-turnserver.sh &
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.example
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ RUN echo 'export DISPLAY=:0' \
>> /etc/bash.bashrc && \
echo 'export GSTREAMER_PATH=/opt/gstreamer' \
>> /etc/bash.bashrc && \
echo 'source /opt/gstreamer/gst-env' \
echo '. /opt/gstreamer/gst-env' \
>> /etc/bash.bashrc

# Write turnserver script
Expand All @@ -195,7 +195,7 @@ RUN echo "#!/bin/bash\n\
export DISPLAY=:0\n\
export GST_DEBUG=*:2\n\
export GSTREAMER_PATH=/opt/gstreamer\n\
source /opt/gstreamer/gst-env\n\
. /opt/gstreamer/gst-env\n\
export LD_PRELOAD=/usr/local/lib/selkies-js-interposer/joystick_interposer.so\n\
export SDL_JOYSTICK_DEVICE=/dev/input/js0\n\
sudo mkdir -pm755 /dev/input\n\
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export DISPLAY=:0
export GST_DEBUG=*:2
# Initialize the GStreamer environment after setting GSTREAMER_PATH to the path of your GStreamer directory
export GSTREAMER_PATH=/opt/gstreamer
source "$GSTREAMER_PATH/gst-env"
. "$GSTREAMER_PATH/gst-env"

# Configure the Joystick Interposer
export LD_PRELOAD=/usr/local/lib/selkies-js-interposer/joystick_interposer.so
Expand Down Expand Up @@ -215,7 +215,7 @@ export DISPLAY=:0
export GST_DEBUG=*:2
# Initialize the GStreamer environment after setting GSTREAMER_PATH to the path of your GStreamer directory
export GSTREAMER_PATH=/opt/gstreamer
source "$GSTREAMER_PATH/gst-env"
. "$GSTREAMER_PATH/gst-env"

# Configure the Joystick Interposer
export LD_PRELOAD=/usr/local/lib/selkies-js-interposer/joystick_interposer.so
Expand Down Expand Up @@ -416,7 +416,7 @@ docker-compose run --service-ports test

```bash
export GSTREAMER_PATH=/opt/gstreamer
source /opt/gstreamer/gst-env
. /opt/gstreamer/gst-env

export TURN_HOST="Your TURN Host"
export TURN_PORT="Your TURN Port"
Expand Down
23 changes: 14 additions & 9 deletions addons/gstreamer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal
ca-certificates \
curl \
git \
pkg-config \
vim && \
rm -rf /var/lib/apt/lists/*

Expand Down Expand Up @@ -62,12 +63,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal
libx264-dev \
libx265-dev \
libvpx-dev \
libvdpau-dev \
libva-dev \
libmfx-dev \
i965-va-driver-shaders \
intel-media-va-driver-non-free \
va-driver-all && \
libvdpau-dev && \
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs | sh -s -- -y && \
. "$HOME/.cargo/env" && \
cargo install cargo-c && \
Expand All @@ -87,14 +83,23 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal

# GStreamer monorepo build with prefix for standalone install
WORKDIR /src
ARG GSTREAMER_VERSION=1.24.0
ARG GSTREAMER_VERSION=1.24.1
RUN git clone -b "${GSTREAMER_VERSION}" --single-branch --depth 1 "https://gitlab.freedesktop.org/gstreamer/gstreamer.git" && cd gstreamer && \
mkdir -p /opt/gstreamer && \
. "$HOME/.cargo/env" && \
meson setup --prefix /opt/gstreamer -Dbuildtype=release -Dpython=enabled -Drs=enabled -Dgpl=enabled -Dbad=enabled -Dugly=enabled -Dlibav=enabled -Dgst-plugins-bad:qsv=enabled -Dgst-plugins-bad:va=enabled -Dgst-plugins-bad:openh264=enabled -Dgst-plugins-ugly:x264=enabled -Ddoc=disabled -Dexamples=disabled -Dtests=disabled builddir && \
meson setup --prefix /opt/gstreamer -Dbuildtype=release -Dpython=enabled -Drs=enabled -Dgpl=enabled -Dbad=enabled -Dugly=enabled -Dlibav=enabled -Dgst-plugins-good:v4l2=enabled -Dgst-plugins-bad:qsv=enabled -Dgst-plugins-bad:va=enabled -Dgst-plugins-bad:v4l2codecs=enabled -Dgst-plugins-bad:openh264=enabled -Dgst-plugins-ugly:x264=enabled -Ddoc=disabled -Dexamples=disabled -Dtests=disabled builddir && \
ninja -C builddir -j "$(nproc)" && \
meson install -C builddir

# Generate environment file
RUN MULTI_ARCH="$(gcc -print-multiarch | sed -e 's/i.*86/i386/')" && \
echo "export GSTREAMER\_PATH\=\$\{GSTREAMER\_PATH\:\-/opt/gstreamer\}\n\
export PATH\=\$\{GSTREAMER\_PATH\}/bin\:\$\{PATH\}\n\
export LD\_LIBRARY\_PATH\=\$\{GSTREAMER\_PATH\}/lib/${MULTI_ARCH}\:\$\{LD\_LIBRARY\_PATH\}\n\
export GI\_TYPELIB\_PATH\=\$\{GSTREAMER\_PATH\}/lib/${MULTI_ARCH}/girepository\-1\.0\:/usr/lib/${MULTI_ARCH}/girepository\-1\.0\:\$\{GI\_TYPELIB\_PATH\}\n\
GST\_PY\_PATH\=\$\(find \$\{GSTREAMER\_PATH\}/lib \-type d \-name \"python3\.\*\"\)\n\
export PYTHONPATH\=\$\{GST\_PY\_PATH\}/site\-packages\:\$\{GSTREAMER\_PATH\}/lib/python3/dist\-packages\:\$\{PYTHONPATH\}\n\
" > /opt/gstreamer/gst-env

# Bundle build result to tarball
COPY config/gst-env /opt/gstreamer/
RUN cd /opt && tar -zcvf selkies-gstreamer-latest.tgz gstreamer
10 changes: 9 additions & 1 deletion src/selkies_gstreamer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
export GI_TYPELIB_PATH=${GSTREAMER_PATH}/lib/x86_64-linux-gnu/girepository-1.0:/usr/lib/x86_64-linux-gnu/girepository-1.0:${GI_TYPELIB_PATH}
GST_PY_PATH=$(find ${GSTREAMER_PATH}/lib -type d -name "python3.*")
export PYTHONPATH=${GST_PY_PATH}/site-packages:${GSTREAMER_PATH}/lib/python3/dist-packages:${PYTHONPATH}
"""
For ARM 64 bit:
export PATH=${GSTREAMER_PATH}/bin:${PATH}
export LD_LIBRARY_PATH=${GSTREAMER_PATH}/lib/aarch64-linux-gnu:${LD_LIBRARY_PATH}
export GI_TYPELIB_PATH=${GSTREAMER_PATH}/lib/aarch64-linux-gnu/girepository-1.0:/usr/lib/aarch64-linux-gnu/girepository-1.0:${GI_TYPELIB_PATH}
GST_PY_PATH=$(find ${GSTREAMER_PATH}/lib -type d -name "python3.*")
export PYTHONPATH=${GST_PY_PATH}/site-packages:${GSTREAMER_PATH}/lib/python3/dist-packages:${PYTHONPATH}
"""
print(msg)
sys.exit(1)

0 comments on commit 639cf3e

Please sign in to comment.