Fix python2.7
[unleashed-userland.git] / components / python / python27 / Makefile
blobf80bb926d0a13104d9dbb5ffb2375ef6eed515a5
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.
24 include ../../../make-rules/shared-macros.mk
26 COMPONENT_NAME= Python
27 COMPONENT_VERSION= 2.7.15
28 COMPONENT_PROJECT_URL= http://python.org/
29 COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
30 COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.xz
31 COMPONENT_ARCHIVE_HASH= \
32 sha256:22d9b1ac5b26135ad2b8c2901a9413537e08749a753356ee913c84dbd2df5574
33 COMPONENT_ARCHIVE_URL= $(COMPONENT_PROJECT_URL)ftp/python/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
34 COMPONENT_SIG_URL= $(COMPONENT_ARCHIVE_URL).asc
35 COMPONENT_BUGDB= utility/python
37 include $(WS_MAKE_RULES)/prep.mk
38 include $(WS_MAKE_RULES)/configure.mk
39 include $(WS_MAKE_RULES)/ips.mk
41 # Need to preserve timestamp for Grammar files. If the pickle files are older,
42 # Python will try to rebuild them.
43 PKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.txt
44 PKGSEND_PUBLISH_OPTIONS += -T \*Grammar\*.pickle
46 # We patch auto* files, so regenerate headers and configure
47 COMPONENT_PREP_ACTION = \
48 (cd $(@D) ; autoheader ; autoconf)
50 # we don't want to leak $(CC_BITS) into BASECFLAGS as it causes problems with
51 # python-config
52 CC += $(CFLAGS)
54 C99MODE=
55 CPPFLAGS += -IPython
57 # to find the ncurses headers
58 CPPFLAGS += -I/usr/include/ncurses
59 # enable large files how they did in JDS
60 CPPFLAGS += -D_LARGEFILE64_SOURCE
62 # libffi for _ctypes
63 CPPFLAGS += $(shell pkg-config --cflags-only-I libffi)
65 # because python links with $(CC) ... $(LDFLAGS) ...
66 LDFLAGS = $(CC_BITS) $(CC_PIC)
68 # build pic
69 CFLAGS += $(CC_PIC)
71 # XPG6
72 CFLAGS += -std=c99 -D_XOPEN_SOURCE=600
74 LDFLAGS += $(LDFLAGS.$(BITS))
76 # Python puts its header files in a special place.
77 LINT_FLAGS += -I$(SOURCE_DIR)/Include
79 CONFIGURE_OPTIONS += --infodir=$(CONFIGURE_INFODIR)
80 CONFIGURE_OPTIONS += --enable-shared
81 CONFIGURE_OPTIONS += --with-system-expat
82 CONFIGURE_OPTIONS += --with-system-ffi
83 CONFIGURE_OPTIONS += --without-gcc
84 CONFIGURE_OPTIONS += --enable-ipv6
85 CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)"
86 CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)"
87 CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
88 CONFIGURE_OPTIONS += DFLAGS="-$(BITS)"
90 COMPONENT_BUILD_ENV += DFLAGS="-$(BITS)"
92 # 64 bit shared objects need to go in a 64-bit directory
93 COMPONENT_INSTALL_ARGS.64 += DESTSHARED=$(CONFIGURE_PREFIX)/lib/python2.7/lib-dynload
95 # Setup pyconfig.h file to support 32 & 64 bit.
96 # If the /usr/lib/python2.7/lib2to3/*.pickle files are older than the related
97 # *.txt files in the same directory, it will rebuild them anytime you try to
98 # build a Python module. So here we also touch the pickle files to avoid this.
100 COMPONENT_POST_INSTALL_ACTION= \
101 (cd $(PROTOUSRDIR) ; \
102 $(MV) include/python2.7/pyconfig.h include/python2.7/pyconfig-$(BITS).h ; \
103 $(TOUCH) lib/python2.7/lib2to3/*.pickle)
105 # common targets
106 $(INSTALL_32): $(INSTALL_64)
107 build: $(BUILD_32_and_64)
108 install: $(INSTALL_32_and_64)
110 # Using "-uall,-network" ensures all tests are run except the network tests.
111 # The network tests contain many expected failures when run behind a firewall.
112 # The "-v" ensures verbose mode. You can set TESTOPTS_PYTHON_TEST to a
113 # particular test if you want to run just one test. For example, run gmake with
114 # "-k" so it continues and does both 32-bit and 64-bit tests, even if there is a
115 # failure, like this:
116 # $ TESTOPTS_PYTHON_TEST=test_sys gmake -k test
117 # Note that when a test succeeds, the builds/*/.tested file gets created. You
118 # may need to remove these files, or run "gmake clobber" or "gmake clean"
119 # between tests.
121 COMPONENT_TEST_ENV = EXTRATESTOPTS="-v -uall,-network $(TESTOPTS_PYTHON_TEST)"
122 COMPONENT_TEST_TARGETS = test
124 test: $(TEST_32_and_64)
126 # Auto-generated dependencies
127 REQUIRED_PACKAGES += compress/bzip2
128 REQUIRED_PACKAGES += database/sqlite-3
129 REQUIRED_PACKAGES += library/database/gdbm
130 REQUIRED_PACKAGES += library/expat
131 REQUIRED_PACKAGES += library/libffi
132 REQUIRED_PACKAGES += library/ncurses
133 REQUIRED_PACKAGES += library/python-2/pip-27
134 REQUIRED_PACKAGES += library/readline
135 REQUIRED_PACKAGES += library/zlib
136 REQUIRED_PACKAGES += runtime/python-27
137 REQUIRED_PACKAGES += runtime/python-27/tests
138 REQUIRED_PACKAGES += SUNWcs
139 REQUIRED_PACKAGES += system/library
140 REQUIRED_PACKAGES += system/library/math