mirror of
https://github.com/audacity/linuxdeploy.git
synced 2026-02-04 12:41:47 -06:00
Add destination parameter to deployExecutable
Code is mostly shared with deployLibrary's destination code. TODO: refactor: extract to separate function and use in both places
This commit is contained in:
parent
5147620250
commit
333c281c20
@ -43,7 +43,7 @@ namespace linuxdeploy {
|
||||
bool deployLibrary(const boost::filesystem::path& path, const boost::filesystem::path& destination = "");
|
||||
|
||||
// deploy executable
|
||||
bool deployExecutable(const boost::filesystem::path& path);
|
||||
bool deployExecutable(const boost::filesystem::path& path, const boost::filesystem::path& destination = "");
|
||||
|
||||
// deploy desktop file
|
||||
bool deployDesktopFile(const desktopfile::DesktopFile& desktopFile);
|
||||
|
||||
@ -270,7 +270,7 @@ namespace linuxdeploy {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool deployExecutable(const bf::path& path) {
|
||||
bool deployExecutable(const bf::path& path, const boost::filesystem::path& destination) {
|
||||
if (hasBeenVisitedAlready(path)) {
|
||||
ldLog() << LD_DEBUG << "File has been visited already:" << path << std::endl;
|
||||
return true;
|
||||
@ -280,9 +280,29 @@ namespace linuxdeploy {
|
||||
|
||||
// FIXME: make executables executable
|
||||
|
||||
deployFile(path, appDirPath / "usr/bin/");
|
||||
auto destinationPath = destination.empty() ? appDirPath / "usr/bin/" : destination;
|
||||
|
||||
setElfRPathOperations[appDirPath / "usr/bin" / path.filename()] = "$ORIGIN/../lib";
|
||||
deployFile(path, destination);
|
||||
|
||||
std::string rpath = "$ORIGIN/../lib";
|
||||
|
||||
if (!destination.empty()) {
|
||||
std::string rpathDestination = destination.string();
|
||||
|
||||
if (destination.string().back() == '/') {
|
||||
rpathDestination = destination.string();
|
||||
|
||||
while (rpathDestination.back() == '/')
|
||||
rpathDestination.erase(rpathDestination.end() - 1, rpathDestination.end());
|
||||
} else {
|
||||
rpathDestination = destination.parent_path().string();
|
||||
}
|
||||
|
||||
auto relPath = bf::relative(bf::absolute(appDirPath) / "usr/lib", bf::absolute(rpathDestination));
|
||||
rpath = "$ORIGIN/" + relPath.string();
|
||||
}
|
||||
|
||||
setElfRPathOperations[destination / path.filename()] = rpath;
|
||||
|
||||
if (!deployElfDependencies(path))
|
||||
return false;
|
||||
@ -427,8 +447,8 @@ namespace linuxdeploy {
|
||||
return d->deployLibrary(path, 0, destination);
|
||||
}
|
||||
|
||||
bool AppDir::deployExecutable(const bf::path& path) {
|
||||
return d->deployExecutable(path);
|
||||
bool AppDir::deployExecutable(const bf::path& path, const boost::filesystem::path& destination) {
|
||||
return d->deployExecutable(path, destination);
|
||||
}
|
||||
|
||||
bool AppDir::deployDesktopFile(const desktopfile::DesktopFile& desktopFile) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user