{"action":"created","issue":{"url":"https://api.github.com/repos/Homebrew/homebrew/issues/47245","labels_url":"https://api.github.com/repos/Homebrew/homebrew/issues/47245/labels{/name}","comments_url":"https://api.github.com/repos/Homebrew/homebrew/issues/47245/comments","events_url":"https://api.github.com/repos/Homebrew/homebrew/issues/47245/events","html_url":"https://github.com/Homebrew/homebrew/pull/47245","id":123428289,"number":47245,"title":"qt: add shared 'plugins' path for use by formulae","user":{"login":"UniqMartin","id":11892150,"avatar_url":"https://avatars.githubusercontent.com/u/11892150?v=3","gravatar_id":"","url":"https://api.github.com/users/UniqMartin","html_url":"https://github.com/UniqMartin","followers_url":"https://api.github.com/users/UniqMartin/followers","following_url":"https://api.github.com/users/UniqMartin/following{/other_user}","gists_url":"https://api.github.com/users/UniqMartin/gists{/gist_id}","starred_url":"https://api.github.com/users/UniqMartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UniqMartin/subscriptions","organizations_url":"https://api.github.com/users/UniqMartin/orgs","repos_url":"https://api.github.com/users/UniqMartin/repos","events_url":"https://api.github.com/users/UniqMartin/events{/privacy}","received_events_url":"https://api.github.com/users/UniqMartin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-22T07:10:04Z","updated_at":"2015-12-23T08:25:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Homebrew/homebrew/pulls/47245","html_url":"https://github.com/Homebrew/homebrew/pull/47245","diff_url":"https://github.com/Homebrew/homebrew/pull/47245.diff","patch_url":"https://github.com/Homebrew/homebrew/pull/47245.patch"},"body":"This path is located in `lib/qt4/plugins` in the Homebrew prefix, thus formulae wishing to make their plug-ins available to Qt Designer (and other Qt programs) can install them in `lib/qt4/plugins` inside their formula prefix. These will be later symlinked into the Homebrew prefix.\r\n\r\nThis new path is searched in addition to (and prior to) the path that contains the plug-ins distributed with Qt itself, but after any user-defined paths.\r\n\r\nThere are other ways to achieve a similar effect, but they are all more fragile than this (in my opinion) rather simple source code change, that just adds another default search path. Possible alternatives are:\r\n\r\n- Set `QT_PLUGIN_PATH` environment variable to include the new directory. Difficult to find a good and reliable place where to set this.\r\n- Rearrange stuff with crazy symlinking between Homebrew and `qt` prefix. Stops working as soon as the `qt` formula is unlinked or becomes keg-only.\r\n\r\nThis PR also fixes/adjusts formulae that provide Qt Designer plugins and replaces #47086.\r\n\r\ncc @DomT4 @mikemcquaid "},"comment":{"url":"https://api.github.com/repos/Homebrew/homebrew/issues/comments/166832580","html_url":"https://github.com/Homebrew/homebrew/pull/47245#issuecomment-166832580","issue_url":"https://api.github.com/repos/Homebrew/homebrew/issues/47245","id":166832580,"user":{"login":"UniqMartin","id":11892150,"avatar_url":"https://avatars.githubusercontent.com/u/11892150?v=3","gravatar_id":"","url":"https://api.github.com/users/UniqMartin","html_url":"https://github.com/UniqMartin","followers_url":"https://api.github.com/users/UniqMartin/followers","following_url":"https://api.github.com/users/UniqMartin/following{/other_user}","gists_url":"https://api.github.com/users/UniqMartin/gists{/gist_id}","starred_url":"https://api.github.com/users/UniqMartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UniqMartin/subscriptions","organizations_url":"https://api.github.com/users/UniqMartin/orgs","repos_url":"https://api.github.com/users/UniqMartin/repos","events_url":"https://api.github.com/users/UniqMartin/events{/privacy}","received_events_url":"https://api.github.com/users/UniqMartin/received_events","type":"User","site_admin":false},"created_at":"2015-12-23T08:25:06Z","updated_at":"2015-12-23T08:25:06Z","body":"A less invasive approach, that also works, is to modify the `Info.plist` of the `Designer.app` to set the `QT_PLUGIN_PATH` environment variable for this application only.\r\n\r\nPossible disadvantages:\r\n\r\n- `Designer.app` will henceforth ignore changes to this environment variable, even if started from the terminal.\r\n- Only `Designer.app` knows of this path. All other Qt applications are unaffected. (Could also be seen as an advantage.)\r\n\r\nHere's a diff for now, as I wanted to avoid going through the CI again before we have agreed on a course of action. Any better solutions than using `PlistBuddy`? Comments welcome. :smiley_cat: \r\n\r\n```diff\r\ndiff --git i/Library/Formula/qt.rb w/Library/Formula/qt.rb\r\nindex 9d97ff4c..d0dea14c 100644\r\n--- i/Library/Formula/qt.rb\r\n+++ w/Library/Formula/qt.rb\r\n@@ -127,6 +124,12 @@ class Qt < Formula\r\n       include.install_symlink path => path.parent.basename(\".framework\")\r\n     end\r\n \r\n+    # Make `HOMEBREW_PREFIX/lib/qt4/plugins` an additional plug-in search path\r\n+    # for Qt Designer to support formulae that provide Qt Designer plug-ins.\r\n+    system \"/usr/libexec/PlistBuddy\",\r\n+            \"-c\", \"Add :LSEnvironment:QT_PLUGIN_PATH string \\\"#{HOMEBREW_PREFIX}/lib/qt4/plugins\\\"\",\r\n+           \"#{bin}/Designer.app/Contents/Info.plist\"\r\n+\r\n     Pathname.glob(\"#{bin}/*.app\") { |app| mv app, prefix }\r\n   end\r\n \r\n```"}}