#parameter 1 should be the path to where the VRML perl files are located
# at compile time. Used in case an rpm goes onto a system that has a 
# different perl version than the one built.
#echo $1

perl -MExtUtils::Embed -e xsinit -- -o perlxsi.c

gcc -c perlxsi.c  \
	-I../CFuncs -D_REENTRANT `perl -MExtUtils::Embed -e ccopts` 

gcc -c freewrl.c \
	-DFWVER=\"$2\" -DPERLPATH=\"$1\" -I../CFuncs -D_REENTRANT `perl -MExtUtils::Embed -e ccopts`

gcc -c fwopts.c \
	-D_REENTRANT

gcc -o freewrl \
	-lGL -lGLU -lXext -lX11  -lfreetype -lpng -lz -ljpeg -ljs\
	-lpthread -lFreeWRLFunc\
	-L/usr/X11R6/lib \
	-L../JS/js/src/Linux_All_OPT.OBJ  \
	perlxsi.o freewrl.o fwopts.o \
	`perl -MExtUtils::Embed -e ccopts -e ldopts`

strip freewrl
