如何为OS X打包一个独立的xulrunner应用程序?

时间:2015-03-17 20:44:18

标签: macos firefox xulrunner

我试图为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?

1 个答案:

答案 0 :(得分:4)

你走在正确的轨道上,只有一个主要问题。

如果你是通过命令行运行应用程序,你会得到一些像这样的输出。

$ 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

现在,修改Info.plist以执行此脚本,而不是直接执行xulrunner,方法是设置CFBundleExecutable条目以匹配您的stub shell脚本。

    <key>CFBundleExecutable</key>
    <string>sampleapplication</string>

现在,当您运行应用程序时,它应该可以正常运行。如果您收到错误说&#34; The application cannot be opened because its executable is missing&#34;,您可能需要重命名应用程序包,或者按照该问题中的建议来避免缓存问题。

奖金信息

您可以删除Contents/Frameworks/XUL.framework目录,it is no longer usedplacing the XUL.framework contents in the MacOS folder is now the correct place to put them

您还应该将dependentlibs.list文件从Contents/MacOS复制到Contents/Resources目录,尽管如果没有它,XULRunner 33似乎正常。