HaikuPorts
  • Login
  • Preferences
  • Help/Guide
  • Wiki
  • Timeline
  • Roadmap
  • View Tickets
  • Search
  • Port Log
  • Blog

Context Navigation

  • ← Previous Change
  • Wiki History
  • Next Change →

Changes between Version 1 and Version 2 of HaikuPorterForPM/HandlingRequirements


Ignore:
Timestamp:
06/13/13 09:58:25 (2 years ago)
Author:
zooey
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HaikuPorterForPM/HandlingRequirements

    v1 v2  
    11= Handling Requirements = 
    22 
    3 ... TODO ... 
     3 '''BEWARE!''':: this page doesn't reflect the current status quo of !HaikuPorter - there's some more work to do such that !HaikuPorter and the recipes actually follow the description given below ... 
     4 
     5In order to avoid any built packages to unexpectedly depend on software that happens to be installed on the build host (i.e. you Haiku installation), !HaikuPorter runs the build commands in a `chroot()`-ed environment. When !HaikuPorter creates the chroot, it populates it with only the packages that are needed by the shell scriptlets that are executing the different build phases. Anything else that is required for building or running the port has to be declared explicitly in the build recipe of each port. 
     6 
     7== Requires == 
     8 
     9Runtime requirements of a port must be added to the `REQUIRES` variable in the build recipe (for ports generating more than a single package, different sets of declarations shoulde be given in the `REQUIRES` variable of the respective package.  
     10 
     11Those declarations can refer to commands that will be executed by the packaged software (but which aren't part of the port) and/or to shared runtime libraries implementing some functionality that the packaged software needs. 
     12 
     13== Build Requires == 
     14 
     15Build-time requirements of a port are all the external entities that are used by the build process and have an effect at runtime.  
     16 
     17Most notably, each library used by the port's build process represents a build requires, as the code in those libraries is being used at runtime. Accordingly, any port using external libraries must declare build requires for those development libraries (no matter if shared or static). 
     18 
     19The build requires of a port must be added to the `BUILD_REQUIRES` variable in the build recipe (again, potentially involving one variable per package).  
     20 
     21Each shared development library that a port references in `BUILD_REQUIRES` should have a corresponding reference to the respective shared runtime library in `REQUIRES`, as a library that a port has been linked to is extremely likely to be necessary at runtime. This conceptual separation of development and runtime libraries is imortant, since those are indeed being provided by separate packages (usually the `base` and the `devel` package). The fact that the development library is just a symlink to the runtime library is merely an implementation detail. 
     22 
     23 Note:: Sometimes, commands used during the build can represent a build requires, too. This would be the case if the build process analyzes the commandline interface of a specific program (say `git`) and then adjusts itself to invoke `git` at runtime using the information gathered during the build. In the given example, `git` would have to be added to `REQUIRES`, too, of course. 
     24 
     25== Build Prerequires == 
     26 
     27Build-time requirements of a port that are just needed during the build, but which do not have any effect at runtime must be added to the `BUILD_PREREQUIRES` variable in the build recipe. 
     28 
     29Those declarations usually refer to commands that are needed by the port's build system (which most of the time includes invocations of `'make'` and `'make install'`). Typical examples of this are actual buildtools like `gcc`, `binutils`, `autoconf` and `make`, but very often additional commands like `sed` and/or `grep`, too. 
     30 
     31== Requires Specification Syntax == 
     32 
     33Individual entries in any of the requires specifications need to adhere to the following syntax (please see [https://dev.haiku-os.org/wiki/PackageManagement/BuildingPackages#The.PackageInfo The .PackageInfo] for more details: 
     34{{{ 
     35required_entity         ::= [type ":"] entity_name [ version_operator version_ref ] 
     36type                    ::= "cmd" | "devel" | "lib" | ... 
     37version_operator        ::= "<" | "<=" | "==" | "!=" | ">=" | ">" 
     38}}} 
     39 
     40 Note:: There are other types than the ones given above, but those are of no concern here. 
     41 
     42=== Requiring a command === 
     43 
     44A requires on a commands can be declared using `cmd:<command>` (e.g. `'cmd:sed'` or `'cmd:git >= 1.7'`).  
     45 
     46Any dashes contained in the name of the command need to be replaced with underscores, so in order to require command `'i586-pc-haiku-gcc'`, one has to add it as `'cmd:i586_pc_haiku_gcc'`. 
     47 
     48=== Requiring a runtime library === 
     49 
     50A requires on a runtime library can be declared using `lib:<library-basename>` (e.g. `'lib:libz'` or `'lib:libpng >= 1.4'`). The basename of the library is everything until the first dot - yes, this means that there's no difference between a shared or static library. 
     51 
     52As with commands, any dashes contained in the name of the library need to be replaced with underscores. 
     53 
     54=== Requiring a development library === 
     55 
     56A requires on a development library can be declared using `devel:<library-basename>` (e.g. `'devel:libz'` or `'devel:libpng >= 1.4'`). 
     57 
     58Again, any dashes contained in the name of the library need to be replaced with underscores. 
     59 
     60=== Requiring a package === 
     61 
     62Any required entity without a `type` specification (e.g. `'openssl'`) is representing a package. Direct package requires are not a good idea, as such a requires relies on the contents of the package to stay the same at all times. However, packages are getting renamed or split, which would mean that such a requires declaration becomes broken. 
     63 
     64== Declared and Actual Requires == 
     65 
     66Before !HaikuPorter collects the build results of a port into packages, the set of declared runtime requires (`REQUIRES`) is being replaced by the actual versions used at time of the build. 
     67 
     68 An example:: For a port that declares a requires `'openssl >= 1.0'` and has actually used openssl-1.0.0j during the build, !HaikuPorter will inject the requires `'openssl >= 1.0.0j'`. The reason for this is that any version of openssl less than `1.0.0j` may not work properly, as ports are expected to be forward-compatible (newer versions can be used instead of older ones), but not necessarily the other way around. 
     69 
     70== Be Explicit! == 
     71 
     72In general, it is advisable to be as explicit as possible with the requires declarations. If, for instance, a port requires three different development libraries which all are provided by the same other port, it is still mandatory to declare all three of them individually as build requires. If that weren't done, a simple package split in the required port would break the port using those libraries. 
     73 
     74There's a direct connection between explicitness of the requires declarations in  build recipes and robustness of the whole packaging repository, so be explict! 

Trac Powered

Powered by Trac 0.13dev-r10686
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/