Andrzej Szeszo
2013-06-04 453bf5a3004107204e1858532a38b3e703e32995
commit | author | age
35a012 1 #
NJ 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 #
2fb857 21 # Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
35a012 22 #
9aea33 23 include ../../../make-rules/shared-macros.mk
35a012 24
NJ 25 PATH=/usr/bin:/usr/gnu/bin:/usr/sbin
26
27 COMPONENT_NAME=        Python
0fe312 28 COMPONENT_VERSION=    2.6.8
60e6e0 29 COMPONENT_PROJECT_URL=    http://python.org/
35a012 30 COMPONENT_SRC=        $(COMPONENT_NAME)-$(COMPONENT_VERSION)
NJ 31 COMPONENT_ARCHIVE=    $(COMPONENT_SRC).tar.bz2
35e110 32 COMPONENT_ARCHIVE_HASH=    \
0fe312 33     sha256:c34036718ee1f091736677f543bc7960861cf9fcbea77d49572b59f7f1ab3c3f
60e6e0 34 COMPONENT_ARCHIVE_URL=    $(COMPONENT_PROJECT_URL)ftp/python/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
3b89c9 35 COMPONENT_BUGDB=    utility/python
35a012 36
NJ 37 include $(WS_TOP)/make-rules/prep.mk
38 include $(WS_TOP)/make-rules/configure.mk
39 include $(WS_TOP)/make-rules/ips.mk
12547d 40 include $(WS_TOP)/make-rules/lint-libraries.mk
2fb857 41
BC 42 # Need to preserve timestamp for Grammar files.  If the pickle files are older, 
43 # Python will try to rebuild them.  
44 PKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.txt
45 PKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.pickle
35a012 46
7eff8b 47 # We patch auto* files, so regenerate headers and configure
NJ 48 COMPONENT_PREP_ACTION = \
49     (cd $(@D) ; autoheader ; autoconf)
50
51 # This seems horribly wrong, but these defines break the ability to build c99
52 # compliant modules or with gcc.
53 COMPONENT_POST_CONFIGURE_ACTION = \
54     (cd $(@D) ; \
55      perl -pi -e 's/(^\#define _POSIX_C_SOURCE.*)/\/* $$1 *\//' pyconfig.h ; \
56      perl -pi -e 's/^(\#define _XOPEN_SOURCE.*)/\/* $$1 *\//' pyconfig.h ; \
57      perl -pi -e 's/^(\#define _XOPEN_SOURCE_EXTENDED.*)/\/* $$1 *\//' \
58             pyconfig.h)
59
7f3d6f 60 # The python build is profile-guided for studio; to see the benefits of that,
SW 61 # Python must be compiled with -xO5 and a different build target must be used.
62 # Use of xprofile requires that the same options be used during compilation and
63 # linking.  The targets chosen are based on Solaris 11 minimum supported system
64 # requirements.
65 COMPONENT_BUILD_TARGETS = profile-opt
66 XPROFILE_DIR = $(BUILD_DIR_$(BITS))/.profile
0c2d4d 67 PYFLAGS.i386 = -xtarget=opteron -xarch=sse2 -xcache=generic
7f3d6f 68 PYFLAGS.sparc =
SW 69 CFLAGS += -xO5 $(PYFLAGS.$(MACH))
70 LDFLAGS += -xO5 $(PYFLAGS.$(MACH))
71
35a012 72 # we don't want to leak $(CC_BITS) into BASECFLAGS as it causes problems with
NJ 73 # python-config
7eff8b 74 CC +=    $(CFLAGS)
35a012 75
NJ 76 C99MODE=
77 CPPFLAGS +=    -IPython
78
7eff8b 79 # so we find the ncurses headers
NJ 80 CPPFLAGS +=    -I/usr/include/ncurses
81 # enable large files how they did in JDS
82 CPPFLAGS +=    -D_LARGEFILE64_SOURCE
35a012 83 # libffi for _ctypes
NJ 84 CPPFLAGS +=    $(shell pkg-config --cflags-only-I libffi)
7eff8b 85
12547d 86 # Python puts its header files in a special place.
DD 87 LINT_FLAGS +=    -I$(SOURCE_DIR)/Include
88
35a012 89 CONFIGURE_OPTIONS  +=        --infodir=$(CONFIGURE_INFODIR)
NJ 90 CONFIGURE_OPTIONS  +=        --enable-shared
91 CONFIGURE_OPTIONS  +=        --with-system-ffi
92 CONFIGURE_OPTIONS  +=        --without-gcc
93 CONFIGURE_OPTIONS  +=        CPPFLAGS="$(CPPFLAGS)"
7eff8b 94 CONFIGURE_OPTIONS  +=        CFLAGS="$(CFLAGS)"
NJ 95 CONFIGURE_OPTIONS  +=        CCSHARED="$(CC_PIC)"
3cec7d 96 CONFIGURE_OPTIONS  +=        CXX="$(CXX)"
NJ 97 CONFIGURE_OPTIONS  +=        CXXFLAGS="$(CXXFLAGS)"
35a012 98 CONFIGURE_OPTIONS  +=        DFLAGS="-$(BITS)"
7f3d6f 99 CONFIGURE_OPTIONS  +=        XPROFILE_DIR="$(XPROFILE_DIR)"
35a012 100 COMPONENT_BUILD_ENV  +=        DFLAGS="-$(BITS)"
7f3d6f 101 COMPONENT_BUILD_ENV  +=        XPROFILE_DIR="$(XPROFILE_DIR)"
35a012 102
NJ 103 # 64 bit shared objects need to go in a 64-bit directory
104 COMPONENT_INSTALL_ARGS.64 += DESTSHARED=$(CONFIGURE_PREFIX)/lib/python2.6/lib-dynload
105
2fb857 106 # Setup pyconfig.h file to support 32 & 64 bit.
BC 107 # If the /usr/lib/python2.6/lib2to3/*.pickle files are older than the related
108 # *.txt files in the same directory, it will rebuild them anytime you try to
109 # build a Python module.  So here we also touch the pickle files to avoid this.
110 #
111 COMPONENT_POST_INSTALL_ACTION= \
112             (cd $(PROTOUSRDIR) ;  \
113              $(MV) include/python2.6/pyconfig.h include/python2.6/pyconfig-$(BITS).h ; \
114              $(TOUCH) lib/python2.6/lib2to3/*.pickle)
115                 
6f9d8e 116 ASLR_MODE = $(ASLR_ENABLE)
BC 117
35a012 118 # common targets
2fb857 119 $(INSTALL_32):  $(INSTALL_64)
35a012 120 build:        $(BUILD_32_and_64)
NJ 121 install:    $(INSTALL_32_and_64)
122
2fb857 123 # Using "-uall,-network" ensures all tests are run except the network tests.
BC 124 # The network tests contain many expected failures when run behind a firewall.
125 # The "-v" ensures verbose mode.  You can set TESTOPTS_PYTHON_TEST to a
126 # particular test if you want to run just one test.  For example, run gmake with
127 # "-k" so it continues and does both 32-bit and 64-bit tests, even if there is a
128 # failure, like this:
129 # $ TESTOPTS_PYTHON_TEST=test_sys gmake -k test
130 # Note that when a test succeeds, the builds/*/.tested file gets created.  You
131 # may need to remove these files, or run "gmake clobber" or "gmake clean"
132 # between tests.
133 #
134 COMPONENT_TEST_ENV = EXTRATESTOPTS="-v -uall,-network $(TESTOPTS_PYTHON_TEST)"
135 COMPONENT_TEST_TARGETS = test
136
137 test:                $(TEST_32_and_64)
35a012 138
NJ 139 BUILD_PKG_DEPENDENCIES =    $(BUILD_TOOLS)
140
141 include $(WS_TOP)/make-rules/depend.mk