2N/A#
2N/A# CDDL HEADER START
2N/A#
2N/A# The contents of this file are subject to the terms of the
2N/A# Common Development and Distribution License (the "License").
2N/A# You may not use this file except in compliance with the License.
2N/A#
2N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A# or http://www.opensolaris.org/os/licensing.
2N/A# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A#
2N/A# When distributing Covered Code, include this CDDL HEADER in each
2N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A# If applicable, add the following below this CDDL HEADER, with the
2N/A# fields enclosed by brackets "[]" replaced with your own identifying
2N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2N/A#
2N/A# CDDL HEADER END
2N/A#
4070N/A
4070N/A#
3996N/A# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
2N/A#
2N/A
59N/A$(BUILD_DIR)/%-2.6/.built: PYTHON_VERSION=2.6
727N/A$(BUILD_DIR)/%-2.7/.built: PYTHON_VERSION=2.7
3778N/A$(BUILD_DIR)/%-3.4/.built: PYTHON_VERSION=3.4
59N/A$(BUILD_DIR)/$(MACH32)-%/.built: BITS=32
59N/A$(BUILD_DIR)/$(MACH64)-%/.built: BITS=64
2N/A
181N/A$(BUILD_DIR)/%-2.6/.installed: PYTHON_VERSION=2.6
727N/A$(BUILD_DIR)/%-2.7/.installed: PYTHON_VERSION=2.7
3778N/A$(BUILD_DIR)/%-3.4/.installed: PYTHON_VERSION=3.4
59N/A$(BUILD_DIR)/$(MACH32)-%/.installed: BITS=32
59N/A$(BUILD_DIR)/$(MACH64)-%/.installed: BITS=64
31N/A
2755N/A$(BUILD_DIR)/%-2.6/.tested: PYTHON_VERSION=2.6
2755N/A$(BUILD_DIR)/%-2.7/.tested: PYTHON_VERSION=2.7
3778N/A$(BUILD_DIR)/%-3.4/.tested: PYTHON_VERSION=3.4
2755N/A$(BUILD_DIR)/$(MACH32)-%/.tested: BITS=32
2755N/A$(BUILD_DIR)/$(MACH64)-%/.tested: BITS=64
2755N/A
3778N/ABUILD_32 = $(PYTHON2_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.built)
59N/ABUILD_64 = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.built)
1874N/ABUILD_NO_ARCH = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.built)
3778N/Aifeq ($(PYTHON_VERSION),3.4)
3778N/ABUILD_32_and_64 = $(BUILD_64)
3778N/Aendif
31N/A
3778N/AINSTALL_32 = $(PYTHON2_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.installed)
59N/AINSTALL_64 = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.installed)
1874N/AINSTALL_NO_ARCH = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.installed)
3778N/Aifeq ($(PYTHON_VERSION),3.4)
3778N/AINSTALL_32_and_64 = $(INSTALL_64)
3778N/Aendif
1874N/A
3778N/ATEST_32 = $(PYTHON2_VERSIONS:%=$(BUILD_DIR)/$(MACH32)-%/.tested)
2756N/ATEST_64 = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.tested)
1874N/ATEST_NO_ARCH = $(PYTHON_VERSIONS:%=$(BUILD_DIR)/$(MACH)-%/.tested)
3778N/Aifeq ($(PYTHON_VERSION),3.4)
3778N/ATEST_32_and_64 = $(TEST_64)
3778N/Aendif
2N/A
99N/APYTHON_ENV = CC="$(CC)"
99N/APYTHON_ENV += CFLAGS="$(CFLAGS)"
3789N/APYTHON_ENV += PATH="$(PATH):$(SPRO_VROOT)/bin"
99N/A
1874N/ACOMPONENT_BUILD_ENV += $(PYTHON_ENV)
1874N/ACOMPONENT_INSTALL_ENV += $(PYTHON_ENV)
1874N/ACOMPONENT_TEST_ENV += $(PYTHON_ENV)
1874N/A
3778N/A# If we are building Python 2.7 or 3.4 support, build them and install them
3778N/A# before Python 2.6, so 2.6 is installed last and is the canonical version.
3778N/A# When we change the default, the new default should go last.
727N/Aifneq ($(findstring 2.7,$(PYTHON_VERSIONS)),)
3778N/A$(BUILD_DIR)/%-2.6/.built: $(BUILD_DIR)/%-2.7/.built
3778N/A$(BUILD_DIR)/%-2.6/.installed: $(BUILD_DIR)/%-2.7/.installed
3778N/Aendif
3778N/Aifneq ($(findstring 3.4,$(PYTHON_VERSIONS)),)
3778N/A$(BUILD_DIR)/%-2.6/.built: $(BUILD_DIR)/%-3.4/.built
3778N/A$(BUILD_DIR)/%-2.6/.installed: $(BUILD_DIR)/%-3.4/.installed
727N/Aendif
727N/A
1873N/A# Create a distutils config file specific to the combination of build
1873N/A# characteristics (bittedness x Python version), and put it in its own
1873N/A# directory. We can set $HOME to point distutils at it later, allowing
1873N/A# the install phase to find the temporary build directories.
1873N/ACFG=.pydistutils.cfg
1873N/A$(BUILD_DIR)/config-%/$(CFG):
1873N/A $(MKDIR) $(@D)
1873N/A echo "[build]\nbuild_base = $(BUILD_DIR)/$*" > $@
1873N/A
2N/A# build the configured source
1873N/A$(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep $(BUILD_DIR)/config-%/$(CFG)
2N/A $(RM) -r $(@D) ; $(MKDIR) $(@D)
2N/A $(COMPONENT_PRE_BUILD_ACTION)
1874N/A (cd $(SOURCE_DIR) ; $(ENV) HOME=$(BUILD_DIR)/config-$* $(COMPONENT_BUILD_ENV) \
1873N/A $(PYTHON.$(BITS)) ./setup.py build)
2N/A $(COMPONENT_POST_BUILD_ACTION)
814N/Aifeq ($(strip $(PARFAIT_BUILD)),yes)
2238N/A -$(PARFAIT) $(@D)
814N/Aendif
2N/A $(TOUCH) $@
2N/A
30N/A
4070N/ACOMPONENT_INSTALL_ARGS += --root $(PROTO_DIR)
62N/ACOMPONENT_INSTALL_ARGS += --install-lib=$(PYTHON_LIB)
727N/ACOMPONENT_INSTALL_ARGS += --install-purelib=$(PYTHON_LIB)
727N/ACOMPONENT_INSTALL_ARGS += --install-platlib=$(PYTHON_LIB)
727N/ACOMPONENT_INSTALL_ARGS += --install-data=$(PYTHON_DATA)
727N/ACOMPONENT_INSTALL_ARGS += --force
62N/A
2N/A# install the built source into a prototype area
1873N/A$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built $(BUILD_DIR)/config-%/$(CFG)
2N/A $(COMPONENT_PRE_INSTALL_ACTION)
1873N/A (cd $(SOURCE_DIR) ; $(ENV) HOME=$(BUILD_DIR)/config-$* $(COMPONENT_INSTALL_ENV) \
62N/A $(PYTHON.$(BITS)) ./setup.py install $(COMPONENT_INSTALL_ARGS))
2N/A $(COMPONENT_POST_INSTALL_ACTION)
2N/A $(TOUCH) $@
62N/A
247N/ACOMPONENT_TEST_DEP = $(BUILD_DIR)/%/.installed
247N/ACOMPONENT_TEST_DIR = $(COMPONENT_SRC)/test
247N/ACOMPONENT_TEST_ENV_CMD = $(ENV) -
247N/ACOMPONENT_TEST_ENV += PYTHONPATH=$(PROTO_DIR)$(PYTHON_VENDOR_PACKAGES)
247N/ACOMPONENT_TEST_CMD = $(PYTHON)
247N/ACOMPONENT_TEST_ARGS += ./runtests.py
247N/A
247N/A# test the built source
247N/A$(BUILD_DIR)/%/.tested: $(COMPONENT_TEST_DEP)
247N/A $(COMPONENT_PRE_TEST_ACTION)
247N/A (cd $(COMPONENT_TEST_DIR); $(COMPONENT_TEST_ENV_CMD) \
247N/A $(COMPONENT_TEST_ENV) \
247N/A $(COMPONENT_TEST_CMD) $(COMPONENT_TEST_ARGS) )
247N/A $(COMPONENT_POST_TEST_ACTION)
247N/A $(TOUCH) $@
247N/A
814N/Aifeq ($(strip $(PARFAIT_BUILD)),yes)
2238N/Aparfait: build
814N/Aelse
814N/Aparfait:
814N/A $(MAKE) PARFAIT_BUILD=yes parfait
814N/Aendif
814N/A
99N/Aclean::
99N/A $(RM) -r $(SOURCE_DIR) $(BUILD_DIR)
1874N/A
4070N/A# Make it easy to construct a URL for a pypi source download. This
4070N/A# construct supports an optional call to a number from
4070N/A# NUM_EXTRA_ARCHIVES for multiple archive downloads.
1874N/APYPI_BASE = http://pypi.python.org/packages/source
4070N/Apypi_url_multi = $(shell echo $(COMPONENT_NAME_$(1)) | cut -c1)/$(COMPONENT_NAME_$(1))/$(COMPONENT_ARCHIVE_$(1))
4070N/Apypi_url_single = $(shell echo $(COMPONENT_NAME) | cut -c1)/$(COMPONENT_NAME)/$(COMPONENT_ARCHIVE)
4070N/Apypi_url = $(PYPI_BASE)/$(if $(COMPONENT_NAME_$(1)),$(pypi_url_multi),$(pypi_url_single))
3996N/A
3996N/Aifneq ($(findstring 2.6, $(PYTHON_VERSIONS)),)
3996N/AREQUIRED_PACKAGES += runtime/python-26
3996N/Aendif
3996N/Aifneq ($(findstring 2.7, $(PYTHON_VERSIONS)),)
3996N/AREQUIRED_PACKAGES += runtime/python-27
3996N/Aendif
3996N/Aifneq ($(findstring 3.4, $(PYTHON_VERSIONS)),)
3996N/AREQUIRED_PACKAGES += runtime/python-34
3996N/Aendif
3996N/AREQUIRED_PACKAGES += library/python/setuptools