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