|
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 # |
|
21 |
|
22 # |
|
23 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
|
24 # |
|
25 |
|
26 include ../../../make-rules/shared-macros.mk |
|
27 |
|
28 COMPONENT_NAME= Python |
|
29 COMPONENT_VERSION= 3.5.0 |
|
30 COMPONENT_PROJECT_URL= http://python.org/ |
|
31 COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION) |
|
32 COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.xz |
|
33 COMPONENT_ARCHIVE_HASH= \ |
|
34 sha256:d6d7aa1634a5eeeca6ed4fca266982a04f84bd8f3945a9179e20b24ad2e2be91 |
|
35 COMPONENT_ARCHIVE_URL= $(COMPONENT_PROJECT_URL)ftp/python/3.5.0/$(COMPONENT_ARCHIVE) |
|
36 COMPONENT_SIG_URL= $(COMPONENT_ARCHIVE_URL).asc |
|
37 COMPONENT_BUGDB= utility/python |
|
38 |
|
39 TPNO= 24524 |
|
40 |
|
41 include $(WS_MAKE_RULES)/prep.mk |
|
42 include $(WS_MAKE_RULES)/configure.mk |
|
43 include $(WS_MAKE_RULES)/ips.mk |
|
44 include $(WS_MAKE_RULES)/lint-libraries.mk |
|
45 |
|
46 # Need to preserve timestamp for Grammar files. If the pickle files are older, |
|
47 # Python will try to rebuild them. |
|
48 PKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.txt |
|
49 PKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.pickle |
|
50 |
|
51 # We patch auto* files, so regenerate headers and configure |
|
52 COMPONENT_PREP_ACTION = \ |
|
53 (cd $(@D) ; autoheader ; autoconf) |
|
54 |
|
55 # The DTrace patch needs this file to be mode 0755. |
|
56 COMPONENT_PRE_BUILD_ACTION=($(CHMOD) +x \ |
|
57 $(SOURCE_DIR)/Include/pydtrace_offsets.sh) |
|
58 |
|
59 # we don't want to leak $(CC_BITS) into BASECFLAGS as it causes problems with |
|
60 # python-config |
|
61 CC += $(CFLAGS) |
|
62 |
|
63 C99MODE= |
|
64 CPPFLAGS += -IPython |
|
65 |
|
66 # to find the ncurses headers |
|
67 CPPFLAGS += -I/usr/include/ncurses |
|
68 # enable large files how they did in JDS |
|
69 CPPFLAGS += -D_LARGEFILE64_SOURCE |
|
70 |
|
71 # libffi for _ctypes |
|
72 CPPFLAGS += $(shell pkg-config --cflags-only-I libffi) |
|
73 |
|
74 # because python links with $(CC) ... $(LDFLAGS) ... |
|
75 LDFLAGS = $(CC_BITS) $(CC_PIC) |
|
76 |
|
77 # build pic |
|
78 CFLAGS += $(CC_PIC) |
|
79 |
|
80 # for DWARF |
|
81 CFLAGS.i386 = -preserve_argvalues=complete |
|
82 CFLAGS += $(CFLAGS.$(MACH)) |
|
83 |
|
84 # 16-byte memory alignment + interpretation of non-alignment prevents SIGBUS. |
|
85 studio_ALIGN.sparc.64 = -xmemalign=16i |
|
86 |
|
87 # The python build is profile-guided for studio; to see the benefits of that, |
|
88 # Python must be compiled with -xO5 and a different build target must be used. |
|
89 # Use of xprofile requires that the same options be used during compilation and |
|
90 # linking. The targets chosen are based on Solaris 11 minimum supported system |
|
91 # requirements. |
|
92 COMPONENT_BUILD_TARGETS = profile-opt |
|
93 XPROFILE_DIR = $(BUILD_DIR_$(BITS))/.profile |
|
94 PYFLAGS.i386 = -xtarget=opteron -xarch=sse2 -xcache=generic |
|
95 PYFLAGS.sparc = |
|
96 CFLAGS += -xO5 $(PYFLAGS.$(MACH)) |
|
97 LDFLAGS += -xO5 $(PYFLAGS.$(MACH)) |
|
98 |
|
99 # Python puts its header files in a special place. |
|
100 LINT_FLAGS += -I$(SOURCE_DIR)/Include |
|
101 |
|
102 # PYTHONPATH in the environment can be harmful, but setting it to empty via |
|
103 # _INSTALL_ENV causes problems too, so just ignore the entire environment. |
|
104 # Because of this, we need to specify PATH in multiple places below. |
|
105 ENV += -i |
|
106 |
|
107 CONFIGURE_ENV += PATH="$(PATH)" |
|
108 |
|
109 CONFIGURE_OPTIONS += --infodir=$(CONFIGURE_INFODIR) |
|
110 CONFIGURE_OPTIONS += --enable-shared |
|
111 CONFIGURE_OPTIONS += --with-dtrace |
|
112 CONFIGURE_OPTIONS += --with-system-expat |
|
113 CONFIGURE_OPTIONS += --with-system-ffi |
|
114 CONFIGURE_OPTIONS += --without-gcc |
|
115 CONFIGURE_OPTIONS += --without-ensurepip |
|
116 CONFIGURE_OPTIONS += --enable-ipv6 |
|
117 CONFIGURE_OPTIONS += --bindir=/usr/bin |
|
118 CONFIGURE_OPTIONS += "ac_cv_func_getentropy=no" |
|
119 CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)" |
|
120 CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)" |
|
121 CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" |
|
122 CONFIGURE_OPTIONS += DFLAGS="-$(BITS)" |
|
123 CONFIGURE_OPTIONS += XPROFILE_DIR="$(XPROFILE_DIR)" |
|
124 |
|
125 COMPONENT_BUILD_ENV += DFLAGS="-$(BITS)" |
|
126 COMPONENT_BUILD_ENV += XPROFILE_DIR="$(XPROFILE_DIR)" |
|
127 COMPONENT_BUILD_ENV += PATH="$(PATH)" |
|
128 |
|
129 # Some tests have non-ASCII characters encoded for international domain names; |
|
130 # the publish step will fail in 'pkgdepend generate' without this: |
|
131 COMPONENT_PUBLISH_ENV += LC_ALL=en_US.UTF-8 |
|
132 |
|
133 # 64 bit shared objects need to go in a 64-bit directory |
|
134 COMPONENT_INSTALL_ARGS.64 += DESTSHARED=$(CONFIGURE_PREFIX)/lib/python3.5/lib-dynload |
|
135 |
|
136 ASLR_MODE = $(ASLR_ENABLE) |
|
137 |
|
138 # Simplify the definitions of CC, CXX, CFLAGS and LDFLAGS so they hard-code |
|
139 # neither paths from our build systems nor Studio-specific options. |
|
140 COMPONENT_PRE_INSTALL_ACTION= \ |
|
141 (cd $(@D) ; \ |
|
142 $(GSED) -i -e 's/^CC=.*/CC=\t\tcc/' -e 's/^CXX=.*/CXX=\t\tCC/' \ |
|
143 -e 's/^CFLAGS=.*/CFLAGS=\t\t\$$\(BASECFLAGS) \$$\(OPT) \$$\(EXTRA_CFLAGS)/' \ |
|
144 -e 's|^LDFLAGS=.*|LDFLAGS=|' Makefile) |
|
145 |
|
146 # Because we stripped the Makefile above, we need to pass several things in the |
|
147 # environment, and use -e to tell gmake to pay attention to the environment. |
|
148 COMPONENT_INSTALL_ENV += CC="$(CC)" |
|
149 COMPONENT_INSTALL_ENV += CXX="$(CXX)" |
|
150 COMPONENT_INSTALL_ENV += CFLAGS="$(CFLAGS)" |
|
151 COMPONENT_INSTALL_ENV += LDFLAGS="$(LDFLAGS)" |
|
152 COMPONENT_INSTALL_ENV += PATH="$(PATH)" |
|
153 COMPONENT_INSTALL_ARGS += -e |
|
154 |
|
155 # Strip build machine paths from _sysconfigdata.py & config/Makefile, |
|
156 # then (re)compile _sysconfigdata.py since we just updated it. |
|
157 # Note that once Python 3.5 has been integrated and propagated to build |
|
158 # machines, then the LD_LIBRARY_PATH setting and PROTO_DIR prefix below |
|
159 # can both be removed. |
|
160 COMPONENT_POST_INSTALL_ACTION= \ |
|
161 (cd $(PROTOUSRLIBDIR)/python3.5 ; \ |
|
162 $(GSED) -i -e 's|$(SOURCE_DIR)|.|g' -e 's|$(COMPONENT_DIR)|..|g' \ |
|
163 -e 's|$(SPRO_VROOT)/bin/||g' _sysconfigdata.py config-3.5m/Makefile; \ |
|
164 LD_LIBRARY_PATH=$(PROTOUSRLIBDIR64) $(PROTO_DIR)$(PYTHON.3.5) -m py_compile _sysconfigdata.py) |
|
165 |
|
166 # common targets |
|
167 configure: $(CONFIGURE_64) |
|
168 build: $(BUILD_64) |
|
169 install: $(INSTALL_64) |
|
170 |
|
171 # Using "-uall,-network" ensures all tests are run except the network tests. |
|
172 # The network tests contain many expected failures when run behind a firewall. |
|
173 # The "-v" ensures verbose mode. You can set TESTOPTS_PYTHON_TEST to a |
|
174 # particular test if you want to run just one test. For example, |
|
175 # $ TESTOPTS_PYTHON_TEST=test_sys gmake -k test |
|
176 # Note that when a test succeeds, the builds/*/.tested file gets created. You |
|
177 # may need to remove these files, or run "gmake clobber" or "gmake clean" |
|
178 # between tests. |
|
179 # |
|
180 COMPONENT_TEST_ENV = EXTRATESTOPTS="-v -uall,-network $(TESTOPTS_PYTHON_TEST)" |
|
181 # The distutils tests need $CC in $PATH. |
|
182 COMPONENT_TEST_ENV += PATH="$(SPRO_VROOT)/bin:$(PATH)" |
|
183 # Prevent the tests from getting stuck waiting for input. |
|
184 COMPONENT_TEST_TARGETS = test < /dev/null |
|
185 # Some different values for system testing. |
|
186 COMPONENT_SYSTEM_TEST_ENV = EXTRATESTOPTS="-v -uall,-network $(TESTOPTS_PYTHON_TEST)" |
|
187 COMPONENT_SYSTEM_TEST_TARGETS = |
|
188 COMPONENT_SYSTEM_TEST_CMD= $(PYTHON.3.5) |
|
189 COMPONENT_SYSTEM_TEST_ARGS= /usr/lib/python3.5/test/regrtest.py -v -uall,-network |
|
190 |
|
191 # The test output contains details from each test, in whatever order they |
|
192 # complete. The default _TRANSFORMER is not powerful enough to deal with |
|
193 # this; we need heavier artillery. Extract just the sections that start |
|
194 # with "tests OK." and end with "Re-running failed tests..." for comparison. |
|
195 COMPONENT_TEST_TRANSFORMER = $(NAWK) |
|
196 COMPONENT_TEST_TRANSFORMS = "'/tests OK./ {results = 1}; /Re-running failed tests in verbose mode/ {results = 0} {if (results) print $0 } '" |
|
197 |
|
198 test: $(TEST_64) |
|
199 system-test: $(SYSTEM_TEST_64) |
|
200 |
|
201 REQUIRED_PACKAGES += compress/bzip2 |
|
202 REQUIRED_PACKAGES += compress/xz |
|
203 REQUIRED_PACKAGES += database/sqlite-3 |
|
204 REQUIRED_PACKAGES += library/database/gdbm |
|
205 REQUIRED_PACKAGES += library/expat |
|
206 REQUIRED_PACKAGES += library/libffi |
|
207 REQUIRED_PACKAGES += library/ncurses |
|
208 REQUIRED_PACKAGES += library/readline |
|
209 REQUIRED_PACKAGES += library/security/openssl |
|
210 REQUIRED_PACKAGES += library/zlib |
|
211 REQUIRED_PACKAGES += runtime/tcl-8 |
|
212 REQUIRED_PACKAGES += runtime/tk-8 |
|
213 REQUIRED_PACKAGES += system/library |
|
214 REQUIRED_PACKAGES += system/library/math |
|
215 REQUIRED_PACKAGES += system/linker |
|
216 REQUIRED_PACKAGES += x11/library/libx11 |