Andreas Wacknitz
2024-03-26 5289b57b9e7e1beae0b0d33715b8b899692f9ac4
commit | author | age
b5a849 1 #
AL 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, 2020, Oracle and/or its affiliates. All rights reserved.
24 # Copyright (c) 2019, Michal Nowak
25 # Copyright (c) 2021, Aurelien Larcher
26 #
27
3b8e40 28 USE_OPENSSL11= yes
77844d 29 USE_PARALLEL_BUILD=    yes
BS 30 USE_CTF=        yes
b5a849 31 include ../../../make-rules/shared-macros.mk
AL 32
33 COMPONENT_NAME=            Python
5289b5 34 COMPONENT_VERSION=      3.9.19
3af965 35 PYTHON_VERSION =    $(subst $(space),.,$(wordlist 1,2,$(subst ., ,$(COMPONENT_VERSION))))
b5a849 36 COMPONENT_SUMMARY=      The Python interpreter, libraries and utilities
4a01ab 37 COMPONENT_PROJECT_URL=  https://python.org/
b5a849 38 COMPONENT_SRC=          $(COMPONENT_NAME)-$(COMPONENT_VERSION)
AL 39 COMPONENT_ARCHIVE=      $(COMPONENT_SRC).tar.xz
5289b5 40 COMPONENT_ARCHIVE_HASH= sha256:d4892cd1618f6458cb851208c030df1482779609d0f3939991bd38184f8c679e
b5a849 41 COMPONENT_ARCHIVE_URL = $(COMPONENT_PROJECT_URL)ftp/python/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
4a01ab 42 COMPONENT_FMRI=            runtime/python-39
AW 43 COMPONENT_CLASSIFICATION= Development/Python
b5a849 44 COMPONENT_LICENSE=      PSFv2
AL 45 COMPONENT_LICENSE_FILE=    python39.license
46
47 CONFIGURE_FIX_LIBTOOL_RPATH = no
48
49 include $(WS_MAKE_RULES)/common.mk
50
4a01ab 51 PATH= $(PATH.gnu)
b5a849 52
AL 53 # Need to preserve timestamp for Grammar files.  If the pickle files are older,
54 # Python will try to rebuild them.
55 PKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.txt
56 PKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.pickle
57
58 # We patch auto* files, so regenerate headers and configure
59 COMPONENT_PREP_ACTION = (cd $(@D) ; autoheader ; autoconf -f)
60
61 # we don't want to leak $(CC_BITS) into BASECFLAGS as it causes problems with
62 # python-config
63 CC += $(CFLAGS)
64
65 gcc_OPT = -O2
66
67 CPPFLAGS += -IPython
68
69 # to find the ncurses headers
70 CPPFLAGS += -I/usr/include/ncurses
71 # enable large files how they did in JDS
72 CPPFLAGS += -D_LARGEFILE64_SOURCE
73
74 # libffi for _ctypes
75 CPPFLAGS += $(shell pkg-config --cflags-only-I libffi)
76
77 # because python links with $(CC) ... $(LDFLAGS) ...
78 LDFLAGS = $(CC_BITS) $(CC_PIC)
79
80 # build pic
81 CFLAGS += $(CC_PIC)
82 CFLAGS += $(CFLAGS.$(MACH))
83
84 # XPG6
4a01ab 85 CFLAGS += $(CPP_XPG6MODE)
b5a849 86
AL 87 # The python build is profile-guided for gcc.  Use of xprofile requires that
88 # the same options be used during compilation and linking.  The targets chosen
89 # are based on Solaris 11 minimum supported system requirements.
4a01ab 90 XPROFILE_DIR= $(BUILD_DIR_$(BITS))/.profile
b5a849 91
AL 92 # PYTHONPATH in the environment can be harmful, but setting it to empty via
93 # _INSTALL_ENV causes problems too, so just ignore the entire environment.
94 # (see 20396493) Because of this, we have to explicitly specify PATH in
95 # multiple places below. Also up the limit of maximum opened files for
96 # testing purposes and pgo.
97 ENV := ulimit -n 16384; $(ENV) -i
98
99 # Configure script should look into sbin folder when looking for dtrace
100 CONFIGURE_ENV += PATH="$(PATH):/usr/sbin"
101
102 # Disable epoll on illumos
103 CONFIGURE_ENV += ac_cv_func_epoll_ctl=no
104 CONFIGURE_ENV += ac_cv_func_epoll_create1=no
105
106 CONFIGURE_ENV += ac_cv_func_getentropy=no
107
4a01ab 108 CONFIGURE_OPTIONS += --infodir=$(CONFIGURE_INFODIR)
AW 109 CONFIGURE_OPTIONS += --enable-shared
110 CONFIGURE_OPTIONS += --enable-optimizations
237085 111 CONFIGURE_OPTIONS += --enable-loadable-sqlite-extensions
4a01ab 112 CONFIGURE_OPTIONS += --with-dtrace
AW 113 CONFIGURE_OPTIONS += --with-system-expat
114 CONFIGURE_OPTIONS += --with-system-ffi
115 CONFIGURE_OPTIONS += --without-ensurepip
116 CONFIGURE_OPTIONS += --enable-ipv6
117 CONFIGURE_OPTIONS += --with-c-locale-coercion
118 CONFIGURE_OPTIONS += --bindir=$(USRBINDIR)
b5a849 119 # https://bugs.python.org/issue25003
AL 120 # CONFIGURE_OPTIONS  +=         "ac_cv_func_getentropy=no"
4a01ab 121 CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS) -DSKIP_ZIP_PATH "
AW 122 CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)"
123 CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
124 CONFIGURE_OPTIONS += DFLAGS="-$(BITS)"
125 CONFIGURE_OPTIONS += XPROFILE_DIR="$(XPROFILE_DIR)"
b5a849 126
AL 127 COMPONENT_BUILD_ENV += DFLAGS="-$(BITS)"
128 COMPONENT_BUILD_ENV += XPROFILE_DIR="$(XPROFILE_DIR)"
129 COMPONENT_BUILD_ENV += PATH="$(PATH)"
130
131 # Some tests have non-ASCII characters encoded for international domain names;
132 # the publish step will fail in 'pkgdepend generate' without this:
133 COMPONENT_PUBLISH_ENV += LC_ALL=en_US.UTF-8
134
135 # 64 bit shared objects need to go in a 64-bit directory
3af965 136 COMPONENT_INSTALL_ARGS += DESTSHARED=$(CONFIGURE_PREFIX)/lib/python$(PYTHON_VERSION)/lib-dynload
b5a849 137
AL 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\tgcc/' -e 's/^CXX=.*/CXX=\t\tg++/' \
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.9 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= \
3af965 161     (cd $(PROTOUSRLIBDIR)/python$(PYTHON_VERSION) ; \
b5a849 162      $(GSED) -i -e 's|$(SOURCE_DIR)|.|g' -e 's|$(COMPONENT_DIR)|..|g' \
3af965 163     -e 's|$(SPRO_VROOT)/bin/||g' _sysconfigdata__sunos5_.py config-$(PYTHON_VERSION)/Makefile; \
MT 164     LD_LIBRARY_PATH=$(PROTOUSRLIBDIR64) $(PROTO_DIR)$(PYTHON) -m py_compile _sysconfigdata__sunos5_.py)
b5a849 165
AL 166 # You can set TESTOPTS_PYTHON_TEST to a particular test if you want to run just
167 # one test.  For example:
168 # $ TESTOPTS_PYTHON_TEST=test_sys
4a01ab 169 TESTOPTS_PYTHON_TEST=
AW 170 COMPONENT_TEST_ENV= PATH="$(PATH)"
171
b5a849 172 # Using "-uall,-network" ensures all tests are run except the network tests.
AL 173 # The network tests contain many expected failures when run behind a firewall.
174 # The "-v" ensures verbose mode.
175 COMPONENT_TEST_ENV += EXTRATESTOPTS="-v -uall,-network $(TESTOPTS_PYTHON_TEST)"
4a01ab 176
b5a849 177 # Prevent the tests from getting stuck waiting for input.
4a01ab 178 COMPONENT_TEST_TARGETS= test < /dev/null
b5a849 179
AL 180 # The test output contains details from each test, in whatever order they
181 # complete.  The default _TRANSFORMER is not powerful enough to deal with
182 # this; we need heavier artillery.  Extract just the sections that start
183 # with "tests OK." and end with "Re-running failed tests..." for comparison.
4a01ab 184 COMPONENT_TEST_TRANSFORMER= $(NAWK)
AW 185 COMPONENT_TEST_TRANSFORMS= "'/tests OK./ {results = 1}; /Total duration/ {results = 0}; /Re-running failed tests in verbose mode/ {results = 0} {if (results) print $0 }'"
8e1e26 186
b5a849 187 # Required for dump(1)
AL 188 REQUIRED_PACKAGES += developer/object-file
189 # Required to build ossaudiodev module
190 REQUIRED_PACKAGES += system/header/header-audio
3b8e40 191
b5a849 192 # Auto-generated dependencies
AL 193 REQUIRED_PACKAGES += compress/bzip2
194 REQUIRED_PACKAGES += compress/xz
195 REQUIRED_PACKAGES += database/sqlite-3
196 REQUIRED_PACKAGES += library/database/gdbm
197 REQUIRED_PACKAGES += library/expat
198 REQUIRED_PACKAGES += library/libffi
199 REQUIRED_PACKAGES += library/ncurses
200 REQUIRED_PACKAGES += library/readline
3b8e40 201 REQUIRED_PACKAGES += library/security/openssl-11
b5a849 202 REQUIRED_PACKAGES += library/zlib
AL 203 REQUIRED_PACKAGES += runtime/tcl-8
204 REQUIRED_PACKAGES += runtime/tk-8
205 REQUIRED_PACKAGES += system/library
206 REQUIRED_PACKAGES += system/library/math