author | Mike Sullivan <Mike.Sullivan@Oracle.COM> |
Mon, 27 May 2013 09:27:06 -0700 | |
changeset 1312 | a1701fc2793f |
parent 1310 | ed3f9d06a78b |
child 1352 | 1358a1e1ff4c |
permissions | -rw-r--r-- |
2 | 1 |
# |
2 |
# CDDL HEADER START |
|
3 |
# |
|
4 |
# The contents of this file are subject to the terms of the |
|
5 |
# Common Development and Distribution License (the "License"). |
|
6 |
# You may not use this file except in compliance with the License. |
|
7 |
# |
|
8 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 |
# or http://www.opensolaris.org/os/licensing. |
|
10 |
# See the License for the specific language governing permissions |
|
11 |
# and limitations under the License. |
|
12 |
# |
|
13 |
# When distributing Covered Code, include this CDDL HEADER in each |
|
14 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 |
# If applicable, add the following below this CDDL HEADER, with the |
|
16 |
# fields enclosed by brackets "[]" replaced with your own identifying |
|
17 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 |
# |
|
19 |
# CDDL HEADER END |
|
20 |
# |
|
1293 | 21 |
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 22 |
# |
23 |
||
59
7500d63edb42
7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
58
diff
changeset
|
24 |
$(BUILD_DIR)/%-2.6/.built: PYTHON_VERSION=2.6 |
706
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
25 |
$(BUILD_DIR)/%-2.7/.built: PYTHON_VERSION=2.7 |
59
7500d63edb42
7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
58
diff
changeset
|
26 |
$(BUILD_DIR)/$(MACH32)-%/.built: BITS=32 |
7500d63edb42
7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
58
diff
changeset
|
27 |
$(BUILD_DIR)/$(MACH64)-%/.built: BITS=64 |
2 | 28 |
|
181
87e11e685b1f
7003927 userland should postprocess packaged files
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
146
diff
changeset
|
29 |
$(BUILD_DIR)/%-2.6/.installed: PYTHON_VERSION=2.6 |
706
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
30 |
$(BUILD_DIR)/%-2.7/.installed: PYTHON_VERSION=2.7 |
59
7500d63edb42
7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
58
diff
changeset
|
31 |
$(BUILD_DIR)/$(MACH32)-%/.installed: BITS=32 |
7500d63edb42
7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
58
diff
changeset
|
32 |
$(BUILD_DIR)/$(MACH64)-%/.installed: BITS=64 |
31
90e0c3ea3281
Implement support for builds with multiple versions of python.
Danek Duvall <danek.duvall@oracle.com>
parents:
30
diff
changeset
|
33 |
|
59
7500d63edb42
7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
58
diff
changeset
|
34 |
BUILD_32 = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.built) |
7500d63edb42
7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
58
diff
changeset
|
35 |
BUILD_64 = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.built) |
1310
ed3f9d06a78b
16828763 Pure python should build with its own macros, not _32/_64
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
1293
diff
changeset
|
36 |
BUILD_NO_ARCH = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.built) |
31
90e0c3ea3281
Implement support for builds with multiple versions of python.
Danek Duvall <danek.duvall@oracle.com>
parents:
30
diff
changeset
|
37 |
|
59
7500d63edb42
7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
58
diff
changeset
|
38 |
INSTALL_32 = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.installed) |
7500d63edb42
7012375 userland build and proto areas should be outside of unpacked source dirs
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
58
diff
changeset
|
39 |
INSTALL_64 = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.installed) |
1310
ed3f9d06a78b
16828763 Pure python should build with its own macros, not _32/_64
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
1293
diff
changeset
|
40 |
INSTALL_NO_ARCH = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.installed) |
ed3f9d06a78b
16828763 Pure python should build with its own macros, not _32/_64
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
1293
diff
changeset
|
41 |
|
ed3f9d06a78b
16828763 Pure python should build with its own macros, not _32/_64
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
1293
diff
changeset
|
42 |
TEST_NO_ARCH = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.tested) |
2 | 43 |
|
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
62
diff
changeset
|
44 |
PYTHON_ENV = CC="$(CC)" |
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
62
diff
changeset
|
45 |
PYTHON_ENV += CFLAGS="$(CFLAGS)" |
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
62
diff
changeset
|
46 |
|
1310
ed3f9d06a78b
16828763 Pure python should build with its own macros, not _32/_64
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
1293
diff
changeset
|
47 |
COMPONENT_BUILD_ENV += $(PYTHON_ENV) |
ed3f9d06a78b
16828763 Pure python should build with its own macros, not _32/_64
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
1293
diff
changeset
|
48 |
COMPONENT_INSTALL_ENV += $(PYTHON_ENV) |
ed3f9d06a78b
16828763 Pure python should build with its own macros, not _32/_64
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
1293
diff
changeset
|
49 |
COMPONENT_TEST_ENV += $(PYTHON_ENV) |
ed3f9d06a78b
16828763 Pure python should build with its own macros, not _32/_64
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
1293
diff
changeset
|
50 |
|
706
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
51 |
# if we are building python 2.7 support, build it and install it first |
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
52 |
# so that python 2.6 is installed last and is the canonical version. |
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
53 |
# when we switch to 2.7 as the default, it should go last. |
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
54 |
ifneq ($(findstring 2.7,$(PYTHON_VERSIONS)),) |
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
55 |
$(BUILD_DIR)/%-2.6/.build: $(BUILD_DIR)/%-2.7/.build |
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
56 |
$(BUILD_DIR)/%-2.6/.installed: $(BUILD_DIR)/%-2.7/.installed |
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
57 |
endif |
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
58 |
|
1057
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
59 |
# Create a distutils config file specific to the combination of build |
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
60 |
# characteristics (bittedness x Python version), and put it in its own |
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
61 |
# directory. We can set $HOME to point distutils at it later, allowing |
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
62 |
# the install phase to find the temporary build directories. |
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
63 |
CFG=.pydistutils.cfg |
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
64 |
$(BUILD_DIR)/config-%/$(CFG): |
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
65 |
$(MKDIR) $(@D) |
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
66 |
echo "[build]\nbuild_base = $(BUILD_DIR)/$*" > $@ |
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
67 |
|
2 | 68 |
# build the configured source |
1057
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
69 |
$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep $(BUILD_DIR)/config-%/$(CFG) |
2 | 70 |
$(RM) -r $(@D) ; $(MKDIR) $(@D) |
71 |
$(COMPONENT_PRE_BUILD_ACTION) |
|
1310
ed3f9d06a78b
16828763 Pure python should build with its own macros, not _32/_64
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
1293
diff
changeset
|
72 |
(cd $(SOURCE_DIR) ; $(ENV) HOME=$(BUILD_DIR)/config-$* $(COMPONENT_BUILD_ENV) \ |
1057
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
73 |
$(PYTHON.$(BITS)) ./setup.py build) |
2 | 74 |
$(COMPONENT_POST_BUILD_ACTION) |
774
d0cbca26a17c
7035978 parfait support for userland bits
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
706
diff
changeset
|
75 |
ifeq ($(strip $(PARFAIT_BUILD)),yes) |
d0cbca26a17c
7035978 parfait support for userland bits
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
706
diff
changeset
|
76 |
-$(PARFAIT) $(SOURCE_DIR)/$(@D:$(BUILD_DIR)/%=%) |
d0cbca26a17c
7035978 parfait support for userland bits
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
706
diff
changeset
|
77 |
endif |
2 | 78 |
$(TOUCH) $@ |
79 |
||
30
440b6ca0641d
Removed $(PUBLISHER) from pkg.fmri package attributes. Renamed package
Danek Duvall <danek.duvall@oracle.com>
parents:
25
diff
changeset
|
80 |
|
62
519e6e3788ce
7013265 userland could use a tool to aid in SUNW package generation
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
59
diff
changeset
|
81 |
COMPONENT_INSTALL_ARGS += --root $(PROTO_DIR) |
519e6e3788ce
7013265 userland could use a tool to aid in SUNW package generation
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
59
diff
changeset
|
82 |
COMPONENT_INSTALL_ARGS += --install-lib=$(PYTHON_LIB) |
706
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
83 |
COMPONENT_INSTALL_ARGS += --install-purelib=$(PYTHON_LIB) |
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
84 |
COMPONENT_INSTALL_ARGS += --install-platlib=$(PYTHON_LIB) |
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
85 |
COMPONENT_INSTALL_ARGS += --install-data=$(PYTHON_DATA) |
6e61f0012046
7108059 Userland should have python2.7 version of its python modules
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
247
diff
changeset
|
86 |
COMPONENT_INSTALL_ARGS += --force |
62
519e6e3788ce
7013265 userland could use a tool to aid in SUNW package generation
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
59
diff
changeset
|
87 |
|
2 | 88 |
# install the built source into a prototype area |
1057
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
89 |
$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built $(BUILD_DIR)/config-%/$(CFG) |
2 | 90 |
$(COMPONENT_PRE_INSTALL_ACTION) |
1057
e04f97962a3d
15791665 SUNBT7168800 python build turds go in the wrong place
Danek Duvall <danek.duvall@oracle.com>
parents:
774
diff
changeset
|
91 |
(cd $(SOURCE_DIR) ; $(ENV) HOME=$(BUILD_DIR)/config-$* $(COMPONENT_INSTALL_ENV) \ |
62
519e6e3788ce
7013265 userland could use a tool to aid in SUNW package generation
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
59
diff
changeset
|
92 |
$(PYTHON.$(BITS)) ./setup.py install $(COMPONENT_INSTALL_ARGS)) |
2 | 93 |
$(COMPONENT_POST_INSTALL_ACTION) |
94 |
$(TOUCH) $@ |
|
62
519e6e3788ce
7013265 userland could use a tool to aid in SUNW package generation
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
59
diff
changeset
|
95 |
|
247
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
96 |
COMPONENT_TEST_DEP = $(BUILD_DIR)/%/.installed |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
97 |
COMPONENT_TEST_DIR = $(COMPONENT_SRC)/test |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
98 |
COMPONENT_TEST_ENV_CMD = $(ENV) - |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
99 |
COMPONENT_TEST_ENV += PYTHONPATH=$(PROTO_DIR)$(PYTHON_VENDOR_PACKAGES) |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
100 |
COMPONENT_TEST_CMD = $(PYTHON) |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
101 |
COMPONENT_TEST_ARGS += ./runtests.py |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
102 |
|
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
103 |
# test the built source |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
104 |
$(BUILD_DIR)/%/.tested: $(COMPONENT_TEST_DEP) |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
105 |
$(COMPONENT_PRE_TEST_ACTION) |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
106 |
(cd $(COMPONENT_TEST_DIR); $(COMPONENT_TEST_ENV_CMD) \ |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
107 |
$(COMPONENT_TEST_ENV) \ |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
108 |
$(COMPONENT_TEST_CMD) $(COMPONENT_TEST_ARGS) ) |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
109 |
$(COMPONENT_POST_TEST_ACTION) |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
110 |
$(TOUCH) $@ |
c57f32335aee
7043992 move pylint from SFW to userland
April Chin <april.chin@oracle.com>
parents:
181
diff
changeset
|
111 |
|
774
d0cbca26a17c
7035978 parfait support for userland bits
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
706
diff
changeset
|
112 |
ifeq ($(strip $(PARFAIT_BUILD)),yes) |
d0cbca26a17c
7035978 parfait support for userland bits
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
706
diff
changeset
|
113 |
parfait: install |
d0cbca26a17c
7035978 parfait support for userland bits
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
706
diff
changeset
|
114 |
-$(PARFAIT) build |
d0cbca26a17c
7035978 parfait support for userland bits
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
706
diff
changeset
|
115 |
else |
d0cbca26a17c
7035978 parfait support for userland bits
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
706
diff
changeset
|
116 |
parfait: |
d0cbca26a17c
7035978 parfait support for userland bits
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
706
diff
changeset
|
117 |
$(MAKE) PARFAIT_BUILD=yes parfait |
d0cbca26a17c
7035978 parfait support for userland bits
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
706
diff
changeset
|
118 |
endif |
d0cbca26a17c
7035978 parfait support for userland bits
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
706
diff
changeset
|
119 |
|
99
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
62
diff
changeset
|
120 |
clean:: |
c15c9099bb44
6841644 OpenSolaris Python should support gdbm
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
62
diff
changeset
|
121 |
$(RM) -r $(SOURCE_DIR) $(BUILD_DIR) |
1293 | 122 |
|
123 |
# Make it easy to construct a URL for a pypi source download. |
|
124 |
PYPI_BASE = http://pypi.python.org/packages/source |
|
125 |
pypi_url = $(PYPI_BASE)/$(shell echo $(COMPONENT_NAME) | cut -c1)/$(COMPONENT_NAME)/$(COMPONENT_ARCHIVE) |