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.
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.
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]
23 # Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
24 # Copyright (c) 2019, Michal Nowak
25 # Copyright (c) 2021, Aurelien Larcher
28 USE_PARALLEL_BUILD
= yes
30 include ..
/..
/..
/make-rules
/shared-macros.mk
32 COMPONENT_NAME
= Python
33 COMPONENT_VERSION
= 3.9.21
34 PYTHON_VERSION
= $(subst $(space
),.
,$(wordlist
1,2,$(subst .
, ,$(COMPONENT_VERSION
))))
35 COMPONENT_SUMMARY
= The Python interpreter
, libraries and utilities
36 COMPONENT_PROJECT_URL
= https
://python.org
/
37 COMPONENT_SRC
= $(COMPONENT_NAME
)-$(COMPONENT_VERSION
)
38 COMPONENT_ARCHIVE
= $(COMPONENT_SRC
).
tar.xz
39 COMPONENT_ARCHIVE_HASH
= sha256
:3126f59592c9b0d798584755f2bf7b081fa1ca35ce7a6fea980108d752a05bb1
40 COMPONENT_ARCHIVE_URL
= $(COMPONENT_PROJECT_URL
)ftp
/python
/$(COMPONENT_VERSION
)/$(COMPONENT_ARCHIVE
)
41 COMPONENT_FMRI
= runtime
/python-39
42 COMPONENT_CLASSIFICATION
= Development
/Python
43 COMPONENT_LICENSE
= PSFv2
44 COMPONENT_LICENSE_FILE
= LICENSE
46 CONFIGURE_FIX_LIBTOOL_RPATH
= no
48 include $(WS_MAKE_RULES
)/common.mk
52 # Need to preserve timestamp for Grammar files. If the pickle files are older,
53 # Python will try to rebuild them.
54 PKGSEND_PUBLISH_OPTIONS
+= -T \
*Grammar\
*.txt
55 PKGSEND_PUBLISH_OPTIONS
+= -T \
*Grammar\
*.pickle
57 # We patch auto* files, so regenerate headers and configure
58 COMPONENT_PREP_ACTION
= (cd
$(@D
) ; autoheader
; autoconf
-f
)
60 # we don't want to leak $(CC_BITS) into BASECFLAGS as it causes problems with
68 # to find the ncurses headers
69 CPPFLAGS
+= -I
/usr
/include/ncurses
70 # enable large files how they did in JDS
71 CPPFLAGS
+= -D_LARGEFILE64_SOURCE
74 CPPFLAGS
+= $(shell pkg-config
--cflags-only-I libffi
)
76 # because python links with $(CC) ... $(LDFLAGS) ...
77 LDFLAGS
= $(CC_BITS
) $(CC_PIC
)
81 CFLAGS
+= $(CFLAGS.
$(MACH
))
84 CFLAGS
+= $(CPP_XPG6MODE
)
86 # The python build is profile-guided for gcc. Use of xprofile requires that
87 # the same options be used during compilation and linking. The targets chosen
88 # are based on Solaris 11 minimum supported system requirements.
89 XPROFILE_DIR
= $(BUILD_DIR_
$(BITS
))/.profile
91 # PYTHONPATH in the environment can be harmful, but setting it to empty via
92 # _INSTALL_ENV causes problems too, so just ignore the entire environment.
93 # (see 20396493) Because of this, we have to explicitly specify PATH in
94 # multiple places below.
96 # Configure script should look into sbin folder when looking for dtrace
97 CONFIGURE_ENV
+= PATH
="$(PATH):/usr/sbin"
99 # Disable epoll on illumos
100 CONFIGURE_ENV
+= ac_cv_func_epoll_ctl
=no
101 CONFIGURE_ENV
+= ac_cv_func_epoll_create1
=no
103 CONFIGURE_ENV
+= ac_cv_func_getentropy
=no
105 CONFIGURE_OPTIONS
+= --infodir=$(CONFIGURE_INFODIR
)
106 CONFIGURE_OPTIONS
+= --enable-shared
107 CONFIGURE_OPTIONS
+= --enable-optimizations
108 CONFIGURE_OPTIONS
+= --enable-loadable-sqlite-extensions
109 CONFIGURE_OPTIONS
+= --with-dtrace
110 CONFIGURE_OPTIONS
+= --with-system-expat
111 CONFIGURE_OPTIONS
+= --with-system-ffi
112 CONFIGURE_OPTIONS
+= --without-ensurepip
113 CONFIGURE_OPTIONS
+= --enable-ipv6
114 CONFIGURE_OPTIONS
+= --with-c-locale-coercion
115 CONFIGURE_OPTIONS
+= --bindir=$(USRBINDIR
)
116 # https://bugs.python.org/issue25003
117 # CONFIGURE_OPTIONS += "ac_cv_func_getentropy=no"
118 CONFIGURE_OPTIONS
+= CPPFLAGS
="$(CPPFLAGS) -DSKIP_ZIP_PATH "
119 CONFIGURE_OPTIONS
+= LDFLAGS
="$(LDFLAGS)"
120 CONFIGURE_OPTIONS
+= CFLAGS
="$(CFLAGS)"
121 CONFIGURE_OPTIONS
+= DFLAGS
="-$(BITS)"
122 CONFIGURE_OPTIONS
+= XPROFILE_DIR
="$(XPROFILE_DIR)"
124 COMPONENT_BUILD_ENV
+= DFLAGS
="-$(BITS)"
125 COMPONENT_BUILD_ENV
+= XPROFILE_DIR
="$(XPROFILE_DIR)"
126 COMPONENT_BUILD_ENV
+= PATH
="$(PATH)"
128 # Some tests have non-ASCII characters encoded for international domain names;
129 # the publish step will fail in 'pkgdepend generate' without this:
130 COMPONENT_PUBLISH_ENV
+= LC_ALL
=en_US.UTF-8
132 # 64 bit shared objects need to go in a 64-bit directory
133 COMPONENT_INSTALL_ARGS
+= DESTSHARED
=$(CONFIGURE_PREFIX
)/lib
/python
$(PYTHON_VERSION
)/lib-dynload
135 # Simplify the definitions of CC, CXX, CFLAGS and LDFLAGS so they hard-code
136 # neither paths from our build systems nor Studio-specific options.
137 COMPONENT_PRE_INSTALL_ACTION
= \
139 $(GSED
) -i
-e
's/^CC=.*/CC=\t\tgcc/' -e
's/^CXX=.*/CXX=\t\tg++/' \
140 -e
's/^CFLAGS=.*/CFLAGS=\t\t\$$\(BASECFLAGS) \$$\(OPT) \$$\(EXTRA_CFLAGS)/' \
141 -e
's|^LDFLAGS=.*|LDFLAGS=|' Makefile
)
143 # Because we stripped the Makefile above, we need to pass several things in the
144 # environment, and use -e to tell gmake to pay attention to the environment.
145 COMPONENT_INSTALL_ENV
+= CC
="$(CC)"
146 COMPONENT_INSTALL_ENV
+= CXX
="$(CXX)"
147 COMPONENT_INSTALL_ENV
+= CFLAGS
="$(CFLAGS)"
148 COMPONENT_INSTALL_ENV
+= LDFLAGS
="$(LDFLAGS)"
149 COMPONENT_INSTALL_ENV
+= PATH
="$(PATH)"
150 COMPONENT_INSTALL_ARGS
+= -e
152 # Strip build machine paths from _sysconfigdata.py & config/Makefile,
153 # then (re)compile _sysconfigdata.py since we just updated it.
154 # Note that once Python 3.9 has been integrated and propagated to build
155 # machines, then the LD_LIBRARY_PATH setting and PROTO_DIR prefix below
156 # can both be removed.
157 COMPONENT_POST_INSTALL_ACTION
= \
158 (cd
$(PROTOUSRLIBDIR
)/python
$(PYTHON_VERSION
) ; \
159 $(GSED
) -i
-e
's|$(SOURCE_DIR)|.|g' -e
's|$(COMPONENT_DIR)|..|g' \
160 -e
's|$(SPRO_VROOT)/bin/||g' _sysconfigdata__sunos5_.py config-
$(PYTHON_VERSION
)/Makefile
; \
161 LD_LIBRARY_PATH
=$(PROTOUSRLIBDIR64
) $(PROTO_DIR
)$(PYTHON
) -m py_compile _sysconfigdata__sunos5_.py
)
163 # You can set TESTOPTS_PYTHON_TEST to a particular test if you want to run just
164 # one test. For example:
165 # $ TESTOPTS_PYTHON_TEST=test_sys
166 TESTOPTS_PYTHON_TEST
=
167 COMPONENT_TEST_ENV
= PATH
="$(PATH)"
169 # Using "-uall,-network" ensures all tests are run except the network tests.
170 # The network tests contain many expected failures when run behind a firewall.
171 # The "-v" ensures verbose mode.
172 COMPONENT_TEST_ENV
+= EXTRATESTOPTS
="-v -uall,-network $(TESTOPTS_PYTHON_TEST)"
174 # Prevent the tests from getting stuck waiting for input.
175 COMPONENT_TEST_TARGETS
= test < /dev
/null
177 # The test output contains details from each test, in whatever order they
178 # complete. The default _TRANSFORMER is not powerful enough to deal with
179 # this; we need heavier artillery. Extract just the sections that start
180 # with "tests OK." and end with "Re-running failed tests..." for comparison.
181 COMPONENT_TEST_TRANSFORMER
= $(NAWK
)
182 COMPONENT_TEST_TRANSFORMS
= "'/tests OK./ {results = 1}; /Total duration/ {results = 0}; /Re-running failed tests in verbose mode/ {results = 0} {if (results) print $0 }'"
184 # Required for dump(1)
185 REQUIRED_PACKAGES
+= developer
/object-file
186 # Required to build ossaudiodev module
187 REQUIRED_PACKAGES
+= system
/header
/header-audio
189 # Auto-generated dependencies
190 REQUIRED_PACKAGES
+= $(OPENSSL_PKG
)
191 REQUIRED_PACKAGES
+= $(READLINE_PKG
)
192 REQUIRED_PACKAGES
+= compress
/bzip2
193 REQUIRED_PACKAGES
+= compress
/xz
194 REQUIRED_PACKAGES
+= database
/sqlite-3
195 REQUIRED_PACKAGES
+= library
/database
/gdbm
196 REQUIRED_PACKAGES
+= library
/expat
197 REQUIRED_PACKAGES
+= library
/libffi
198 REQUIRED_PACKAGES
+= library
/ncurses
199 REQUIRED_PACKAGES
+= library
/zlib
200 REQUIRED_PACKAGES
+= runtime
/tcl-8
201 REQUIRED_PACKAGES
+= runtime
/tk-8
202 REQUIRED_PACKAGES
+= system
/library
203 REQUIRED_PACKAGES
+= system
/library
/math