Skip to content

Commit

Permalink
Python 3.6.4 build with Lubuntu 17.10/ fix EXT_SUFFIX in setup.py, #143
Browse files Browse the repository at this point in the history
- fix rejected patch around expat and xxlimit modules.
- fix EXT_SUFFIX: https://stackoverflow.com/questions/38523941/change-cythons-naming-rules-for-so-files/40193040#40193040
  • Loading branch information
Shimoda committed Jan 7, 2018
1 parent 1021673 commit ccd0aae
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 42 deletions.
22 changes: 16 additions & 6 deletions python3-alpha/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# build settings section 1 {{{1
VER_MAJ=3.6
VER_MAJ_NODOT=$(subst .,,$(VER_MAJ))
VERSION=$(VER_MAJ).3
VERSION=$(VER_MAJ).4
# set -ex
CWD := $(shell pwd)
DEBUG=no
Expand All @@ -27,6 +27,15 @@ ZIP := $(ZIP_BINarm) $(ZIP_BINx86) \
$(ZIPEXTRA) \
$(ZIPSCRIPTS)

ifeq (x$log_arm,x)
log_arm := > build.arm.log 2>&1
endif
ifeq (x$log_x86,x)
log_x86 := > build.x86.log 2>&1
endif
lad_arm := $(subst >,>>,$(log_arm))
lad_x86 := $(subst >,>>,$(log_x86))

# check environment {{{1
BUILDMACHINE := $(shell uname -m)
BUILDOS := $(shell uname -s | tr A-Z a-z)
Expand Down Expand Up @@ -330,8 +339,8 @@ build_src: $(PYTHONTAR) $(CWD)/patches/python-*.patch
echo "patching: $$p..."; patch -p1 -i $$p; done

.build_config: .build_src .build_misc .build_openssl
make build_config CROSS=arm PIE=yes
make build_config CROSS=x86 PIE=yes
make build_config CROSS=arm PIE=yes $(log_arm)
make build_config CROSS=x86 PIE=yes $(log_x86)
touch .build_config
build_config:
# @echo PATH: "'$$PATH'"
Expand All @@ -346,11 +355,12 @@ build_config:
--prefix=$(PYBIN) --enable-shared --with-ensurepip=yes

.build_bin: .build_config
make build_bin CROSS=arm PIE=yes
make build_bin CROSS=x86 PIE=yes
make build_bin CROSS=arm PIE=yes $(lad_arm)
make build_bin CROSS=x86 PIE=yes $(lad_x86)
touch .build_bin
build_bin: .build_openssl .build_misc
CFLAGS="$(CFLAGS)" CROSS_COMPILE_TARGET=yes make -C $(PYTHONSRC) sharedmods # build
CFLAGS="$(CFLAGS)" CROSS_COMPILE_TARGET=yes make \
-C $(PYTHONSRC) sharedmods # build

.build_install: .build_bin
make build_install CROSS=arm PIE=yes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff -ur host-src/setup.py python-src_arm/setup.py
--- host-src/setup.py 2016-12-23 11:21:22.000000000 +0900
+++ python-src_arm/setup.py 2017-01-20 02:39:24.242570580 +0900
--- host-src/setup.py 2017-12-19 13:53:56.000000000 +0900
+++ python-src_arm/setup.py 2018-01-07 17:25:51.448928383 +0900
@@ -18,11 +18,37 @@

cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
Expand Down Expand Up @@ -40,7 +40,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py

class Dummy:
"""Hack for parallel build"""
@@ -600,63 +626,66 @@
@@ -631,63 +657,66 @@
#

# array objects
Expand Down Expand Up @@ -130,7 +130,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py

# Modules with some UNIX dependencies -- on by default:
# (If you have a really backward UNIX, select and socket may not be
@@ -667,30 +696,33 @@
@@ -698,30 +727,33 @@
if (config_h_vars.get('FLOCK_NEEDS_LIBBSD', False)):
# May be necessary on AIX for flock function
libs = ['bsd']
Expand Down Expand Up @@ -172,7 +172,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py

#
# Here ends the simple stuff. From here on, modules need certain
@@ -706,7 +738,7 @@
@@ -737,7 +769,7 @@
# 64-bit platforms.
#
# audioop needs math_libs for floor() in multiple functions.
Expand All @@ -181,7 +181,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py
libraries=math_libs) )

# readline
@@ -785,7 +817,7 @@
@@ -816,7 +848,7 @@
['/usr/lib/termcap'],
'termcap'):
readline_libs.append('termcap')
Expand All @@ -190,7 +190,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py
library_dirs=['/usr/lib/termcap'],
extra_link_args=readline_extra_link_args,
libraries=readline_libs) )
@@ -798,17 +830,19 @@
@@ -829,17 +861,19 @@
libs = ['crypt']
else:
libs = []
Expand All @@ -215,7 +215,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py
# Detect SSL support for the socket module (via _ssl)
search_for_ssl_incs_in = [
'/usr/local/ssl/include',
@@ -869,8 +903,8 @@
@@ -900,8 +934,8 @@
if have_usable_openssl:
# The _hashlib module wraps optimized implementations
# of hash functions from the OpenSSL library.
Expand All @@ -226,7 +226,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py
include_dirs = ssl_incs,
library_dirs = ssl_libs,
libraries = ['ssl', 'crypto']) )
@@ -882,14 +916,14 @@
@@ -913,14 +947,14 @@
# We always compile these even when OpenSSL is available (issue #14693).
# It's harmless and the object code is tiny (40-50 KB per module,
# only loaded when actually used).
Expand All @@ -249,7 +249,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py

blake2_deps = glob(os.path.join(os.getcwd(), srcdir,
'Modules/_blake2/impl/*'))
@@ -901,9 +935,9 @@
@@ -935,9 +969,9 @@
blake2_macros.append(('BLAKE2_USE_SSE', '1'))

exts.append( Extension('_blake2',
Expand All @@ -262,7 +262,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py
define_macros=blake2_macros,
depends=blake2_deps) )

@@ -911,7 +945,7 @@
@@ -945,7 +979,7 @@
'Modules/_sha3/kcp/*'))
sha3_deps.append('hashlib.h')
exts.append( Extension('_sha3',
Expand All @@ -271,7 +271,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py
depends=sha3_deps))

# Modules that provide persistent dictionary-like semantics. You will
@@ -1324,9 +1358,9 @@
@@ -1358,9 +1392,9 @@
# Unix-only modules
if host_platform != 'win32':
# Steen Lumholt's termios module
Expand All @@ -283,7 +283,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py

# Sun yellow pages. Some systems have the functions in libc.
if (host_platform not in ['cygwin', 'qnx6'] and
@@ -1410,7 +1444,10 @@
@@ -1445,7 +1479,10 @@
#
# You can upgrade zlib to version 1.1.4 yourself by going to
# http://www.gzip.org/zlib/
Expand All @@ -295,7 +295,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py
have_zlib = False
if zlib_inc is not None:
zlib_h = zlib_inc[0] + '/zlib.h'
@@ -1427,12 +1464,12 @@
@@ -1462,12 +1499,12 @@
version = line.split()[2]
break
if version >= version_req:
Expand All @@ -310,7 +310,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py
libraries = ['z'],
extra_link_args = zlib_extra_link_args))
have_zlib = True
@@ -1453,7 +1490,7 @@
@@ -1488,7 +1525,7 @@
extra_compile_args = []
libraries = []
extra_link_args = []
Expand All @@ -319,16 +319,9 @@ diff -ur host-src/setup.py python-src_arm/setup.py
extra_compile_args = extra_compile_args,
libraries = libraries,
extra_link_args = extra_link_args) )
@@ -1495,32 +1532,33 @@
expat_sources = []
expat_depends = []
else:
- expat_inc = [os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')]
+ expat_inc = [os.path.join(os.getcwd(),
+ srcdir, 'Modules', 'expat')]
define_macros = [
('HAVE_EXPAT_CONFIG_H', '1'),
@@ -1540,20 +1577,20 @@
]
extra_compile_args = []
expat_lib = []
- expat_sources = ['expat/xmlparse.c',
- 'expat/xmlrole.c',
Expand Down Expand Up @@ -360,16 +353,29 @@ diff -ur host-src/setup.py python-src_arm/setup.py
+ 'Modules/expat/xmltok_impl.h'
]

exts.append(Extension('pyexpat',
define_macros = define_macros,
cc = sysconfig.get_config_var('CC').split()[0]
@@ -1567,7 +1604,7 @@
extra_compile_args = extra_compile_args,
include_dirs = expat_inc,
libraries = expat_lib,
- sources = ['pyexpat.c'] + expat_sources,
+ sources = ['Modules/pyexpat.c'] + expat_sources,
+ sources=['Modules/pyexpat.c'] + expat_sources,
depends = expat_depends,
))

@@ -1542,10 +1580,10 @@
@@ -1580,19 +1617,19 @@
define_macros = define_macros,
include_dirs = expat_inc,
libraries = expat_lib,
- sources = ['_elementtree.c'],
- depends = ['pyexpat.c'] + expat_sources +
- expat_depends,
+ sources=['Modules/_elementtree.c'],
+ depends=['Modules/pyexpat.c'] +
+ expat_sources + expat_depends,
))
else:
missing.append('_elementtree')

# Hye-Shik Chang's CJKCodecs modules.
exts.append(Extension('_multibytecodec',
Expand All @@ -382,7 +388,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py

# Stefan Krah's _decimal module
exts.append(self._decimal_ext())
@@ -1590,11 +1628,11 @@
@@ -1637,11 +1674,11 @@
]

else:
Expand All @@ -396,7 +402,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py

if sysconfig.get_config_var('WITH_THREAD'):
exts.append ( Extension('_multiprocessing', multiprocessing_srcs,
@@ -1606,7 +1644,7 @@
@@ -1653,7 +1690,7 @@

# Platform-specific libraries
if host_platform.startswith(('linux', 'freebsd', 'gnukfreebsd')):
Expand All @@ -405,16 +411,16 @@ diff -ur host-src/setup.py python-src_arm/setup.py
else:
missing.append('ossaudiodev')

@@ -1631,7 +1669,7 @@
@@ -1678,7 +1715,7 @@
## self.extensions.append(ext)

if 'd' not in sys.abiflags:
if 'd' not in sysconfig.get_config_var('ABIFLAGS'):
- ext = Extension('xxlimited', ['xxlimited.c'],
+ ext = Extension('xxlimited', ['Modules/xxlimited.c'],
define_macros=[('Py_LIMITED_API', '0x03050000')])
self.extensions.append(ext)

@@ -2008,7 +2046,7 @@
@@ -2055,7 +2092,7 @@
depends=depends)
# function my_sqrt() needs math library for sqrt()
ext_test = Extension('_ctypes_test',
Expand All @@ -423,9 +429,9 @@ diff -ur host-src/setup.py python-src_arm/setup.py
libraries=math_libs)
self.extensions.extend([ext, ext_test])

@@ -2064,40 +2102,40 @@
@@ -2111,40 +2148,40 @@
'libmpdec'))]
libraries = []
libraries = self.detect_math_libs()
sources = [
- '_decimal/_decimal.c',
- '_decimal/libmpdec/basearith.c',
Expand Down Expand Up @@ -496,7 +502,7 @@ diff -ur host-src/setup.py python-src_arm/setup.py
]

config = {
@@ -2293,7 +2331,7 @@
@@ -2340,7 +2377,7 @@
'install_lib': PyBuildInstallLib},
# The struct module is defined here, because build_ext won't be
# called unless there's at least one extension module defined.
Expand Down

0 comments on commit ccd0aae

Please sign in to comment.