Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App bundle arg, improved run-path search algorithm, handle frameworks #49

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SCG82
Copy link
Collaborator

@SCG82 SCG82 commented Jan 10, 2020

  • New flag: -a MyApp.app (or --app MyApp.app) automatically adds the main executable (in MyApp.app/Contents/MacOS/) to the list of files to fix up.
  • If the '-a' flag is used, set the default destination to MyApp.app/Contents/Frameworks and default install name prefix to @executable_path/../Frameworks as per Apple's app bundle structure guidelines. If the '-a' flag is not used, the default destination & install name prefix are set to ./libs @executable_path/../libs respectively (same as current defaults).
  • New flag: -f, --frameworks bundles (copies and fixes) dependencies that are frameworks.
  • If there are Qt framework libraries, copy any needed Qt plugins to MyApp.app/Contents/PlugIns/ and output a qt.conf file in MyApp.app/Contents/Resources. Running macdeployqt is no longer needed.
  • Use otool -l to gather dependent libraries (LC_LOAD_DYLIB) instead of otool -L because the latter output contains the ID and weakly linked dylibs.
  • Bundled libraries ID (prefix) is set to @rpath/ instead of the default install name prefix.
  • Dependencies with run-time paths (@loader_path/@rpath) are resolved automatically.
  • New flag: -q, --quiet for less verbose output

@@ -77,7 +87,7 @@ fixes dependencies where bundled libraries depend on each other. If this option
> If the output directory does not exist, create it.

A command may look like
`% dylibbundler -od -b -x ./HelloWorld.app/Contents/MacOS/helloworld -d ./HelloWorld.app/Contents/libs/`
`% dylibbundler -cd -b -f -a ./HelloWorld.app -x ./HelloWorld.app/Contents/PlugIns/printsupport`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the use of "PlugIns/printsupport" here, this might be needlessly specific and confusing. What was wrong with the previous example?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to show that the -x flag can be used to add additional executable files in an app bundle (besides the primary executable and its LC_LOAD_DYLIB dependencies. The -a flag provides an alternative way to fix-up app bundles. While most simple apps may only need the -a flag with the location of the app bundle, more complicated app bundles may require additional binary files (plugins) fixed up by adding them with -x flags. I've added back your (excellent) example. Thank you for creating this very useful tool.

@@ -107,72 +63,85 @@ Dependency::Dependency(std::string path)
}

// check if given path is a symlink
if (original_file != rtrim(path))
Copy link
Owner

@auriamg auriamg Jan 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General note, I wish this had been submitted as a series of smaller pull requests. This pull request is so large it basically rewrites the entire app into a different product, that is exceedinly hard to review for me. I'm asking this without any sarcasm, if I merge this PR there's basically very little of my old code left and this would become your app basically, so would you actually be willing to take ownership of it and maintain it? I wrote this as a small utility years ago and no longer have time/interest to maintain it so TBH if you're interested in doing huge changes it might actually be simpler to actually make you maintainer of this app

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'm willing to maintain if you'd like. I understand it's a relatively large PR, so how about creating a new branch for it while I work on breaking this pull request into smaller PRs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way it can be more thoroughly tested and gain additional feedback/review.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've invited you as a collaborator, as I'm more than happy to have help on this. But yes, I like your idea of creating a branch and breaking it into smaller PRs. After all, it is good practice to keep commits fairly focused around one thing - makes things much easier to follow than huge commits that contain unrelated changes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the invitation. I'm more than happy to help.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, another suggestion : the Qt stuff seems quite mixed/intertwined with other code. It might be preferable to move Qt stuff to its own file. Mixing Qt-specific code within the generic bundling risks putting too much unrelated stuff in the same file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely agree.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SCG82 We're using your fork on OBS for GitHub Actions CI right now and it works without issues, but when trying to bundle the app with self-compiled Qt Frameworks I run into errors. You have issues disabled on your fork, what would be the best way to reach out/report?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I enabled issues on my fork. Thanks.

@SCG82 SCG82 marked this pull request as draft April 17, 2020 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants