add argument to specify app bundle path
This commit is contained in:
parent
f9c3a2ca24
commit
a8a9f7b944
|
@ -262,7 +262,6 @@ void doneWithDeps_go()
|
|||
// copy files if requested by user
|
||||
if (Settings::bundleLibs()) {
|
||||
createDestDir();
|
||||
|
||||
for (size_t i=0; i<deps_size; ++i) {
|
||||
deps[i].copyYourself();
|
||||
changeLibPathsOnFile(deps[i].getInstallPath());
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "Settings.h"
|
||||
#include "Utils.h"
|
||||
|
||||
namespace Settings {
|
||||
|
||||
|
@ -10,7 +11,7 @@ bool verbose_output = false;
|
|||
bool bundleLibs_bool = false;
|
||||
bool bundle_frameworks = false;
|
||||
|
||||
std::string dest_folder_str = "./Frameworks/";
|
||||
std::string dest_folder_str = "Frameworks";
|
||||
std::string inside_path_str = "@executable_path/../Frameworks/";
|
||||
|
||||
bool canOverwriteFiles() { return overwrite_files; }
|
||||
|
@ -27,13 +28,37 @@ void bundleLibs(bool on) { bundleLibs_bool = on; }
|
|||
bool bundleFrameworks() { return bundle_frameworks; }
|
||||
void bundleFrameworks(bool status) { bundle_frameworks = status; }
|
||||
|
||||
std::string destFolder() { return dest_folder_str; }
|
||||
std::string app_bundle;
|
||||
std::string dest_folder;
|
||||
std::string appBundle() { return app_bundle; }
|
||||
void appBundle(std::string path) {
|
||||
app_bundle = path;
|
||||
// fix path if needed so it ends with '/'
|
||||
if (app_bundle[app_bundle.size()-1] != '/')
|
||||
app_bundle += "/";
|
||||
|
||||
std::string cmd = "/usr/libexec/PlistBuddy -c 'Print :CFBundleExecutable' " + app_bundle + "Contents/Info.plist";
|
||||
std::string bundle_executable = systemOutput(cmd);
|
||||
|
||||
addFileToFix(app_bundle + "Contents/MacOS/" + bundle_executable);
|
||||
|
||||
// fix path if needed so it ends with '/'
|
||||
if (dest_folder_str[dest_folder_str.size()-1] != '/')
|
||||
dest_folder_str += "/";
|
||||
dest_folder = app_bundle + "Contents/" + dest_folder_str;
|
||||
}
|
||||
|
||||
std::string destFolder() { return dest_folder; }
|
||||
void destFolder(std::string path)
|
||||
{
|
||||
dest_folder_str = path;
|
||||
// fix path if needed so it ends with '/'
|
||||
if (dest_folder_str[dest_folder_str.size()-1] != '/')
|
||||
dest_folder_str += "/";
|
||||
dest_folder = dest_folder_str;
|
||||
if (!app_bundle.empty()) {
|
||||
dest_folder = app_bundle + "Contents/" + dest_folder_str;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> files;
|
||||
|
|
|
@ -25,6 +25,9 @@ void bundleLibs(bool on);
|
|||
bool bundleFrameworks();
|
||||
void bundleFrameworks(bool status);
|
||||
|
||||
std::string appBundle();
|
||||
void appBundle(std::string path);
|
||||
|
||||
std::string destFolder();
|
||||
void destFolder(std::string path);
|
||||
|
||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -24,11 +24,12 @@ void showHelp()
|
|||
{
|
||||
std::cout << "Usage: dylibbundler [options] -x file" << std::endl;
|
||||
std::cout << "Options:" << std::endl;
|
||||
std::cout << " -x, --fix-file Object file to bundle dependencies (can enter more than one)" << std::endl;
|
||||
std::cout << " -a, --app Application bundle to make self-contained" << std::endl;
|
||||
std::cout << " -x, --fix-file Object file(s) to bundle dependencies (optional)" << std::endl;
|
||||
std::cout << " -b, --bundle-deps Copy dependencies to app bundle and fix internal names and rpaths" << std::endl;
|
||||
std::cout << " -f, --bundle-frameworks Copy dependencies that are frameworks (experimental)" << std::endl;
|
||||
std::cout << " -d, --dest-dir Directory (relative) to copy bundled libraries (default: ../Frameworks/)" << std::endl;
|
||||
std::cout << " -p, --install-path Inner path (@rpath) of bundled libraries (default: @executable_path/../Frameworks/)" << std::endl;
|
||||
std::cout << " -d, --dest-dir Directory to copy dependencies, relative to <app>/Contents (default: ./Frameworks)" << std::endl;
|
||||
std::cout << " -p, --install-path Inner path (@rpath) of bundled dependencies (default: @executable_path/../Frameworks/)" << std::endl;
|
||||
std::cout << " -s, --search-path Directory to add to list of locations searched" << std::endl;
|
||||
std::cout << " -of, --overwrite-files Allow overwriting files in output directory" << std::endl;
|
||||
std::cout << " -od, --overwrite-dir Overwrite output directory if it exists (implies --create-dir)" << std::endl;
|
||||
|
@ -44,7 +45,12 @@ int main (int argc, char * const argv[])
|
|||
{
|
||||
// parse arguments
|
||||
for (int i=0; i<argc; i++) {
|
||||
if (strcmp(argv[i],"-x") == 0 || strcmp(argv[i],"--fix-file") == 0) {
|
||||
if (strcmp(argv[i],"-a") == 0 || strcmp(argv[i],"--app") == 0) {
|
||||
i++;
|
||||
Settings::appBundle(argv[i]);
|
||||
continue;
|
||||
}
|
||||
else if (strcmp(argv[i],"-x") == 0 || strcmp(argv[i],"--fix-file") == 0) {
|
||||
i++;
|
||||
Settings::addFileToFix(argv[i]);
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue