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
|
.Dd September 27, 2026
.Dt MKPKG.CONF 5
.Os
.Sh NAME
.Nm mkpkg.conf
.Nd build and install configuration
.Sh SYNOPSIS
.Pa /etc/mkpkg.conf
.Sh DESCRIPTION
.Nm
is read in three ways.
.Ic mkpkg -g
names another file for the first two.
.Bl -bullet
.It
The
.Fn shell ,
.Fn build
and
.Fn post_build
hooks of a
.Xr MAKEPKG 5
source it as a shell script, after
.Ev PKG ,
.Ev SRC
and the other variables of
.Xr mkpkg 8
are exported, so it may refer to them.
.Fn extract
and
.Fn patch
do not source it.
This is where compilers, flags and other build environment are set.
.It
.Xr mkpkg 8
reads the
.Ev MKPKG_*
settings below itself, without a shell.
Their values must be literal: quotes and a trailing comment are
removed, but nothing is expanded.
A leading
.Ic export
is allowed.
.It
.Xr addpkg 8
reads
.Ev IGNORE_NEW .
.El
.Sh BUILD ENVIRONMENT
Anything a shell script can set.
The shipped file sets, among others:
.Bl -tag -width PKG_CONFIG_PATH
.It Ev CC , CXX
The compilers,
.Li clang
and
.Li clang++ .
.It Ev CFLAGS , CXXFLAGS , CPPFLAGS , LDFLAGS
Compiler and linker flags.
.It Ev PKG_CONFIG_PATH
Where
.Ic pkgconf
looks.
.It Ev MAKEFLAGS
Flags for
.Xr make 1 ,
such as
.Li -j$(nproc) .
.It Ev CARGO_HOME , GOPATH
Caches for cargo and Go, set below
.Ev SRC
so they are part of the work directory.
.El
.Sh MKPKG SETTINGS
.Bl -tag -width Ds
.It Ev MKPKG_SOURCE_DIR
Directory for downloaded sources, exported to the hooks as
.Ev PKGMK_SOURCE_DIR .
Default: the port directory.
.It Ev MKPKG_PACKAGE_DIR
Directory for built packages.
Default: the port directory.
.It Ev MKPKG_WORK_DIR
Work directory.
Default:
.Pa work
in the port directory.
An absolute path that does not end in
.Pa /work ,
such as
.Pa /dev/shm ,
is a place for work directories: each build uses its own
.Pa mkpkg_ Ns Ar pid
below it.
.It Ev MKPKG_TMP_DIR
A directory the full lockbox may write to; see
.Xr lockbox 7 .
Default:
.Pa /dev/shm .
.It Ev MKPKG_SECRET_KEY
The
.Xr signify 1
secret key to sign ports with.
Only port maintainers need it.
Default:
.Pa /etc/ports/keys/rawnix.sec .
.It Ev MKPKG_COMPRESSION_MODE
Package compression:
.Li gz ,
.Li xz ,
.Li zst ,
.Li bz2
or
.Li lz .
It is also the file name extension.
Parallel compressors are used when installed:
.Ic pigz
for
.Li gz ,
lbzip2 or pbzip2 for
.Li bz2 ,
plzip for
.Li lz ;
.Li xz
and
.Li zst
use all threads.
Default:
.Li gz .
.It Ev MKPKG_IGNORE_CHECKSUMS
Like
.Ic mkpkg -ic .
.It Ev MKPKG_IGNORE_FOOTPRINT
Like
.Ic mkpkg -if .
.It Ev MKPKG_IGNORE_SIGNATURE
Like
.Ic mkpkg -is .
.It Ev MKPKG_NO_STRIP
Do not strip binaries.
.El
.Pp
The last four are on for
.Li yes
or
.Li 1 ,
and off otherwise.
.Sh INSTALL SETTINGS
.Bl -tag -width Ds
.It Ev IGNORE_NEW
If
.Li yes ,
.Xr addpkg 8
installs a package that has files its
.Pa .footprint
does not list.
Otherwise it refuses.
Default:
.Li no .
.El
.Sh FILES
.Bl -tag -width Ds -compact
.It Pa /etc/mkpkg.conf
This file.
.El
.Sh EXAMPLES
.Bd -literal -offset indent
export CC=clang
export CXX=clang++
export CFLAGS="-O2 -pipe -march=x86-64-v3 -fstack-protector-strong"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-Wl,-O1 -Wl,--as-needed"
export MAKEFLAGS="-j$(nproc)"
export CARGO_HOME="$SRC/.cargo"
# build in RAM
MKPKG_WORK_DIR=/dev/shm
MKPKG_COMPRESSION_MODE=zst
IGNORE_NEW=no
.Ed
.Sh SEE ALSO
.Xr MAKEPKG 5 ,
.Xr addpkg 8 ,
.Xr mkpkg 8
.Sh CAVEATS
An unknown
.Ev MKPKG_COMPRESSION_MODE
is compressed with gzip but still used as the extension.
|