I wonder how linux distros like Debian, Red Hat, Gentoo, Ubuntu make many binary packages from one package? When I compile package, they just become install all in one. So my questions are:
1 Answer
When distribution packages are built, the artifacts aren’t installed directly in their target locations. Instead, they are installed to a temporary location, and the packages are built using the contents there.
For source packages which build multiple binary packages, the last step above is split into multiple target packages. Each target package lists the files it’s supposed to contain. See the various .install
files in my libevdev
package for example; the libevdev
build installs the following files:
debian/tmp/usr/include/libevdev-1.0/libevdev/libevdev.h
debian/tmp/usr/include/libevdev-1.0/libevdev/libevdev-uinput.h
debian/tmp/usr/lib/x86_64-linux-gnu/libevdev.la
debian/tmp/usr/lib/x86_64-linux-gnu/libevdev.a
debian/tmp/usr/lib/x86_64-linux-gnu/libevdev.so.2.3.0
debian/tmp/usr/lib/x86_64-linux-gnu/pkgconfig/libevdev.pc
debian/tmp/usr/bin/libevdev-tweak-device
debian/tmp/usr/bin/mouse-dpi-tool
debian/tmp/usr/bin/touchpad-edge-detector
debian/tmp/usr/share/man/man3/libevdev.3
(the equivalent of what you’d get by installing with sudo make install
), and these are split up into
libevdev2
:/usr/lib/x86_64-linux-gnu/libevdev.so.2.3.0
libevdev-dev
:/usr/include/libevdev-1.0/libevdev/libevdev.h /usr/include/libevdev-1.0/libevdev/libevdev-uinput.h /usr/lib/x86_64-linux-gnu/libevdev.a /usr/lib/x86_64-linux-gnu/pkgconfig/libevdev.pc /usr/share/man/man3/libevdev.3
libevdev-tools
:/usr/bin/libevdev-tweak-device /usr/bin/mouse-dpi-tool /usr/bin/touchpad-edge-detector
(The udeb
is a special case, probably not worth discussing here.)
gcc
,g++
,libstdc++
package is built from one source package GCC.apt install gcc libc6-dev linux-libc-dev
... orapt install g++