component(developer/golang-123): Add Component
[oi-userland.git] / components / python / python27 / Makefile
blob0a3ba19e6e0b4f6c01882bdcd8fb85f6b0d86e41
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
21 # Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
22 # Copyright (c) 2019, Michal Nowak
24 BUILD_BITS= 32_and_64
25 USE_COMMON_TEST_MASTER= no
26 include ../../../make-rules/shared-macros.mk
28 COMPONENT_NAME= Python
29 COMPONENT_VERSION= 2.7.18
30 COMPONENT_REVISION= 6
31 COMPONENT_PROJECT_URL= https://python.org
32 COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
33 COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.xz
34 COMPONENT_ARCHIVE_HASH= sha256:b62c0e7937551d0cc02b8fd5cb0f544f9405bafc9a54d3808ed4594812edef43
35 COMPONENT_ARCHIVE_URL= $(COMPONENT_PROJECT_URL)/ftp/python/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
36 COMPONENT_SIG_URL= $(COMPONENT_ARCHIVE_URL).asc
38 CONFIGURE_FIX_LIBTOOL_RPATH = no
40 include $(WS_MAKE_RULES)/common.mk
42 # Need to preserve timestamp for Grammar files. If the pickle files are older,
43 # Python will try to rebuild them.
44 PKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.txt
45 PKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.pickle
47 # We patch auto* files, so regenerate headers and configure
48 COMPONENT_PREP_ACTION = \
49 (cd $(@D) ; autoheader ; autoconf)
51 # we don't want to leak $(CC_BITS) into BASECFLAGS as it causes problems with
52 # python-config
53 CC += $(CFLAGS)
55 C99MODE=
56 CPPFLAGS += -IPython
58 # to find the ncurses headers
59 CPPFLAGS += -I/usr/include/ncurses
60 # enable large files how they did in JDS
61 CPPFLAGS += -D_LARGEFILE64_SOURCE
63 # libffi for _ctypes
64 CPPFLAGS += $(shell pkg-config --cflags-only-I libffi)
66 # because python links with $(CC) ... $(LDFLAGS) ...
67 LDFLAGS = $(CC_BITS) $(CC_PIC)
69 # build pic
70 CFLAGS += $(CC_PIC)
72 # XPG6
73 CFLAGS += -std=c99 -D_XOPEN_SOURCE=600
75 # add /usr/gnu/lib to the library search/run path
76 LDFLAGS.32 = -R/usr/gnu/lib -L/usr/gnu/lib
77 LDFLAGS.64 = -R/usr/gnu/lib/$(MACH64) -L/usr/gnu/lib/$(MACH64)
78 LDFLAGS += $(LDFLAGS.$(BITS))
80 # Python puts its header files in a special place.
81 LINT_FLAGS += -I$(SOURCE_DIR)/Include
83 CONFIGURE_OPTIONS += --infodir=$(CONFIGURE_INFODIR)
84 CONFIGURE_OPTIONS += --enable-shared
85 CONFIGURE_OPTIONS += --with-system-expat
86 CONFIGURE_OPTIONS += --with-system-ffi
87 CONFIGURE_OPTIONS += --without-gcc
88 CONFIGURE_OPTIONS += --enable-ipv6
89 CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)"
90 CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)"
91 CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
92 CONFIGURE_OPTIONS += DFLAGS="-$(BITS)"
94 COMPONENT_BUILD_ENV += DFLAGS="-$(BITS)"
95 COMPONENT_BUILD_ENV += PATH="$(PATH)"
97 COMPONENT_INSTALL_ENV += PATH="$(PATH)"
99 # 64 bit shared objects need to go in a 64-bit directory
100 COMPONENT_INSTALL_ARGS.64 += DESTSHARED=$(CONFIGURE_PREFIX)/lib/python2.7/lib-dynload
102 # Setup pyconfig.h file to support 32 & 64 bit.
103 # If the /usr/lib/python2.7/lib2to3/*.pickle files are older than the related
104 # *.txt files in the same directory, it will rebuild them anytime you try to
105 # build a Python module. So here we also touch the pickle files to avoid this.
107 COMPONENT_POST_INSTALL_ACTION= \
108 (cd $(PROTOUSRDIR) ; \
109 $(MV) include/python2.7/pyconfig.h include/python2.7/pyconfig-$(BITS).h ; \
110 $(TOUCH) lib/python2.7/lib2to3/*.pickle)
112 $(INSTALL_32): $(INSTALL_64)
114 # Using "-uall,-network" ensures all tests are run except the network tests.
115 # The network tests contain many expected failures when run behind a firewall.
116 # The "-v" ensures verbose mode. You can set TESTOPTS_PYTHON_TEST to a
117 # particular test if you want to run just one test. For example, run gmake with
118 # "-k" so it continues and does both 32-bit and 64-bit tests, even if there is a
119 # failure, like this:
120 # $ TESTOPTS_PYTHON_TEST=test_sys gmake -k test
121 # Note that when a test succeeds, the builds/*/.tested file gets created. You
122 # may need to remove these files, or run "gmake clobber" or "gmake clean"
123 # between tests.
125 COMPONENT_TEST_ENV = EXTRATESTOPTS="-v -uall,-network $(TESTOPTS_PYTHON_TEST)"
126 COMPONENT_TEST_TARGETS = test
128 # The test output contains details from each test, in whatever order they
129 # complete. The default _TRANSFORMER is not powerful enough to deal with
130 # this; we need heavier artillery. Extract just the sections that start
131 # with "tests OK." and end with "Makefile: " for comparison.
132 COMPONENT_TEST_TRANSFORMER = $(NAWK)
133 COMPONENT_TEST_TRANSFORMS = "'/tests OK/ { results = 1 }; /Total duration/ { \$$$\0 = \"\" }; /^make|LD_LIBRARY_PATH/ { results = 0 } { if (results) print }'"
135 test: $(TEST_32_and_64)
137 # Required to build ossaudiodev module
138 REQUIRED_PACKAGES += system/header/header-audio
140 # Auto-generated dependencies
141 REQUIRED_PACKAGES += SUNWcs
142 REQUIRED_PACKAGES += compress/bzip2
143 REQUIRED_PACKAGES += database/sqlite-3
144 REQUIRED_PACKAGES += library/database/gdbm
145 REQUIRED_PACKAGES += library/expat
146 REQUIRED_PACKAGES += library/libffi
147 REQUIRED_PACKAGES += library/ncurses
148 REQUIRED_PACKAGES += library/readline
149 REQUIRED_PACKAGES += library/security/openssl
150 REQUIRED_PACKAGES += library/zlib
151 REQUIRED_PACKAGES += runtime/tcl-8
152 REQUIRED_PACKAGES += runtime/tk-8
153 REQUIRED_PACKAGES += shell/ksh93
154 REQUIRED_PACKAGES += system/library
155 REQUIRED_PACKAGES += system/library/math