frameworks: don't copy Headers directory
This commit is contained in:
parent
fd0d9cd701
commit
3cf89cca1b
|
@ -211,11 +211,13 @@ void Dependency::copyYourself()
|
|||
std::string dest_path = getInstallPath();
|
||||
std::string inner_path = getInnerPath();
|
||||
std::string install_path = dest_path;
|
||||
bool framework = false;
|
||||
|
||||
if (Settings::verboseOutput())
|
||||
std::cout << "original path: " << original_path << std::endl;
|
||||
|
||||
if (original_path.find(".framework") != std::string::npos) {
|
||||
framework = true;
|
||||
std::string framework_root = getFrameworkRoot(original_path);
|
||||
std::string framework_path = getFrameworkPath(original_path);
|
||||
std::string framework_name = stripPrefix(framework_root);
|
||||
|
@ -238,6 +240,21 @@ void Dependency::copyYourself()
|
|||
|
||||
copyFile(original_path, dest_path);
|
||||
|
||||
if (framework) {
|
||||
std::string headers_path = dest_path + std::string("/Headers");
|
||||
std::string headers_realpath = headers_path;
|
||||
char buffer[PATH_MAX];
|
||||
|
||||
if (realpath(rtrim(headers_path).c_str(), buffer))
|
||||
headers_realpath = buffer;
|
||||
|
||||
if (Settings::verboseOutput())
|
||||
std::cout << "headers path: " << headers_realpath << std::endl;
|
||||
|
||||
deleteFile(headers_path, true);
|
||||
deleteFile(headers_realpath, true);
|
||||
}
|
||||
|
||||
// fix the lib's inner name
|
||||
std::string command = std::string("install_name_tool -id ") + inner_path + " " + install_path;
|
||||
if (systemp(command) != 0) {
|
||||
|
|
|
@ -46,7 +46,7 @@ void collectRpaths(const std::string& filename)
|
|||
}
|
||||
|
||||
std::string cmd = "otool -l " + filename;
|
||||
std::string output = system_get_output(cmd);
|
||||
std::string output = systemOutput(cmd);
|
||||
|
||||
std::vector<std::string> lc_lines;
|
||||
tokenize(output, "\n", &lc_lines);
|
||||
|
@ -177,7 +177,7 @@ void addDependency(std::string path, std::string filename)
|
|||
void collectDependencies(std::string filename, std::vector<std::string>& lines)
|
||||
{
|
||||
std::string cmd = "otool -L " + filename;
|
||||
std::string output = system_get_output(cmd);
|
||||
std::string output = systemOutput(cmd);
|
||||
|
||||
if (output.find("can't open file") != std::string::npos
|
||||
|| output.find("No such file") != std::string::npos
|
||||
|
|
|
@ -72,7 +72,23 @@ void copyFile(std::string from, std::string to)
|
|||
}
|
||||
}
|
||||
|
||||
std::string system_get_output(std::string cmd)
|
||||
void deleteFile(std::string path, bool overwrite)
|
||||
{
|
||||
std::string overwrite_permission = std::string(overwrite ? "-f " : " ");
|
||||
std::string command = std::string("rm -r ") + overwrite_permission + path;
|
||||
if (systemp(command) != 0) {
|
||||
std::cerr << "\n\nError: An error occured while trying to delete " << path << "\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void deleteFile(std::string path)
|
||||
{
|
||||
bool overwrite = Settings::canOverwriteFiles();
|
||||
deleteFile(path, overwrite);
|
||||
}
|
||||
|
||||
std::string systemOutput(const std::string& cmd)
|
||||
{
|
||||
FILE* command_output;
|
||||
char output[128];
|
||||
|
@ -108,7 +124,7 @@ std::string system_get_output(std::string cmd)
|
|||
return full_output;
|
||||
}
|
||||
|
||||
int systemp(std::string& cmd)
|
||||
int systemp(const std::string& cmd)
|
||||
{
|
||||
if (!Settings::quietOutput()) {
|
||||
std::cout << " " << cmd << "\n";
|
||||
|
|
|
@ -4,18 +4,20 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Library;
|
||||
// class Library;
|
||||
|
||||
void tokenize(const std::string& str, const char* delimiters, std::vector<std::string>*);
|
||||
bool fileExists(std::string filename);
|
||||
|
||||
void copyFile(std::string from, std::string to);
|
||||
void deleteFile(std::string path, bool overwrite);
|
||||
void deleteFile(std::string path);
|
||||
|
||||
// executes a command in the native shell and returns output in string
|
||||
std::string system_get_output(std::string cmd);
|
||||
std::string systemOutput(const std::string& cmd);
|
||||
|
||||
// like 'system', runs a command on the system shell, but also prints the command to stdout.
|
||||
int systemp(std::string& cmd);
|
||||
int systemp(const std::string& cmd);
|
||||
std::string getUserInputDirForFile(const std::string& filename);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue