summaryrefslogtreecommitdiffstats
path: root/specs/spf-2.0/buildsys.mdwn
blob: 07c80393c7c7dc0148d7a550e070376d6570d080 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
Build Makefile [build]
======================

A file named `build` directs the process of building and installing data files
to be provided by binary packages.  It must be a makefile, and it must be
executable by all users (mode 0755 octal).

The first line of this file must name a **make**(1) interpreter in a magic
number sample as follows:

    #! /usr/bin/make -f

Any number of spaces and/or tabs may be used after the `#!` magic number and
before the `-f` argument.

The following targets are required:

  * `build`

    The `build` target should perform all the configuration and compilation
    needed to produce files for installation into binary packages.

    The `build` target should create a file named `build` in the build work area
    to prevent configuration and compilation from being performed multiple
    times.

    The `build` target must not do anything that might require superuser
    privilege.

  * `install`

    The `install` target should install data files into the data directories of
    binary packages (see $[sectlink][work-area] for information on these
    directories).

    The `install` target should depend on the `build` target.

    The `install` target shall be invoked as the superuser.

The required targets and their dependencies must not require interactive user
input.

Additional targets may exist in the `build` makefile.

Certain environment variables (see $[sectlink][env-vars]) shall be set when the
`build` makefile is executed.


Build Work Area [work-area]
===========================

When building packages, a new directory named `tmp` shall be created in the
source package directory.  In this directory, the package source code shall be
copied or unpacked into a directory called `src` shall be created.

After all expected binary packages have been built, the work area (`tmp` and its
children) shall be removed.


Environment Variables [env-vars]
================================

Certain environment variables shall be set to provide to the configuration
script and build makefile information about the package and the environments in
and for which binary packages are to be built.

The terms "build system" and "host system" below are used according to [the
convention set by GNU Autoconf][target-triplets].  The build system is the type
of system on which a package is built.  The host system is the type of system on
which a binary package is expected to be natively installed and used.

Package Variables [env-vars-pkg]
--------------------------------

The following environment variables shall be set to describe the source package:

  * `OPK_SOURCE`

    The source package name, as given in the most recent entry of the change
    log.  See $[sectlink][changelog] for more information on the source package
    name.

  * `OPK_SOURCE_VERSION`

    The source package version, as given in the most recent entry of the change
    log.  See $[sectlink][src-ver] for the syntax of source package version
    identifiers.

  * `OPK_SOURCE_VERSION_UPSTREAM`

  * `OPK_BINARY_VERSION`

  * `OPK_PACKAGES`

    A list of binary packages to be built.

    This may not include all packages for which the source package has metadata.
    The `Architecture` field of some packages may not match the host
    architecture for which packages are to be built.  Only
    architecture-dependent or architecture-independent packages may have been
    selected for building.

Build and Host System Variables [env-vars-sys]
----------------------------------------------

The following environment variables shall be set to describe the build system:

  * `OPK_BUILD_ARCH`

    The distribution architecture string of the build system.

  * `OPK_BUILD_ARCH_CPU`

    The CPU component of the distribution architecture string of the build
    system.

  * `OPK_BUILD_ARCH_KERNEL`

    The kernel component of the distribution architecture string of the build
    system.

  * `OPK_BUILD_ARCH_LIBS`

    The system libraries component of the distribution architecture string of
    the build system.

  * `OPK_BUILD_ARCH_GNU`

    The GNU system type of the build system.

  * `OPK_BUILD_PLAT`

    The application platform of the build system.

The following environment variables shall be set to describe the host system:

  * `OPK_HOST_ARCH`

    The distribution architecture string of the host system.

  * `OPK_HOST_ARCH_CPU`

    The CPU component of the distribution architecture string of the host
    system.

  * `OPK_HOST_ARCH_KERNEL`

    The kernel component of the distribution architecture string of the host
    system.

  * `OPK_HOST_ARCH_LIBS`

    The system libraries component of the distribution architecture string of
    the host system.

  * `OPK_HOST_ARCH_GNU`

    The GNU system type of the host system.

  * `OPK_HOST_PLAT`

    The application platform of the host system.

Toolchain Variables [env-vars-tools]
------------------------------------

The following environment variables shall be set to describe the toolchain:

  * `AR`

  * `AS`

  * `CC`

  * `CPP`

  * `CXX`

  * `LD`

  * `NM`

  * `OBJCOPY`

  * `OBJDUMP`

  * `RANLIB`

  * `READELF`

  * `SIZE`

  * `STRINGS`

  * `STRIP`

Note that this list of environment variables assumes the use of GNU Binutils,
GCC, and the ELF binary format.  Support for other toolchains may be specified
in a future version of this source package format.


[target-triplets]: https://www.gnu.org/software/autoconf/manual/html_node/Specifying-Target-Triplets.html