4. Install for your compiler
Not every user of vectors builds with FoBiS: a colleague compiles by hand, another project uses CMake. They need vectors installed, as a library and its module files. A module file works only with the compiler that wrote it, so there is no prebuilt package to download: fobis pkg install builds the package from its source with your compiler.
$ fobis pkg install lab:vectors
Building vectors v0.2.0 with gfortran (gnu-13.4.0-c19ce216), fobis
Installed vectors v0.2.0 for gnu-13.4.0-c19ce216 in ~/.fobis/pkgs/gnu-13.4.0-c19ce216/vectors/0.2.0
modules : kinds, vectors
use it : export PKG_CONFIG_PATH=~/.fobis/pkgs/gnu-13.4.0-c19ce216/vectors/0.2.0/lib/pkgconfigThe package is filed under a toolchain key: the compiler family, its version, and a digest of the compiler's path, MPI and flags. Installing with another compiler, or other flags, gives another key, and both stay installed. vectors brings kinds along, because its library contains what it uses.
$ fobis pkg list
vectors v0.2.0 gnu-13.4.0-c19ce216 fobis file://~/remotes/vectors.gitUse it from any build system
Each library gets a pkg-config file. fobis pkg path --pkgconfig gives its directory:
$ fobis pkg path vectors --pkgconfig
~/.fobis/pkgs/gnu-13.4.0-c19ce216/vectors/0.2.0/lib/pkgconfigprogram length
!< A program of another lab member, linked to the installed vectors through pkg-config.
use kinds, only : R8P
use vectors, only : norm
implicit none
print '(F6.3)', norm([1._R8P, 2._R8P, 2._R8P])
end program length$ cd ~ && export PKG_CONFIG_PATH=$(fobis pkg path vectors --pkgconfig) && gfortran length.f90 $(pkg-config --cflags --libs vectors) -o length && ./length
3.000CMake reads the same file with pkg_check_modules, make with pkg-config --cflags --libs vectors.
Upgrade and uninstall
The lab publishes vectors 0.2.1, a patch release. fobis pkg upgrade installs the newest version the original request allows, for the same toolchain, and removes the old one. The install named no --version, so any newer version qualifies; pkg install lab:vectors --version "^0.2" would have kept the upgrades within 0.x from 0.2:
$ fobis pkg upgrade vectors
Building vectors v0.2.1 with gfortran (gnu-13.4.0-c19ce216), fobis
vectors: v0.2.0 -> v0.2.1 (gnu-13.4.0-c19ce216)uninstall removes exactly the files and links the install wrote, recorded in the store:
$ fobis pkg uninstall vectors
Removed vectors v0.2.1 (gnu-13.4.0-c19ce216): 4 file(s) and link(s)$ fobis pkg list
No package installed (fobis pkg install NAME).The outputs above depend on the machine: the key names the compiler and its path.
What you learned
fobis pkg install, toolchain keys, pkg list, pkg path --pkgconfig, linking from another build system, pkg upgrade, pkg uninstall. Reference: pkg, install a package for your compiler.