#!/bin/bash ################################################################################ # # prep_relocated_libtool_la.sh - removes ${_RELOCDIR} references from .la files # Part of cygport - Cygwin packaging application # Copyright (C) 2006 Charles Wilson # Distributed under the terms of the GNU General Public License v2 # # Invoke as: # if [ -n "${_ENABLE_RELOCATION}" ] # then # prep_relocated_libtool_la.sh ${_RELOCDIR} list-of-la-files # fi # ################################################################################ set -e declare -r ltversion="$(/usr/bin/libtool --version | /bin/grep ltmain.sh)" _RELOCDIR=$1 shift if [ -z "${_RELOCDIR}" ] then echo "internal error: bad call to prep_relocated_libtool_la.sh: _RELOCDIR empty" exit 1 fi case "${_RELOCDIR}" in *.la ) echo "internal error: bad call to prep_relocated_libtool_la.sh: _RELOCDIR=${_RELOCDIR}" exit 1 ;; /* ) ;; * ) echo "internal error: _RELOCDIR must be an absolute path: _RELOCDIR=${_RELOCDIR}" exit 1 ;; esac echo "Fixing relocated libtool modules:" for lib_la in "${@}" do if [ ! -f ${lib_la} ] then error "file ${lib_la} does not exist!" fi if ! grep -q "libtool library file" ${lib_la} then continue # go to next iteration of for loop fi echo " ${lib_la}" new_lib_la=${lib_la}.new cat ${lib_la} | sed -e "/^dependency_libs=/s,${_RELOCDIR},,g" \ -e "/^libdir=/s,${_RELOCDIR},,g" > ${new_lib_la} mv ${new_lib_la} ${lib_la} done