如何为OS X打包独立的xulrunner应用程序? [英] How to package a standalone xulrunner app for OS X?
问题描述
我正在尝试为OS X 10.9+创建一个xulrunner应用程序。我需要它是独立的,即不需要任何额外的附加软件(包括Firefox)与应用程序一起安装在盒子上。
我无法谷歌了最新的指导如何做到这一点。看来我已经遇到了这里描述的每个问题: https://bugzilla.mozilla.org /show_bug.cgi?id=923979
最后一个是:
$打开MyApp.app
LSOpenURLsWithRole()失败,错误-10810为/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
用途:xulrunner [选项]
xulrunner APP-FILE [应用程序选项...]
选项
- app指定APP-FILE(可选)
-h,--help显示此消息
-v,--version显示版本
--gre-version print t他在标准输出上使用GRE版本字符串
APP-FILE
应用程序初始化文件。
应用程序选项
应用程序特定选项
看到,可执行文件没有自动运行 Contents / Resources / application.ini
,就像教程所说的那样。这是一个已知的问题,而XULRunner用户普遍使用的解决方法是创建一个存根shell脚本来将所需的参数传递给 xulrunner
二进制文件。
这是一个我刚刚提到的脚本。
$ p $
#!/ 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
条目直接匹配您的存根shell脚本
< key> CFBundleExecutable< / key>
< string> sampleapplication< / string>
现在,当您运行应用程序时,它应该可以工作。如果您收到应用程序不能打开,因为它的可执行文件丢失了,您可能需要重命名应用程序包,或者按照该问题的建议来避免缓存问题。
奖金Info
您可以删除 Contents / Frameworks / XUL.framework
目录,不再使用和将XUL.framework的内容放在MacOS文件夹中,现在是放置它们的正确位置。
您还应该将依赖文件夹.list
文件从 Contents / MacOS
复制到目录/资源
目录,尽管XULRunner 33似乎没有问题就这样。
I'm trying to create a xulrunner app for OS X 10.9+. I need it to be standalone, i.e. to not require any extra additional software (including Firefox) to be installed on the box along with the app.
I was not able to google up an up-to-date guide on how to do that. It seems that I've hit every issue described here: https://bugzilla.mozilla.org/show_bug.cgi?id=923979
One of the last ones is:
$ open MyApp.app LSOpenURLsWithRole() failed with error -10810 for the file /Path/To/MyApp.app.
Here is an what I have so far:
https://drive.google.com/file/d/0BxRquYs2Nx92ZTZaVjk0QThMN2c/view?usp=sharing
How can I create an OS X .app for a modern (v36+) xulrunner application?
You are on the right track, there is just one major issue you are facing.
If you were to run you application by the command line, you would get some output like this.
$ 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
As we can see, the executable did not automatically run the Contents/Resources/application.ini
like the tutorials say it will. This is a known issue, and the popular workaround among XULRunner users is to create a stub shell script to pass the required argument to the xulrunner
binary.
Here is a script I've whipped up to do just that.
#!/bin/sh
runpath="`dirname "$0"`"
contentsdir="`cd "$runpath"/.. > /dev/null && pwd`"
exec "$runpath/xulrunner" --app "$contentsdir/Resources/application.ini"
Save this text to a file in your MacOS
directory and give it executable permissions. For sake of example, I will use sampleapplication
. Here is the command to set executable permissions.
chmod +x sampleapplication
Now, modify your Info.plist
to execute this script instead of executing xulrunner
directly by setting the CFBundleExecutable
entry to match your stub shell script.
<key>CFBundleExecutable</key>
<string>sampleapplication</string>
Now when you run your application, it should work. If you are getting an error saying "The application cannot be opened because its executable is missing", you may want to rename the application bundle, or follow the advice in that question to avoid the caching issue.
Bonus Info
You can remove the Contents/Frameworks/XUL.framework
directory, it is no longer used and placing the XUL.framework contents in the MacOS folder is now the correct place to put them.
You should also copy the dependentlibs.list
file from the Contents/MacOS
to the Contents/Resources
directory, although XULRunner 33 seems to be getting on fine without it.
这篇关于如何为OS X打包独立的xulrunner应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!