制作一个可执行的Ubuntu [英] Making a Ubuntu executable

查看:128
本文介绍了制作一个可执行的Ubuntu的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用gcc编译器在C程序。现在它没有GUI组件。我用makefile文件编译它,并在终端上运行它。我需要这样的可执行文件是独立进行部署。我想可执行文件有一个图标,点击后开始在终端程序。谁能告诉我如何做到这一点?

i have made a program in C using the gcc compiler. Right now it has no GUI components. I am compiling it with makefile and running it in the terminal. I need to deploy it so that the executable is standalone. I want the executable to have an icon and when clicked start the program in the terminal. Can anyone tell me how to do this?

推荐答案

(声明:以下与Kubuntu的测试,你可能需要为你的系统进行一些调整)

The basics

(disclaimer: the following was tested with kubuntu, you might need to make some adjustments for your system)

其实,有一个标准要做到这一点,不仅对Ubuntu的,但任何数量的* nix系统。请教: http://www.freedesktop.org/wiki/Howto_desktop_files

Actually there is a standard to do that, not just for Ubuntu but for any number of *nix systems. Consult: http://www.freedesktop.org/wiki/Howto_desktop_files:

让我们假设你有你的 foo.bin 文件要部署。按照文件系统层次标准的,一个好地方,把它(如果你不使用的软件包管理器)为的/ usr / local / bin目录/ 。您还需要一个图标,我会假设你的艺术天赋产生 foo.png ,和良好的地方可能是的/ usr /本地/股票/图标/

Lets assume you have your foo.bin file you want to deploy. According to the Filesystem Hierarchy Standard, a good place to put it (if you are not using a package manager) is /usr/local/bin/. You will also need an icon, I will assume your artistic talent produced foo.png, and a good place for it might be /usr/local/share/icons/.

现在你需要创建 foo.desktop 可能看起来是这样的:

Now you need to create foo.desktop that might look like this:

[Desktop Entry]
Comment=My awesome fooish application 
Exec=/usr/local/bin/foo.bin
Icon=/usr/local/share/icons/foo.png
Name=Foobar
NoDisplay=false
StartupNotify=false
Terminal=1
TerminalOptions=
Type=Application

和把它放在的/ usr /共享/应用/

您可能能够使用您的菜单编辑器来创建这样一个文件。寻找生成桌面文件在〜/。本地/共享/应用/

You might be able to use your menu editor to create such a file. Look for the generated desktop file under ~/.local/share/applications/.

这应该做的伎俩。

另一个约定是把一切都在 /选择/富/ 并创建符号链接的/ usr /本地/

Another convention is to put everything under /opt/foo/ and create symbolic links to /usr/local/.

借助 Portland项目提供了 XDG - * 命令行实用程序,可以很容易地安装应用程序的图标/菜单项/资源文件,在DE(GNOME,KDE等),独立的方式。

The Portland project provides the xdg-* command line utilities that make it easy to install the application's icon / menu entry / resource file, in a DE (GNOME, KDE, etc) independent way.

查看 KDE和放大器;在linuxuser.co.uk GNOME跨桌面的开发教程

有关部署,你应该考虑创建一个 *。的deb 包。 (与你的可执行文件, *桌面文件和图标)。有几个教程在这个问题上如的http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/How-to-make-deb-packages/.

For deployment you should consider creating a *.deb package. (with your executable, *.desktop file and icon). There are several tutorials on this subject e.g. http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/How-to-make-deb-packages/.

请注意,如果您使用的软件包管理器,文件位置的约定变成的/ usr / 而不是的/ usr /本地/

Note that if you are using a package manager, the convention for file location becomes /usr/ instead of /usr/local/.

下一步,如果你是倾向于把它是设置自己的资料库,或 PPA

The next step, if you are inclined to take it, is setup your own repository, or PPA.

这篇关于制作一个可执行的Ubuntu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆