aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/bsd.scons.mk
blob: 7f611b0621fe36be98ed82b010a53a45838f841c (plain) (blame)
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
#-*- tab-width: 4; -*-
# ex:ts=4
#
# $FreeBSD$
#
# bsd.scons.mk - Python-based SCons build system interface.
# Author: Alexander Botero-Lowry <alexbl@FreeBSD.org>
#
# Please view me with 4 column tabs!

# Please make sure all changes to this file are passed through the maintainer.
SCONS_MAINTAINER=   python@FreeBSD.org

#
# SCONS_BIN is the location where the scons port installs the scons
# executable.
#
# SCONS_PORT is where the scons port is located in the ports tree.
#
SCONS_BIN=  ${LOCALBASE}/bin/scons
SCONS_PORT= ${PORTSDIR}/devel/scons

#
# CCFLAGS is the scons equivalent of CFLAGS. So we should bring in our
# FreeBSD CFLAGS.
#
# LINKFLAGS is equivalent to LDFLAGS in make speak, so we bring in the
# FreeBSD default LDFLAGS.
#
# Some scons projects may honor PKGCONFIGDIR, which tells them where to
# look for, and install, pkgconfig files.
#
# LIBPATH is the search path for libraries. Bring in some safe defaults.
#
# CPPPATH is the search path for includes, Again, bring in some safe defaults.
#
CCFLAGS?=   ${CFLAGS}
LINKFLAGS?= ${LDFLAGS}
PKGCONFIGDIR?=  ${LOCALBASE}/libdata/pkgconfig
LIBPATH?=   ${LOCALBASE}/lib
CPPPATH?=   ${LOCALBASE}/include

#
# SCONS_ENV is where we pass all the stuff that should be the
# same for any scons port to scons. Things like CCFLAGS, and LINKFLAGS
# go here.
#
# SCONS_ARGS is where you pass port specific scons flags to the scons
# environment.
#
# SCONS_BUILDENV is where you pass variables you want to be in the
# System Environment instead of the SCons Environment.
#
# SCONS_TARGET is the same as MAKE_TARGET it is passed as the last
# argument to scons.
#
SCONS_ENV?= CCFLAGS="${CCFLAGS}" CXXFLAGS="${CXXFLAGS}" \
        LINKFLAGS="${LINKFLAGS}" PKGCONFIGDIR="${PKGCONFIGDIR}"  \
        CPPPATH="${CPPPATH}" LIBPATH="${LIBPATH}" PREFIX="${PREFIX}" \
        CC="${CC}" CXX="${CXX}"
SCONS_ARGS?=
SCONS_BUILDENV?=
SCONS_TARGET?=

.if !defined(NO_STAGE)
SCONS_ARGS+=    ${DESTDIRNAME}=${STAGEDIR}
.endif

#
# SCONS_INSTALL_TARGET is the default target to be used when
# installing a port using scons.
#
SCONS_INSTALL_TARGET?=  ${INSTALL_TARGET}

#
# Make sure we depend on scons
#
BUILD_DEPENDS+= ${SCONS_BIN}:${SCONS_PORT}

.if !target(do-build)
do-build:
    @cd ${BUILD_WRKSRC} && \
    ${SETENV} ${SCONS_BUILDENV} ${SCONS_BIN} ${SCONS_ENV} ${_MAKE_JOBS} \
    ${SCONS_ARGS} ${SCONS_TARGET}
.endif

.if !target(do-install)
do-install:
    @cd ${INSTALL_WRKSRC} && ${SETENV} ${SCONS_BUILDENV} ${SCONS_BIN} \
    ${SCONS_ENV} ${SCONS_ARGS} ${SCONS_INSTALL_TARGET}
.endif