Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://editorconfig.org

root=true

[*.{c,h,sh,sh.in}]
indent_style = space
indent_size = 2
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ debian/tmp
*.substvars
*.changes
*.buildinfo

# test-locally.sh
test-locally.sh
/test-locally-install-dir
5 changes: 4 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ dnl set the plugindir where plugins should be installed (for plugins/Makefile.am
if test "x${prefix}" = "x$HOME"; then
plugindir="$HOME/.gstreamer-1.0/plugins"
else
plugindir="\$(libdir)/gstreamer-1.0"
plugindir="${libdir}/gstreamer-1.0"
fi
AC_SUBST(plugindir)

Expand All @@ -87,4 +87,7 @@ GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst
AC_SUBST(GST_PLUGIN_LDFLAGS)

AC_CONFIG_FILES([Makefile plugins/Makefile])
AC_CONFIG_FILES(
[test-locally.sh], [chmod +x test-locally.sh]
)
AC_OUTPUT
68 changes: 68 additions & 0 deletions test-locally.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash
# @configure_input@
#
# test-locally.sh: open a shell for testing an installation of gst-perf
# in a local directory.
#
# GST_DEBUG is set unless already set. If GST_DEBUG_EXTRA is set, it will
# be added to the end of GST_DEBUG, whether existing or default.
#
# Copyright (c) 2020 D3 Engineering, LLC
# By Christopher White <cwhite@d3engineering.com>

set -Eeuo pipefail

# --- main ------------------------------------------------------------------

main() {

# Collect variables
prefix="@prefix@"
exec_prefix="@exec_prefix@"
libdir="@libdir@"
bindir="@bindir@"
plugindir="@plugindir@"

# Install locally
destdir="$(realpath -m test-locally-install-dir)"
sync
rm -rf "$destdir"
V mkdir -p "$destdir"
V make -j4 install DESTDIR="$destdir"

# Set up environment
export G_MESSAGES_DEBUG=all
if [[ ! "${GST_DEBUG:-}" ]]; then
export GST_DEBUG='*:3,perf:6'
fi
export GST_DEBUG="$GST_DEBUG${GST_DEBUG_EXTRA:+,}${GST_DEBUG_EXTRA:-}"

export GST_PLUGIN_PATH="${destdir}@plugindir@:${GST_PLUGIN_PATH:-}"
export LD_LIBRARY_PATH="${destdir}@plugindir@:${LD_LIBRARY_PATH:-}"

# Open shell
if ! gst-inspect-1.0 perf &> /dev/null ; then
die "Could not find gst-perf plugin. GST_PLUGIN_PATH=$GST_PLUGIN_PATH"
fi
V "${SHELL:-bash}"
}

# --- Helpers ---------------------------------------------------------------

# Print the command, then run it
V() {
echo '>>> ' "$@" 1>&2
"$@"
}

# Print an error message and exit
function die() {
printf '%s ' 'Error:' "$@" 1>&2
echo 1>&2
echo "Aborting." 1>&2
exit 1
} #die()

# --- Run -------------------------------------------------------------------

main "$@"