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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
|
# $NetBSD: bsd.prefs.mk,v 1.214 2005/12/02 17:08:49 wiz Exp $
#
# Make file, included to get the site preferences, if any. Should
# only be included by package Makefiles before any .if defined()
# statements or modifications to "passed" variables (CFLAGS, LDFLAGS, ...),
# to make sure any variables defined in /etc/mk.conf, $MAKECONF, or
# the system defaults (sys.mk and bsd.own.mk) are used.
# Do not recursively include mk.conf, redefine OPSYS, include bsd.own.mk, etc.
# Some variables defined here:
# OPSYS
# The operating system name, as returned by ``uname -s''.
.if !defined(BSD_PKG_MK)
# Let mk.conf know that this is pkgsrc.
BSD_PKG_MK=1
__PREFIX_SET__:=${PREFIX}
# Expand MAKE to a full path.
.if !defined(_MAKE)
_MAKE:= ${MAKE}
. for _dir_ in ${PATH:C/\:/ /g}
. if empty(_MAKE:M/*)
. if exists(${_dir_}/${MAKE})
_MAKE:= ${_dir_}/${MAKE}
. endif
. endif
. endfor
. if !empty(_MAKE:M/*)
MAKEFLAGS+= _MAKE=${_MAKE:Q}
. endif
.endif
MAKE:= ${_MAKE}
.if exists(/usr/bin/uname)
UNAME=/usr/bin/uname
.elif exists(/bin/uname)
UNAME=/bin/uname
.else
UNAME=echo Unknown
.endif
.if exists(/usr/bin/cut)
CUT=/usr/bin/cut
.elif exists(/bin/cut)
CUT=/bin/cut
.else
CUT=echo Unknown
.endif
.if !defined(OPSYS)
OPSYS!= ${UNAME} -s | tr -d /
MAKEFLAGS+= OPSYS=${OPSYS}
.endif
# The _CMD indirection allows code below to modify these values
# without executing the commands at all. Later, recursed make
# invocations will skip these blocks entirely thanks to MAKEFLAGS.
.if !defined(OS_VERSION)
_OS_VERSION_CMD= ${UNAME} -r
OS_VERSION= ${_OS_VERSION_CMD:sh}
MAKEFLAGS+= OS_VERSION=${OS_VERSION}
.endif
.if !defined(LOWER_OS_VERSION)
_LOWER_OS_VERSION_CMD= echo ${OS_VERSION} | tr 'A-Z' 'a-z'
LOWER_OS_VERSION= ${_LOWER_OS_VERSION_CMD:sh}
MAKEFLAGS+= LOWER_OS_VERSION=${LOWER_OS_VERSION}
.endif
# Preload these for architectures not in all variations of bsd.own.mk,
# which do not match their GNU names exactly.
GNU_ARCH.arm26?= arm
GNU_ARCH.arm32?= arm
GNU_ARCH.i486?= i386
GNU_ARCH.i586?= i386
GNU_ARCH.i686?= i386
GNU_ARCH.m68000?= m68010
GNU_ARCH.mips?= mipsel
GNU_ARCH.sh3eb?= sh
GNU_ARCH.sh3el?= shle
MACHINE_GNU_ARCH?= ${GNU_ARCH.${MACHINE_ARCH}:U${MACHINE_ARCH}}
.if ${OPSYS} == "NetBSD"
LOWER_OPSYS?= netbsd
.elif ${OPSYS} == "AIX"
LOWER_ARCH!= _cpuid=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $$1 }'`; \
if /usr/sbin/lsattr -El $$_cpuid | grep ' POWER' >/dev/null 2>&1; then \
echo rs6000; \
else \
echo powerpc; \
fi
MACHINE_ARCH?= ${LOWER_ARCH}
. if exists(/usr/bin/oslevel)
_OS_VERSION!= /usr/bin/oslevel
. else
_OS_VERSION!= echo `${UNAME} -v`.`${UNAME} -r`
. endif
OS_VERSION!= echo ${_OS_VERSION} | sed -e 's,\([0-9]*\.[0-9]*\).*,\1,'
LOWER_OS_VERSION= ${OS_VERSION}
LOWER_OPSYS_VERSUFFIX= ${_OS_VERSION}
LOWER_OPSYS?= aix
LOWER_VENDOR?= ibm
.elif ${OPSYS} == "BSDOS"
LOWER_OPSYS?= bsdi
.elif ${OPSYS} == "Darwin"
LOWER_OPSYS?= darwin
LOWER_ARCH!= ${UNAME} -p
MACHINE_ARCH= ${LOWER_ARCH}
MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH}
LOWER_VENDOR?= apple
.elif ${OPSYS} == "DragonFly"
LOWER_OPSYS?= dragonfly
LOWER_ARCH!= ${UNAME} -p
MACHINE_ARCH= ${LOWER_ARCH}
MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH}
LOWER_OPSYS_VERSUFFIX!= echo ${LOWER_OS_VERSION} | ${CUT} -c -1
LOWER_VENDOR?= pc
.elif ${OPSYS} == "FreeBSD"
LOWER_OPSYS?= freebsd
LOWER_ARCH!= ${UNAME} -p
MACHINE_ARCH= ${LOWER_ARCH}
MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH}
LOWER_OPSYS_VERSUFFIX!= echo ${LOWER_OS_VERSION} | ${CUT} -c -1
. if ${LOWER_ARCH} == "i386"
LOWER_VENDOR?= pc
. endif
LOWER_VENDOR?= unknown
.elif ${OPSYS} == "Interix"
LOWER_OPSYS?= interix3
LOWER_VENDOR?= pc
. if exists(/usr/lib/libc.so.3.5)
OS_VERSION= 3.5
. elif exists(/usr/lib/libc.so.3.1)
OS_VERSION= 3.1
. else
OS_VERSION= 3.0
. endif
LOWER_OS_VERSION= ${OS_VERSION}
.elif !empty(OPSYS:MIRIX*)
LOWER_ARCH!= ${UNAME} -p
LOWER_OPSYS?= irix${OS_VERSION}
LOWER_VENDOR?= sgi
.elif ${OPSYS} == "Linux"
LOWER_OPSYS?= linux
MACHINE_ARCH:= ${MACHINE_ARCH:C/i.86/i386/}
MACHINE_ARCH:= ${MACHINE_ARCH:C/ppc/powerpc/}
. if !defined(LOWER_ARCH)
LOWER_ARCH!= ${UNAME} -m | sed -e 's/i.86/i386/' -e 's/ppc/powerpc/'
. endif # !defined(LOWER_ARCH)
. if ${MACHINE_ARCH} == "unknown" || ${MACHINE_ARCH} == ""
MACHINE_ARCH= ${LOWER_ARCH}
MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH}
. endif
. if exists(/etc/debian_version)
LOWER_VENDOR?= debian
. elif exists(/etc/mandrake-release)
LOWER_VENDOR?= mandrake
. elif exists(/etc/redhat-version)
LOWER_VENDOR?= redhat
. elif exists(/etc/slackware-version)
LOWER_VENDOR?= slackware
. elif ${LOWER_ARCH} == "i386"
LOWER_VENDOR?= pc
. endif
LOWER_VENDOR?= unknown
.elif ${OPSYS} == "OSF1"
LOWER_ARCH!= ${UNAME} -p
MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH}
MACHINE_ARCH?= ${LOWER_ARCH}
OS_VERSION:= ${OS_VERSION:C/^V//}
LOWER_OPSYS?= osf${OS_VERSION}
LOWER_VENDOR?= dec
.elif ${OPSYS} == "SunOS"
. if ${MACHINE_ARCH} == "sparc"
SPARC_TARGET_ARCH?= sparcv7
. elif ${MACHINE_ARCH} == "sun4"
MACHINE_ARCH= sparc
SPARC_TARGET_ARCH?= sparcv7
. elif ${MACHINE_ARCH} == "i86pc"
MACHINE_ARCH= i386
. elif ${MACHINE_ARCH} == "unknown"
. if !defined(LOWER_ARCH)
LOWER_ARCH!= ${UNAME} -p
. endif # !defined(LOWER_ARCH)
MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH}
. endif
LOWER_VENDOR?= sun
LOWER_OPSYS?= solaris
LOWER_OPSYS_VERSUFFIX= 2
.elif !defined(LOWER_OPSYS)
LOWER_OPSYS!= echo ${OPSYS} | tr A-Z a-z
.endif
# Now commit the [LOWER_]OS_VERSION values computed above, eliding the :sh
LOWER_OS_VERSION:= ${LOWER_OS_VERSION}
OS_VERSION:= ${OS_VERSION}
MAKEFLAGS+= LOWER_OPSYS=${LOWER_OPSYS}
LOWER_VENDOR?= # empty ("arch--opsys")
LOWER_ARCH?= ${MACHINE_GNU_ARCH}
MACHINE_PLATFORM?= ${OPSYS}-${OS_VERSION}-${MACHINE_ARCH}
MACHINE_GNU_PLATFORM?= ${LOWER_ARCH}-${LOWER_VENDOR}-${LOWER_OPSYS}${APPEND_ELF}${LOWER_OPSYS_VERSUFFIX}
# Needed to prevent an "install:" target from being created in bsd.own.mk.
NEED_OWN_INSTALL_TARGET=no
# This prevents default use of the cross-tool harness in the "src" tree,
# in the odd possible case of someone extracting "pkgsrc" underneath "src".
USETOOLS= no
MAKE_ENV+= USETOOLS=no
# Set this before <bsd.own.mk> does, since it doesn't know about Darwin
.if ${OPSYS} == "Darwin"
OBJECT_FMT?= Mach-O
.endif
# Load the settings from MAKECONF, which is /etc/mk.conf by default.
.include <bsd.own.mk>
# /usr/share/mk/bsd.own.mk on NetBSD 1.3 does not define OBJECT_FMT
.if !empty(MACHINE_PLATFORM:MNetBSD-1.3*)
. if ${MACHINE_ARCH} == "alpha" || \
${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64"
OBJECT_FMT?= ELF
. else
OBJECT_FMT?= a.out
. endif
# override what bootstrap-pkgsrc sets, which isn't right for NetBSD
# 1.4.
# XXX other ELF platforms in 1.4 need to be added to here.
.elif !empty(MACHINE_PLATFORM:MNetBSD-1.4*)
. if ${MACHINE_ARCH} == "alpha" || \
${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64"
OBJECT_FMT= ELF
. else
OBJECT_FMT= a.out
. endif
.endif
.if ${OPSYS} == "OpenBSD"
. if defined(ELF_TOOLCHAIN) && ${ELF_TOOLCHAIN} == "yes"
OBJECT_FMT?= ELF
. else
OBJECT_FMT?= a.out
. endif
.elif ${OPSYS} == "DragonFly"
OBJECT_FMT= ELF
.elif ${OPSYS} == "AIX"
OBJECT_FMT= XCOFF
.endif
# Calculate depth
.if exists(${.CURDIR}/mk/bsd.pkg.mk)
_PKGSRC_TOPDIR= ${.CURDIR}
.elif exists(${.CURDIR}/../mk/bsd.pkg.mk)
_PKGSRC_TOPDIR= ${.CURDIR}/..
.elif exists(${.CURDIR}/../../mk/bsd.pkg.mk)
_PKGSRC_TOPDIR= ${.CURDIR}/../..
.endif
# include the defaults file
.if exists(${_PKGSRC_TOPDIR}/mk/defaults/mk.conf)
. include "${_PKGSRC_TOPDIR}/mk/defaults/mk.conf"
.endif
USE_TOOLS?= # empty
# Provide default values for TOOLs used by the top-level make.
USE_TOOLS+= [ awk dirname echo grep pwd sed test true
# These tools are used by the top-level make only in certain packages and
# should eventually be moved into those particular package Makefiles.
#
USE_TOOLS+= date tr
.include "${_PKGSRC_TOPDIR}/mk/tools/defaults.mk"
.if ${OPSYS} == "NetBSD"
. if ${OBJECT_FMT} == "ELF" && \
(${MACHINE_GNU_ARCH} == "arm" || \
${MACHINE_ARCH} == "i386" || \
${MACHINE_ARCH} == "m68k" || \
${MACHINE_ARCH} == "m68000" || \
${MACHINE_GNU_ARCH} == "sh" || \
${MACHINE_GNU_ARCH} == "shle" || \
${MACHINE_ARCH} == "sparc" || \
${MACHINE_ARCH} == "vax")
APPEND_ELF= elf
. endif
.endif
SHAREOWN?= ${DOCOWN}
SHAREGRP?= ${DOCGRP}
SHAREMODE?= ${DOCMODE}
.if defined(PREFIX) && (${PREFIX} != ${__PREFIX_SET__})
.BEGIN:
@${ECHO_MSG} "You can NOT set PREFIX manually or in mk.conf. Set LOCALBASE or X11BASE"
@${ECHO_MSG} "depending on your needs. See the pkg system documentation for more info."
@${FALSE}
.endif
# Preload all default values for CFLAGS, LDFLAGS, etc. before bsd.pkg.mk
# or a pkg Makefile modifies them.
.include <sys.mk>
# Load the OS-specific definitions for program variables. Default to loading
# the NetBSD ones if an OS-specific file doesn't exist.
.if exists(${_PKGSRC_TOPDIR}/mk/platform/${OPSYS}.mk)
. include "${_PKGSRC_TOPDIR}/mk/platform/${OPSYS}.mk"
.else
. include "${_PKGSRC_TOPDIR}/mk/platform/NetBSD.mk"
PKG_FAIL_REASON+= "missing mk/platform/${OPSYS}.mk"
.endif
PKGDIRMODE?= 755
PKG_PHASE?= none
#
# The PHASES_AFTER_<phase> variables list every phase "greater than or
# equal to" <phase>.
#
ALL_PHASES= ${PHASES_AFTER_FETCH}
PHASES_AFTER_FETCH= fetch ${PHASES_AFTER_EXTRACT}
PHASES_AFTER_EXTRACT= extract ${PHASES_AFTER_PATCH}
PHASES_AFTER_PATCH= patch ${PHASES_AFTER_TOOLS}
PHASES_AFTER_TOOLS= tools ${PHASES_AFTER_WRAPPER}
PHASES_AFTER_WRAPPER= wrapper ${PHASES_AFTER_CONFIGURE}
PHASES_AFTER_CONFIGURE= configure ${PHASES_AFTER_BUILD}
PHASES_AFTER_BUILD= build ${PHASES_AFTER_INSTALL}
PHASES_AFTER_INSTALL= install ${PHASES_AFTER_PACKAGE}
PHASES_AFTER_PACKAGE= package
PKG_INSTALLATION_TYPES?= overwrite
# This is a whitespace-separated list of installation types supported
# by the package.
#
# *NOTE*: This variable *must* be set in the package Makefile *before*
# the inclusion of bsd.prefs.mk.
#
# Possible: any of: overwrite, pkgviews
# Default: overwrite
# Set the style of installation to be performed for the package. The
# funky make variable modifiers just select the first word of the value
# stored in the referenced variable.
#
.for _pref_ in ${PKG_INSTALLATION_PREFS}
. if !empty(PKG_INSTALLATION_TYPES:M${_pref_})
PKG_INSTALLATION_TYPE?= ${PKG_INSTALLATION_TYPES:M${_pref_}:S/^/_pkginsttype_/1:M_pkginsttype_*:S/^_pkginsttype_//}
. endif
.endfor
PKG_INSTALLATION_TYPE?= none
# if the system is IPv6-ready, compile with IPv6 support turned on.
.if defined(USE_INET6)
. if empty(USE_INET6:M[Yy][Ee][Ss])
USE_INET6= NO
. else
USE_INET6= YES
. endif
.elif empty(_OPSYS_HAS_INET6:M[nN][oO])
USE_INET6= YES
.else
USE_INET6= NO
.endif
LOCALBASE?= ${DESTDIR}/usr/pkg
.if ${OPSYS} == "SunOS"
# On Solaris, we default to using OpenWindows for X11.
X11BASE?= ${DESTDIR}/usr/openwin
.elif !defined(X11_TYPE) || defined(X11_TYPE) && !empty(X11_TYPE:Mnative)
X11BASE?= ${DESTDIR}/usr/X11R6
.endif
CROSSBASE?= ${LOCALBASE}/cross
# If xpkgwedge.def is found, then clearly we're using xpkgwedge.
.if exists(${LOCALBASE}/lib/X11/config/xpkgwedge.def) || \
exists(${X11BASE}/lib/X11/config/xpkgwedge.def)
USE_XPKGWEDGE= yes
.else
USE_XPKGWEDGE?= yes
.endif
.if defined(_OPSYS_NEEDS_XPKGWEDGE) && \
!empty(_OPSYS_NEEDS_XPKGWEDGE:M[yY][eE][sS])
USE_XPKGWEDGE= yes
.endif
.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
USE_XPKGWEDGE= yes
.endif
# Default installation prefix for meta-pkgs/XFree86 and
# meta-pkgs/xorg.
.if defined(X11_TYPE) && !empty(X11_TYPE:MXFree86)
X11ROOT_PREFIX?= XFree86
.elif defined(X11_TYPE) && !empty(X11_TYPE:Mxorg)
X11ROOT_PREFIX?= xorg
.else
X11ROOT_PREFIX?= # empty
.endif
.if ((defined(X11_TYPE) && !empty(X11_TYPE:MXFree86) || \
defined(X11_TYPE) && !empty(X11_TYPE:Mxorg)) && \
defined(X11_TYPE) && empty(X11_TYPE:Mnative))
X11BASE?= ${LOCALBASE}/${X11ROOT_PREFIX}
.endif
# Set X11PREFIX to reflect the install directory of X11 packages.
# Set XMKMF_CMD properly if xpkgwedge is installed.
#
# The check for the existence of ${X11BASE}/lib/X11/config/xpkgwedge.def
# is to catch users of xpkgwedge<1.0.
#
.if !empty(USE_XPKGWEDGE:M[Yy][Ee][Ss])
X11PREFIX= ${LOCALBASE}
.else
X11PREFIX= ${X11BASE}
.endif
DEPOT_SUBDIR?= packages
DEPOTBASE= ${LOCALBASE}/${DEPOT_SUBDIR}
# LINK_RPATH_FLAG publicly exports the linker flag used to set the
# run-time library search path.
#
.if defined(_OPSYS_LINKER_RPATH_FLAG)
LINKER_RPATH_FLAG= ${_OPSYS_LINKER_RPATH_FLAG}
.else
LINKER_RPATH_FLAG?= ${_LINKER_RPATH_FLAG}
.endif
# COMPILER_RPATH_FLAG publicly exports the compiler flag used to pass
# run-time library search path directives to the linker.
#
.if defined(_OPSYS_COMPILER_RPATH_FLAG)
COMPILER_RPATH_FLAG= ${_OPSYS_COMPILER_RPATH_FLAG}
.else
COMPILER_RPATH_FLAG?= ${_COMPILER_RPATH_FLAG}
.endif
# WHOLE_ARCHIVE_FLAG and NO_WHOLE_ARCHIVE_FLAG publically export the
# linker flags to extract all symbols from a static archive.
WHOLE_ARCHIVE_FLAG?= ${_OPSYS_WHOLE_ARCHIVE_FLAG}
NO_WHOLE_ARCHIVE_FLAG?= ${_OPSYS_NO_WHOLE_ARCHIVE_FLAG}
.if !defined(DIGEST)
DIGEST:= ${LOCALBASE}/bin/digest
MAKEFLAGS+= DIGEST=${DIGEST}
.endif
# Only add the DIGEST_VERSION value to MAKEFLAGS when we know
# we've got a valid version number, retrieved from the digest(1)
# binary. This is different to PKGTOOLS_VERSION, since, in that
# case, the build dies when pkg_info(1) is out of date.
.if !exists(${DIGEST})
DIGEST_VERSION= 20010301
.elif !defined(DIGEST_VERSION)
DIGEST_VERSION!= ${DIGEST} -V 2>/dev/null
MAKEFLAGS+= DIGEST_VERSION=${DIGEST_VERSION}
.endif
# This is the package database directory for the default view.
PKG_DBDIR?= ${DESTDIR}/var/db/pkg
# _PKG_DBDIR is the actual packages database directory where we register
# packages.
#
.if ${PKG_INSTALLATION_TYPE} == "overwrite"
_PKG_DBDIR= ${PKG_DBDIR}
.elif ${PKG_INSTALLATION_TYPE} == "pkgviews"
_PKG_DBDIR= ${DEPOTBASE}
.endif
PKG_ADD_CMD?= ${PKG_TOOLS_BIN}/pkg_add
PKG_ADMIN_CMD?= ${PKG_TOOLS_BIN}/pkg_admin
PKG_CREATE_CMD?= ${PKG_TOOLS_BIN}/pkg_create
PKG_DELETE_CMD?= ${PKG_TOOLS_BIN}/pkg_delete
PKG_INFO_CMD?= ${PKG_TOOLS_BIN}/pkg_info
PKG_VIEW_CMD?= ${PKG_TOOLS_BIN}/pkg_view
LINKFARM_CMD?= ${PKG_TOOLS_BIN}/linkfarm
.if !defined(PKGTOOLS_VERSION)
PKGTOOLS_VERSION!= ${PKG_INFO_CMD} -V 2>/dev/null || echo 20010302
MAKEFLAGS+= PKGTOOLS_VERSION=${PKGTOOLS_VERSION}
.endif
# The binary pkg_install tools all need to consistently to refer to the
# correct package database directory.
#
.if ${PKGTOOLS_VERSION} < 20030823
PKGTOOLS_ENV?= PKG_DBDIR=${_PKG_DBDIR:Q}
PKGTOOLS_ARGS?= # empty
.else
PKGTOOLS_ENV?= # empty
PKGTOOLS_ARGS?= -K ${_PKG_DBDIR:Q}
.endif
# Views are rooted in ${LOCALBASE}, all packages are depoted in
# ${DEPOTBASE}, and the package database directory for the default view
# is in ${PKG_DBDIR}.
#
PKG_VIEW_ARGS?= -W ${LOCALBASE} -d ${DEPOTBASE} -k ${PKG_DBDIR}
PKG_ADD?= ${SETENV} ${PKGTOOLS_ENV} ${PKG_ADD_CMD} ${PKGTOOLS_ARGS}
PKG_ADMIN?= ${SETENV} ${PKGTOOLS_ENV} ${PKG_ADMIN_CMD} ${PKGTOOLS_ARGS}
PKG_CREATE?= ${SETENV} ${PKGTOOLS_ENV} ${PKG_CREATE_CMD} ${PKGTOOLS_ARGS}
PKG_DELETE?= ${SETENV} ${PKGTOOLS_ENV} ${PKG_DELETE_CMD} ${PKGTOOLS_ARGS}
PKG_INFO?= ${SETENV} ${PKGTOOLS_ENV} ${PKG_INFO_CMD} ${PKGTOOLS_ARGS}
PKG_VIEW?= ${SETENV} ${PKGTOOLS_ENV} ${PKG_VIEW_CMD} ${PKG_VIEW_ARGS}
LINKFARM?= ${LINKFARM_CMD}
# "${PKG_BEST_EXISTS} pkgpattern" prints out the name of the installed
# package that best matches pkgpattern. Use this instead of
# "${PKG_INFO} -e pkgpattern" if the latter would return more than one
# package name.
#
PKG_BEST_EXISTS?= ${PKG_ADMIN} -b -d ${_PKG_DBDIR} -S lsbest
.if exists(${LOCALBASE}/bsd/share/mk/zoularis.mk)
PKG_FAIL_REASON+= 'You appear to have a deprecated Zoularis installation.'
PKG_FAIL_REASON+= 'Please update your system to bootstrap-pkgsrc and remove the'
PKG_FAIL_REASON+= '${LOCALBASE}/bsd directory.'
PKG_FAIL_REASON+= 'See http://mail-index.NetBSD.org/tech-pkg/2004/02/14/0004.html'
PKG_FAIL_REASON+= 'for more details.'
.endif
PKGPATH?= ${.CURDIR:C|.*/([^/]*/[^/]*)$|\1|}
.if !defined(_PKGSRCDIR)
_PKGSRCDIR!= cd ${_PKGSRC_TOPDIR} && ${PWD_CMD}
MAKEFLAGS+= _PKGSRCDIR=${_PKGSRCDIR:Q}
.endif
PKGSRCDIR= ${_PKGSRCDIR}
DISTDIR?= ${PKGSRCDIR}/distfiles
PACKAGES?= ${PKGSRCDIR}/packages
TEMPLATES?= ${PKGSRCDIR}/templates
PATCHDIR?= ${.CURDIR}/patches
SCRIPTDIR?= ${.CURDIR}/scripts
FILESDIR?= ${.CURDIR}/files
PKGDIR?= ${.CURDIR}
_PKGSRC_DEPS?= # empty
# If WRKOBJDIR is set, use that tree to build
.if defined(WRKOBJDIR)
BUILD_DIR?= ${WRKOBJDIR}/${PKGPATH}
.else
BUILD_DIR!= cd ${.CURDIR} && ${PWD_CMD}
.endif
# If OBJHOSTNAME is set, use first component of hostname in directory name.
# If OBJMACHINE is set, use ${MACHINE_ARCH} in the working directory name.
#
.if defined(OBJHOSTNAME)
. if !defined(_HOSTNAME)
_HOSTNAME!= ${UNAME} -n
MAKEFLAGS+= _HOSTNAME=${_HOSTNAME}
. endif
WRKDIR_BASENAME?= work.${_HOSTNAME:C|\..*||}
MAKEFLAGS+= OBJHOSTNAME=${OBJHOSTNAME}
.elif defined(OBJMACHINE)
WRKDIR_BASENAME?= work.${MACHINE_ARCH}
MAKEFLAGS+= OBJMACHINE=${OBJMACHINE}
.else
WRKDIR_BASENAME?= work
.endif
WRKDIR?= ${BUILD_DIR}/${WRKDIR_BASENAME}
# There are many uses for a common log file, so define one that may be
# picked up and used by tools.mk, bsd.buildlink3.mk, etc.
#
WRKLOG?= ${WRKDIR}/.work.log
PKG_DEFAULT_OPTIONS?= # empty
PKG_OPTIONS?= # empty
# we want this *before* compiler.mk, so that compiler.mk paths override them
PREPEND_PATH+= ${USE_X11:D${X11BASE}/bin} ${LOCALBASE}/bin
# Wrapper framework definitions
.include "${PKGSRCDIR}/mk/wrapper/wrapper-defs.mk"
# Make variable definitions cache
.include "${PKGSRCDIR}/mk/bsd.makevars.mk"
USE_TOOLS+= awk:pkgsrc cut:pkgsrc echo:pkgsrc pwd:pkgsrc \
sed:pkgsrc tr:pkgsrc uname:pkgsrc
.endif # BSD_PKG_MK
|