简体   繁体   English

发布Ubuntu

[英]Releasing for Ubuntu

I've built a few pieces of C++ software I want to release for Ubuntu. 我已经构建了一些要为Ubuntu发布的C ++软件。 What ways are there and what can you recommend? 有什么方法,您能推荐什么? Is building .deb files and setting up an apt repo for them the best way? 生成.deb文件并为其设置一个apt repo是最好的方法吗? What about make install , is it considered an acceptable way to install software? 关于make install ,它被认为是可接受的软件安装方式吗?

By far simplest for me, and perhaps most transparent for the user, would be to just have a github repository in which one could run make install to get all programs installed at one go. 对我来说,最简单,甚至对用户最透明的就是,只有一个github存储库,在其中可以运行make install一次make install所有程序。

Do I always install the binaries into /usr/bin ? 我是否总是将二进制文件安装到/usr/bin

One of the programs contains Python 3 library code, should that be installed in /usr/lib/python3/dist-packages ? 其中一个程序包含Python 3库代码,应该安装在/usr/lib/python3/dist-packages吗? (I don't want to create a pip package, that would make the installation harder -- and waste more of my time.) The program also contains Python 3 examples/tutorials intended for the user to tweak and learn from, where do I install those? (我不想创建一个pip包,这会使安装更加困难-并且浪费更多的时间。)该程序还包含Python 3示例/教程,供用户进行调整和学习,在哪里可以做?安装那些? Do I create a ~/my-prog-tutorial-dir/ to put them in? 我是否创建~/my-prog-tutorial-dir/来放入它们? If so: how should I name that directory? 如果是这样:我应该如何命名该目录?

Edit: if I simply release the statically linked binaries in a tarball, what will break eventually? 编辑:如果我只是在压缩包中释放静态链接的二进制文件,最终会破坏什么? Libc? Libc? Are there any major application APIs that usually change between Ubuntu LTSs? 在Ubuntu LTS之间是否有通常会更改的主要应用程序API? I only use pthreads, X11 and OpenGL so I suspect statically linked binaries could be a fairly stable option? 我只使用pthreads,X11和OpenGL,所以我怀疑静态链接的二进制文件可能是一个相当稳定的选择?

In general, building a binary package will make your software much easier for your users to install and keep up to date. 通常,构建二进制软件包将使您的软件更易于用户安装和更新。 The same goes for python packages. python包也是如此。 There are generally tools to generate apt packages from pip packages, so you can just list your python code as a dependency of your binary package(s). 通常,有一些工具可以从pip包中生成apt包,因此您可以将python代码作为二进制包的依赖项列出。

You may see packaging and installers as a waste of your time, but only providing a source distribution wastes your users' time. 您可能会看到打包和安装程序在浪费您的时间,但是仅提供源分发会浪费用户的时间。 Users don't want to constantly have to check github for new versions, and they often don't want to have to install all of your build dependencies if they just want to use your software. 用户并不需要经常检查github是否有新版本,并且如果他们只想使用您的软件,他们通常不需要安装所有构建依赖项。 If your software is targeted towards developers this may be less of an issue, but it's still extra work that your users have to go through. 如果您的软件面向开发人员,那么这可能不是什么大问题,但用户仍然需要做额外的工作。

As for examples, the general convention is to put those in /usr/share/doc/myprogram/samples or a samples directory in your python package. 例如,一般约定是将它们放在python软件包的/ usr / share / doc / myprogram / samples或samples目录中。

The best way to release software for Ubuntu depends on the software itself and its target audience, as Miles Budnek already pointed out. 正如Miles Budnek指出的那样, Ubuntu发布软件的最佳方法取决于软件本身及其目标受众。

Your goal is to lower the barriers to software usage. 您的目标是降低软件使用的障碍。 If you are targeting developers of your software (ie, you develop source files that are supposed to be edited by others) or you are developing piece of code supposed to be included in other projects (eg, gnulib), probably it is best to just provide sources and documentation. 如果您以软件开发人员为目标(例如,开发应该由他人编辑的源文件),或者正在开发应包含在其他项目中的代码段(例如,gnulib),则最好仅提供资源和文档。

In any other case that I currently imagine (including when you are targeting developers), providing precompiled binaries is a better option. 在我目前想象的任何其他情况下(包括以开发人员为目标的情况),提供预编译的二进制文件是更好的选择。 In this case the optimal solution would be to have the software in Ubuntu. 在这种情况下,最佳解决方案是 Ubuntu中安装该软件。 In this case How to get my software into Ubuntu? 在这种情况下, 如何使我的软件进入Ubuntu? provides a lot of useful information, as suggested by Mark K . 正如Mark K所建议的那样,它提供了许多有用的信息。

Getting software into Debian or Ubuntu can be difficult and may require a large amount of time (you have to respect a lot of policies that you may not be aware of and you have to find a sponsor) and you will soon learn that a key point is to use a decent and popular build system for your software (eg, autotools, cmake, distutils, ...) as mentioned in the Debian Upstream Guide . 将软件移植到Debian或Ubuntu可能很困难,可能需要大量时间(您必须遵守很多您可能不了解的政策,并且必须找到赞助商),并且您很快就会知道一个关键点如Debian上游指南中所述,为您的软件(例如,自动工具,cmake,distutils等)使用一个体面且流行的构建系统。 Being compliant with the guide will also be beneficial for users of other distributions. 遵守该指南还将对其他发行版的用户有所帮助。

In general I suggest to proceed in this order: 通常,我建议按以下顺序进行:

  1. provide sources; 提供资源;
  2. use a common build system (from the point of view of system administrators, ie, people installing the software, autotools works best in my experience for Posix systems); 使用通用的构建系统(从系统管理员的角度(即,安装软件的人员的角度来看,自动工具在我对Posix系统的经验中效果最好);
  3. create a binary package (please keep in mind that you have to maintain it or your users will likely encounter binary incompatibilities); 创建一个二进制包(请记住,您必须对其进行维护,否则您的用户可能会遇到二进制不兼容的情况);
  4. add the package in private repository (I suggest aptly for this task); 将包添加到私有存储库中(我建议适当地完成此任务);
  5. try to get the package in the distribution of choice (please keep in mind maintainance costs). 尝试在选择的分销中获取包装(请记住维护成本)。

Another option that I do not suggest, is to provide statically linked builds. 我不建议的另一种选择是提供静态链接的构建。 This reduces the possibility of binary incompatibilities, but augment the costs of bug fixing (eg, if the bug is in a dependency) and security, as explained in this and following comments. 这减少了二进制不兼容的可能性,但增加的bug修复(例如,如果错误是在依赖)和安全性的成本,在解释这个及以下意见。 Another reason to avoid static linking is if several implementations of the same ABI exists, in order to exploit hardware acceleration (eg, OpenGL), but you can also mix static and dynamic linking. 避免静态链接的另一个原因是,为了利用硬件加速(例如OpenGL),是否存在相同ABI的几种实现,但是您也可以混合使用静态链接和动态链接。

Finally you may also provide a container, like docker , to ship your software and all its dependencies: your users will just need docker to run your application very portably. 最后,您可能还会提供一个容器,例如docker ,以运送您的软件及其所有依赖项:您的用户将只需要docker即可非常方便地运行您的应用程序。 However it is probably overkill in most situations and if it is a practical solution or not depends on your application and target audience. 但是,在大多数情况下,这可能是矫solution过正,并且是否可行,取决于您的应用程序和目标受众。

I was asked to expand my comment in an answer, and so I do. 我被要求在评论中扩展我的评论,所以我这样做。

The project I was talking about is called Woodpecker hash Bruteforce , and I distribute it as plain archived executables for Mac OS, Windows and Linux. 我正在谈论的项目称为Woodpecker hash Bruteforce ,我将其作为Mac OS,Windows和Linux的纯归档可执行文件分发。

Woodpecker hash Bruteforce has only two dependencies I have to care about (the users don't need to install anything): OpenSSL and Botan - libraries to do hashing. 啄木鸟哈希Bruteforce仅需考虑两个依赖项(用户无需安装任何东西):OpenSSL和Botan-用于哈希化的库。 I've got two virtual machines on my Mac where I build the project and several scripts to automate the process. 我在Mac上有两个虚拟机,用于构建项目和几个脚本来自动执行该过程。 I'm using Docker (in collaboration with VirtualBox) and VMware Fusion. 我正在使用Docker(与VirtualBox合作)和VMware Fusion。

Above I said the users don't need to worry about any third-party libraries because everything's linked statically with the executable: you just download the appropriate file from the official website, unarchive it (if needed), sudo chmod +x the executable and that's it! 上面我说过,用户无需担心任何第三方库,因为所有内容都与可执行文件静态链接:您只需从官方网站下载适当的文件,然后将其取消存档(如果需要), sudo chmod +x可执行文件以及而已!

This works on any version of Linux, including Ubuntu (this is where I perform the build) and Kali Linux. 它适用于任何版本的Linux,包括Ubuntu(我在此处进行构建的地方)和Kali Linux。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM