Makefile revision 5556
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# CDDL HEADER START
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# The contents of this file are subject to the terms of the
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# Common Development and Distribution License (the "License").
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# You may not use this file except in compliance with the License.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# or http://www.opensolaris.org/os/licensing.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# See the License for the specific language governing permissions
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# and limitations under the License.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# When distributing Covered Code, include this CDDL HEADER in each
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# If applicable, add the following below this CDDL HEADER, with the
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# fields enclosed by brackets "[]" replaced with your own identifying
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# information: Portions Copyright [yyyy] [name of copyright owner]
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# CDDL HEADER END
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poetteringinclude ../../../make-rules/shared-macros.mk
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCOMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
3b7124a8db56ed57525b9ecfd19cfdc8c9facba0Lennart PoetteringCOMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.xz
6482f6269c87d2249e52e889a63adbdd50f2d691Ronny Chevalier sha256:962b4c45af50124ea61f11a30deb4342fc0bc21126790fa1d7f6c79809413f46
0b452006de98294d1690f045f6ea2f7f6630ec3bRonny ChevalierCOMPONENT_ARCHIVE_URL= $(COMPONENT_PROJECT_URL)ftp/python/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCOMPONENT_SIG_URL= $(COMPONENT_ARCHIVE_URL).asc
b92bea5d2a9481de69bb627a7b442a9f58fca43dZbigniew Jędrzejewski-Szmekinclude $(WS_MAKE_RULES)/lint-libraries.mk
b92bea5d2a9481de69bb627a7b442a9f58fca43dZbigniew Jędrzejewski-Szmek# Need to preserve timestamp for Grammar files. If the pickle files are older,
b92bea5d2a9481de69bb627a7b442a9f58fca43dZbigniew Jędrzejewski-Szmek# Python will try to rebuild them.
b92bea5d2a9481de69bb627a7b442a9f58fca43dZbigniew Jędrzejewski-SzmekPKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.txt
46b131574fdd7d77c15a0919ca9010cad7aa6ac7Lennart PoetteringPKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.pickle
f8294e4175918117ca6c131720bcf287eadcd029Josh Triplett# We patch auto* files, so regenerate headers and configure
b92bea5d2a9481de69bb627a7b442a9f58fca43dZbigniew Jędrzejewski-SzmekCOMPONENT_PREP_ACTION = (cd $(@D) ; autoheader ; autoconf -f)
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# we don't want to leak $(CC_BITS) into BASECFLAGS as it causes problems with
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# python-config
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# to find the ncurses headers
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# enable large files how they did in JDS
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# libffi for _ctypes
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCPPFLAGS += $(shell pkg-config --cflags-only-I libffi)
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# because python links with $(CC) ... $(LDFLAGS) ...
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# The python build is profile-guided for studio; to see the benefits of that,
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# Python must be compiled with -xO5 and a different build target must be used.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# Use of xprofile requires that the same options be used during compilation and
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# linking. The targets chosen are based on Solaris 11 minimum supported system
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# requirements.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringXPROFILE_DIR = $(BUILD_DIR_$(BITS))/.profile
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringPYFLAGS.i386 = -xtarget=opteron -xarch=sse2 -xcache=generic
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# Python puts its header files in a special place.
ccf23ad5faf228d450d263d7291156a948b61af2Christian Seiler# PYTHONPATH in the environment can be harmful, but setting it to empty via
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# _INSTALL_ENV causes problems too, so just ignore the entire environment.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# Because of this, we need to specify PATH in multiple places below.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCONFIGURE_OPTIONS += --infodir=$(CONFIGURE_INFODIR)
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCONFIGURE_OPTIONS += "ac_cv_func_forkpty=no"
178cc7700c23ac088cd7190d7854282075028d91Lennart PoetteringCONFIGURE_OPTIONS += "ac_cv_func_openpty=no"
178cc7700c23ac088cd7190d7854282075028d91Lennart PoetteringCONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)"
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCONFIGURE_OPTIONS += XPROFILE_DIR="$(XPROFILE_DIR)"
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCOMPONENT_BUILD_ENV += XPROFILE_DIR="$(XPROFILE_DIR)"
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# 64 bit shared objects need to go in a 64-bit directory
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCOMPONENT_INSTALL_ARGS.64 += DESTSHARED=$(CONFIGURE_PREFIX)/lib/python2.7/lib-dynload
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# Simplify the definitions of CC, CXX, CFLAGS and LDFLAGS so they hard-code
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# neither paths from our build systems nor Studio-specific options.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering (cd $(@D) ; $(GSED) -i -e 's/^CC=.*/CC=\t\tcc/' \
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering -e 's/^CFLAGS=.*/CFLAGS=\t\t\$$\(BASECFLAGS) \$$\(OPT) \$$\(EXTRA_CFLAGS)/' \
3b3154df7e2773332bb814e167187367a0ccae4aLennart Poettering# Because we stripped the Makefile above, we need to pass several things in the
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# environment, and use -e to tell gmake to pay attention to the environment.
5ffa8c818120e35c89becd938d160235c069dd12Zbigniew Jędrzejewski-SzmekCOMPONENT_INSTALL_ENV += CXX="$(CXX)"
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCOMPONENT_INSTALL_ENV += CFLAGS="$(CFLAGS)"
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCOMPONENT_INSTALL_ENV += LDFLAGS="$(LDFLAGS)"
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# 1. Setup pyconfig.h file to support 32 & 64 bit.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# 2. If the /usr/lib/python2.7/lib2to3/*.pickle files are older than the
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# related *.txt files in the same directory, it will rebuild them any time
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# you try to build a Python module. So here we also touch the pickle files
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# to avoid this.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# 3. Strip build machine paths from _sysconfigdata.py & config/Makefile.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# Note that although the 64-bit version is not used (and thus commented
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# out in the manifest), we still need to specify the 32-/64-bit paths,
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# otherwise the 64-bit build will fail to find the 32-bit path.
5ffa8c818120e35c89becd938d160235c069dd12Zbigniew Jędrzejewski-Szmek# 4. (Re)compile _sysconfigdata.py since we just updated it.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCONFIG_MAKEFILE.32= lib/python2.7/config/Makefile
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCONFIG_MAKEFILE.64= lib/$(MACH64)/python2.7/config/Makefile
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCONFIG_MAKEFILE= $(CONFIG_MAKEFILE.$(BITS))
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering $(MV) include/python2.7/pyconfig.h include/python2.7/pyconfig-$(BITS).h ; \
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering $(TOUCH) lib/python2.7/lib2to3/*.pickle ; \
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering $(GSED) -i -e 's|$(SOURCE_DIR)|.|g' -e 's|$(COMPONENT_DIR)|..|g' \
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering -e 's|$(SPRO_VROOT)/bin/||g' lib/python2.7/_sysconfigdata.py \
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering $(PYTHON.2.7) -m py_compile lib/python2.7/_sysconfigdata.py)
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# common targets
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# Using "-uall,-network" ensures all tests are run except the network tests.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# The network tests contain many expected failures when run behind a firewall.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# The "-v" ensures verbose mode. You can set TESTOPTS_PYTHON_TEST to a
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# particular test if you want to run just one test. For example, run gmake with
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# "-k" so it continues and does both 32-bit and 64-bit tests, even if there is a
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# failure, like this:
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# $ TESTOPTS_PYTHON_TEST=test_sys gmake -k test
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# Note that when a test succeeds, the builds/*/.tested file gets created. You
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# may need to remove these files, or run "gmake clobber" or "gmake clean"
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# between tests.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCOMPONENT_TEST_ENV = EXTRATESTOPTS="-v -uall,-network $(TESTOPTS_PYTHON_TEST)"
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# The distutils tests need $CC in $PATH.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCOMPONENT_TEST_ENV += PATH="$(SPRO_VROOT)/bin:$(PATH)"
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# The test output contains details from each test, in whatever order they
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# complete. The default _TRANSFORMER is not powerful enough to deal with
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# this; we need heavier artillery. Extract just the sections that start
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart Poettering# with "tests OK." and end with "Makefile: " for comparison.
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringCOMPONENT_TEST_TRANSFORMS = "'/tests OK./ {results = 1}; /Makefile:/ {results = 0} {if (results) print $0 } '"
e88baee88fad8bc59d33b55a7a2d640ef9e16cd6Zbigniew Jędrzejewski-Szmeksystem-test: $(SYSTEM_TESTS_NOT_IMPLEMENTED)
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringREQUIRED_PACKAGES += developer/library/xprofile
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringREQUIRED_PACKAGES += library/database/gdbm
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringREQUIRED_PACKAGES += library/python/pip-27
35e2e347d38cc2f8bd7c38a0d8a5129f5fbb0ab9Lennart PoetteringREQUIRED_PACKAGES += library/security/openssl