1 # $NetBSD: bsd.pkg.mk,v 1.1987 2013/02/22 13:35:27 obache Exp $
3 # This file is in the public domain.
5 # Please see the pkgsrc/doc/guide manual for details on the
6 # variables used in this make file template.
8 # Default sequence for "all" is:
22 .
include "misc/common.mk"
24 ############################################################################
25 # Transform package Makefile variables and set defaults
26 # This is the early set used directly or indirectly in
27 # the phase variables.
28 ############################################################################
30 ##### PKGBASE, PKGNAME[_NOREV], PKGVERSION
32 PKGBASE?
= ${PKGNAME
:C
/-[^
-]*$//}
33 PKGVERSION?
= ${PKGNAME
:C
/^.
*-//}
34 .if defined
(PKGREVISION
) && !empty
(PKGREVISION
) && (${PKGREVISION} != "0")
36 PKGNAME_NOREV
:= ${PKGNAME}
37 PKGNAME
:= ${PKGNAME}nb
${PKGREVISION}
39 PKGNAME?
= ${DISTNAME}nb
${PKGREVISION}
40 PKGNAME_NOREV
= ${DISTNAME}
44 PKGNAME_NOREV
= ${PKGNAME}
46 PKGVERSION_NOREV
= ${PKGNAME_NOREV
:C
/^.
*-//}
48 # Fail-safe in the case of circular dependencies
49 .if defined
(_PKGSRC_DEPS
) && defined
(PKGNAME
) && !empty
(_PKGSRC_DEPS
:M
${PKGNAME})
50 PKG_FAIL_REASON
+= "Circular dependency detected"
55 ############################################################################
56 # Allow various phases to define the default variables
57 ############################################################################
58 .if defined
(EMUL_PLATFORMS
) && !empty
(EMUL_PLATFORMS
)
59 .
include "emulator/emulator.mk"
62 .
include "features/features.mk"
64 .
include "pkgformat/bsd.pkgformat-vars.mk"
65 .
include "check/bsd.check-vars.mk"
66 .
include "depends/bsd.depends-vars.mk"
67 .
include "fetch/bsd.fetch-vars.mk"
68 .
include "checksum/bsd.checksum-vars.mk"
69 .
include "extract/bsd.extract-vars.mk"
70 .
include "patch/bsd.patch-vars.mk"
71 .
include "configure/bsd.configure-vars.mk"
72 .
include "build/bsd.build-vars.mk"
73 .
include "install/bsd.install-vars.mk"
75 .
include "bsd.pkg.error.mk"
77 .
include "bsd.hacks.mk"
79 ############################################################################
80 # Transform package Makefile variables and set defaults
81 ############################################################################
83 MKCRYPTO?
= YES
# build crypto packages by default
87 BUILD_DEPENDS?
= # empty
88 COMMENT?
= (no description
)
90 DESCR_SRC?
= ${PKGDIR}/DESCR
91 INTERACTIVE_STAGE?
= none
95 MAINTAINER?
= pkgsrc-users@NetBSD.org
97 PKGWILDCARD?
= ${PKGBASE}-[0-9]*
98 SVR4_PKGNAME?
= ${PKGNAME}
99 WRKSRC?
= ${WRKDIR}/${DISTNAME}
101 # Override for SU_CMD user check
102 _IS_ROOT_CMD?
= ${TEST} `${ID} -u` = `${ID} -u ${_SU_ROOT_USER}`
103 _SU_ROOT_USER?
= ${ROOT_USER}
104 REAL_ROOT_USER?
= ${ROOT_USER}
105 REAL_ROOT_GROUP?
= ${ROOT_GROUP}
107 .if
(defined
(INSTALL_UNSTRIPPED
) && !empty
(INSTALL_UNSTRIPPED
:M
[yY
][eE
][sS
])) || defined
(DEBUG_FLAGS
)
108 _INSTALL_UNSTRIPPED
= # set (flag used by platform/*.mk)
111 ##### Transform USE_* into dependencies
113 .
include "bsd.pkg.use.mk"
115 ############################################################################
117 ############################################################################
119 .if defined
(BUILDLINK_DEPTH
) || defined
(BUILDLINK_PACKAGES
) || \
120 defined
(BUILDLINK_DEPENDS
) || defined
(BUILDLINK_ORDER
)
121 PKG_FAIL_REASON
+= "Out-dated buildlink3.mk detected, please update"
124 # PKG_INSTALLATION_TYPE can only be one of two values: "pkgviews" or
126 .if
(${PKG_INSTALLATION_TYPE} != "pkgviews") && \
127 (${PKG_INSTALLATION_TYPE} != "overwrite")
128 PKG_FAIL_REASON
+= "PKG_INSTALLATION_TYPE must be \`\`pkgviews'' or \`\`overwrite''."
131 .if empty
(PKG_INSTALLATION_TYPES
:M
${PKG_INSTALLATION_TYPE})
132 PKG_FAIL_REASON
+= "This package doesn't support PKG_INSTALLATION_TYPE=${PKG_INSTALLATION_TYPE}."
135 .if
!defined
(CATEGORIES
) ||
!defined
(DISTNAME
)
136 PKG_FAIL_REASON
+='CATEGORIES and DISTNAME are mandatory.'
139 .if defined
(PKG_PATH
)
140 PKG_FAIL_REASON
+='Please unset PKG_PATH before doing pkgsrc work!'
143 # Allow variables to be set on a per-OS basis
144 OPSYSVARS
+= CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LIBS
145 .for _var_ in
${OPSYSVARS
:O
}
146 . if defined
(${_var_}.
${OPSYS})
147 ${_var_}+= ${${_var_}.
${OPSYS}}
148 . elif defined
(${_var_}.
*)
149 ${_var_}+= ${${_var_}.
*}
153 CPPFLAGS
+= ${CPP_PRECOMP_FLAGS}
155 # To sanitise environment set PKGSRC_SETENV=${SETENV} -i
156 PKGSRC_SETENV?
= ${SETENV}
159 ALL_ENV
+= CFLAGS
=${CFLAGS
:M
*:Q
}
160 ALL_ENV
+= CPPFLAGS
=${CPPFLAGS
:M
*:Q
}
161 ALL_ENV
+= CXX
=${CXX
:Q
}
162 ALL_ENV
+= CXXFLAGS
=${CXXFLAGS
:M
*:Q
}
163 ALL_ENV
+= COMPILER_RPATH_FLAG
=${COMPILER_RPATH_FLAG
:Q
}
164 ALL_ENV
+= F77
=${FC
:Q
}
166 ALL_ENV
+= FFLAGS
=${FFLAGS
:M
*:Q
}
169 ALL_ENV
+= LC_COLLATE
=C
171 ALL_ENV
+= LC_MESSAGES
=C
172 ALL_ENV
+= LC_MONETARY
=C
173 ALL_ENV
+= LC_NUMERIC
=C
175 ALL_ENV
+= LDFLAGS
=${LDFLAGS
:M
*:Q
}
176 ALL_ENV
+= LINKER_RPATH_FLAG
=${LINKER_RPATH_FLAG
:Q
}
177 ALL_ENV
+= PATH
=${PATH
:Q
}:${LOCALBASE}/bin
:${X11BASE}/bin
178 ALL_ENV
+= PREFIX
=${PREFIX}
180 # This variable can be added to MAKE_ENV to ease installation of packages
181 # that use BSD-style Makefiles.
182 BSD_MAKE_ENV
= BINOWN
=${BINOWN} BINGRP
=${BINGRP}
183 BSD_MAKE_ENV
+= GAMEOWN
=${GAMEOWN} GAMEGRP
=${GAMEGRP}
184 BSD_MAKE_ENV
+= MANOWN
=${MANOWN} MANGRP
=${MANGRP}
185 BSD_MAKE_ENV
+= SHAREOWN
=${SHAREOWN} SHAREGRP
=${SHAREGRP}
186 BSD_MAKE_ENV
+= DOCOWN
=${DOCOWN} DOCGRP
=${DOCGRP}
187 BSD_MAKE_ENV
+= BINMODE
=${BINMODE} NONBINMODE
=${NONBINMODE}
188 BSD_MAKE_ENV
+= BINDIR
=${PREFIX}/bin
189 BSD_MAKE_ENV
+= INCSDIR
=${PREFIX}/include
190 BSD_MAKE_ENV
+= LIBDIR
=${PREFIX}/lib
191 BSD_MAKE_ENV
+= MANDIR
=${PREFIX}/${PKGMANDIR}
192 BSD_MAKE_ENV
+= STRIPFLAG
=${_STRIPFLAG_INSTALL
:Q
}
193 BSD_MAKE_ENV
+= MANINSTALL
=${MANINSTALL
:Q
}
194 BSD_MAKE_ENV
+= MKCATPAGES
=${MKCATPAGES
:Q
}
195 BSD_MAKE_ENV
+= MKHTML
=no
197 _BUILD_DEFS
= ${BUILD_DEFS}
198 _BUILD_DEFS
+= LOCALBASE
199 _BUILD_DEFS
+= PKGGNUDIR
200 _BUILD_DEFS
+= PKGINFODIR
201 _BUILD_DEFS
+= PKGMANDIR
202 _BUILD_DEFS
+= _USE_DESTDIR
204 # Store the result in the +BUILD_INFO file so we can query for the build
205 # options using "pkg_info -Q PKG_OPTIONS <pkg>".
207 .if defined
(PKG_SUPPORTED_OPTIONS
) && defined
(PKG_OPTIONS
)
208 _BUILD_DEFS
+= PKG_OPTIONS
211 .if empty
(DEPOT_SUBDIR
)
212 PKG_FAIL_REASON
+= "DEPOT_SUBDIR may not be empty."
215 # Store the build options for multi-packages, i.e. packages that can
216 # be built with multiple versions of Apache, Python, Ruby, PHP etc.
222 # ZERO_FILESIZE_P exits with a successful return code if the given file
224 # NONZERO_FILESIZE_P exits with a successful return code if the given file
225 # has nonzero length.
227 _ZERO_FILESIZE_P
= ${AWK} 'END { exit (NR > 0) ? 1 : 0; }'
228 _NONZERO_FILESIZE_P
= ${AWK} 'END { exit (NR > 0) ? 0 : 1; }'
230 # Automatically increase process limit where necessary for building.
231 _ULIMIT_CMD
= ${UNLIMIT_RESOURCES
:@_lim_@
${ULIMIT_CMD_
${_lim_}};@
}
233 _NULL_COOKIE
= ${WRKDIR}/.null
235 # Miscellaneous overridable commands:
236 SHCOMMENT?
= ${ECHO_MSG} >/dev
/null
'***'
242 # A few aliases for *-install targets
243 INSTALL
= ${TOOLS_INSTALL} # XXX override sys.mk
245 ${INSTALL} ${COPY} ${_STRIPFLAG_INSTALL} -o
${BINOWN} -g
${BINGRP} -m
${BINMODE}
247 ${INSTALL} ${COPY} ${_STRIPFLAG_INSTALL} -o
${GAMEOWN} -g
${GAMEGRP} -m
${GAMEMODE}
249 ${INSTALL} ${COPY} -o
${BINOWN} -g
${BINGRP} -m
${BINMODE}
251 ${INSTALL} ${COPY} -o
${BINOWN} -g
${BINGRP} -m
${BINMODE}
253 ${INSTALL} ${COPY} -o
${SHAREOWN} -g
${SHAREGRP} -m
${SHAREMODE}
254 INSTALL_GAME_DATA?
= \
255 ${INSTALL} ${COPY} -o
${GAMEOWN} -g
${GAMEGRP} -m
${GAMEDATAMODE}
257 ${INSTALL} ${COPY} -o
${MANOWN} -g
${MANGRP} -m
${MANMODE}
258 INSTALL_PROGRAM_DIR?
= \
259 ${INSTALL} -d
-o
${BINOWN} -g
${BINGRP} -m
${PKGDIRMODE}
261 ${INSTALL} -d
-o
${GAMEOWN} -g
${GAMEGRP} -m
${GAMEDIRMODE}
262 INSTALL_SCRIPT_DIR?
= \
263 ${INSTALL_PROGRAM_DIR}
265 ${INSTALL_PROGRAM_DIR}
267 ${INSTALL} -d
-o
${SHAREOWN} -g
${SHAREGRP} -m
${PKGDIRMODE}
269 ${INSTALL} -d
-o
${MANOWN} -g
${MANGRP} -m
${PKGDIRMODE}
271 INSTALL_MACROS
= BSD_INSTALL_PROGRAM
=${INSTALL_PROGRAM
:Q
} \
272 BSD_INSTALL_SCRIPT
=${INSTALL_SCRIPT
:Q
} \
273 BSD_INSTALL_LIB
=${INSTALL_LIB
:Q
} \
274 BSD_INSTALL_DATA
=${INSTALL_DATA
:Q
} \
275 BSD_INSTALL_MAN
=${INSTALL_MAN
:Q
} \
276 BSD_INSTALL
=${INSTALL
:Q
} \
277 BSD_INSTALL_PROGRAM_DIR
=${INSTALL_PROGRAM_DIR
:Q
} \
278 BSD_INSTALL_SCRIPT_DIR
=${INSTALL_SCRIPT_DIR
:Q
} \
279 BSD_INSTALL_LIB_DIR
=${INSTALL_LIB_DIR
:Q
} \
280 BSD_INSTALL_DATA_DIR
=${INSTALL_DATA_DIR
:Q
} \
281 BSD_INSTALL_MAN_DIR
=${INSTALL_MAN_DIR
:Q
} \
282 BSD_INSTALL_GAME
=${INSTALL_GAME
:Q
} \
283 BSD_INSTALL_GAME_DATA
=${INSTALL_GAME_DATA
:Q
} \
284 BSD_INSTALL_GAME_DIR
=${INSTALL_GAME_DIR
:Q
}
285 MAKE_ENV
+= ${INSTALL_MACROS
:M
*}
286 SCRIPTS_ENV
+= ${INSTALL_MACROS
:M
*}
288 # If pkgsrc is supposed to ensure that tests are run before installation
289 # of the package, then the build targets should be "build test", otherwise
290 # just "build" suffices.
292 .if
!empty
(PKGSRC_RUN_TEST
:M
[yY
][eE
][sS
])
293 _PKGSRC_BUILD_TARGETS
= build
test
295 _PKGSRC_BUILD_TARGETS
= build
298 # OVERRIDE_DIRDEPTH represents the common directory depth under
299 # ${WRKSRC} up to which we find the files that need to be
300 # overridden. By default, we search two levels down, i.e.,
303 OVERRIDE_DIRDEPTH?
= 2
305 # Handle alternatives
307 .
include "alternatives.mk"
309 # Define SMART_MESSAGES in /etc/mk.conf for messages giving the tree
310 # of dependencies for building, and the current target.
311 _PKGSRC_IN?
= ===${SMART_MESSAGES
:D
> ${.TARGET
} [${PKGNAME}${_PKGSRC_DEPS}] ===}
313 # Used to print all the '===>' style prompts - override this to turn them off.
315 PHASE_MSG?
= ${ECHO_MSG} ${_PKGSRC_IN
:Q
}\
>
316 STEP_MSG?
= ${ECHO_MSG} "=>"
317 INFO_MSG?
= ${ECHO_MSG} "INFO:"
318 WARNING_MSG?
= ${ECHO_MSG} 1>&2 "WARNING:"
319 ERROR_MSG?
= ${ECHO_MSG} 1>&2 "ERROR:"
320 FAIL_MSG?
= ${FAIL} ${ERROR_MSG}
322 WARNING_CAT?
= ${SED} -e
"s|^|WARNING: |" 1>&2
323 ERROR_CAT?
= ${SED} -e
"s|^|ERROR: |" 1>&2
325 # How to do nothing. Override if you, for some strange reason, would rather
329 # the FAIL command executes its arguments and then exits with a non-zero
331 FAIL?
= ${SH} ${PKGSRCDIR}/mk
/scripts
/fail
334 # Config file related settings - see doc/pkgsrc.txt
336 PKG_SYSCONFVAR?
= ${PKGBASE}
337 PKG_SYSCONFSUBDIR?
= # empty
338 .if
${PKG_INSTALLATION_TYPE} == "overwrite"
339 PKG_SYSCONFDEPOTBASE
= # empty
340 PKG_SYSCONFBASEDIR
= ${PKG_SYSCONFBASE}
342 . if
!empty
(PKG_SYSCONFBASE
:M
${PREFIX}) || \
343 !empty
(PKG_SYSCONFBASE
:M
${PREFIX}/*)
344 PKG_SYSCONFDEPOTBASE
= # empty
345 PKG_SYSCONFBASEDIR
= ${PKG_SYSCONFBASE}
347 PKG_SYSCONFDEPOTBASE
= ${PKG_SYSCONFBASE}/${DEPOT_SUBDIR}
348 PKG_SYSCONFBASEDIR
= ${PKG_SYSCONFDEPOTBASE}/${PKGNAME}
351 .if empty
(PKG_SYSCONFSUBDIR
)
352 DFLT_PKG_SYSCONFDIR
:= ${PKG_SYSCONFBASEDIR}
354 DFLT_PKG_SYSCONFDIR
:= ${PKG_SYSCONFBASEDIR}/${PKG_SYSCONFSUBDIR}
356 PKG_SYSCONFDIR
= ${DFLT_PKG_SYSCONFDIR}
357 .if defined
(PKG_SYSCONFDIR.
${PKG_SYSCONFVAR})
358 PKG_SYSCONFDIR
= ${PKG_SYSCONFDIR.
${PKG_SYSCONFVAR}}
359 PKG_SYSCONFBASEDIR
= ${PKG_SYSCONFDIR.
${PKG_SYSCONFVAR}}
360 PKG_SYSCONFDEPOTBASE
= # empty
362 PKG_SYSCONFDIR_PERMS?
= ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 755
364 ALL_ENV
+= PKG_SYSCONFDIR
=${PKG_SYSCONFDIR
:Q
}
365 _BUILD_DEFS
+= PKG_SYSCONFBASEDIR PKG_SYSCONFDIR
367 # These are all of the tools use by pkgsrc Makefiles. This should
368 # eventually be split up into lists of tools required by different
369 # phases of a pkgsrc build.
372 [ awk
basename cat chgrp chmod chown cmp cp cut dirname echo \
373 egrep env false file find grep head hostname id
install ln ls \
374 mkdir mv printf pwd
rm rmdir sed sh
sort \
375 tail
test touch tr true wc xargs
380 # bsd.bulk-pkg.mk uses certain tools
382 USE_TOOLS
+= tee tsort
385 # INSTALL/DEINSTALL script framework
386 .
include "pkginstall/bsd.pkginstall.mk"
389 .
include "internal/locking.mk"
392 .
include "tools/bsd.tools.mk"
395 .
include "bsd.pkg.barrier.mk"
397 # Unprivileged builds
398 .
include "unprivileged.mk"
400 # If NO_BUILD is defined, default to not needing a compiler.
401 .if defined
(NO_BUILD
)
402 USE_LANGUAGES?
= # empty
405 # Get the proper dependencies and set the PATH to use the compiler
406 # named in PKGSRC_COMPILER.
408 .
include "compiler.mk"
410 #Fake up a home directory
411 WRAPPER_TARGETS
+= fake-home
412 FAKEHOMEDIR
= ${WRKDIR}/.home
413 ALL_ENV
+= HOME
=${FAKEHOMEDIR}
415 fake-home
: ${FAKEHOMEDIR}
417 ${RUN} ${MKDIR} ${.TARGET
}
419 .
include "wrapper/bsd.wrapper.mk"
421 .if defined
(ABI_DEPENDS
) || defined
(BUILD_ABI_DEPENDS
)
422 . if
!empty
(USE_ABI_DEPENDS
:M
[yY
][eE
][sS
])
423 DEPENDS
+= ${ABI_DEPENDS}
424 BUILD_DEPENDS
+= ${BUILD_ABI_DEPENDS}
426 _BUILD_DEFS
+= USE_ABI_DEPENDS
430 # Find out the PREFIX of dependencies where the PREFIX is needed at build time.
431 .if defined
(EVAL_PREFIX
)
432 FIND_PREFIX
:= ${EVAL_PREFIX}
433 .
include "find-prefix.mk"
436 .if
!defined
(_PATH_ORIG
)
438 MAKEFLAGS
+= _PATH_ORIG
=${_PATH_ORIG
:Q
}
441 .if
!empty
(PREPEND_PATH
:M
*)
442 # This is very Special. Because PREPEND_PATH is set with += in reverse order,
443 # this command reverses the order again (since bootstrap bmake doesn't
444 # yet support the :[-1..1] construct).
446 path
=${_PATH_ORIG
:Q
}; \
447 for i in
${PREPEND_PATH}; do path
="$$i:$$path"; done
; \
449 PATH
= ${_PATH_CMD
:sh
} # DOES NOT use :=, to defer evaluation
452 ################################################################
453 # Many ways to disable a package.
455 # Ignore packages that can't be resold if building for a CDROM.
457 # Don't build a package if it's restricted and we don't want to
460 # Don't build any package that utilizes strong cryptography, for
461 # when the law of the land forbids it.
463 # Don't attempt to build packages against X if we don't have X.
465 # Don't build a package if it's broken.
466 ################################################################
467 .if
${X11_TYPE} == "xorg"
468 PKG_FAIL_REASON
+= "Support for X11_TYPE=xorg was removed."
469 PKG_FAIL_REASON
+= "Please switch to X11_TYPE=modular."
474 .if
!defined
(NO_SKIP
)
475 . if
(defined
(NO_BIN_ON_CDROM
) && defined
(FOR_CDROM
))
476 PKG_FAIL_REASON
+= "${PKGNAME} may not be placed in binary form on a CDROM:" \
477 " "${NO_BIN_ON_CDROM
:Q
}
479 . if
(defined
(NO_SRC_ON_CDROM
) && defined
(FOR_CDROM
))
480 PKG_FAIL_REASON
+= "${PKGNAME} may not be placed in source form on a CDROM:" \
481 " "${NO_SRC_ON_CDROM
:Q
}
483 . if
(defined
(RESTRICTED
) && defined
(NO_RESTRICTED
))
484 PKG_FAIL_REASON
+= "${PKGNAME} is restricted:" \
487 . if
!(${MKCRYPTO} == "YES" ||
${MKCRYPTO} == yes
)
489 PKG_FAIL_REASON
+= "${PKGNAME} may not be built, because it utilizes strong cryptography"
492 . if defined
(USE_X11
) && (${X11_TYPE} == "native") && !exists
(${X11BASE})
493 PKG_FAIL_REASON
+= "${PKGNAME} uses X11, but ${X11BASE} not found"
496 PKG_FAIL_REASON
+= "${PKGNAME} is marked as broken:" ${BROKEN
:Q
}
499 .
include "license.mk"
501 # Define __PLATFORM_OK only if the OS matches the pkg's allowed list.
502 . if defined
(ONLY_FOR_PLATFORM
) && !empty
(ONLY_FOR_PLATFORM
)
503 . for __tmp__ in
${ONLY_FOR_PLATFORM}
504 . if
${MACHINE_PLATFORM
:M
${__tmp__}} != ""
506 .
endif # MACHINE_PLATFORM
508 .
else # !ONLY_FOR_PLATFORM
510 .
endif # ONLY_FOR_PLATFORM
511 . for __tmp__ in
${NOT_FOR_PLATFORM}
512 . if
${MACHINE_PLATFORM
:M
${__tmp__}} != ""
513 . undef __PLATFORM_OK
514 .
endif # MACHINE_PLATFORM
516 . if
!defined
(__PLATFORM_OK
)
517 PKG_FAIL_REASON
+= "${PKGNAME} is not available for ${MACHINE_PLATFORM}"
518 .
endif # !__PLATFORM_OK
521 # Add these defs to the ones dumped into +BUILD_DEFS
522 _BUILD_DEFS
+= PKGPATH
523 _BUILD_DEFS
+= OPSYS OS_VERSION MACHINE_ARCH MACHINE_GNU_ARCH
525 _BUILD_DEFS
+= CPPFLAGS CFLAGS FFLAGS LDFLAGS
526 _BUILD_DEFS
+= OBJECT_FMT LICENSE RESTRICTED
527 _BUILD_DEFS
+= NO_SRC_ON_FTP NO_SRC_ON_CDROM
528 _BUILD_DEFS
+= NO_BIN_ON_FTP NO_BIN_ON_CDROM
530 .if defined
(OSVERSION_SPECIFIC
)
531 _BUILD_DEFS
+= OSVERSION_SPECIFIC
532 DEPENDS
+= osabi-
${OPSYS}-${OS_VERSION}:..
/..
/pkgtools
/osabi
533 .
endif # OSVERSION_SPECIFIC
535 .for _pkg_ in
${_BUILTIN_PKGS}
536 . if defined
(USE_BUILTIN.
${_pkg_}) && \
537 !empty
(USE_BUILTIN.
${_pkg_}:M
[yY
][eE
][sS
]) && \
538 defined
(BUILTIN_PKG.
${_pkg_}) && !empty
(BUILTIN_PKG.
${_pkg_})
539 BUILTIN_PKGS
+= ${BUILTIN_PKG.
${_pkg_}}
542 .if defined
(BUILTIN_PKGS
)
543 _BUILD_DEFS
+= BUILTIN_PKGS
546 .if defined
(GLIBC_VERSION
)
547 _BUILD_DEFS
+= GLIBC_VERSION
548 .
endif # GLIBC_VERSION
552 all: ${_PKGSRC_BUILD_TARGETS}
559 .if
!defined
(KEEP_WRKDIR
)
560 . if
${WRKDIR_LOCKTYPE} != "none"
561 ${RUN} ${TEST} -f
${_WRKDIR_LOCKFILE} ||
${RM} -fr
${WRKDIR}
564 ${RUN} umask
077 && ${MKDIR} ${WRKDIR}
566 # Create a symlink from ${WRKDIR} to the package directory if
567 # CREATE_WRKDIR_SYMLINK is "yes".
569 CREATE_WRKDIR_SYMLINK?
= no
571 .if defined
(WRKOBJDIR
) && !empty
(CREATE_WRKDIR_SYMLINK
:M
[Yy
][Ee
][Ss
])
572 makedirs
: ${.CURDIR
}/${WRKDIR_BASENAME}
573 ${.CURDIR
}/${WRKDIR_BASENAME}:
574 . if
${WRKDIR_LOCKTYPE} != "none"
575 ${RUN} ${TEST} -f
${_WRKDIR_LOCKFILE} ||
${RM} -f
${.TARGET
}
578 if
${LN} -s
${WRKDIR} ${.TARGET
} 2>/dev
/null
; then \
579 ${ECHO_MSG} "${.TARGET:T} -> ${WRKDIR}"; \
583 .
include "pkgformat/bsd.pkgformat.mk"
585 .
include "depends/bsd.depends.mk"
586 .
include "check/bsd.check.mk"
587 .
include "fetch/bsd.fetch.mk"
588 .
include "checksum/bsd.checksum.mk"
589 .
include "extract/bsd.extract.mk"
590 .
include "patch/bsd.patch.mk"
591 .
include "configure/bsd.configure.mk"
592 .
include "build/bsd.build.mk"
593 .
include "install/bsd.install.mk"
594 .
include "package/bsd.package.mk"
596 .
include "bsd.pkg.clean.mk"
597 .
include "bsd.pkg.update.mk"
599 # su-target is a macro target that does just-in-time su-to-root before
600 # reinvoking the make process as root. It acquires root privileges and
601 # invokes a new make process with the target named "su-${.TARGET}".
603 # MAKEFLAGS.su-${.TARGET}
604 # The additional flags that are passed to the make process.
607 _ROOT_CMD
= cd
${.CURDIR
} && \
608 ${PKGSRC_SETENV} ${PKGSRC_MAKE_ENV} \
609 PATH
=${_PATH_ORIG
:Q
}:${SU_CMD_PATH_APPEND
:Q
} \
610 ${MAKE} ${MAKEFLAGS} _PKGSRC_BARRIER
=yes \
611 PKG_DEBUG_LEVEL
=${PKG_DEBUG_LEVEL
:Q
} \
612 su-
${.TARGET
} ${MAKEFLAGS.su-
${.TARGET
}}
617 case
${PRE_CMD.su-
${.TARGET
}:Q
}"" in \
619 *) ${PRE_CMD.su-
${.TARGET
}} ;; \
621 if
${_IS_ROOT_CMD}; then \
624 case
${PRE_ROOT_CMD
:Q
}"" in \
626 *) ${WARNING_MSG} "Running: "${PRE_ROOT_CMD
:Q
} ;; \
629 ${STEP_MSG} "Becoming \`\`${_SU_ROOT_USER}'' to make su-${.TARGET} (`${ECHO} ${SU_CMD} | ${AWK} '{ print $$1 }'`)"; \
630 ${SU_CMD} ${_ROOT_CMD
:Q
}; \
631 ${STEP_MSG} "Dropping \`\`${_SU_ROOT_USER}'' privileges."; \
634 ################################################################
635 # Some more targets supplied for users' convenience
636 ################################################################
641 ${RUN} ${LOCALBASE}/bin
/pkglint
643 # List of flags to pass to pkg_add(1) for bin-install:
645 BIN_INSTALL_FLAGS?
= # -v
646 .if
${PKG_INSTALLATION_TYPE} == "pkgviews"
647 PKG_ARGS_ADD
= -W
${LOCALBASE} -w
${DEFAULT_VIEW}
649 _BIN_INSTALL_FLAGS
= ${BIN_INSTALL_FLAGS}
650 .if defined
(_AUTOMATIC
) && !empty
(_AUTOMATIC
:M
[Yy
][Ee
][Ss
])
651 _BIN_INSTALL_FLAGS
+= -A
653 _BIN_INSTALL_FLAGS
+= ${PKG_ARGS_ADD}
655 _SHORT_UNAME_R
= ${:!${UNAME} -r
!:C@\.
([0-9]*)[_.
-].
*@.\
1@
} # n.n[_.]anything => n.n
657 .
include "install/bin-install.mk"
659 .PHONY
: show-pkgtools-version
660 .if
!target
(show-pkgtools-version
)
661 show-pkgtools-version
:
662 @
${ECHO} ${PKGTOOLS_VERSION}
665 # convenience target, to display make variables from command line
666 # i.e. "make show-var VARNAME=var", will print var's value
669 # show-vars, show-subdir-var
673 @
${ECHO} ${${VARNAME}:Q
}
675 # enhanced version of target above, to display multiple variables
678 .for VARNAME in
${VARNAMES}
679 @
${ECHO} ${${VARNAME}:Q
}
682 # displays multiple variables as shell expressions
683 # VARS is space separated list of VARNAME:shellvarname
684 .PHONY
: show-vars-eval
687 @
${ECHO} ${var
:C
/^.
*://}="${${var:C/:.*$//}:Q}"
690 LICENSE_FILE?
= ${PKGSRCDIR}/licenses
/${LICENSE}
692 .if
!target
(show-license
)
693 show-license show-licence
: .PHONY
694 @license
=${LICENSE
:Q
}; \
695 license_file
=${LICENSE_FILE
:Q
}; \
697 case
"$$pager" in
"") pager
=${CAT
:Q
};; esac
; \
698 case
"$$license" in
"") exit
0;; esac
; \
699 if
${TEST} -f
"$$license_file"; then \
700 $$pager "$$license_file"; \
702 ${ECHO} "Generic $$license information not available"; \
703 ${ECHO} "See the package description (pkg_info -d ${PKGNAME}) for more information."; \
707 # This target is defined in bsd.options.mk for packages that use
708 # the options framework.
709 .if
!target
(show-options
)
712 @
${ECHO} This package does not use the options framework.
715 # Depend is generally meaningless for arbitrary packages, but if someone wants
716 # one they can override this. This is just to catch people who've gotten into
717 # the habit of typing `${MAKE} depend all install' as a matter of course.
730 .
include "plist/bsd.plist.mk"
732 .
include "bsd.utils.mk"
737 # For bulk build targets (bulk-install, bulk-package), the
738 # BATCH variable must be set in /etc/mk.conf:
741 .
include "bulk/bsd.bulk-pkg.mk"
744 # README generation code.
745 .
include "bsd.pkg.readme.mk"
747 # Create a PKG_ERROR_HANDLER shell command for each class listed in
748 # PKG_ERROR_CLASSES. The error handler is meant to be invoked within
751 .for _class_ in
${PKG_ERROR_CLASSES}
752 PKG_ERROR_HANDLER.
${_class_}?
= { \
754 for str in
${PKG_ERROR_MSG.
${_class_}}; do \
755 ${PHASE_MSG} "$$str"; \
761 # Cache variables listed in MAKEVARS in a phase-specific "makevars.mk"
762 # file. These variables are effectively passed to sub-make processes
763 # that are invoked on the same Makefile.
765 .for _phase_ in
${_ALL_PHASES}
766 ${_MAKEVARS_MK.
${_phase_}}: ${WRKDIR}
767 ${RUN}${RM} -f
${.TARGET
}.tmp
768 . for _var_ in
${MAKEVARS
:O
:u
}
769 . if defined
(${_var_})
771 ${ECHO} ${_var_}"= "${${_var_}:Q
} >> ${.TARGET
}.tmp
775 if
${TEST} -f
${.TARGET
}.tmp
; then \
776 ( ${ECHO} ".if !defined(_MAKEVARS_MK)"; \
777 ${ECHO} "_MAKEVARS_MK= defined"; \
779 ${CAT} ${.TARGET
}.tmp
; \
781 ${ECHO} ".endif # _MAKEVARS_MK"; \
783 ${RM} -f
${.TARGET
}.tmp
; \
785 ${RUN}${TOUCH} ${TOUCH_FLAGS} ${.TARGET
}
788 .if make
(pbulk-index
) || make
(pbulk-index-item
) || make
(pbulk-save-wrkdir
)
789 .
include "pbulk/pbulk-index.mk"
792 .if defined
(_OPSYS_REQUIRE_UAC_MANIFEST
) && !empty
(_OPSYS_REQUIRE_UAC_MANIFEST
:M
[Yy
][Ee
][Ss
])
793 . if defined
(UAC_REQD_EXECS
) && !empty
(UAC_REQD_EXECS
)
794 .
include "misc/uac-manifest.mk"
798 .if defined
(PKG_DEVELOPER
) && ${PKG_DEVELOPER} != "no"
799 .
include "misc/developer.mk"
801 .
include "misc/show.mk"
803 .
include "bsd.pkg.debug.mk"
805 .
include "misc/warnings.mk"
807 .
include "misc/import.mk"
809 .
include "misc/can-be-built-here.mk"