From f301c7e20cef85f7133838f8390ad2df6e3f795c Mon Sep 17 00:00:00 2001 From: Abou Al Montacir Date: Wed, 30 Dec 2020 22:21:46 +0100 Subject: [PATCH] Fix samplecfg tool to be compatible with multiarch compiler paths. (Closes: Bug#975351) Gbp-Pq: Name fix-samplecfg-tool.patch --- fpcsrc/compiler/utils/samplecfg | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/fpcsrc/compiler/utils/samplecfg b/fpcsrc/compiler/utils/samplecfg index 592b8df2..882c3782 100644 --- a/fpcsrc/compiler/utils/samplecfg +++ b/fpcsrc/compiler/utils/samplecfg @@ -15,7 +15,7 @@ if [ $# = 0 ]; then echo 'confdir = Path to /etc' echo 'Example :' echo 'samplecfg /usr/local/lib/fpc/3.0.2' - exit 1 + fpcdir=${1:-`dirname $0`} fi if [ "$2" ]; then sysdir="$2" @@ -23,17 +23,19 @@ if [ "$2" ]; then else sysdir=/etc fi -FPCBIN=`dirname "$1"`/../../bin/fpc -FPBIN=`dirname "$1"`/../../bin/fp -FPPKGBIN=`dirname "$1"`/../../bin/fppkg -FPCMKCFGBIN=`dirname "$1"`/../../bin/fpcmkcfg -SHAREPATH=`dirname "$1"`/../../share/fpc/\$fpcversion +fpcdir=`realpath -s "${fpcdir}"` +echo 'Running with fpcdir="'${fpcdir}'"' +FPCBIN=/usr/bin/fpc +FPBIN=/usr/bin/fp +FPPKGBIN=/usr/bin/fppkg +FPCMKCFGBIN=/usr/bin/fpcmkcfg +SHAREPATH=/usr/share/fpc/\$fpcversion # Look for one in the PATH, if no new one was installed. if [ ! -f $FPCMKCFGBIN ]; then FPCMKCFGBIN=fpcmkcfg fi -sysfpdirbase=`dirname "$1"`/`"$FPCBIN" -iV` +sysfpdirbase=`dirname "${fpcdir}"`/`"$FPCBIN" -iV` sysfpdirbase2=$sysfpdirbase/ide sysfpdir=$sysfpdirbase2/text @@ -72,10 +74,10 @@ if [ -f "$FPBIN" ] ; then fi # set right path to FPC with $fpcversion -FPCPATH=`dirname "$1"`/\$fpcversion +FPCPATH=`dirname "${fpcdir}"` # set right prefix to FPC -FPCGLOBALPATH=`dirname "$1"` -FPCGLOBALPREFIX="$FPCGLOBALPATH"/../../ +FPCGLOBALPATH=`dirname "${FPCPATH}"` +FPCGLOBALPREFIX=/usr # Write (.)fpc.cfg echo Writing sample configuration file to $fpccfgfile -- 2.30.2