#!/bin/sh

# If using normal root, avoid changing anything.
if [ -z "${RPM_BUILD_ROOT#/}" ]; then
	echo "RPM_BUILD_ROOT is not set or set to / : skipping strip"
	exit 0
fi
if [ "$NO_BRP_STRIP_ERLANG_BEAM" = "true" ] ; then
	echo "NO_BRP_STRIP_ERLANG_BEAM is set: skipping strip"
	exit 0
fi

find "${RPM_BUILD_ROOT}/usr/lib/erlang/lib" -maxdepth 3 -mindepth 3 -path '*/ebin/*.beam' -print0 |
xargs -0 escript /usr/lib/rpm/strip_beam.escript
