#!/bin/bash source ScriptFunctions Import Log Import OptionParser Import File Import GoboLinux ### Options ################################################################### scriptDescription="Converts .{la,pc,cmake} files created by libtool/pkgconfig/cmake to make them GoboLinux-compliant." scriptCredits="Copyright (C) Hisham H. Muhammad et al, 2003-2007. Released under the GNU GPL." helpOnNoArguments=yes scriptUsage="" scriptExample="-b *.la *.pc *.cmake" Add_Option_Boolean "b" "backup" "Keep a backup file of the original files before modifying them." Parse_Options "$@" ### Operation ################################################################# Parse_Conf Compile/Compile.conf || exit 1 Is_Writable "$PWD" || exit 1 n=$(Number_Of_Arguments) for (( i=1 ; i<=n ; i++)) do current="$(Arg ${i})" if [ "${current##*.}" != "la" -a "${current##*.}" != "pc" -a "${current##*.}" != "cmake" -a "${current##*.}" != "prl" ] then continue else Log_Verbose "Converting ${current}..." fi old="${current}~" while [ -e "$old" ] do old="$old~" done cp "${current}" "$old" cat "$old" | sed -r " s%$goboPrograms/[^ /]*/*[^ /]*/+lib(/?)/*%$goboLibraries\1%g; s%$goboPrograms/[^ /]*/*[^ /]*/+lib([ '\''])%$goboLibraries/\1%g; s%$goboPrograms/[^ /]*/*[^ /]*/+include(/?)/*%$goboHeaders\1%g; s%$goboPrograms/[^ /]*/*[^ /]*/+include([ '\''])%$goboHeaders/\1%g; s%$goboPrograms/[^ /]*/*[^ /]*/+share(/?)/*%$goboShared\1%g; s%$goboPrograms/[^ /]*/*[^ /]*/+share([ '\''])%$goboShared/\1%g; s%$goboPrograms/[^ /]*/*[^ /]*/+etc(/?)/*%$goboSettings\1%g; s%$goboPrograms/[^ /]*/+Settings/(.*)%$goboSettings/\1%g; s%$goboPrograms/[^ /]*/*[^ /]*%/usr%g; s%(-L|-I|-R)*$compileDir/[^('| )]*%%g; " > "${current}" Boolean "backup" || rm -- "$old" done # Why the hell does libtool and pkgconfig keep hardcoded paths?