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