Annotation of pkgsrc/mk/bsd.prefs.mk, Revision 1.351
1.351 ! agc 1: # $NetBSD: bsd.prefs.mk,v 1.350 2014/11/29 06:03:02 obache Exp $
1.263 rillig 2: #
3: # This file includes the mk.conf file, which contains the user settings.
4: #
5: # Packages should include this file before any of the .if directives, as
6: # well as before modifying variables like CFLAGS, LDFLAGS, and so on.
7: # Otherwise the behavior may be unexpected.
8: #
9: # When mk.conf is included by this file, the following variables are
10: # defined:
11: #
12: # ACCEPTABLE_LICENSES
13: # This variable is set to the list of Open Source licenses. See
14: # mk/license.mk for details.
15: #
16: # MACHINE_PLATFORM
17: # The platform for which the packages are built. It has the form
18: # ${OPSYS}-${OS_VERSION}-${MACHINE_ARCH}.
19: #
20: # NATIVE_MACHINE_PLATFORM
21: # The platform on which the packages are built. This is usually
22: # the same as ${MACHINE_PLATFORM}, but can be different when
23: # cross-building packages.
24: #
25: # PKGPATH
26: # The path of the package, relative to the pkgsrc top-level
27: # directory. Typical values look like editors/emacs or
28: # misc/openoffice-bin.
29: #
30: # Keywords: mk.conf user
1.1 agc 31: #
1.199 wiz 32:
1.192 rillig 33: .if !defined(BSD_PKG_MK)
1.5 tv 34:
1.7 tv 35: # Let mk.conf know that this is pkgsrc.
1.104 jlam 36: BSD_PKG_MK=1
1.7 tv 37: __PREFIX_SET__:=${PREFIX}
1.1 agc 38:
1.216 abs 39: # Set PATH if not already set
40: .if !defined(PATH)
41: PATH=/bin:/usr/bin:/sbin:/usr/sbin
42: .endif
43:
1.149 jlam 44: # Expand MAKE to a full path.
45: .if !defined(_MAKE)
46: _MAKE:= ${MAKE}
1.262 rillig 47: # allow for MAKE=./make and similar.
48: . if empty(_MAKE:M/*) && !empty(_MAKE:M*/*) && defined(PWD) && exists(${PWD}/${MAKE})
49: _MAKE:= ${PWD}/${MAKE}
50: . endif
1.149 jlam 51: . for _dir_ in ${PATH:C/\:/ /g}
52: . if empty(_MAKE:M/*)
53: . if exists(${_dir_}/${MAKE})
54: _MAKE:= ${_dir_}/${MAKE}
55: . endif
56: . endif
57: . endfor
58: . if !empty(_MAKE:M/*)
1.150 jlam 59: MAKEFLAGS+= _MAKE=${_MAKE:Q}
1.149 jlam 60: . endif
61: .endif
62: MAKE:= ${_MAKE}
63:
1.9 christos 64: .if exists(/usr/bin/uname)
65: UNAME=/usr/bin/uname
66: .elif exists(/bin/uname)
67: UNAME=/bin/uname
68: .else
69: UNAME=echo Unknown
70: .endif
71:
1.192 rillig 72: .if !defined(OPSYS)
1.331 obache 73: OPSYS:= ${:!${UNAME} -s!:S/-//g:S/\///g:C/^CYGWIN_.*$/Cygwin/}
1.215 rillig 74: MAKEFLAGS+= OPSYS=${OPSYS:Q}
1.17 mycroft 75: .endif
1.203 tv 76:
1.324 jperkin 77: # OS_VARIANT is used to differentiate operating systems which have a common
78: # basis but offer contrasting environments, for example Linux distributions
79: # or illumos forks.
80: OS_VARIANT?= # empty
81:
1.203 tv 82: # The _CMD indirection allows code below to modify these values
83: # without executing the commands at all. Later, recursed make
84: # invocations will skip these blocks entirely thanks to MAKEFLAGS.
1.192 rillig 85: .if !defined(OS_VERSION)
1.203 tv 86: _OS_VERSION_CMD= ${UNAME} -r
87: OS_VERSION= ${_OS_VERSION_CMD:sh}
1.215 rillig 88: MAKEFLAGS+= OS_VERSION=${OS_VERSION:Q}
1.66 abs 89: .endif
1.1 agc 90:
1.201 tv 91: # Preload these for architectures not in all variations of bsd.own.mk,
92: # which do not match their GNU names exactly.
1.349 joerg 93: GNU_ARCH.aarch64eb?= aarch64_be
94: GNU_ARCH.coldfire?= m5407
1.70 fredb 95: GNU_ARCH.arm26?= arm
1.7 tv 96: GNU_ARCH.arm32?= arm
1.349 joerg 97: GNU_ARCH.earm?= arm
98: GNU_ARCH.earmhf?= arm
99: GNU_ARCH.earmeb?= armeb
100: GNU_ARCH.earmhfeb?= armeb
101: GNU_ARCH.earmv4?= armv4
102: GNU_ARCH.earmv4eb?= armv4eb
103: GNU_ARCH.earmv5?= arm
104: GNU_ARCH.earmv5eb?= armeb
105: GNU_ARCH.earmv6?= armv6
106: GNU_ARCH.earmv6hf?= armv6
107: GNU_ARCH.earmv6eb?= armv6eb
108: GNU_ARCH.earmv6hfeb?= armv6eb
109: GNU_ARCH.earmv7?= armv7
110: GNU_ARCH.earmv7hf?= armv7
111: GNU_ARCH.earmv7eb?= armv7eb
112: GNU_ARCH.earmv7hfeb?= armv7eb
113: GNU_ARCH.i386?= i486
114: GNU_ARCH.i586?= i486
115: GNU_ARCH.i686?= i486
1.70 fredb 116: GNU_ARCH.m68000?= m68010
1.7 tv 117: GNU_ARCH.mips?= mipsel
1.70 fredb 118: GNU_ARCH.sh3eb?= sh
119: GNU_ARCH.sh3el?= shle
1.349 joerg 120: GNU_ARCH.mips64eb?= mips64
1.260 joerg 121: NATIVE_MACHINE_GNU_ARCH?= ${GNU_ARCH.${NATIVE_MACHINE_ARCH}:U${NATIVE_MACHINE_ARCH}}
122: MACHINE_GNU_ARCH?= ${GNU_ARCH.${MACHINE_ARCH}:U${MACHINE_ARCH}}
1.3 tv 123:
1.309 sbd 124: ## If changes are made to how OS_VERSION is set below please keep
125: ## "pkgsrc/pkgtools/osabi/INSTALL" in-sync.
1.10 agc 126: .if ${OPSYS} == "NetBSD"
127: LOWER_OPSYS?= netbsd
1.135 reed 128:
1.202 tv 129: .elif ${OPSYS} == "AIX"
130: LOWER_ARCH!= _cpuid=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $$1 }'`; \
131: if /usr/sbin/lsattr -El $$_cpuid | grep ' POWER' >/dev/null 2>&1; then \
132: echo rs6000; \
133: else \
134: echo powerpc; \
135: fi
136: MACHINE_ARCH?= ${LOWER_ARCH}
137: . if exists(/usr/bin/oslevel)
138: _OS_VERSION!= /usr/bin/oslevel
139: . else
140: _OS_VERSION!= echo `${UNAME} -v`.`${UNAME} -r`
141: . endif
1.313 sbd 142: OS_VERSION= ${_OS_VERSION:C/([0-9]*\.[0-9]*).*/\1/}
1.202 tv 143: LOWER_OPSYS_VERSUFFIX= ${_OS_VERSION}
144: LOWER_OPSYS?= aix
145: LOWER_VENDOR?= ibm
146:
1.135 reed 147: .elif ${OPSYS} == "BSDOS"
148: LOWER_OPSYS?= bsdi
1.90 grant 149:
1.331 obache 150: .elif ${OPSYS} == "Cygwin"
151: LOWER_OPSYS?= cygwin
152: LOWER_VENDOR?= pc
1.335 obache 153: . if !defined(LOWER_ARCH)
154: LOWER_ARCH!= ${UNAME} -m | sed -e 's/i.86/i386/'
155: . endif # !defined(LOWER_ARCH)
1.331 obache 156: _OS_VERSION!= ${UNAME} -r
157: OS_VERSION= ${_OS_VERSION:C/\(.*\)//}
1.332 obache 158: OS_VARIANT!= ${UNAME} -s
1.331 obache 159:
1.202 tv 160: .elif ${OPSYS} == "Darwin"
161: LOWER_OPSYS?= darwin
1.298 tron 162: .if empty(OS_VERSION:M[1-9].*.*)
1.300 tron 163: # Automatically select the ABI under Mac OS X Snow Leopard. We don't
164: # use this at the moment because too many third party programs don't
165: # work with it.
166: #
167: # _SYSCTL_HW_OPTIONAL_X86_64!= /usr/sbin/sysctl -n hw.optional.x86_64
168: # . if ${_SYSCTL_HW_OPTIONAL_X86_64} == "1"
169: # ABI= 64
170: # .else
171: # ABI= 32
172: #. endif
1.298 tron 173: ABI= 32
174: LOWER_ARCH.32= i386
175: LOWER_ARCH.64= x86_64
176: LOWER_ARCH= ${LOWER_ARCH.${ABI}}
177: .else
1.202 tv 178: LOWER_ARCH!= ${UNAME} -p
1.298 tron 179: .endif
1.202 tv 180: MACHINE_ARCH= ${LOWER_ARCH}
1.215 rillig 181: MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
1.257 joerg 182: LOWER_OPSYS_VERSUFFIX= ${LOWER_OS_VERSION:C/([0-9]*).*/\1/}
1.202 tv 183: LOWER_VENDOR?= apple
184:
185: .elif ${OPSYS} == "DragonFly"
1.218 joerg 186: OS_VERSION:= ${OS_VERSION:C/-.*$//}
1.202 tv 187: LOWER_OPSYS?= dragonfly
188: LOWER_ARCH!= ${UNAME} -p
1.299 hasso 189: . if ${LOWER_ARCH} == "amd64"
190: MACHINE_ARCH= x86_64
191: . else
1.202 tv 192: MACHINE_ARCH= ${LOWER_ARCH}
1.299 hasso 193: . endif
1.215 rillig 194: MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
1.202 tv 195: LOWER_VENDOR?= pc
196:
1.90 grant 197: .elif ${OPSYS} == "FreeBSD"
1.252 joerg 198: OS_VERSION:= ${OS_VERSION:C/-.*$//}
1.90 grant 199: LOWER_OPSYS?= freebsd
200: LOWER_ARCH!= ${UNAME} -p
1.244 tonio 201: . if ${LOWER_ARCH} == "amd64"
202: MACHINE_ARCH= x86_64
203: . else
1.90 grant 204: MACHINE_ARCH= ${LOWER_ARCH}
1.244 tonio 205: . endif
1.215 rillig 206: MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
1.257 joerg 207: LOWER_OPSYS_VERSUFFIX= ${LOWER_OS_VERSION:C/([0-9]*).*/\1/}
1.91 grant 208: . if ${LOWER_ARCH} == "i386"
1.90 grant 209: LOWER_VENDOR?= pc
1.203 tv 210: . endif
1.91 grant 211: LOWER_VENDOR?= unknown
1.58 abs 212:
1.307 obache 213: .elif ${OPSYS} == "Haiku"
214: LOWER_OPSYS?= haiku
215: . if ${MACHINE_ARCH} == "i386"
216: LOWER_VENDOR?= pc
217: . endif
218:
1.202 tv 219: .elif ${OPSYS} == "Interix"
1.272 tnn 220: LOWER_OPSYS?= interix
1.301 obache 221: LOWER_VENDOR?= pc
222: . if exists(/usr/lib/libc.so.5.2) || exists(/usr/lib/x86/libc.so.5.2)
223: LOWER_OPSYS_VERSUFFIX= ${LOWER_OS_VERSION:C/([0-9]*).*/\1/}
224: . else
1.272 tnn 225: LOWER_OPSYS_VERSUFFIX?= 3
1.301 obache 226: . if exists(/usr/lib/libc.so.3.5)
1.203 tv 227: OS_VERSION= 3.5
1.301 obache 228: . elif exists(/usr/lib/libc.so.3.1)
1.203 tv 229: OS_VERSION= 3.1
1.301 obache 230: . else
1.203 tv 231: OS_VERSION= 3.0
1.301 obache 232: . endif
1.203 tv 233: . endif
1.176 wiz 234:
1.312 agc 235: .elif ${OPSYS} == "MirBSD"
236: LOWER_OPSYS?= mirbsd
237: LOWER_OS_VERSION= ${OS_VERSION}
238: LOWER_OPSYS_VERSUFFIX= ${OS_VERSION}
239: LOWER_ARCH!= arch -s
240: LOWER_VENDOR?= unknown
241: MACHINE_ARCH= ${LOWER_ARCH}
242: MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
243:
1.202 tv 244: .elif !empty(OPSYS:MIRIX*)
1.112 grant 245: LOWER_ARCH!= ${UNAME} -p
1.272 tnn 246: LOWER_OPSYS?= irix
247: LOWER_OPSYS_VERSUFFIX?= ${OS_VERSION}
1.202 tv 248: LOWER_VENDOR?= sgi
1.58 abs 249:
1.10 agc 250: .elif ${OPSYS} == "Linux"
1.270 joerg 251: OS_VERSION:= ${OS_VERSION:C/-.*$//}
1.10 agc 252: LOWER_OPSYS?= linux
1.102 jschauma 253: . if !defined(LOWER_ARCH)
1.175 martti 254: LOWER_ARCH!= ${UNAME} -m | sed -e 's/i.86/i386/' -e 's/ppc/powerpc/'
1.102 jschauma 255: . endif # !defined(LOWER_ARCH)
1.35 abs 256: MACHINE_ARCH= ${LOWER_ARCH}
1.215 rillig 257: MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
1.106 jschauma 258: . if exists(/etc/debian_version)
259: LOWER_VENDOR?= debian
260: . elif exists(/etc/mandrake-release)
261: LOWER_VENDOR?= mandrake
1.343 jperkin 262: . elif exists(/etc/redhat-version) || exists(/etc/redhat-release)
1.106 jschauma 263: LOWER_VENDOR?= redhat
264: . elif exists(/etc/slackware-version)
265: LOWER_VENDOR?= slackware
1.303 obache 266: . elif exists(/etc/ssdlinux_version)
267: LOWER_VENDOR?= ssd
1.106 jschauma 268: . elif ${LOWER_ARCH} == "i386"
269: LOWER_VENDOR?= pc
1.203 tv 270: . endif
1.106 jschauma 271: LOWER_VENDOR?= unknown
1.12 christos 272:
1.177 grant 273: .elif ${OPSYS} == "OSF1"
274: LOWER_ARCH!= ${UNAME} -p
1.215 rillig 275: MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
1.177 grant 276: MACHINE_ARCH?= ${LOWER_ARCH}
1.203 tv 277: OS_VERSION:= ${OS_VERSION:C/^V//}
1.271 tnn 278: LOWER_OPSYS?= osf1
279: LOWER_OPSYS_VERSUFFIX?= ${OS_VERSION}
1.177 grant 280: LOWER_VENDOR?= dec
281:
1.247 tnn 282: .elif ${OPSYS} == "HPUX"
283: OS_VERSION:= ${OS_VERSION:C/^B.//}
284: .if ${MACHINE_ARCH} == "9000"
285: MACHINE_ARCH= hppa
286: .endif
1.271 tnn 287: LOWER_OPSYS?= hpux
288: LOWER_OPSYS_VERSUFFIX?= ${OS_VERSION}
289: LOWER_VENDOR?= hp
1.247 tnn 290:
1.202 tv 291: .elif ${OPSYS} == "SunOS"
1.325 jperkin 292: ABI?= 32
1.202 tv 293: . if ${MACHINE_ARCH} == "sparc"
294: SPARC_TARGET_ARCH?= sparcv7
295: . elif ${MACHINE_ARCH} == "sun4"
296: MACHINE_ARCH= sparc
297: SPARC_TARGET_ARCH?= sparcv7
1.322 jperkin 298: . elif ${MACHINE_ARCH} == "i86pc" || ${MACHINE_ARCH} == "i86xpv" || ${MACHINE_ARCH} == "i386"
299: LOWER_ARCH.32= i386
300: LOWER_ARCH.64= x86_64
301: LOWER_ARCH= ${LOWER_ARCH.${ABI}}
302: MACHINE_ARCH= ${LOWER_ARCH}
1.202 tv 303: . elif ${MACHINE_ARCH} == "unknown"
304: . if !defined(LOWER_ARCH)
305: LOWER_ARCH!= ${UNAME} -p
306: . endif # !defined(LOWER_ARCH)
1.215 rillig 307: MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q}
1.181 grant 308: . endif
1.202 tv 309: LOWER_VENDOR?= sun
310: LOWER_OPSYS?= solaris
1.318 hans 311: LOWER_OPSYS_VERSUFFIX= 2.${OS_VERSION:C/5.//}
1.324 jperkin 312: _UNAME_V!= ${UNAME} -v
313: . if !empty(_UNAME_V:Mjoyent_*)
314: OS_VARIANT= SmartOS
1.342 ryoon 315: . elif !empty(_UNAME_V:Momnios-*)
1.337 ryoon 316: OS_VARIANT= OmniOS
1.324 jperkin 317: . endif
1.181 grant 318:
1.344 ryoon 319: .elif ${OPSYS} == "SCO_SV"
320: SCO_RELEASE!= ${UNAME} -r
321: SCO_VERSION!= ${UNAME} -v
322: LOWER_VENDOR?= pc
1.350 obache 323: LOWER_OPSYS?= sco
324: LOWER_OPSYS_VERSUFFIX= ${SCO_RELEASE}v${SCO_VERSION}
1.344 ryoon 325: _UNAME_V!= ${UNAME} -v
326: . if !empty(_UNAME_V:M5.0*)
327: OS_VARIANT= SCOOSR5
328: . elif !empty(_UNAME_V:M6.0*)
329: OS_VARIANT= SCOOSR6
330: . endif
331:
1.334 tcort 332: .elif ${OPSYS} == "Minix"
333: LOWER_VENDOR?= pc
334: LOWER_OPSYS:= ${OPSYS:tl}
335: LDFLAGS+= -lcompat_minix -lminlib
336:
1.10 agc 337: .elif !defined(LOWER_OPSYS)
1.277 tnn 338: LOWER_OPSYS:= ${OPSYS:tl}
1.17 mycroft 339: .endif
1.58 abs 340:
1.203 tv 341: # Now commit the [LOWER_]OS_VERSION values computed above, eliding the :sh
342: OS_VERSION:= ${OS_VERSION}
1.277 tnn 343: LOWER_OS_VERSION:= ${OS_VERSION:tl}
1.203 tv 344:
1.215 rillig 345: MAKEFLAGS+= LOWER_OPSYS=${LOWER_OPSYS:Q}
1.7 tv 346:
1.260 joerg 347: LOWER_VENDOR?= # empty ("arch--opsys")
348: LOWER_ARCH?= ${MACHINE_GNU_ARCH}
349: # Expand now as MACHINE_ARCH can be overriden in mk.conf and
350: # LOWER_ARCH is typically derived from it.
351: NATIVE_LOWER_ARCH:= ${LOWER_ARCH}
352: NATIVE_MACHINE_ARCH:= ${MACHINE_ARCH}
353:
354: NATIVE_MACHINE_PLATFORM?= ${OPSYS}-${OS_VERSION}-${NATIVE_MACHINE_ARCH}
355: MACHINE_PLATFORM?= ${OPSYS}-${OS_VERSION}-${MACHINE_ARCH}
1.308 sbd 356: NATIVE_MACHINE_GNU_PLATFORM?= ${NATIVE_MACHINE_GNU_ARCH}-${LOWER_VENDOR}-${LOWER_OPSYS:C/[0-9]//g}${APPEND_ELF}${LOWER_OPSYS_VERSUFFIX}
357: MACHINE_GNU_PLATFORM?= ${MACHINE_GNU_ARCH}-${LOWER_VENDOR}-${LOWER_OPSYS:C/[0-9]//g}${APPEND_ELF}${LOWER_OPSYS_VERSUFFIX}
1.59 agc 358:
1.152 grant 359: # Needed to prevent an "install:" target from being created in bsd.own.mk.
1.60 tron 360: NEED_OWN_INSTALL_TARGET=no
1.65 tv 361:
362: # This prevents default use of the cross-tool harness in the "src" tree,
363: # in the odd possible case of someone extracting "pkgsrc" underneath "src".
364: USETOOLS= no
365: MAKE_ENV+= USETOOLS=no
1.71 schmonz 366:
367: # Set this before <bsd.own.mk> does, since it doesn't know about Darwin
368: .if ${OPSYS} == "Darwin"
369: OBJECT_FMT?= Mach-O
370: .endif
1.60 tron 371:
1.273 rillig 372: ACCEPTABLE_LICENSES?= ${DEFAULT_ACCEPTABLE_LICENSES}
1.263 rillig 373:
1.259 joerg 374: # Provide PKGPATH early on so that mk.conf can use it.
375: PKGPATH?= ${.CURDIR:C|.*/([^/]*/[^/]*)$|\1|}
376:
1.205 rillig 377: # Load the settings from MAKECONF, which is /etc/mk.conf by default.
1.73 jlam 378: .include <bsd.own.mk>
379:
1.72 jlam 380: # /usr/share/mk/bsd.own.mk on NetBSD 1.3 does not define OBJECT_FMT
1.134 grant 381: .if !empty(MACHINE_PLATFORM:MNetBSD-1.3*)
1.126 grant 382: . if ${MACHINE_ARCH} == "alpha" || \
383: ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
384: ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64"
1.72 jlam 385: OBJECT_FMT?= ELF
1.126 grant 386: . else
1.72 jlam 387: OBJECT_FMT?= a.out
1.134 grant 388: . endif
389: # override what bootstrap-pkgsrc sets, which isn't right for NetBSD
390: # 1.4.
391: # XXX other ELF platforms in 1.4 need to be added to here.
392: .elif !empty(MACHINE_PLATFORM:MNetBSD-1.4*)
393: . if ${MACHINE_ARCH} == "alpha" || \
394: ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
395: ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64"
396: OBJECT_FMT= ELF
397: . else
398: OBJECT_FMT= a.out
1.127 itojun 399: . endif
400: .endif
401:
402: .if ${OPSYS} == "OpenBSD"
403: . if defined(ELF_TOOLCHAIN) && ${ELF_TOOLCHAIN} == "yes"
404: OBJECT_FMT?= ELF
405: . else
406: OBJECT_FMT?= a.out
1.126 grant 407: . endif
1.345 asau 408: .elif ${OPSYS} == "FreeBSD"
409: OBJECT_FMT?= ELF
1.182 grant 410: .elif ${OPSYS} == "DragonFly"
411: OBJECT_FMT= ELF
1.312 agc 412: .elif ${OPSYS} == "MirBSD"
413: OBJECT_FMT= ELF
414: MKPROFILE= no
1.182 grant 415: .elif ${OPSYS} == "AIX"
416: OBJECT_FMT= XCOFF
1.246 tnn 417: .elif ${OPSYS} == "OSF1"
418: OBJECT_FMT= ECOFF
1.247 tnn 419: .elif ${OPSYS} == "HPUX"
420: . if ${MACHINE_ARCH} == "ia64" || (defined(ABI) && ${ABI} == "64")
421: OBJECT_FMT= ELF
422: . else
423: OBJECT_FMT= SOM
424: . endif
1.331 obache 425: .elif ${OPSYS} == "Cygwin"
426: OBJECT_FMT= PE
1.176 wiz 427: .endif
428:
1.167 jlam 429: # Calculate depth
1.170 jlam 430: .if exists(${.CURDIR}/mk/bsd.pkg.mk)
1.171 jlam 431: _PKGSRC_TOPDIR= ${.CURDIR}
1.167 jlam 432: .elif exists(${.CURDIR}/../mk/bsd.pkg.mk)
1.171 jlam 433: _PKGSRC_TOPDIR= ${.CURDIR}/..
1.170 jlam 434: .elif exists(${.CURDIR}/../../mk/bsd.pkg.mk)
1.171 jlam 435: _PKGSRC_TOPDIR= ${.CURDIR}/../..
1.167 jlam 436: .endif
437:
1.59 agc 438: # include the defaults file
1.263 rillig 439: .include "${_PKGSRC_TOPDIR}/mk/defaults/mk.conf"
1.70 fredb 440:
1.7 tv 441: SHAREOWN?= ${DOCOWN}
442: SHAREGRP?= ${DOCGRP}
443: SHAREMODE?= ${DOCMODE}
1.1 agc 444:
1.3 tv 445: .if defined(PREFIX) && (${PREFIX} != ${__PREFIX_SET__})
1.2 tv 446: .BEGIN:
1.233 schwarz 447: @${ECHO_MSG} "You CANNOT set PREFIX manually or in mk.conf. Set LOCALBASE or X11BASE"
448: @${ECHO_MSG} "depending on your needs. See the pkg system documentation for more info."
1.2 tv 449: @${FALSE}
1.14 itojun 450: .endif
451:
1.42 skrll 452: # Load the OS-specific definitions for program variables. Default to loading
453: # the NetBSD ones if an OS-specific file doesn't exist.
1.171 jlam 454: .if exists(${_PKGSRC_TOPDIR}/mk/platform/${OPSYS}.mk)
455: . include "${_PKGSRC_TOPDIR}/mk/platform/${OPSYS}.mk"
1.179 tv 456: .else
1.171 jlam 457: . include "${_PKGSRC_TOPDIR}/mk/platform/NetBSD.mk"
1.179 tv 458: PKG_FAIL_REASON+= "missing mk/platform/${OPSYS}.mk"
1.97 schmonz 459: .endif
460:
1.160 tv 461: PKGDIRMODE?= 755
1.140 jlam 462:
1.284 joerg 463: # A meta-package is a package that does not have any files and whose
464: # only purpose is to depend on other packages, giving that collection
465: # a simple name.
466: #
1.285 joerg 467: # This variable must be set before including bsd.prefs.mk directly or
468: # indirectly.
469: #
1.284 joerg 470: # Keywords: meta meta-package META_PACKAGE
471: #
472: .if defined(META_PACKAGE)
473: PKG_DESTDIR_SUPPORT= user-destdir
474: NO_CONFIGURE= yes
475: NO_BUILD= yes
476: DISTFILES= # none
477: PLIST_SRC= # none
1.289 joerg 478: CHECK_PERMS= no
1.290 joerg 479: USE_LANGUAGES= # empty
1.284 joerg 480: do-patch:
481: @${DO_NADA}
482: do-install:
483: @${DO_NADA}
484: .endif
485:
1.314 wiz 486: # After 2011Q1, the default is to use DESTDIR.
487: USE_DESTDIR?= yes
1.326 asau 488: # PKG_DESTDIR_SUPPORT can only be one of "none", "destdir", or "user-destdir".
1.327 asau 489: PKG_DESTDIR_SUPPORT?= user-destdir
1.241 joerg 490:
1.326 asau 491: .if ${PKG_DESTDIR_SUPPORT} == "none" || empty(USE_DESTDIR:M[Yy][Ee][Ss])
1.293 wiz 492: . if empty(USE_DESTDIR:M[Yy][Ee][Ss]) && empty(USE_DESTDIR:M[Nn][Oo])
1.292 joerg 493: PKG_FAIL_REASON+= "USE_DESTDIR must be either \`\`yes'' or \`\`no''"
494: . endif
1.241 joerg 495: _USE_DESTDIR= no
496: .elif ${PKG_DESTDIR_SUPPORT} == "user-destdir"
497: _USE_DESTDIR= user-destdir
498: .elif ${PKG_DESTDIR_SUPPORT} == "destdir"
499: _USE_DESTDIR= destdir
500: .else
1.326 asau 501: PKG_FAIL_REASON+= "PKG_DESTDIR_SUPPORT must be \`\`none'', \`\`destdir'', or \`\`user-destdir''."
1.241 joerg 502: .endif
503:
1.314 wiz 504: # This stanza serves to warn the user; deciding to not build
505: # non-DESTDIR-capable packages when not in DESTDIR mode is above.
1.326 asau 506: .if ${PKG_DESTDIR_SUPPORT} == "none"
1.304 dholland 507: WARNINGS+= "[bsd.prefs.mk] The package ${PKGNAME} is missing DESTDIR support."
1.294 joerg 508: .endif
509:
1.241 joerg 510: # When using staged installation, everything gets installed into
511: # ${DESTDIR}${PREFIX} instead of ${PREFIX} directly.
512: #
513: .if ${_USE_DESTDIR} != "no"
514: DESTDIR= ${WRKDIR}/.destdir
515: . if ${_USE_DESTDIR} == "destdir"
516: _MAKE_PACKAGE_AS_ROOT= yes
517: _MAKE_CLEAN_AS_ROOT= yes
518: _MAKE_INSTALL_AS_ROOT= yes
519: . elif ${_USE_DESTDIR} == "user-destdir"
520: _MAKE_PACKAGE_AS_ROOT= no
521: _MAKE_CLEAN_AS_ROOT= no
522: _MAKE_INSTALL_AS_ROOT= no
523: . endif
524: .else
525: DESTDIR=
526: .endif
527:
1.351 ! agc 528: # controls whether binary packages are preserved in pkgsrc/packages/All
! 529: # default is no (to preserve settings since 2013/05/23, prior to that it
! 530: # was yes)
! 531: _KEEP_BIN_PKGS?= no
! 532: .if !empty(PKGSRC_KEEP_BIN_PKGS:M[Yy][Ee][Ss])
! 533: _KEEP_BIN_PKGS= yes
! 534: .endif
! 535:
1.239 joerg 536: _MAKE_CLEAN_AS_ROOT?= no
537: # Whether to run the clean target as root.
1.240 joerg 538: _MAKE_INSTALL_AS_ROOT?= yes
539: # Whether to run the install target as root.
1.239 joerg 540: _MAKE_PACKAGE_AS_ROOT?= yes
541: # Whether to run the package target as root.
542:
1.261 joerg 543: # When cross-compilation support is requested, the following options
544: # must be specified as well or guessable:
545: # - MACHINE_ARCH is set to TARGET_ARCH if set.
546: # - CROSS_DESTDIR is guessed from MAKEOBJDIR and MACHINE_ARCH.
547: # - PKG_DBDIR is expanded and prefixed with CROSS_DESTDIR
548: # - DESTDIR support is required
549: #
550: # _CROSS_DESTDIR is set for internal use to avoid conditionalising
551: # the use.
552:
553: .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
554: . if defined(TARGET_ARCH)
555: MACHINE_ARCH= ${TARGET_ARCH}
556: . endif
557: CROSS_DESTDIR?= ${MAKEOBJDIR}/destdir.${MACHINE_ARCH}
558: . if !exists(${CROSS_DESTDIR}/usr/include/stddef.h)
559: PKG_FAIL_REASON+= "The cross-compiling root ${CROSS_DESTDIR:Q} is incomplete"
560: . else
561: _CROSS_DESTDIR= ${CROSS_DESTDIR}
562: . endif
563: .endif
564:
1.264 joerg 565: # Depends on MACHINE_ARCH override above
566: .if ${OPSYS} == "NetBSD"
567: . if ${OBJECT_FMT} == "ELF" && \
568: (${MACHINE_GNU_ARCH} == "arm" || \
569: ${MACHINE_ARCH} == "i386" || \
570: ${MACHINE_ARCH} == "m68k" || \
571: ${MACHINE_ARCH} == "m68000" || \
572: ${MACHINE_GNU_ARCH} == "sh" || \
573: ${MACHINE_GNU_ARCH} == "shle" || \
574: ${MACHINE_ARCH} == "sparc" || \
575: ${MACHINE_ARCH} == "vax")
576: APPEND_ELF= elf
577: . endif
578: .endif
579:
1.206 rillig 580: PKG_INSTALLATION_TYPES?= overwrite
581: # This is a whitespace-separated list of installation types supported
582: # by the package.
583: #
584: # *NOTE*: This variable *must* be set in the package Makefile *before*
585: # the inclusion of bsd.prefs.mk.
586: #
587: # Possible: any of: overwrite, pkgviews
588: # Default: overwrite
589:
1.142 jlam 590: # Set the style of installation to be performed for the package. The
591: # funky make variable modifiers just select the first word of the value
592: # stored in the referenced variable.
593: #
594: .for _pref_ in ${PKG_INSTALLATION_PREFS}
595: . if !empty(PKG_INSTALLATION_TYPES:M${_pref_})
596: PKG_INSTALLATION_TYPE?= ${PKG_INSTALLATION_TYPES:M${_pref_}:S/^/_pkginsttype_/1:M_pkginsttype_*:S/^_pkginsttype_//}
597: . endif
598: .endfor
599: PKG_INSTALLATION_TYPE?= none
600:
1.97 schmonz 601: # if the system is IPv6-ready, compile with IPv6 support turned on.
1.267 jlam 602: .if empty(_OPSYS_HAS_INET6:M[nN][oO])
603: IPV6_READY= YES
1.136 tron 604: .else
1.267 jlam 605: IPV6_READY= NO
1.136 tron 606: .endif
1.22 agc 607:
1.238 joerg 608: LOCALBASE?= /usr/pkg
1.316 abs 609: X11_TYPE?= modular
1.232 schwarz 610: .if !empty(X11_TYPE:Mnative)
1.217 markd 611: . if ${OPSYS} == "SunOS"
1.87 jlam 612: # On Solaris, we default to using OpenWindows for X11.
1.238 joerg 613: X11BASE?= /usr/openwin
1.333 obache 614: . elif ${OPSYS} == "Cygwin" || ${OPSYS} == "IRIX" || ${OPSYS} == "OSF1" || ${OPSYS} == "HPUX"
1.238 joerg 615: X11BASE?= /usr
1.295 tron 616: . elif !empty(MACHINE_PLATFORM:MDarwin-9.*-*) || \
1.330 tron 617: !empty(MACHINE_PLATFORM:MDarwin-10.*-*) || \
618: !empty(MACHINE_PLATFORM:MDarwin-11.*-*)
1.287 tron 619: X11BASE?= /usr/X11
1.330 tron 620: . elif !empty(MACHINE_PLATFORM:MDarwin-??.*-*)
621: X11BASE?= /opt/X11
1.319 jmcneill 622: . elif ${OPSYS} == "NetBSD" && ${X11FLAVOUR:U} == "Xorg"
623: X11BASE?= /usr/X11R7
1.288 cube 624: . elif exists(/usr/X11R7/lib/libX11.so)
625: X11BASE?= /usr/X11R7
1.341 jperkin 626: . elif exists(/usr/lib/libX11.so) || exists(/usr/lib64/libX11.so)
627: X11BASE?= /usr
1.217 markd 628: . else
1.238 joerg 629: X11BASE?= /usr/X11R6
1.217 markd 630: . endif
1.87 jlam 631: .endif
1.163 xtraeme 632: CROSSBASE?= ${LOCALBASE}/cross
1.77 rh 633:
1.276 tnn 634: .if defined(FIX_SYSTEM_HEADERS) && ${FIX_SYSTEM_HEADERS} == "yes" && \
1.286 tnn 635: !defined(BOOTSTRAP_PKG) && \
1.283 tnn 636: exists(../../pkgtools/compat_headers/buildlink3.mk)
637: . include "../../pkgtools/compat_headers/buildlink3.mk"
1.276 tnn 638: .endif
639:
1.265 joerg 640: .if ${X11_TYPE} == "modular"
1.243 joerg 641: X11BASE= ${LOCALBASE}
1.204 reed 642: .endif
643:
1.77 rh 644: X11PREFIX= ${LOCALBASE}
645:
1.236 joerg 646: # Default directory for font encodings
1.329 markd 647: .if ${X11_TYPE} == "modular"
1.328 wiz 648: X11_ENCODINGSDIR?= ${X11BASE}/share/fonts/X11/encodings
1.329 markd 649: .else
650: X11_ENCODINGSDIR?= ${X11BASE}/lib/X11/fonts/encodings
651: .endif
1.236 joerg 652:
1.338 jperkin 653: CATMAN_SECTION_SUFFIX?= no
654:
1.321 joerg 655: IMAKE_MAN_SOURCE_PATH= man/man
656: IMAKE_MAN_SUFFIX= 1
657: IMAKE_LIBMAN_SUFFIX= 3
658: IMAKE_KERNMAN_SUFFIX= 4
659: IMAKE_FILEMAN_SUFFIX= 5
660: IMAKE_GAMEMAN_SUFFIX= 6
661: IMAKE_MISCMAN_SUFFIX= 7
662: IMAKE_MAN_DIR= ${IMAKE_MAN_SOURCE_PATH}1
663: IMAKE_LIBMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}3
664: IMAKE_KERNMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}4
665: IMAKE_FILEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}5
666: IMAKE_GAMEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}6
667: IMAKE_MISCMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}7
668: IMAKE_MANNEWSUFFIX= ${IMAKE_MAN_SUFFIX}
669: IMAKE_MANINSTALL?= maninstall
670:
1.122 jlam 671: DEPOT_SUBDIR?= packages
672: DEPOTBASE= ${LOCALBASE}/${DEPOT_SUBDIR}
673:
1.165 jlam 674: # LINK_RPATH_FLAG publicly exports the linker flag used to set the
675: # run-time library search path.
1.107 jlam 676: #
1.165 jlam 677: .if defined(_OPSYS_LINKER_RPATH_FLAG)
678: LINKER_RPATH_FLAG= ${_OPSYS_LINKER_RPATH_FLAG}
679: .else
680: LINKER_RPATH_FLAG?= ${_LINKER_RPATH_FLAG}
681: .endif
682:
683: # COMPILER_RPATH_FLAG publicly exports the compiler flag used to pass
684: # run-time library search path directives to the linker.
685: #
686: .if defined(_OPSYS_COMPILER_RPATH_FLAG)
687: COMPILER_RPATH_FLAG= ${_OPSYS_COMPILER_RPATH_FLAG}
688: .else
689: COMPILER_RPATH_FLAG?= ${_COMPILER_RPATH_FLAG}
690: .endif
1.110 grant 691:
1.336 obache 692: COMPILER_INCLUDE_DIRS?= ${_OPSYS_INCLUDE_DIRS:U/usr/include}
693: COMPILER_LIB_DIRS?= ${_OPSYS_LIB_DIRS:U/usr/lib${LIBABISUFFIX} /lib${LIBABISUFFIX}}
694: SYSTEM_DEFAULT_RPATH?= ${_OPSYS_SYSTEM_RPATH:U/usr/lib}
695:
1.110 grant 696: # WHOLE_ARCHIVE_FLAG and NO_WHOLE_ARCHIVE_FLAG publically export the
697: # linker flags to extract all symbols from a static archive.
1.263 rillig 698: #
1.110 grant 699: WHOLE_ARCHIVE_FLAG?= ${_OPSYS_WHOLE_ARCHIVE_FLAG}
700: NO_WHOLE_ARCHIVE_FLAG?= ${_OPSYS_NO_WHOLE_ARCHIVE_FLAG}
1.26 agc 701:
1.227 jlam 702: USE_TOOLS?= # empty
703:
704: # Provide default values for TOOLs used by the top-level make.
705: USE_TOOLS+= [ awk dirname echo grep pwd sed test true
706:
707: # These tools are used by the top-level make only in certain packages and
708: # should eventually be moved into those particular package Makefiles.
709: #
710: USE_TOOLS+= date tr
711:
712: # These are tools used directly by bsd.prefs.mk and files included by
713: # bsd.prefs.mk.
714: #
715: USE_TOOLS+= awk:pkgsrc cut:pkgsrc echo:pkgsrc pwd:pkgsrc \
716: sed:pkgsrc tr:pkgsrc uname:pkgsrc
717:
718: .include "${_PKGSRC_TOPDIR}/mk/tools/defaults.mk"
719:
1.339 tron 720: .if ${FETCH_USING} == "auto"
721: . if defined(TOOLS_PLATFORM.fetch)
722: FETCH_USING= fetch
723: . elif defined(TOOLS_PLATFORM.curl)
724: FETCH_USING= curl
1.340 obache 725: . elif defined(TOOLS_PLATFORM.wget)
726: FETCH_USING= wget
1.339 tron 727: . else
728: FETCH_USING= ftp
729: . endif
730: .endif
731:
1.173 jlam 732: .if !defined(_PKGSRCDIR)
733: _PKGSRCDIR!= cd ${_PKGSRC_TOPDIR} && ${PWD_CMD}
734: MAKEFLAGS+= _PKGSRCDIR=${_PKGSRCDIR:Q}
1.171 jlam 735: .endif
1.173 jlam 736: PKGSRCDIR= ${_PKGSRCDIR}
1.82 jlam 737:
1.226 jlam 738: DISTDIR?= ${PKGSRCDIR}/distfiles
1.171 jlam 739: PACKAGES?= ${PKGSRCDIR}/packages
740: TEMPLATES?= ${PKGSRCDIR}/templates
1.82 jlam 741:
1.226 jlam 742: PATCHDIR?= ${.CURDIR}/patches
1.82 jlam 743: FILESDIR?= ${.CURDIR}/files
744: PKGDIR?= ${.CURDIR}
1.120 gavan 745:
746: _PKGSRC_DEPS?= # empty
1.310 sbd 747: _BUILTIN_PKGS?= # empty
1.82 jlam 748:
749: # If WRKOBJDIR is set, use that tree to build
1.88 jlam 750: .if defined(WRKOBJDIR)
1.82 jlam 751: BUILD_DIR?= ${WRKOBJDIR}/${PKGPATH}
752: .else
1.105 jlam 753: BUILD_DIR!= cd ${.CURDIR} && ${PWD_CMD}
754: .endif
1.82 jlam 755:
756: # If OBJHOSTNAME is set, use first component of hostname in directory name.
757: # If OBJMACHINE is set, use ${MACHINE_ARCH} in the working directory name.
758: #
759: .if defined(OBJHOSTNAME)
760: . if !defined(_HOSTNAME)
1.93 wiz 761: _HOSTNAME!= ${UNAME} -n
1.215 rillig 762: MAKEFLAGS+= _HOSTNAME=${_HOSTNAME:Q}
1.82 jlam 763: . endif
764: WRKDIR_BASENAME?= work.${_HOSTNAME:C|\..*||}
1.215 rillig 765: MAKEFLAGS+= OBJHOSTNAME=${OBJHOSTNAME:Q}
1.82 jlam 766: .elif defined(OBJMACHINE)
767: WRKDIR_BASENAME?= work.${MACHINE_ARCH}
1.215 rillig 768: MAKEFLAGS+= OBJMACHINE=${OBJMACHINE:Q}
1.82 jlam 769: .else
770: WRKDIR_BASENAME?= work
1.93 wiz 771: .endif
1.82 jlam 772:
773: WRKDIR?= ${BUILD_DIR}/${WRKDIR_BASENAME}
1.119 jlam 774:
775: # There are many uses for a common log file, so define one that may be
1.162 wiz 776: # picked up and used by tools.mk, bsd.buildlink3.mk, etc.
1.119 jlam 777: #
778: WRKLOG?= ${WRKDIR}/.work.log
1.128 grant 779:
1.164 jlam 780: PKG_DEFAULT_OPTIONS?= # empty
781: PKG_OPTIONS?= # empty
782:
1.178 tv 783: # we want this *before* compiler.mk, so that compiler.mk paths override them
1.242 joerg 784: .if ${X11_TYPE} != "modular" && defined(USE_X11)
785: PREPEND_PATH+= ${X11BASE}/bin
786: .endif
787: PREPEND_PATH+= ${LOCALBASE}/bin
1.178 tv 788:
1.347 jperkin 789: # Support alternative init systems.
790: #
791: INIT_SYSTEM?= rc.d
792: _BUILD_DEFS+= INIT_SYSTEM
793:
1.168 jlam 794: # Wrapper framework definitions
1.274 rillig 795: .include "wrapper/wrapper-defs.mk"
1.168 jlam 796:
1.254 jlam 797: # Binary emulator framework definitions
798: .if defined(EMUL_PLATFORMS) && !empty(EMUL_PLATFORMS)
1.274 rillig 799: . include "emulator/emulator-vars.mk"
1.254 jlam 800: .endif
801:
1.266 jlam 802: # System features framework
1.274 rillig 803: .include "features/features-vars.mk"
1.266 jlam 804:
1.317 reed 805: # Package system format definitions
806: .include "pkgformat/bsd.pkgformat-vars.mk"
1.226 jlam 807:
1.194 jlam 808: # Make variable definitions cache
1.274 rillig 809: .include "bsd.makevars.mk"
1.194 jlam 810:
1.231 jlam 811: # If MAKECONF is defined, then pass it down to all recursive make
812: # processes invoked by pkgsrc.
813: #
814: PKGSRC_MAKE_ENV+= ${MAKECONF:DMAKECONF=${MAKECONF:Q}}
1.315 abs 815: RECURSIVE_MAKE= ${PKGSRC_SETENV} ${PKGSRC_MAKE_ENV} ${MAKE}
1.231 jlam 816:
1.269 rillig 817: _VARGROUPS+= dirs
818: _USER_VARS.dirs= DISTDIR LOCALBASE PACKAGES PKG_SYSCONFDIR WRKOBJDIR
819: _PKG_VARS.dirs= WRKSRC PATCHDIR FILESDIR PKGDIR
820: _SYS_VARS.dirs= WRKDIR DESTDIR PKG_SYSCONFBASEDIR
821:
1.302 joerg 822: # List of 64bit operating systems with sizeof(int) != sizeof(void *).
823: # This can be used for software that is not 64bit clean.
1.346 ryoon 824: # amd64 is for OpenBSD.
1.302 joerg 825: #
826: # Keywords: ONLY_FOR_PLATFORM NOT_FOR_PLATFORM 64bit
827: #
1.346 ryoon 828: LP64PLATFORMS= *-*-alpha *-*-sparc64 *-*-x86_64 *-*-amd64
1.302 joerg 829:
1.104 jlam 830: .endif # BSD_PKG_MK
CVSweb <webmaster@jp.NetBSD.org>