#!/bin/bash
################################################################################
#
# doexe - installs executable into exeinto directory
#
# Part of cygport - Cygwin packaging application
# Copyright (C) 2006, 2007, 2008 Yaakov Selkowitz
# Provided by the Cygwin Ports project <http://cygwinports.dotsrc.org/>
#
# cygport is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cygport 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cygport.  If not, see <http://www.gnu.org/licenses/>.
#
# $Id: doexe 4155 2008-08-07 04:58:41Z yselkowitz $
#
################################################################################
set -e

if ! defined _exeinto_dir || [ ! -d ${D}${_exeinto_dir} ]
then
	error "exeinto must be called before doexe"
fi

for i
do
	if [ ! -e ${i} ]
	then
		error "file ${i} does not exist"
	fi

	case ${i} in
		*.la)
			check_prog_req libtool
			inst_prog="libtool --mode=install /bin/install"
			;;
		*) 	inst_prog="/bin/install -m0755" ;;
	esac

	${inst_prog} ${i} ${D}${_exeinto_dir} || error "doexe ${i} failed"
done
