在没有源代码的情况下在Linux中分发程序
我希望能够在 Linux 中分发程序,而无需分发源代码。 当前的解决方案是分发带有预编译二进制文件的 tar.gz。 将此二进制文件放置在“应用程序”菜单中的最简单方法是什么? 有没有一种在大多数 Linux 发行版中都很常见的方法来做到这一点,但 Ubuntu、Fedora 和 OpenSUSE 将是优先考虑的。
I want to be able to distribute a program in Linux without distributing the source with it. The current solution is distributing a tar.gz with a precompiled binary. What is the easiest way to have this binary be placed in the Applications Menu? Is there a way to do this that is common across most linux distributions, but Ubuntu, Fedora, and OpenSUSE would be the priority.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您将需要创建一个 .deb 和一个 .rpm。 前者涵盖 Ubuntu(Debian 变体),后者涵盖 Red Hat 变体。 您还可以为其他可以处理菜单等事务的用户提供独立的可执行文件。
您将必须处理 Gnome 和 KDE 菜单管理,并且不同的发行版的菜单布局也不同。 还有上网本变体的问题,例如 Moblin,它们的上网本界面可能有自己的“添加应用程序”机制。 我不知道单个 .deb 是否可以同时处理 Gnome 和 KDE 菜单系统(分别适用于 Ubuntu 和 Kubuntu),但我想这种能力可以减少 Ubuntu 的重复工作。
You will want to create a .deb and a .rpm. The former covers Ubuntu (Debian variants), and the latter Red Hat variants. You can also supply a standalone executable for other users who can deal with things like menus themselves.
You will have to deal with Gnome and KDE menu management, and also different distributions lay out their menus differently. There is also the issue of netbook variants such as Moblin, that have a netbook interface that probably has its own "add application" mechanism. I don't know if it is possible for a single .deb to handle both Gnome and KDE menus systems (for Ubuntu and Kubuntu respectively) but I imagine the capability is there to reduce duplication of effort for Ubuntu.
所有最近的发行版都应该安装 xdg-utils,它提供了
等脚本,这似乎就是您正在寻找的内容。
All recent distributions should have
xdg-utils
installed, which provides scripts such aswhich seem to be what you're looking for.
最近没有研究过它……但是在我使用 Linux 的那一天(实际上并不是很久以前),RPM 是分发预编译二进制文件的最简单方法(大多数发行版曾经并且仍然如此)有对 RPM 包的某种支持)。
这里有一个关于构建 RPM 包的旧指南:
Linux Online - RPM 操作方法
Haven't looked into it lately...but back in the day (which really wasn't all that long ago) when I was using Linux, RPM was the easiest way to distribute pre-combiled binaries (most distributations had, and still have, some kind of support for RPM packages).
Here's an old how-to on building an RPM package:
Linux Online - RPM How-To
您可以查看BitRock 安装程序。
You could look at BitRock intaller.
尝试 Autopackage 或其他 问题。
Try Autopackage or other solutions posted in another question.
执行 tar.gz,然后授予社区重新分发修改后的软件包的权利。 他们将为他们喜爱的发行版制作 RPM、DEB 和任何其他软件包……这可能比您制作的更适合他们的发行版。
发行版之间确实存在太多差异,无法制作一刀切的包,而且通常是微妙的差异。 例如,某些发行版有“应用程序”部分,其他发行版有“应用程序s”...这使得菜单项在某些发行版上消失。 库可以不同,默认设置可以不同,等等……
RPM 和 DEB 并不像人们认为的那么可移植。 对于一个软件包,即使是单个发行版的不同版本也可能会出现问题,没有什么比努力正确安装准备得不好的软件包更糟糕的了。
Do tar.gz and then give community rights to redistribute modified packages. They will make RPMs, DEBs and any other packages for their beloved distributions... which will probably fit their distros much better than you could ever make.
There is really too many differences between distributions to make one-size-fits-all package, often subtle ones. For example some distributions has "Application" section, other "Applications"... and this made menu items disappear on some distros. Libraries can be different, default settings can be different, and so on...
RPMs and DEBs aren't so portable as it is believed. With one package there might be problems even with different versions of a single distribution, and there is nothing worse than fighting to install badly prepared package correctly.
JeeBee 是正确的,您会想要使用 .deb 或 .rpm。
对于 Ubuntu/Debian(.deb),我想补充一点,您不会将其发送给人们,而是创建一个“存储库”并让用户将该 url 添加到他们的 /etc/apt/sources.list 中,然后您就可以轻松获得也是更新软件的方法。
这样你就可以同时解决分发和更新的问题。
下面是一个示例:
存储库的外观如下:
但不要重复Atmels的错误,只做i386,因为有现在还有很多其他常见的架构,例如 amd64。
/约翰
JeeBee is correct that you would want to go with .deb or .rpm.
For Ubuntu/Debian (the .deb) I would add that you do not send it to people but you create a "repository" and have the users add that url to their /etc/apt/sources.list, then you get a easy way to update the software as well.
That way you solve the distribution and updated problem at the same time.
And here is a example of how this could look like:
And how a repository could look like:
But don't repeat Atmels mistake and only do i386 because there is a lot of other common architectures out there right now, like the amd64.
/Johan
对于 RPM,IBM 提供的这个由三部分组成的教程是我所知道的最好的打包初学者指南:
http://www.ibm.com/developerworks/library/l-rpm1/
http://www.ibm.com/developerworks/library/l-rpm2/< /a>
http://www.ibm.com/developerworks/library/l-rpm3。 html
For RPM, this three-part tutorial by IBM is the best beginner's guide to packaging I know:
http://www.ibm.com/developerworks/library/l-rpm1/
http://www.ibm.com/developerworks/library/l-rpm2/
http://www.ibm.com/developerworks/library/l-rpm3.html