#! /bin/sh
# gtk-engines - a collection of drawing engines for GTK+ 
# Copyright (C) 2007 Benjamin Berg <benjamin@sipsolutions.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# 
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
# 
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
# Project contact: <gnome-themes-list@gnome.org>
#


ALLOWED_SYMBOLS="\(g_module_check_init\|theme_create_rc_style\|theme_exit\|theme_init\)"

# exit with status 77 if nm does not exist
which nm >/dev/null || exit 77

ENGINE="`basename $0 | cut -d '_' -f 2`"
ENGINE_FILE="engines/lib$ENGINE.so"

nm -gD --defined-only $ENGINE_FILE | cut -d ' ' -f 2,3 | cut -d ' ' -f 2 | grep -v '^_' | grep -v "$ALLOWED_SYMBOLS" >symbols/$ENGINE

if [ -s symbols/$ENGINE ]; then
	exit 1;
else
	if [ -f symbols/$ENGINE ]; then
		# No point in keeping an empty file around
		rm symbols/$ENGINE
	else
		# Something wen't wrong, there is no file?!?
		# This should never happen ...
		exit 1
	fi
fi	

