我正在尝试为 OS X 10.9+ 创建一个 xulrunner 应用程序。我需要它是独立的,即不需要任何额外的附加软件(包括 Firefox)与应用程序一起安装在盒子上。
我无法通过谷歌搜索到如何做到这一点的最新指南。看来我已经解决了这里描述的每个问题:https://bugzilla.mozilla.org/show_bug.cgi?id=923979
最后一个是:
$ open MyApp.app LSOpenURLsWithRole() failed with error -10810 for the file /Path/To/MyApp.app.
这是我到目前为止所拥有的:
https://drive.google.com/file/d/0BxRquYs2Nx92ZTZaVjk0QThMN2c/view?usp=sharing
如何为现代 (v36+) xulrunner 应用程序创建 OS X .app?
最佳答案
您的方向是正确的,您面临的只有一个主要问题。
如果您通过命令行运行应用程序,您将得到如下输出。
$ SampleApplication.app/Contents/MacOS/xulrunner
Mozilla XULRunner 33.0
Usage: xulrunner [OPTIONS]
xulrunner APP-FILE [APP-OPTIONS...]
OPTIONS
--app specify APP-FILE (optional)
-h, --help show this message
-v, --version show version
--gre-version print the GRE version string on stdout
APP-FILE
Application initialization file.
APP-OPTIONS
Application specific options
正如我们所看到的,可执行文件并没有像教程所说的那样自动运行 Contents/Resources/application.ini
。这是一个已知问题,XULRunner 用户中流行的解决方法是创建一个 stub shell 脚本,将所需的参数传递给 xulrunner
二进制文件。
这是我为此编写的一个脚本。
#!/bin/sh
runpath="`dirname "$0"`"
contentsdir="`cd "$runpath"/.. > /dev/null && pwd`"
exec "$runpath/xulrunner" --app "$contentsdir/Resources/application.ini"
将此文本保存到 MacOS
目录中的文件中,并为其授予可执行权限。为了举例,我将使用sampleapplication
。这是设置可执行权限的命令。
chmod +x sampleapplication
现在,通过设置 CFBundleExecutable
条目来匹配您的 stub shell,修改您的 Info.plist
以执行此脚本,而不是直接执行 xulrunner
脚本。
<key>CFBundleExecutable</key>
<string>sampleapplication</string>
现在,当您运行应用程序时,它应该可以工作。如果您收到错误消息“The application cannot be opened because its executable is missing ”,您可能需要重命名应用程序包,或按照该问题中的建议进行操作以避免缓存问题。
奖金信息
您可以删除 Contents/Frameworks/XUL.framework
目录,it is no longer used和 placing the XUL.framework contents in the MacOS folder is now the correct place to put them .
您还应该将 dependentlibs.list
文件从 Contents/MacOS
复制到 Contents/Resources
目录,尽管 XULRunner 33 似乎没有它也能过得很好。
关于macos - 如何为 OS X 打包独立的 xulrunner 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29109305/