create changeInstallName function
This commit is contained in:
parent
c589a4fcaf
commit
02ce7f927e
|
@ -210,55 +210,24 @@ void Dependency::copyYourself()
|
|||
void Dependency::fixFileThatDependsOnMe(std::string file_to_fix)
|
||||
{
|
||||
// for main lib file
|
||||
std::string command = std::string("install_name_tool -change ") +
|
||||
getOriginalPath() + " " + getInnerPath() + " " + file_to_fix;
|
||||
|
||||
if( systemp( command ) != 0 )
|
||||
{
|
||||
std::cerr << "\n\nError : An error occured while trying to fix dependencies of " << file_to_fix << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
changeInstallName(file_to_fix, getOriginalPath(), getInnerPath());
|
||||
// for symlinks
|
||||
const int symamount = symlinks.size();
|
||||
for(int n=0; n<symamount; n++)
|
||||
{
|
||||
command = std::string("install_name_tool -change ") +
|
||||
symlinks[n] + " " + getInnerPath() + " " + file_to_fix;
|
||||
|
||||
if( systemp( command ) != 0 )
|
||||
{
|
||||
std::cerr << "\n\nError : An error occured while trying to fix dependencies of " << file_to_fix << std::endl;
|
||||
exit(1);
|
||||
changeInstallName(file_to_fix, symlinks[n], getInnerPath());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FIXME - hackish
|
||||
if(missing_prefixes)
|
||||
{
|
||||
// for main lib file
|
||||
command = std::string("install_name_tool -change ") +
|
||||
filename + " " + getInnerPath() + " " + file_to_fix;
|
||||
|
||||
if( systemp( command ) != 0 )
|
||||
{
|
||||
std::cerr << "\n\nError : An error occured while trying to fix dependencies of " << file_to_fix << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
changeInstallName(file_to_fix, filename, getInnerPath());
|
||||
// for symlinks
|
||||
const int symamount = symlinks.size();
|
||||
for(int n=0; n<symamount; n++)
|
||||
{
|
||||
command = std::string("install_name_tool -change ") +
|
||||
symlinks[n] + " " + getInnerPath() + " " + file_to_fix;
|
||||
|
||||
if( systemp( command ) != 0 )
|
||||
{
|
||||
std::cerr << "\n\nError : An error occured while trying to fix dependencies of " << file_to_fix << std::endl;
|
||||
exit(1);
|
||||
changeInstallName(file_to_fix, symlinks[n], getInnerPath());
|
||||
}
|
||||
}
|
||||
}//next
|
||||
}// end if(missing_prefixes)
|
||||
}
|
||||
|
|
|
@ -167,6 +167,16 @@ int systemp(std::string& cmd)
|
|||
return system(cmd.c_str());
|
||||
}
|
||||
|
||||
void changeInstallName(const std::string& binary_file, const std::string& old_name, const std::string& new_name)
|
||||
{
|
||||
std::string command = std::string("install_name_tool -change ") + old_name + " " + new_name + " " + binary_file;
|
||||
if( systemp( command ) != 0 )
|
||||
{
|
||||
std::cerr << "\n\nError: An error occured while trying to fix dependencies of " << binary_file << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
std::string getUserInputDirForFile(const std::string& filename)
|
||||
{
|
||||
const int searchPathAmount = Settings::searchPathAmount();
|
||||
|
|
|
@ -41,6 +41,7 @@ std::string system_get_output(std::string cmd);
|
|||
|
||||
// like 'system', runs a command on the system shell, but also prints the command to stdout.
|
||||
int systemp(std::string& cmd);
|
||||
void changeInstallName(const std::string& binary_file, const std::string& old_name, const std::string& new_name);
|
||||
std::string getUserInputDirForFile(const std::string& filename);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue