📜 ⬆️ ⬇️

BSD vs Linux. What is a "port"?

Now, after the base system , the second category: those programs that are add-on packages. In the BSD world, this is commonly referred to as the “port system”. This name was not chosen by chance. Traditionally, to run a program on a system, the first thing you had to do was compile it. And often before compiling it was necessary to finish it. Your system could require other header files. Sometimes the declared constants differed. Some parts sometimes corresponded from scratch due to their incompatibility with your system. In other words, you had to “port” the program for your OS and / or for your particular system. The main purpose of the port system is to do all the work of porting for you. The fact that it also automates the build and installation and provides services such as 'uninstall' in her name, however, not reflected. But as is the case with many things, over time the port system outgrew its name and turned into that beast that we see today. The FreeBSD Ports Collection contains over 10,000 packages. The most obvious feature of ports is that programs are built from source, and not just pre-installed binaries are installed. This is another obvious difference that confuses people who are evaluating BSD from a Linux perspective. But, the fact that they are collected from sources is not a primary goal, a third-party effect. Binary packages are also available — in fact, they are built from the ports tree ! Indeed, most Linux users install binary packages, and BSD users collect from source files. Part of the reason for this is the toolkit. The port system is designed around the concept of building from source, with the background of the ability to build and install binary packages. While the Linux package system, such as RPM or dpkg, is in turn designed around the concept of building and installing binaries, building from source is in mind. Historically, binary packages were not dominant in Unix systems, as I said above. Therefore, the packages themselves are a later thing. Traditionally, it was necessary to deal with the uninstallation manually. Gentoo is a Linux distribution that is gaining popularity. One of its advantages lies in the Portage system, which is often compared to BSD ports. Perhaps the most noticeable similarity lies in the assembly of the source. This eliminates many of the problems of binary packages. I never used it myself, but the impressions of the information about her and my acquaintances who used it make it possible to say that the system took good ideas from everywhere and put them together. It will be interesting to observe its development in the coming years. Nevertheless, Gentoo is still Linux, not BSD, but claims to be closest to the BSD style from the leading Linux distributions. Now, with regard to the advantages of binary packages: this is time (a lot of time) and usually less than the required space for installing packages than with sources. There are advantages in building from sources, for example, avoiding a leap-through with versions of libraries (something that upsets me in binary packages). In Linux or BSD, you can install packages, or you can build them from source. But users seem to be configured differently, because systems are configured differently, because users are configured differently ... this is the correspondence. I think it’s important to understand that the difference between ports and RPM is not only that the ports are compiled, and the packages are simply installed. Ports are designed to cover the entire range of bits and components of the installation process: encoding, tracking and dependencies, packages, installation and uninstallation, local changes required for installation on your system, configuration "chips" and so on. RPM is just a binary package. If you want to automatically pick up all the dependencies, you will need a higher level tool, such as urpmi or apt-get. And since this is a binary, you still have to deal with library version conflicts, or missing compiler options, or any other restrictions that you encounter, NOT collecting it on your system. Further, the ports, like the rest of the BSD systems , centralized. The "ports tree" is a huge structured directory, with a bunch of folders in categories containing a Makefile with declared variables, checksum, packing list, and other such things. Each of these folders is a separate program that is described by these files. A bunch of black magic goes off-stage when you type make : it finds and downloads the distribution kit, wherever it is, makes all the necessary changes, recursively finds and installs all dependencies, calls GNU configure or imake or any other preparatory program with the necessary options, starts compiling with the necessary parameters, etc. But the FreeBSD project itself manages all the files in this large directory. For example, when someone wrote KDE, it did not appear magically in the ports tree. Someone had to write the necessary “glue” to create its port, then upload files to the FreeBSD CVS repository in order for it to appear in the ports collection. Again, there is a certain level of confidence that it works with all other things in the ports collection. All existing dependencies will be there because it cannot declare dependencies outside ports. Things break, of course. Maybe some dependency site will disappear, so that no one can download the source. Maybe a new version of a third program will break your program, which will lead to the failure of things dependent on it. Of course, all problems can not be solved. But there are fewer incidents with “I want A, which requires B, which I cannot find” than with decentralized systems like RPM. For more information, see the handbook section .

1. BSD vs Linux. Introduction.
2. BSD vs Linux. Characters.
3. BSD vs Linux. What is the "Basic System"?

')

Source: https://habr.com/ru/post/31499/


All Articles