Commit 2116a113 authored by Jason Madden's avatar Jason Madden

Refactor the Travis build to make the matrix explicit and faster. Eliminate Makefile

This should eliminate cache thrashing when we upgrade python versions. And also eventually might do more caching here.

Also simplify the paths at which pythons are installed, so we only have to change one place to update a version.

The cache is only shared between stages that match things like environment variables.

Ah, we need CFFI at runtime; build isolation means pyproject.toml doesn't deliver it to us. We must have had it cached.

A DNSPython test we didn't run before sometimes fails. Must be multiple answers.

Tweak test coverage and test_ssl for PyPy3

Refactoring the testrunner; more needed, but this gets us simple travis folding.

Reorganize the test matrix for clarity, and shrink it back to what we used to test.

Remove now-unused entries from the makefile.

Remove the makefile, port the posix specific rules to Python for 'setup.py clean'
parent 110b8263
...@@ -91,8 +91,3 @@ deps/libuv/.libs ...@@ -91,8 +91,3 @@ deps/libuv/.libs
deps/libuv/*.lo deps/libuv/*.lo
deps/libuv/*.la deps/libuv/*.la
deps/libuv/*.o deps/libuv/*.o
# running setup.py on PyPy
config.h
configure-output.txt
# .travis.yml based on https://github.com/DRMacIver/hypothesis/blob/master/.travis.yml # .travis.yml based on
language: python # https://github.com/DRMacIver/hypothesis/blob/master/.travis.yml
# Setting the language to C overrides our CC environment variable
# and disables ccache.
# Setting it to python overrides our TRAVIS_PYTHON_VERSION (which
# we're only using in hopes of being able to go *back* to using
# python: one day so making the migration simpler)
language: minimal
dist: xenial dist: xenial
group: travis_latest group: travis_latest
python:
- 3.7
env: env:
global: global:
...@@ -13,24 +17,247 @@ env: ...@@ -13,24 +17,247 @@ env:
- CCACHE_NOCPP2=true - CCACHE_NOCPP2=true
- CCACHE_SLOPPINESS=file_macro,time_macros,include_file_ctime,include_file_mtime - CCACHE_SLOPPINESS=file_macro,time_macros,include_file_ctime,include_file_mtime
- CCACHE_NOHASHDIR=true - CCACHE_NOHASHDIR=true
- BUILD_LIBS=$HOME/.libs
- CFLAGS="-g -pipe" - CFLAGS="-g -pipe"
- CPPFLAGS="-I$BUILD_LIBS/include"
- LDFLAGS="-L$BUILD_LIBS/lib"
- LD_LIBRARY_PATH="$BUILD_LIBS/lib"
# Note that this list is again *manually* expanded
# for the 'cache' stage. The benefit of doing this (instead of
# only listing a single version here, or using a different 'language')
# is that we get separate caches per version. This keeps them small,
# and prevents stepping on each other when we change Python minor
# versions.
# We do it here, rather than with the python: keyword
# because the way travis handles pypy is pretty messed up.
# Recall that unless otherwise specified, jobs inherit
# the first entry in this list.
matrix: matrix:
# These are ordered to get as much diversity in the - TRAVIS_PYTHON_VERSION=2.7
# first group of parallel runs (4) as possible - TRAVIS_PYTHON_VERSION=3.5
- TASK=test-py27-noembed - TRAVIS_PYTHON_VERSION=3.6
- TASK=test-py37 - TRAVIS_PYTHON_VERSION=3.7
- TASK=test-py27 - TRAVIS_PYTHON_VERSION=pypy2.7
- TASK=test-pypy - TRAVIS_PYTHON_VERSION=pypy3.6
- TASK=test-py36 - TRAVIS_PYTHON_VERSION=2.7 EMBED=0
- TASK=test-pypy3
- TASK=test-py35
matrix: matrix:
fast_finish: true fast_finish: true
before_install:
- export PATH=$BUILD_RUNTIMES/snakepit/$TRAVIS_PYTHON_VERSION.d/bin:$PATH
before_script:
# Show some details of interest
- python --version
- >
python -c "import greenlet; print(greenlet, greenlet.__version__)"
- >
python -c "import gevent.core; print(gevent.core.loop)"
- >
python -c "import gevent.ares; print(gevent.ares)"
# Installing is taken care of by the first stage.
install:
- ls -l $BUILD_RUNTIMES/snakepit/
- echo $BUILD_RUNTIMES/snakepit/$TRAVIS_PYTHON_VERSION.d
- ls -l $BUILD_RUNTIMES/snakepit/$TRAVIS_PYTHON_VERSION.d
- python -c 'import gevent; print(gevent.__version__)'
script: script:
- make $TASK # The generic script for the matrix expansion is to
# test the defaults.
- &test-basic python -m gevent.tests
# Now, the non-default threaded file object.
# In the past, we included all test files that had a reference to 'subprocess'' somewhere in their
# text. The monkey-patched stdlib tests were specifically included here.
# However, we now always also test on AppVeyor (Windows) which only has GEVENT_FILE=thread,
# so we can save a lot of CI time by reducing the set and excluding the stdlib tests without
# losing any coverage. Which is good, because coverage fails when run this way.
- (cd src/gevent/tests && GEVENT_FILE=thread python -mgevent.tests test__*subprocess*.py)
# Submit coverage info
after_success:
- python -m coverage combine
- python -m coverage report -i
- python -m coveralls
stages:
- build-gevent
- test
- test-ares
jobs:
include:
- &build-gevent
stage: build-gevent
install:
# Install the Python runtime
- &build-gevent-python time ./scripts/install.sh $TRAVIS_PYTHON_VERSION
# Install gevent. Yes, this will create different files each time,
# leading to a fresh cache. But because of CCache stats, we had already been doing
# that (before we learned about CCACHE_NOSTATS)
# First, the build dependencies (see setup.cfg)
# so that we don't have to use build isolation and can better use the cache;
# Note that we can't use -U for cffi and greenlet on PyPy.
- &build-gevent-deps pip install -U setuptools wheel && pip install cffi cython greenlet
- GEVENTSETUP_EV_VERIFY=3 pip install --no-build-isolation .[test,events,dnspython]
script: ccache -s
before_script: true
after_success: true
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=3.5
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=3.6
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=3.7
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=pypy2.7
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=pypy3.6
- <<: *build-gevent
env: TRAVIS_PYTHON_VERSION=2.7 EMBED=0
install:
# Install the Python runtime
- *build-gevent-python
- *build-gevent-deps
# Install the C dependencies to a known location. This is used
# to test "no embed" cases. It might seem like it would prime
# the CCache for when we *do* embed if we did it as part of the generic build stage,
# but overall it just seems to slow things down. The Travis caching and CCache is not working as
# well as we would hope.
- pushd deps/libev && ./configure --prefix=$BUILD_LIBS && make install && popd
- pushd deps/c-ares && ./configure --prefix=$BUILD_LIBS && make -j4 install && popd
- pushd deps/libuv && ./autogen.sh && ./configure --disable-static --prefix=$BUILD_LIBS && make -j4 install && popd
# libev builds a manpage each time, and it includes today's date, so it frequently changes.
# delete to avoid repacking the archive
- rm -rf $BUILD_LIBS/share/man/
- ls -l $BUILD_LIBS $BUILD_LIBS/lib
- EMBED=0 pip install --no-build-isolation .[test,events,dnspython]
# Ok, now we switch to the test stage. These are all in addition
# to the jobs created by the matrix (and should override the `script` command).
# Lint the code. Because this is a separate job, even if it fails fast
# the tests will still run. Put it at the top for fast feedback.
# We only need to do this on one version, and it should be Python 3, because
# pylint has stopped updating for Python 2.
- stage: test
script: python -m pylint --rcfile=.pylintrc gevent
env: TRAVIS_PYTHON_VERSION=3.7
name: lint37
# Now the various functional test groups.
# We organize these by interpreter, rather than functional test group,
# so that it's easy to see which interpreters are in which group.
# First, default (cpython 2.7). This tests essentially all the groups.
# Test the c-ares resolver. It's implemented in C, so don't bother with coverage.
# Also, we don't support it on PyPy for production, so don't bother to test PyPy.
- &test-ares-jobs
stage: test
script: GEVENT_RESOLVER=ares python -mgevent.tests --ignore tests_that_dont_use_resolver.txt
name: ares27
# Run dnspython with coverage enabled, it's implemented in python whereas ares is C.
# PyPy is supported.
- &test-dnspython-jobs
script: GEVENT_RESOLVER=dnspython python -mgevent.tests --coverage --ignore tests_that_dont_use_resolver.txt
name: dnspython27
# Now test the alternate backends, starting with libuv-cffi, which should be present everywhere
- &test-libuv-jobs
script: GEVENT_LOOP=libuv python -mgevent.tests --coverage
name: libuv27
# Next the libev-cffi backend, which is only needed on CPython (default on PyPy)
- &test-libev-jobs
script: GEVENT_LOOP=libev-cffi python -mgevent.tests --coverage
name: libev-cffi27
# No compiled cython modules on CPython, using the default backend. Get coverage here.
# We should only need to run this for a single Python 2 and a Python 3
- &test-pure-jobs
script: PURE_PYTHON=1 python -mgevent.tests --coverage
name: pure27
# Run the leaktests; this seems to be extremely slow on Python 3.7
# XXX: Figure out why. Can we reproduce locally?
- &test-leak-jobs
script: GEVENTTEST_LEAKCHECK=1 python -m gevent.tests --ignore tests_that_dont_do_leakchecks.txt
name: leak27
# Now, in order of the matrix, tests for particular versions.
# For the CPython interpreters, unless we have reason to expect
# different behaviour across the versions (e.g., as measured by coverage)
# it's sufficient to test the alternate backends for non-current versions;
# run the full suite on the current version.
# 3.5.
- <<: *test-libuv-jobs
env: TRAVIS_PYTHON_VERSION=3.5
name: libuv35
- <<: *test-libev-jobs
env: TRAVIS_PYTHON_VERSION=3.5
name: libev-cffi35
# 3.6
- <<: *test-libuv-jobs
env: TRAVIS_PYTHON_VERSION=3.6
name: libuv36
- <<: *test-libev-jobs
env: TRAVIS_PYTHON_VERSION=3.6
name: libev-cffi36
# 3.7
- <<: *test-ares-jobs
env: TRAVIS_PYTHON_VERSION=3.7
name: ares37
- <<: *test-dnspython-jobs
env: TRAVIS_PYTHON_VERSION=3.7
name: dnspython37
- <<: *test-libuv-jobs
env: TRAVIS_PYTHON_VERSION=3.7
name: libuv37
- <<: *test-libev-jobs
env: TRAVIS_PYTHON_VERSION=3.7
name: libev-cffi37
- <<: *test-pure-jobs
env: TRAVIS_PYTHON_VERSION=3.7
name: pure37
# 2.7, no-embed. Run the tests that exercise the libraries we linked to.
- <<: *test-ares-jobs
env: TRAVIS_PYTHON_VERSION=2.7 EMBED=0
name: ares27-noembed
- <<: *test-libuv-jobs
env: TRAVIS_PYTHON_VERSION=2.7 EMBED=0
name: libuv27-noembed
- <<: *test-libev-jobs
env: TRAVIS_PYTHON_VERSION=2.7 EMBED=0
name: libev27-noembed
# PyPy 2.7
- <<: *test-dnspython-jobs
env: TRAVIS_PYTHON_VERSION=pypy2.7
name: dnspythonpypy27
- <<: *test-libuv-jobs
env: TRAVIS_PYTHON_VERSION=pypy2.7
name: libuvpypy27
# PyPy 3.6
# We don't do particular extra tests on it, it's not
# considered a production (still alpha at this writing).
# - <<: *test-dnspython-jobs
# env: TRAVIS_PYTHON_VERSION=pypy3.6
# name: dnspythonpypy36
notifications: notifications:
email: false email: false
...@@ -43,6 +270,7 @@ cache: ...@@ -43,6 +270,7 @@ cache:
- $HOME/.runtimes - $HOME/.runtimes
- $HOME/.wheelhouse - $HOME/.wheelhouse
- $HOME/.ccache - $HOME/.ccache
- $HOME/.libs
before_cache: before_cache:
- rm -f $HOME/.cache/pip/log/debug.log - rm -f $HOME/.cache/pip/log/debug.log
...@@ -78,6 +78,12 @@ ...@@ -78,6 +78,12 @@
- Spawning greenlets can be up to 10% faster. - Spawning greenlets can be up to 10% faster.
- Remove the ``Makefile``. Its most useful commands, ``make clean``
and ``make distclean``, can now be accomplished in a cross-platform
way using ``python setup.py clean`` and ``python setup.py clean
-a``, respectively. The remainder of the ``Makefile`` contained
Travis CI commands that have been moved to ``.travis.yml``.
1.4.0 (2019-01-04) 1.4.0 (2019-01-04)
================== ==================
......
# This file is renamed to "Makefile.ext" in release tarballs so that setup.py won't try to
# run it. If you want setup.py to run "make" automatically, rename it back to "Makefile".
# The pyvenv multiple runtime support is based on https://github.com/DRMacIver/hypothesis/blob/master/Makefile
PYTHON?=python${TRAVIS_PYTHON_VERSION}
CYTHON?=cython
export PATH:=$(BUILD_RUNTIMES)/snakepit:$(PATH)
export LC_ALL=C.UTF-8
export GEVENT_RESOLVER_NAMESERVERS=8.8.8.8
clean:
rm -f src/gevent/libev/corecext.c src/gevent/libev/corecext.h
rm -f src/gevent/resolver/cares.c src/gevent/resolver/cares.h
rm -f src/gevent/_semaphore.c src/gevent/_semaphore.h
rm -f src/gevent/local.c src/gevent/local.h
rm -f src/gevent/*.so src/gevent/*.pyd src/gevent/libev/*.so src/gevent/libuv/*.so src/gevent/libev/*.pyd src/gevent/libuv/*.pyd
rm -rf src/gevent/libev/*.o src/gevent/libuv/*.o src/gevent/*.o
rm -rf src/gevent/__pycache__ src/greentest/__pycache__ src/greentest/greentest/__pycache__ src/gevent/libev/__pycache__
rm -rf src/gevent/*.pyc src/greentest/*.pyc src/gevent/libev/*.pyc
rm -rf htmlcov .coverage
rm -rf build
distclean: clean
rm -rf dist
rm -rf deps/libev/config.h deps/libev/config.log deps/libev/config.status deps/libev/.deps deps/libev/.libs
rm -rf deps/c-ares/config.h deps/c-ares/config.log deps/c-ares/config.status deps/c-ares/.deps deps/c-ares/.libs
doc:
cd doc && PYTHONPATH=.. make html
prospector:
which pylint
pylint --rcfile=.pylintrc gevent
# debugging
# pylint --rcfile=.pylintrc --init-hook="import sys, code; sys.excepthook = lambda exc, exc_type, tb: print(tb.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_next.tb_frame.f_locals['self'])" gevent src/greentest/* || true
# XXX: prospector is failing right now. I can't reproduce locally:
# https://travis-ci.org/gevent/gevent/jobs/345474139
# ${PYTHON} scripts/gprospector.py -X
lint: prospector
test_prelim:
@which ${PYTHON}
@${PYTHON} --version
@${PYTHON} -c 'import greenlet; print(greenlet, greenlet.__version__)'
@${PYTHON} -c 'import gevent.core; print(gevent.core.loop)'
@${PYTHON} -c 'import gevent.ares; print(gevent.ares)'
@make bench
# Folding from https://github.com/travis-ci/travis-rubies/blob/9f7962a881c55d32da7c76baefc58b89e3941d91/build.sh#L38-L44
basictest: test_prelim
@${PYTHON} scripts/travis.py fold_start basictest "Running basic tests"
GEVENT_RESOLVER=thread ${PYTHON} -mgevent.tests --config known_failures.py --quiet
@${PYTHON} scripts/travis.py fold_end basictest
alltest: basictest
@${PYTHON} scripts/travis.py fold_start ares "Running c-ares tests"
GEVENT_RESOLVER=ares ${PYTHON} -mgevent.tests --config known_failures.py --ignore tests_that_dont_use_resolver.txt --quiet
@${PYTHON} scripts/travis.py fold_end ares
@${PYTHON} scripts/travis.py fold_start dnspython "Running dnspython tests"
GEVENT_RESOLVER=dnspython ${PYTHON} -mgevent.tests --config known_failures.py --ignore tests_that_dont_use_resolver.txt --quiet
@${PYTHON} scripts/travis.py fold_end dnspython
# In the past, we included all test files that had a reference to 'subprocess'' somewhere in their
# text. The monkey-patched stdlib tests were specifically included here.
# However, we now always also test on AppVeyor (Windows) which only has GEVENT_FILE=thread,
# so we can save a lot of CI time by reducing the set and excluding the stdlib tests without
# losing any coverage.
@${PYTHON} scripts/travis.py fold_start thread "Running GEVENT_FILE=thread tests"
cd src/gevent/tests && GEVENT_FILE=thread ${PYTHON} -mgevent.tests --config known_failures.py test__*subprocess*.py --quiet
@${PYTHON} scripts/travis.py fold_end thread
allbackendtest:
@${PYTHON} scripts/travis.py fold_start default "Testing default backend"
GEVENTTEST_COVERAGE=1 make alltest
@${PYTHON} scripts/travis.py fold_end default
GEVENTTEST_COVERAGE=1 make cffibackendtest
# because we set parallel=true, each run produces new and different coverage files; they all need
# to be combined
make coverage_combine
cffibackendtest:
@${PYTHON} scripts/travis.py fold_start libuv "Testing libuv backend"
GEVENT_LOOP=libuv make alltest
@${PYTHON} scripts/travis.py fold_end libuv
@${PYTHON} scripts/travis.py fold_start libev "Testing libev CFFI backend"
GEVENT_LOOP=libev-cffi make alltest
@${PYTHON} scripts/travis.py fold_end libev
leaktest: test_prelim
@${PYTHON} scripts/travis.py fold_start leaktest "Running leak tests"
GEVENT_RESOLVER=thread GEVENTTEST_LEAKCHECK=1 ${PYTHON} -mgevent.tests --config known_failures.py --quiet --ignore tests_that_dont_do_leakchecks.txt
@${PYTHON} scripts/travis.py fold_end leaktest
@${PYTHON} scripts/travis.py fold_start default "Testing default backend pure python"
PURE_PYTHON=1 GEVENTTEST_COVERAGE=1 make basictest
@${PYTHON} scripts/travis.py fold_end default
bench:
time ${PYTHON} benchmarks/bench_sendall.py --loops 3 --processes 2 --values 2 --warmups 2 --quiet
travis_test_linters:
make lint
make leaktest
make cffibackendtest
coverage_combine:
coverage combine .
coverage report -i
-coveralls
.PHONY: clean doc prospector lint travistest travis
# Managing runtimes
BUILD_RUNTIMES?=$(PWD)/.runtimes
PY27=$(BUILD_RUNTIMES)/snakepit/python2.7.16
PY35=$(BUILD_RUNTIMES)/snakepit/python3.5.6
PY36=$(BUILD_RUNTIMES)/snakepit/python3.6.8
PY37=$(BUILD_RUNTIMES)/snakepit/python3.7.2
PYPY=$(BUILD_RUNTIMES)/snakepit/pypy710
PYPY3=$(BUILD_RUNTIMES)/snakepit/pypy3.6_710
$(PY27):
scripts/install.sh 2.7
$(PY35):
scripts/install.sh 3.5
$(PY36):
scripts/install.sh 3.6
$(PY37):
scripts/install.sh 3.7
$(PYPY):
scripts/install.sh pypy
$(PYPY3):
scripts/install.sh pypy3
develop:
@${PYTHON} scripts/travis.py fold_start install "Installing gevent"
@echo python is at `which $(PYTHON)`
# First install a newer pip so that it can use the wheel cache
# (only needed until travis upgrades pip to 7.x; note that the 3.5
# environment uses pip 7.1 by default)
${PYTHON} -m pip install -U pip setuptools
# Then start installing our deps so they can be cached. Note that use of --build-options / --global-options / --install-options
# disables the cache.
# We need wheel>=0.26 on Python 3.5. See previous revisions.
GEVENTSETUP_EV_VERIFY=3 time ${PYTHON} -m pip install -U --upgrade-strategy=eager -r dev-requirements.txt
${PYTHON} -m pip freeze
ccache -s
@${PYTHON} scripts/travis.py fold_end install
test-py27: $(PY27)
PYTHON=python2.7.16 PATH=$(BUILD_RUNTIMES)/versions/python2.7.16/bin:$(PATH) make develop leaktest cffibackendtest coverage_combine
test-py35: $(PY35)
PYTHON=python3.5.6 PATH=$(BUILD_RUNTIMES)/versions/python3.5.6/bin:$(PATH) make develop basictest
test-py36: $(PY36)
PYTHON=python3.6.8 PATH=$(BUILD_RUNTIMES)/versions/python3.6.8/bin:$(PATH) make develop lint basictest
test-py37: $(PY37)
PYTHON=python3.7.2 PATH=$(BUILD_RUNTIMES)/versions/python3.7.2/bin:$(PATH) make develop leaktest cffibackendtest coverage_combine
test-pypy: $(PYPY)
PYTHON=$(PYPY) PATH=$(BUILD_RUNTIMES)/versions/pypy710/bin:$(PATH) make develop cffibackendtest
test-pypy3: $(PYPY3)
PYTHON=$(PYPY3) PATH=$(BUILD_RUNTIMES)/versions/pypy3.6_710/bin:$(PATH) make develop basictest
test-py27-noembed: $(PY27)
@python2.7.16 scripts/travis.py fold_start conf_libev "Configuring libev"
cd deps/libev && ./configure --disable-dependency-tracking && make
@python2.7.16 scripts/travis.py fold_end conf_libev
@python2.7.16 scripts/travis.py fold_start conf_cares "Configuring cares"
cd deps/c-ares && ./configure --disable-dependency-tracking && make
@python2.7.16 scripts/travis.py fold_end conf_cares
@python2.7.16 scripts/travis.py fold_start conf_libuv "Configuring libuv"
cd deps/libuv && ./autogen.sh && ./configure --disable-static && make
@python2.7.16 scripts/travis.py fold_end conf_libuv
CPPFLAGS="-Ideps/libev -Ideps/c-ares -Ideps/libuv/include" LDFLAGS="-Ldeps/libev/.libs -Ldeps/c-ares/.libs -Ldeps/libuv/.libs" LD_LIBRARY_PATH="$(PWD)/deps/libev/.libs:$(PWD)/deps/c-ares/.libs:$(PWD)/deps/libuv/.libs" EMBED=0 PYTHON=python2.7.16 PATH=$(BUILD_RUNTIMES)/versions/python2.7.16/bin:$(PATH) make develop alltest cffibackendtest
...@@ -221,15 +221,11 @@ class ConfiguringBuildExt(build_ext): ...@@ -221,15 +221,11 @@ class ConfiguringBuildExt(build_ext):
def build_extension(self, ext): def build_extension(self, ext):
self.gevent_prepare(ext) self.gevent_prepare(ext)
try: try:
result = build_ext.build_extension(self, ext) return build_ext.build_extension(self, ext)
except ext_errors: except ext_errors:
if getattr(ext, 'optional', False): if getattr(ext, 'optional', False):
raise BuildFailed() raise BuildFailed()
else: raise
raise
return result
class Extension(_Extension): class Extension(_Extension):
...@@ -242,3 +238,137 @@ class Extension(_Extension): ...@@ -242,3 +238,137 @@ class Extension(_Extension):
# Python 2 has this as an old-style class for some reason # Python 2 has this as an old-style class for some reason
# so super() doesn't work. # so super() doesn't work.
_Extension.__init__(self, *args, **kwargs) # pylint:disable=no-member,non-parent-init-called _Extension.__init__(self, *args, **kwargs) # pylint:disable=no-member,non-parent-init-called
from distutils.command.clean import clean # pylint:disable=no-name-in-module,import-error
from distutils import log # pylint:disable=no-name-in-module
from distutils.dir_util import remove_tree # pylint:disable=no-name-in-module,import-error
class GeventClean(clean):
BASE_GEVENT_SRC = os.path.join('src', 'gevent')
def __find_directories_in(self, top, named=None):
"""
Iterate directories, beneath and including *top* ignoring '.'
entries.
"""
for dirpath, dirnames, _ in os.walk(top):
# Modify dirnames in place to prevent walk from
# recursing into hidden directories.
dirnames[:] = [x for x in dirnames if not x.startswith('.')]
for dirname in dirnames:
if named is None or named == dirname:
yield os.path.join(dirpath, dirname)
def __glob_under(self, base, file_pat):
return glob_many(
os.path.join(base, file_pat),
*(os.path.join(x, file_pat)
for x in
self.__find_directories_in(base)))
def __remove_dirs(self, remove_file):
dirs_to_remove = [
'htmlcov',
'.eggs',
]
if self.all:
dirs_to_remove += [
# tox
'.tox',
# instal.sh for pyenv
'.runtimes',
# Built wheels from manylinux
'wheelhouse',
# Doc build
os.path.join('.', 'doc', '_build'),
]
dir_finders = [
# All python cache dirs
(self.__find_directories_in, '.', '__pycache__'),
]
for finder in dir_finders:
func = finder[0]
args = finder[1:]
dirs_to_remove.extend(func(*args))
for f in sorted(dirs_to_remove):
remove_file(f)
def run(self):
clean.run(self)
if self.dry_run:
def remove_file(f):
if os.path.isdir(f):
remove_tree(f, dry_run=self.dry_run)
elif os.path.exists(f):
log.info("Would remove '%s'", f)
else:
def remove_file(f):
if os.path.isdir(f):
remove_tree(f, dry_run=self.dry_run)
elif os.path.exists(f):
log.info("Removing '%s'", f)
os.remove(f)
# Remove directories first before searching for individual files
self.__remove_dirs(remove_file)
def glob_gevent(file_path):
return glob(os.path.join(self.BASE_GEVENT_SRC, file_path))
def glob_gevent_and_under(file_pat):
return self.__glob_under(self.BASE_GEVENT_SRC, file_pat)
def glob_root_and_under(file_pat):
return self.__glob_under('.', file_pat)
files_to_remove = [
'.coverage',
# One-off cython-generated code that doesn't
# follow a globbale-pattern
os.path.join(self.BASE_GEVENT_SRC, 'libev', 'corecext.c'),
os.path.join(self.BASE_GEVENT_SRC, 'libev', 'corecext.h'),
os.path.join(self.BASE_GEVENT_SRC, 'resolver', 'cares.c'),
os.path.join(self.BASE_GEVENT_SRC, 'resolver', 'cares.c'),
]
def dep_configure_artifacts(dep):
for f in (
'config.h',
'config.log',
'config.status',
'.libs'
):
yield os.path.join('deps', dep, f)
file_finders = [
# The base gevent directory contains
# only generated .c code. Remove it.
(glob_gevent, "*.c"),
# Any .html files found in the gevent directory
# are the result of Cython annotations. Remove them.
(glob_gevent_and_under, "*.html"),
# Any compiled binaries have to go
(glob_gevent_and_under, "*.so"),
(glob_gevent_and_under, "*.pyd"),
(glob_root_and_under, "*.o"),
# Compiled python files too
(glob_gevent_and_under, "*.pyc"),
(glob_gevent_and_under, "*.pyo"),
# Artifacts of building dependencies in place
(dep_configure_artifacts, 'libev'),
(dep_configure_artifacts, 'libuv'),
(dep_configure_artifacts, 'c-ares'),
]
for func, pat in file_finders:
files_to_remove.extend(func(pat))
for f in sorted(files_to_remove):
remove_file(f)
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
Managing Embedded Dependencies Managing Embedded Dependencies
================================ ================================
- Modify the c-ares Makefile.in[c] to empty out the MANPAGES variables
so that we don't have to ship those in the sdist.
XXX: We need a patch for that.
Updating libev Updating libev
============== ==============
...@@ -30,6 +26,17 @@ Check if 'config.guess' and/or 'config.sub' went backwards in time ...@@ -30,6 +26,17 @@ Check if 'config.guess' and/or 'config.sub' went backwards in time
from the latest source from the latest source
http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree ) http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree )
Updating c-ares
===============
- Modify the c-ares Makefile.in[c] to empty out the MANPAGES variables
so that we don't have to ship those in the sdist.
XXX: We need a patch for that.
- Follow the same 'config.guess' and 'config.sub' steps as libev.
Updating libuv Updating libuv
============== ==============
...@@ -57,3 +64,5 @@ and the build process. Evaluate those and add them to git and to ...@@ -57,3 +64,5 @@ and the build process. Evaluate those and add them to git and to
``src/gevent/libuv/_corecffi_build.py`` as needed. Then check if there ``src/gevent/libuv/_corecffi_build.py`` as needed. Then check if there
are changes to the build system (e.g., the .gyp files) that need to be are changes to the build system (e.g., the .gyp files) that need to be
accounted for in our build file. accounted for in our build file.
- Follow the same 'config.guess' and 'config.sub' steps as libev.
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright 1992-2018 Free Software Foundation, Inc. # Copyright 1992-2019 Free Software Foundation, Inc.
timestamp='2018-03-08' timestamp='2019-03-04'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
...@@ -50,7 +50,7 @@ version="\ ...@@ -50,7 +50,7 @@ version="\
GNU config.guess ($timestamp) GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright 1992-2018 Free Software Foundation, Inc. Copyright 1992-2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
...@@ -84,8 +84,6 @@ if test $# != 0; then ...@@ -84,8 +84,6 @@ if test $# != 0; then
exit 1 exit 1
fi fi
trap 'exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires # compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a # temporary files to be created and, as you can see below, it is a
...@@ -96,34 +94,38 @@ trap 'exit 1' 1 2 15 ...@@ -96,34 +94,38 @@ trap 'exit 1' 1 2 15
# Portable tmp directory creation inspired by the Autoconf team. # Portable tmp directory creation inspired by the Autoconf team.
set_cc_for_build=' tmp=
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; # shellcheck disable=SC2172
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || set_cc_for_build() {
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || : "${TMPDIR=/tmp}"
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || # shellcheck disable=SC2039
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
dummy=$tmp/dummy ; { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
case $CC_FOR_BUILD,$HOST_CC,$CC in { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
,,) echo "int x;" > "$dummy.c" ; dummy=$tmp/dummy
for c in cc gcc c89 c99 ; do case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then ,,) echo "int x;" > "$dummy.c"
CC_FOR_BUILD="$c"; break ; for driver in cc gcc c89 c99 ; do
fi ; if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
done ; CC_FOR_BUILD="$driver"
if test x"$CC_FOR_BUILD" = x ; then break
CC_FOR_BUILD=no_compiler_found ; fi
fi done
;; if test x"$CC_FOR_BUILD" = x ; then
,,*) CC_FOR_BUILD=$CC ;; CC_FOR_BUILD=no_compiler_found
,*,*) CC_FOR_BUILD=$HOST_CC ;; fi
esac ; set_cc_for_build= ;' ;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac
}
# This is needed to find uname on a Pyramid OSx when run in the BSD universe. # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24) # (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then if test -f /.attbin/uname ; then
PATH=$PATH:/.attbin ; export PATH PATH=$PATH:/.attbin ; export PATH
fi fi
...@@ -138,7 +140,7 @@ Linux|GNU|GNU/*) ...@@ -138,7 +140,7 @@ Linux|GNU|GNU/*)
# We could probably try harder. # We could probably try harder.
LIBC=gnu LIBC=gnu
eval "$set_cc_for_build" set_cc_for_build
cat <<-EOF > "$dummy.c" cat <<-EOF > "$dummy.c"
#include <features.h> #include <features.h>
#if defined(__UCLIBC__) #if defined(__UCLIBC__)
...@@ -199,7 +201,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ...@@ -199,7 +201,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
os=netbsdelf os=netbsdelf
;; ;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax) arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval "$set_cc_for_build" set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__ | grep -q __ELF__
then then
...@@ -237,7 +239,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ...@@ -237,7 +239,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form: # contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "$machine-${os}${release}${abi}" echo "$machine-${os}${release}${abi-}"
exit ;; exit ;;
*:Bitrig:*:*) *:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
...@@ -389,7 +391,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ...@@ -389,7 +391,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
echo i386-pc-auroraux"$UNAME_RELEASE" echo i386-pc-auroraux"$UNAME_RELEASE"
exit ;; exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval "$set_cc_for_build" set_cc_for_build
SUN_ARCH=i386 SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects. # If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
...@@ -482,7 +484,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ...@@ -482,7 +484,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
echo clipper-intergraph-clix"$UNAME_RELEASE" echo clipper-intergraph-clix"$UNAME_RELEASE"
exit ;; exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos) mips:*:*:UMIPS | mips:*:*:RISCos)
eval "$set_cc_for_build" set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c" sed 's/^ //' << EOF > "$dummy.c"
#ifdef __cplusplus #ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */ #include <stdio.h> /* for printf() prototype */
...@@ -579,7 +581,7 @@ EOF ...@@ -579,7 +581,7 @@ EOF
exit ;; exit ;;
*:AIX:2:3) *:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval "$set_cc_for_build" set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c" sed 's/^ //' << EOF > "$dummy.c"
#include <sys/systemcfg.h> #include <sys/systemcfg.h>
...@@ -660,7 +662,7 @@ EOF ...@@ -660,7 +662,7 @@ EOF
esac esac
fi fi
if [ "$HP_ARCH" = "" ]; then if [ "$HP_ARCH" = "" ]; then
eval "$set_cc_for_build" set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c" sed 's/^ //' << EOF > "$dummy.c"
#define _HPUX_SOURCE #define _HPUX_SOURCE
...@@ -700,7 +702,7 @@ EOF ...@@ -700,7 +702,7 @@ EOF
esac esac
if [ "$HP_ARCH" = hppa2.0w ] if [ "$HP_ARCH" = hppa2.0w ]
then then
eval "$set_cc_for_build" set_cc_for_build
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
...@@ -726,7 +728,7 @@ EOF ...@@ -726,7 +728,7 @@ EOF
echo ia64-hp-hpux"$HPUX_REV" echo ia64-hp-hpux"$HPUX_REV"
exit ;; exit ;;
3050*:HI-UX:*:*) 3050*:HI-UX:*:*)
eval "$set_cc_for_build" set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c" sed 's/^ //' << EOF > "$dummy.c"
#include <unistd.h> #include <unistd.h>
int int
...@@ -840,6 +842,17 @@ EOF ...@@ -840,6 +842,17 @@ EOF
*:BSD/OS:*:*) *:BSD/OS:*:*)
echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
exit ;; exit ;;
arm:FreeBSD:*:*)
UNAME_PROCESSOR=`uname -p`
set_cc_for_build
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi
else
echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf
fi
exit ;;
*:FreeBSD:*:*) *:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p` UNAME_PROCESSOR=`/usr/bin/uname -p`
case "$UNAME_PROCESSOR" in case "$UNAME_PROCESSOR" in
...@@ -881,7 +894,7 @@ EOF ...@@ -881,7 +894,7 @@ EOF
echo "$UNAME_MACHINE"-pc-uwin echo "$UNAME_MACHINE"-pc-uwin
exit ;; exit ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin echo x86_64-pc-cygwin
exit ;; exit ;;
prep*:SunOS:5.*:*) prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
...@@ -894,8 +907,8 @@ EOF ...@@ -894,8 +907,8 @@ EOF
# other systems with GNU libc and userland # other systems with GNU libc and userland
echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
exit ;; exit ;;
i*86:Minix:*:*) *:Minix:*:*)
echo "$UNAME_MACHINE"-pc-minix echo "$UNAME_MACHINE"-unknown-minix
exit ;; exit ;;
aarch64:Linux:*:*) aarch64:Linux:*:*)
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
...@@ -922,7 +935,7 @@ EOF ...@@ -922,7 +935,7 @@ EOF
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
arm*:Linux:*:*) arm*:Linux:*:*)
eval "$set_cc_for_build" set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__ | grep -q __ARM_EABI__
then then
...@@ -971,23 +984,51 @@ EOF ...@@ -971,23 +984,51 @@ EOF
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
mips:Linux:*:* | mips64:Linux:*:*) mips:Linux:*:* | mips64:Linux:*:*)
eval "$set_cc_for_build" set_cc_for_build
IS_GLIBC=0
test x"${LIBC}" = xgnu && IS_GLIBC=1
sed 's/^ //' << EOF > "$dummy.c" sed 's/^ //' << EOF > "$dummy.c"
#undef CPU #undef CPU
#undef ${UNAME_MACHINE} #undef mips
#undef ${UNAME_MACHINE}el #undef mipsel
#undef mips64
#undef mips64el
#if ${IS_GLIBC} && defined(_ABI64)
LIBCABI=gnuabi64
#else
#if ${IS_GLIBC} && defined(_ABIN32)
LIBCABI=gnuabin32
#else
LIBCABI=${LIBC}
#endif
#endif
#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
CPU=mipsisa64r6
#else
#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
CPU=mipsisa32r6
#else
#if defined(__mips64)
CPU=mips64
#else
CPU=mips
#endif
#endif
#endif
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=${UNAME_MACHINE}el MIPS_ENDIAN=el
#else #else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=${UNAME_MACHINE} MIPS_ENDIAN=
#else #else
CPU= MIPS_ENDIAN=
#endif #endif
#endif #endif
EOF EOF
eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`"
test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
;; ;;
mips64el:Linux:*:*) mips64el:Linux:*:*)
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
...@@ -1100,7 +1141,7 @@ EOF ...@@ -1100,7 +1141,7 @@ EOF
*Pentium) UNAME_MACHINE=i586 ;; *Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac esac
echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
exit ;; exit ;;
i*86:*:3.2:*) i*86:*:3.2:*)
if test -f /usr/options/cb.name; then if test -f /usr/options/cb.name; then
...@@ -1285,7 +1326,7 @@ EOF ...@@ -1285,7 +1326,7 @@ EOF
exit ;; exit ;;
*:Darwin:*:*) *:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
eval "$set_cc_for_build" set_cc_for_build
if test "$UNAME_PROCESSOR" = unknown ; then if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc UNAME_PROCESSOR=powerpc
fi fi
...@@ -1358,6 +1399,7 @@ EOF ...@@ -1358,6 +1399,7 @@ EOF
# "uname -m" is not consistent, so use $cputype instead. 386 # "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86 # is converted to i386 for consistency with other x86
# operating systems. # operating systems.
# shellcheck disable=SC2154
if test "$cputype" = 386; then if test "$cputype" = 386; then
UNAME_MACHINE=i386 UNAME_MACHINE=i386
else else
...@@ -1414,8 +1456,135 @@ EOF ...@@ -1414,8 +1456,135 @@ EOF
amd64:Isilon\ OneFS:*:*) amd64:Isilon\ OneFS:*:*)
echo x86_64-unknown-onefs echo x86_64-unknown-onefs
exit ;; exit ;;
*:Unleashed:*:*)
echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
exit ;;
esac esac
# No uname command or uname output not recognized.
set_cc_for_build
cat > "$dummy.c" <<EOF
#ifdef _SEQUENT_
#include <sys/types.h>
#include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
#if !defined (ultrix)
#include <sys/param.h>
#if defined (BSD)
#if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
#else
#if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
#else
printf ("vax-dec-bsd\n"); exit (0);
#endif
#endif
#else
printf ("vax-dec-bsd\n"); exit (0);
#endif
#else
printf ("vax-dec-ultrix\n"); exit (0);
#endif
#endif
#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
#include <signal.h>
#if defined(_SIZE_T_) /* >= ULTRIX4 */
printf ("mips-dec-ultrix4\n"); exit (0);
#else
#if defined(ULTRIX3) || defined(ultrix3) || defined(SIGLOST)
printf ("mips-dec-ultrix3\n"); exit (0);
#endif
#endif
#endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
echo "$0: unable to guess system type" >&2 echo "$0: unable to guess system type" >&2
case "$UNAME_MACHINE:$UNAME_SYSTEM" in case "$UNAME_MACHINE:$UNAME_SYSTEM" in
......
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright 1992-2018 Free Software Foundation, Inc. # Copyright 1992-2019 Free Software Foundation, Inc.
timestamp='2018-05-03' timestamp='2019-01-05'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
...@@ -67,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>." ...@@ -67,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright 1992-2018 Free Software Foundation, Inc. Copyright 1992-2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
...@@ -89,7 +89,7 @@ while test $# -gt 0 ; do ...@@ -89,7 +89,7 @@ while test $# -gt 0 ; do
- ) # Use stdin as input. - ) # Use stdin as input.
break ;; break ;;
-* ) -* )
echo "$me: invalid option $1$help" echo "$me: invalid option $1$help" >&2
exit 1 ;; exit 1 ;;
*local*) *local*)
...@@ -110,1234 +110,1167 @@ case $# in ...@@ -110,1234 +110,1167 @@ case $# in
exit 1;; exit 1;;
esac esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Split fields of configuration type
# Here we must recognize all the valid KERNEL-OS combinations. # shellcheck disable=SC2162
maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` IFS="-" read field1 field2 field3 field4 <<EOF
case $maybe_os in $1
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ EOF
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
kopensolaris*-gnu* | cloudabi*-eabi* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
android-linux)
os=-linux-android
basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
basic_machine=`echo "$1" | sed 's/-[^-]*$//'`
case $1 in
*-*)
os=`echo "$1" | sed 's/.*-/-/'`
;;
*)
os=
;;
esac
;;
esac
### Let's recognize common machines as not being operating systems so # Separate into logical components for further validation
### that things like config.sub decstation-3100 work. We also case $1 in
### recognize some manufacturers as not being operating systems, so we *-*-*-*-*)
### can provide default operating systems below. echo Invalid configuration \`"$1"\': more than four components >&2
case $os in exit 1
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
;;
-scout)
;;
-wrs)
os=-vxworks
basic_machine=$1
;;
-chorusos*)
os=-chorusos
basic_machine=$1
;;
-chorusrdb)
os=-chorusrdb
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco6)
os=-sco5v6
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-udk*)
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;; ;;
-lynx*) *-*-*-*)
os=-lynxos basic_machine=$field1-$field2
os=$field3-$field4
;; ;;
-ptx*) *-*-*)
basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
# parts
maybe_os=$field2-$field3
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \
| linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \
| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
| storm-chaos* | os2-emx* | rtmk-nova*)
basic_machine=$field1
os=$maybe_os
;;
android-linux)
basic_machine=$field1-unknown
os=linux-android
;;
*)
basic_machine=$field1-$field2
os=$field3
;;
esac
;; ;;
-psos*) *-*)
os=-psos # A lone config we happen to match not fitting any pattern
case $field1-$field2 in
decstation-3100)
basic_machine=mips-dec
os=
;;
*-*)
# Second component is usually, but not always the OS
case $field2 in
# Prevent following clause from handling this valid os
sun*os*)
basic_machine=$field1
os=$field2
;;
# Manufacturers
dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
| unicom* | ibm* | next | hp | isi* | apollo | altos* \
| convergent* | ncr* | news | 32* | 3600* | 3100* \
| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
| ultra | tti* | harris | dolphin | highlevel | gould \
| cbm | ns | masscomp | apple | axis | knuth | cray \
| microblaze* | sim | cisco \
| oki | wec | wrs | winbond)
basic_machine=$field1-$field2
os=
;;
*)
basic_machine=$field1
os=$field2
;;
esac
;;
esac
;; ;;
-mint | -mint[0-9]*) *)
basic_machine=m68k-atari # Convert single-component short-hands not valid as part of
os=-mint # multi-component configurations.
case $field1 in
386bsd)
basic_machine=i386-pc
os=bsd
;;
a29khif)
basic_machine=a29k-amd
os=udi
;;
adobe68k)
basic_machine=m68010-adobe
os=scout
;;
alliant)
basic_machine=fx80-alliant
os=
;;
altos | altos3068)
basic_machine=m68k-altos
os=
;;
am29k)
basic_machine=a29k-none
os=bsd
;;
amdahl)
basic_machine=580-amdahl
os=sysv
;;
amiga)
basic_machine=m68k-unknown
os=
;;
amigaos | amigados)
basic_machine=m68k-unknown
os=amigaos
;;
amigaunix | amix)
basic_machine=m68k-unknown
os=sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
os=bsd
;;
aros)
basic_machine=i386-pc
os=aros
;;
aux)
basic_machine=m68k-apple
os=aux
;;
balance)
basic_machine=ns32k-sequent
os=dynix
;;
blackfin)
basic_machine=bfin-unknown
os=linux
;;
cegcc)
basic_machine=arm-unknown
os=cegcc
;;
convex-c1)
basic_machine=c1-convex
os=bsd
;;
convex-c2)
basic_machine=c2-convex
os=bsd
;;
convex-c32)
basic_machine=c32-convex
os=bsd
;;
convex-c34)
basic_machine=c34-convex
os=bsd
;;
convex-c38)
basic_machine=c38-convex
os=bsd
;;
cray)
basic_machine=j90-cray
os=unicos
;;
crds | unos)
basic_machine=m68k-crds
os=
;;
da30)
basic_machine=m68k-da30
os=
;;
decstation | pmax | pmin | dec3100 | decstatn)
basic_machine=mips-dec
os=
;;
delta88)
basic_machine=m88k-motorola
os=sysv3
;;
dicos)
basic_machine=i686-pc
os=dicos
;;
djgpp)
basic_machine=i586-pc
os=msdosdjgpp
;;
ebmon29k)
basic_machine=a29k-amd
os=ebmon
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
os=ose
;;
gmicro)
basic_machine=tron-gmicro
os=sysv
;;
go32)
basic_machine=i386-pc
os=go32
;;
h8300hms)
basic_machine=h8300-hitachi
os=hms
;;
h8300xray)
basic_machine=h8300-hitachi
os=xray
;;
h8500hms)
basic_machine=h8500-hitachi
os=hms
;;
harris)
basic_machine=m88k-harris
os=sysv3
;;
hp300)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=hpux
;;
hppaosf)
basic_machine=hppa1.1-hp
os=osf
;;
hppro)
basic_machine=hppa1.1-hp
os=proelf
;;
i386mach)
basic_machine=i386-mach
os=mach
;;
vsta)
basic_machine=i386-pc
os=vsta
;;
isi68 | isi)
basic_machine=m68k-isi
os=sysv
;;
m68knommu)
basic_machine=m68k-unknown
os=linux
;;
magnum | m3230)
basic_machine=mips-mips
os=sysv
;;
merlin)
basic_machine=ns32k-utek
os=sysv
;;
mingw64)
basic_machine=x86_64-pc
os=mingw64
;;
mingw32)
basic_machine=i686-pc
os=mingw32
;;
mingw32ce)
basic_machine=arm-unknown
os=mingw32ce
;;
monitor)
basic_machine=m68k-rom68k
os=coff
;;
morphos)
basic_machine=powerpc-unknown
os=morphos
;;
moxiebox)
basic_machine=moxie-unknown
os=moxiebox
;;
msdos)
basic_machine=i386-pc
os=msdos
;;
msys)
basic_machine=i686-pc
os=msys
;;
mvs)
basic_machine=i370-ibm
os=mvs
;;
nacl)
basic_machine=le32-unknown
os=nacl
;;
ncr3000)
basic_machine=i486-ncr
os=sysv4
;;
netbsd386)
basic_machine=i386-pc
os=netbsd
;;
netwinder)
basic_machine=armv4l-rebel
os=linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=newsos
;;
news1000)
basic_machine=m68030-sony
os=newsos
;;
necv70)
basic_machine=v70-nec
os=sysv
;;
nh3000)
basic_machine=m68k-harris
os=cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=cxux
;;
nindy960)
basic_machine=i960-intel
os=nindy
;;
mon960)
basic_machine=i960-intel
os=mon960
;;
nonstopux)
basic_machine=mips-compaq
os=nonstopux
;;
os400)
basic_machine=powerpc-ibm
os=os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=ose
;;
os68k)
basic_machine=m68k-none
os=os68k
;;
paragon)
basic_machine=i860-intel
os=osf
;;
parisc)
basic_machine=hppa-unknown
os=linux
;;
pw32)
basic_machine=i586-unknown
os=pw32
;;
rdos | rdos64)
basic_machine=x86_64-pc
os=rdos
;;
rdos32)
basic_machine=i386-pc
os=rdos
;;
rom68k)
basic_machine=m68k-rom68k
os=coff
;;
sa29200)
basic_machine=a29k-amd
os=udi
;;
sei)
basic_machine=mips-sei
os=seiux
;;
sequent)
basic_machine=i386-sequent
os=
;;
sps7)
basic_machine=m68k-bull
os=sysv2
;;
st2000)
basic_machine=m68k-tandem
os=
;;
stratus)
basic_machine=i860-stratus
os=sysv4
;;
sun2)
basic_machine=m68000-sun
os=
;;
sun2os3)
basic_machine=m68000-sun
os=sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=sunos4
;;
sun3)
basic_machine=m68k-sun
os=
;;
sun3os3)
basic_machine=m68k-sun
os=sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=sunos4
;;
sun4)
basic_machine=sparc-sun
os=
;;
sun4os3)
basic_machine=sparc-sun
os=sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=sunos4
;;
sun4sol2)
basic_machine=sparc-sun
os=solaris2
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
os=
;;
sv1)
basic_machine=sv1-cray
os=unicos
;;
symmetry)
basic_machine=i386-sequent
os=dynix
;;
t3e)
basic_machine=alphaev5-cray
os=unicos
;;
t90)
basic_machine=t90-cray
os=unicos
;;
toad1)
basic_machine=pdp10-xkl
os=tops20
;;
tpf)
basic_machine=s390x-ibm
os=tpf
;;
udi29k)
basic_machine=a29k-amd
os=udi
;;
ultra3)
basic_machine=a29k-nyu
os=sym1
;;
v810 | necv810)
basic_machine=v810-nec
os=none
;;
vaxv)
basic_machine=vax-dec
os=sysv
;;
vms)
basic_machine=vax-dec
os=vms
;;
vxworks960)
basic_machine=i960-wrs
os=vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
os=vxworks
;;
xbox)
basic_machine=i686-pc
os=mingw32
;;
ymp)
basic_machine=ymp-cray
os=unicos
;;
*)
basic_machine=$1
os=
;;
esac
;; ;;
esac esac
# Decode aliases for certain CPU-COMPANY combinations. # Decode 1-component or ad-hoc basic machines
case $basic_machine in case $basic_machine in
# Recognize the basic CPU types without company name. # Here we handle the default manufacturer of certain CPU types. It is in
# Some are omitted here because they have special meanings below. # some cases the only manufacturer, in others, it is the most popular.
1750a | 580 \ w89k)
| a29k \ cpu=hppa1.1
| aarch64 | aarch64_be \ vendor=winbond
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \
| avr | avr32 \
| ba \
| be32 | be64 \
| bfin \
| c4x | c8051 | clipper | csky \
| d10v | d30v | dlx | dsp16xx \
| e2k | epiphany \
| fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia16 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nfp \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 | or1k | or1knd | or32 \
| pdp10 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pru \
| pyramid \
| riscv32 | riscv64 \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| wasm32 \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
c54x)
basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
;; ;;
m9s12z | m68hcs12z | hcs12z | s12z) op50n)
basic_machine=s12z-unknown cpu=hppa1.1
os=-none vendor=oki
;; ;;
ms1) op60c)
basic_machine=mt-unknown cpu=hppa1.1
vendor=oki
;; ;;
ibm*)
strongarm | thumb | xscale) cpu=i370
basic_machine=arm-unknown vendor=ibm
;; ;;
xgate) orion105)
basic_machine=$basic_machine-unknown cpu=clipper
os=-none vendor=highlevel
;; ;;
xscaleeb) mac | mpw | mac-mpw)
basic_machine=armeb-unknown cpu=m68k
vendor=apple
;; ;;
pmac | pmac-mpw)
xscaleel) cpu=powerpc
basic_machine=armel-unknown vendor=apple
;; ;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| ba-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | csky-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| e2k-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia16-* | ia64-* \
| ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nfp-* \
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| or1k*-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pru-* \
| pyramid-* \
| riscv32-* | riscv64-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| visium-* \
| wasm32-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand # Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS. # for a CPU type and a company and sometimes even an OS.
386bsd)
basic_machine=i386-pc
os=-bsd
;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att cpu=m68000
vendor=att
;; ;;
3b*) 3b*)
basic_machine=we32k-att cpu=we32k
;; vendor=att
a29khif)
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-unknown
;;
amigaos | amigados)
basic_machine=m68k-unknown
os=-amigaos
;;
amigaunix | amix)
basic_machine=m68k-unknown
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
os=-bsd
;;
aros)
basic_machine=i386-pc
os=-aros
;;
asmjs)
basic_machine=asmjs-unknown
;;
aux)
basic_machine=m68k-apple
os=-aux
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
os=-linux
;; ;;
bluegene*) bluegene*)
basic_machine=powerpc-ibm cpu=powerpc
os=-cnk vendor=ibm
;; os=cnk
c54x-*)
basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | j90)
basic_machine=j90-cray
os=-unicos
;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16 | cr16-*)
basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;; ;;
decsystem10* | dec10*) decsystem10* | dec10*)
basic_machine=pdp10-dec cpu=pdp10
os=-tops10 vendor=dec
os=tops10
;; ;;
decsystem20* | dec20*) decsystem20* | dec20*)
basic_machine=pdp10-dec cpu=pdp10
os=-tops20 vendor=dec
os=tops20
;; ;;
delta | 3300 | motorola-3300 | motorola-delta \ delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola) | 3300-motorola | delta-motorola)
basic_machine=m68k-motorola cpu=m68k
;; vendor=motorola
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;; ;;
dpx2*) dpx2*)
basic_machine=m68k-bull cpu=m68k
os=-sysv3 vendor=bull
;; os=sysv3
e500v[12])
basic_machine=powerpc-unknown
os=$os"spe"
;;
e500v[12]-*)
basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
os=$os"spe"
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;; ;;
encore | umax | mmax) encore | umax | mmax)
basic_machine=ns32k-encore cpu=ns32k
vendor=encore
;; ;;
es1800 | OSE68k | ose68k | ose | OSE) elxsi)
basic_machine=m68k-ericsson cpu=elxsi
os=-ose vendor=elxsi
os=${os:-bsd}
;; ;;
fx2800) fx2800)
basic_machine=i860-alliant cpu=i860
vendor=alliant
;; ;;
genix) genix)
basic_machine=ns32k-ns cpu=ns32k
;; vendor=ns
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
go32)
basic_machine=i386-pc
os=-go32
;; ;;
h3050r* | hiux*) h3050r* | hiux*)
basic_machine=hppa1.1-hitachi cpu=hppa1.1
os=-hiuxwe2 vendor=hitachi
;; os=hiuxwe2
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
h8300xray)
basic_machine=h8300-hitachi
os=-xray
;;
h8500hms)
basic_machine=h8500-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;; ;;
hp3k9[0-9][0-9] | hp9[0-9][0-9]) hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp cpu=hppa1.0
vendor=hp
;; ;;
hp9k2[0-9][0-9] | hp9k31[0-9]) hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp cpu=m68000
vendor=hp
;; ;;
hp9k3[2-9][0-9]) hp9k3[2-9][0-9])
basic_machine=m68k-hp cpu=m68k
vendor=hp
;; ;;
hp9k6[0-9][0-9] | hp6[0-9][0-9]) hp9k6[0-9][0-9] | hp6[0-9][0-9])
basic_machine=hppa1.0-hp cpu=hppa1.0
vendor=hp
;; ;;
hp9k7[0-79][0-9] | hp7[0-79][0-9]) hp9k7[0-79][0-9] | hp7[0-79][0-9])
basic_machine=hppa1.1-hp cpu=hppa1.1
vendor=hp
;; ;;
hp9k78[0-9] | hp78[0-9]) hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp # FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp cpu=hppa1.1
vendor=hp
;; ;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp # FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp cpu=hppa1.1
vendor=hp
;; ;;
hp9k8[0-9][13679] | hp8[0-9][13679]) hp9k8[0-9][13679] | hp8[0-9][13679])
basic_machine=hppa1.1-hp cpu=hppa1.1
vendor=hp
;; ;;
hp9k8[0-9][0-9] | hp8[0-9][0-9]) hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp cpu=hppa1.0
;; vendor=hp
hppaosf)
basic_machine=hppa1.1-hp
os=-osf
;;
hppro)
basic_machine=hppa1.1-hp
os=-proelf
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
;; ;;
i*86v32) i*86v32)
basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` cpu=`echo "$1" | sed -e 's/86.*/86/'`
os=-sysv32 vendor=pc
os=sysv32
;; ;;
i*86v4*) i*86v4*)
basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` cpu=`echo "$1" | sed -e 's/86.*/86/'`
os=-sysv4 vendor=pc
os=sysv4
;; ;;
i*86v) i*86v)
basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` cpu=`echo "$1" | sed -e 's/86.*/86/'`
os=-sysv vendor=pc
os=sysv
;; ;;
i*86sol2) i*86sol2)
basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` cpu=`echo "$1" | sed -e 's/86.*/86/'`
os=-solaris2 vendor=pc
;; os=solaris2
i386mach)
basic_machine=i386-mach
os=-mach
;; ;;
vsta) j90 | j90-cray)
basic_machine=i386-unknown cpu=j90
os=-vsta vendor=cray
os=${os:-unicos}
;; ;;
iris | iris4d) iris | iris4d)
basic_machine=mips-sgi cpu=mips
vendor=sgi
case $os in case $os in
-irix*) irix*)
;; ;;
*) *)
os=-irix4 os=irix4
;; ;;
esac esac
;; ;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
os=-linux
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
microblaze*)
basic_machine=microblaze-xilinx
;;
mingw64)
basic_machine=x86_64-pc
os=-mingw64
;;
mingw32)
basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
basic_machine=arm-unknown
os=-mingw32ce
;;
miniframe) miniframe)
basic_machine=m68000-convergent cpu=m68000
;; vendor=convergent
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
mips3*-*)
basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
;;
morphos)
basic_machine=powerpc-unknown
os=-morphos
;;
moxiebox)
basic_machine=moxie-unknown
os=-moxiebox
;;
msdos)
basic_machine=i386-pc
os=-msdos
;;
ms1-*)
basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=i686-pc
os=-msys
;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
nacl)
basic_machine=le32-unknown
os=-nacl
;; ;;
ncr3000) *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
basic_machine=i486-ncr cpu=m68k
os=-sysv4 vendor=atari
;; os=mint
netbsd386)
basic_machine=i386-unknown
os=-netbsd
;;
netwinder)
basic_machine=armv4l-rebel
os=-linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;; ;;
news-3600 | risc-news) news-3600 | risc-news)
basic_machine=mips-sony cpu=mips
os=-newsos vendor=sony
;; os=newsos
necv70)
basic_machine=v70-nec
os=-sysv
;; ;;
next | m*-next) next | m*-next)
basic_machine=m68k-next cpu=m68k
vendor=next
case $os in case $os in
-nextstep* ) openstep*)
;;
nextstep*)
;; ;;
-ns2*) ns2*)
os=-nextstep2 os=nextstep2
;; ;;
*) *)
os=-nextstep3 os=nextstep3
;; ;;
esac esac
;; ;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
mon960)
basic_machine=i960-intel
os=-mon960
;;
nonstopux)
basic_machine=mips-compaq
os=-nonstopux
;;
np1) np1)
basic_machine=np1-gould cpu=np1
;; vendor=gould
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
nsv-tandem)
basic_machine=nsv-tandem
;;
nsx-tandem)
basic_machine=nsx-tandem
;; ;;
op50n-* | op60c-*) op50n-* | op60c-*)
basic_machine=hppa1.1-oki cpu=hppa1.1
os=-proelf vendor=oki
;; os=proelf
openrisc | openrisc-*)
basic_machine=or32-unknown
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
;;
os68k)
basic_machine=m68k-none
os=-os68k
;; ;;
pa-hitachi) pa-hitachi)
basic_machine=hppa1.1-hitachi cpu=hppa1.1
os=-hiuxwe2 vendor=hitachi
;; os=hiuxwe2
paragon)
basic_machine=i860-intel
os=-osf
;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
os=-linux
;; ;;
pbd) pbd)
basic_machine=sparc-tti cpu=sparc
vendor=tti
;; ;;
pbb) pbb)
basic_machine=m68k-tti cpu=m68k
;; vendor=tti
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pc98)
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc
;;
pentiumii | pentium2 | pentiumiii | pentium3)
basic_machine=i686-pc
;;
pentium4)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;; ;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) pc532)
basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` cpu=ns32k
;; vendor=pc532
pentium4-*)
basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;; ;;
pn) pn)
basic_machine=pn-gould cpu=pn
;; vendor=gould
power) basic_machine=power-ibm
;;
ppc | ppcbe) basic_machine=powerpc-unknown
;;
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;; ;;
ppcle | powerpclittle) power)
basic_machine=powerpcle-unknown cpu=power
vendor=ibm
;; ;;
ppcle-* | powerpclittle-*) ps2)
basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` cpu=i386
;; vendor=ibm
ppc64) basic_machine=powerpc64-unknown
;; ;;
ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` rm[46]00)
cpu=mips
vendor=siemens
;; ;;
ppc64le | powerpc64little) rtpc | rtpc-*)
basic_machine=powerpc64le-unknown cpu=romp
vendor=ibm
;; ;;
ppc64le-* | powerpc64little-*) sde)
basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` cpu=mipsisa32
vendor=sde
os=${os:-elf}
;; ;;
ps2) simso-wrs)
basic_machine=i386-ibm cpu=sparclite
vendor=wrs
os=vxworks
;; ;;
pw32) tower | tower-32)
basic_machine=i586-unknown cpu=m68k
os=-pw32 vendor=ncr
;; ;;
rdos | rdos64) vpp*|vx|vx-*)
basic_machine=x86_64-pc cpu=f301
os=-rdos vendor=fujitsu
;; ;;
rdos32) w65)
basic_machine=i386-pc cpu=w65
os=-rdos vendor=wdc
;; ;;
rom68k) w89k-*)
basic_machine=m68k-rom68k cpu=hppa1.1
os=-coff vendor=winbond
os=proelf
;; ;;
rm[46]00) none)
basic_machine=mips-siemens cpu=none
vendor=none
;; ;;
rtpc | rtpc-*) leon|leon[3-9])
basic_machine=romp-ibm cpu=sparc
vendor=$basic_machine
;; ;;
s390 | s390-*) leon-*|leon[3-9]-*)
basic_machine=s390-ibm cpu=sparc
vendor=`echo "$basic_machine" | sed 's/-.*//'`
;; ;;
s390x | s390x-*)
basic_machine=s390x-ibm *-*)
# shellcheck disable=SC2162
IFS="-" read cpu vendor <<EOF
$basic_machine
EOF
;; ;;
sa29200) # We use `pc' rather than `unknown'
basic_machine=a29k-amd # because (1) that's what they normally are, and
os=-udi # (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64)
cpu=$basic_machine
vendor=pc
;; ;;
sb1) # These rules are duplicated from below for sake of the special case above;
basic_machine=mipsisa64sb1-unknown # i.e. things that normalized to x86 arches should also default to "pc"
pc98)
cpu=i386
vendor=pc
;; ;;
sb1el) x64 | amd64)
basic_machine=mipsisa64sb1el-unknown cpu=x86_64
vendor=pc
;; ;;
sde) # Recognize the basic CPU types without company name.
basic_machine=mipsisa32-sde *)
os=-elf cpu=$basic_machine
vendor=unknown
;; ;;
sei) esac
basic_machine=mips-sei
os=-seiux unset -v basic_machine
# Decode basic machines in the full and proper CPU-Company form.
case $cpu-$vendor in
# Here we handle the default manufacturer of certain CPU types in canonical form. It is in
# some cases the only manufacturer, in others, it is the most popular.
craynv-unknown)
vendor=cray
os=${os:-unicosmp}
;; ;;
sequent) c90-unknown | c90-cray)
basic_machine=i386-sequent vendor=cray
os=${os:-unicos}
;; ;;
sh5el) fx80-unknown)
basic_machine=sh5le-unknown vendor=alliant
;; ;;
simso-wrs) romp-unknown)
basic_machine=sparclite-wrs vendor=ibm
os=-vxworks
;; ;;
sps7) mmix-unknown)
basic_machine=m68k-bull vendor=knuth
os=-sysv2
;; ;;
spur) microblaze-unknown | microblazeel-unknown)
basic_machine=spur-unknown vendor=xilinx
;; ;;
st2000) rs6000-unknown)
basic_machine=m68k-tandem vendor=ibm
;; ;;
stratus) vax-unknown)
basic_machine=i860-stratus vendor=dec
os=-sysv4
;; ;;
strongarm-* | thumb-*) pdp11-unknown)
basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` vendor=dec
;; ;;
sun2) we32k-unknown)
basic_machine=m68000-sun vendor=att
;; ;;
sun2os3) cydra-unknown)
basic_machine=m68000-sun vendor=cydrome
os=-sunos3
;; ;;
sun2os4) i370-ibm*)
basic_machine=m68000-sun vendor=ibm
os=-sunos4
;; ;;
sun3os3) orion-unknown)
basic_machine=m68k-sun vendor=highlevel
os=-sunos3
;; ;;
sun3os4) xps-unknown | xps100-unknown)
basic_machine=m68k-sun cpu=xps100
os=-sunos4 vendor=honeywell
;; ;;
sun4os3)
basic_machine=sparc-sun # Here we normalize CPU types with a missing or matching vendor
os=-sunos3 dpx20-unknown | dpx20-bull)
cpu=rs6000
vendor=bull
os=${os:-bosx}
;; ;;
sun4os4)
basic_machine=sparc-sun # Here we normalize CPU types irrespective of the vendor
os=-sunos4 amd64-*)
cpu=x86_64
;; ;;
sun4sol2) blackfin-*)
basic_machine=sparc-sun cpu=bfin
os=-solaris2 os=linux
;; ;;
sun3 | sun3-*) c54x-*)
basic_machine=m68k-sun cpu=tic54x
;; ;;
sun4) c55x-*)
basic_machine=sparc-sun cpu=tic55x
;; ;;
sun386 | sun386i | roadrunner) c6x-*)
basic_machine=i386-sun cpu=tic6x
;; ;;
sv1) e500v[12]-*)
basic_machine=sv1-cray cpu=powerpc
os=-unicos os=$os"spe"
;; ;;
symmetry) mips3*-*)
basic_machine=i386-sequent cpu=mips64
os=-dynix
;; ;;
t3e) ms1-*)
basic_machine=alphaev5-cray cpu=mt
os=-unicos
;; ;;
t90) m68knommu-*)
basic_machine=t90-cray cpu=m68k
os=-unicos os=linux
;; ;;
tile*) m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
basic_machine=$basic_machine-unknown cpu=s12z
os=-linux-gnu
;; ;;
tx39) openrisc-*)
basic_machine=mipstx39-unknown cpu=or32
;; ;;
tx39el) parisc-*)
basic_machine=mipstx39el-unknown cpu=hppa
os=linux
;; ;;
toad1) pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=pdp10-xkl cpu=i586
os=-tops20
;; ;;
tower | tower-32) pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
basic_machine=m68k-ncr cpu=i686
;; ;;
tpf) pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
basic_machine=s390x-ibm cpu=i686
os=-tpf
;; ;;
udi29k) pentium4-*)
basic_machine=a29k-amd cpu=i786
os=-udi
;; ;;
ultra3) pc98-*)
basic_machine=a29k-nyu cpu=i386
os=-sym1
;; ;;
v810 | necv810) ppc-* | ppcbe-*)
basic_machine=v810-nec cpu=powerpc
os=-none
;; ;;
vaxv) ppcle-* | powerpclittle-*)
basic_machine=vax-dec cpu=powerpcle
os=-sysv
;; ;;
vms) ppc64-*)
basic_machine=vax-dec cpu=powerpc64
os=-vms
;; ;;
vpp*|vx|vx-*) ppc64le-* | powerpc64little-*)
basic_machine=f301-fujitsu cpu=powerpc64le
;; ;;
vxworks960) sb1-*)
basic_machine=i960-wrs cpu=mipsisa64sb1
os=-vxworks
;; ;;
vxworks68) sb1el-*)
basic_machine=m68k-wrs cpu=mipsisa64sb1el
os=-vxworks
;; ;;
vxworks29k) sh5e[lb]-*)
basic_machine=a29k-wrs cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
os=-vxworks
;; ;;
w65*) spur-*)
basic_machine=w65-wdc cpu=spur
os=-none
;; ;;
w89k-*) strongarm-* | thumb-*)
basic_machine=hppa1.1-winbond cpu=arm
os=-proelf
;; ;;
x64) tx39-*)
basic_machine=x86_64-pc cpu=mipstx39
;; ;;
xbox) tx39el-*)
basic_machine=i686-pc cpu=mipstx39el
os=-mingw32
;; ;;
xps | xps100) x64-*)
basic_machine=xps100-honeywell cpu=x86_64
;; ;;
xscale-* | xscalee[bl]-*) xscale-* | xscalee[bl]-*)
basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
;;
ymp)
basic_machine=ymp-cray
os=-unicos
;;
none)
basic_machine=none-none
os=-none
;; ;;
# Here we handle the default manufacturer of certain CPU types. It is in # Recognize the canonical CPU Types that limit and/or modify the
# some cases the only manufacturer, in others, it is the most popular. # company names they are paired with.
w89k) cr16-*)
basic_machine=hppa1.1-winbond os=${os:-elf}
;; ;;
op50n) crisv32-* | etraxfs*-*)
basic_machine=hppa1.1-oki cpu=crisv32
;; vendor=axis
op60c)
basic_machine=hppa1.1-oki
;;
romp)
basic_machine=romp-ibm
;; ;;
mmix) cris-* | etrax*-*)
basic_machine=mmix-knuth cpu=cris
vendor=axis
;; ;;
rs6000) crx-*)
basic_machine=rs6000-ibm os=${os:-elf}
;; ;;
vax) neo-tandem)
basic_machine=vax-dec cpu=neo
;; vendor=tandem
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;; ;;
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) nse-tandem)
basic_machine=sh-unknown cpu=nse
vendor=tandem
;; ;;
cydra) nsr-tandem)
basic_machine=cydra-cydrome cpu=nsr
vendor=tandem
;; ;;
orion) nsv-tandem)
basic_machine=orion-highlevel cpu=nsv
vendor=tandem
;; ;;
orion105) nsx-tandem)
basic_machine=clipper-highlevel cpu=nsx
vendor=tandem
;; ;;
mac | mpw | mac-mpw) s390-*)
basic_machine=m68k-apple cpu=s390
vendor=ibm
;; ;;
pmac | pmac-mpw) s390x-*)
basic_machine=powerpc-apple cpu=s390x
vendor=ibm
;; ;;
*-unknown) tile*-*)
# Make sure to match an already-canonicalized machine name. os=${os:-linux-gnu}
;; ;;
*) *)
echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 # Recognize the canonical CPU types that are allowed with any
exit 1 # company name.
case $cpu in
1750a | 580 \
| a29k \
| aarch64 | aarch64_be \
| abacus \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
| alphapca5[67] | alpha64pca5[67] \
| am33_2.0 \
| amdgcn \
| arc | arceb \
| arm | arm[lb]e | arme[lb] | armv* \
| avr | avr32 \
| asmjs \
| ba \
| be32 | be64 \
| bfin | bs2000 \
| c[123]* | c30 | [cjt]90 | c4x \
| c8051 | clipper | craynv | csky | cydra \
| d10v | d30v | dlx | dsp16xx \
| e2k | elxsi | epiphany \
| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
| h8300 | h8500 \
| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i*86 | i860 | i960 | ia16 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle \
| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
| m88110 | m88k | maxq | mb | mcore | mep | metag \
| microblaze | microblazeel \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64eb | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mmix \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nfp \
| nios | nios2 | nios2eb | nios2el \
| none | np1 | ns16k | ns32k | nvptx \
| open8 \
| or1k* \
| or32 \
| orion \
| picochip \
| pdp10 | pdp11 | pj | pjl | pn | power \
| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
| pru \
| pyramid \
| riscv | riscv32 | riscv64 \
| rl78 | romp | rs6000 | rx \
| score \
| sh | shl \
| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
| sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
| sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
| spu \
| tahoe \
| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
| tron \
| ubicom32 \
| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
| vax \
| visium \
| w65 \
| wasm32 | wasm64 \
| we32k \
| x86 | x86_64 | xc16x | xgate | xps100 \
| xstormy16 | xtensa* \
| ymp \
| z8k | z80)
;;
*)
echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
exit 1
;;
esac
;; ;;
esac esac
# Here we canonicalize certain aliases for manufacturers. # Here we canonicalize certain aliases for manufacturers.
case $basic_machine in case $vendor in
*-digital*) digital*)
basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` vendor=dec
;; ;;
*-commodore*) commodore*)
basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` vendor=cbm
;; ;;
*) *)
;; ;;
...@@ -1345,199 +1278,245 @@ esac ...@@ -1345,199 +1278,245 @@ esac
# Decode manufacturer-specific aliases for certain operating systems. # Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ] if [ x$os != x ]
then then
case $os in case $os in
# First match some system type aliases that might get confused # First match some system type aliases that might get confused
# with valid system types. # with valid system types.
# -solaris* is a basic system type, with this one exception. # solaris* is a basic system type, with this one exception.
-auroraux) auroraux)
os=-auroraux os=auroraux
;; ;;
-solaris1 | -solaris1.*) bluegene*)
os=cnk
;;
solaris1 | solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'` os=`echo $os | sed -e 's|solaris1|sunos4|'`
;; ;;
-solaris) solaris)
os=-solaris2 os=solaris2
;; ;;
-unixware*) unixware*)
os=-sysv4.2uw os=sysv4.2uw
;; ;;
-gnu/linux*) gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;; ;;
# es1800 is here to avoid being matched by es* (a different OS) # es1800 is here to avoid being matched by es* (a different OS)
-es1800*) es1800*)
os=-ose os=ose
;;
# Some version numbers need modification
chorusos*)
os=chorusos
;;
isc)
os=isc2.2
;;
sco6)
os=sco5v6
;;
sco5)
os=sco3.2v5
;;
sco4)
os=sco3.2v4
;;
sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
;;
sco3.2v[4-9]* | sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
;;
scout)
# Don't match below
;;
sco*)
os=sco3.2v2
;;
psos*)
os=psos
;; ;;
# Now accept the basic system types. # Now accept the basic system types.
# The portable systems comes first. # The portable systems comes first.
# Each alternative MUST end in a * to match a version number. # Each alternative MUST end in a * to match a version number.
# -sysv* is not here because it comes later, after sysvr4. # sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
| -sym* | -kopensolaris* | -plan9* \ | sym* | kopensolaris* | plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
| -aos* | -aros* | -cloudabi* | -sortix* \ | aos* | aros* | cloudabi* | sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
| -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | knetbsd* | mirbsd* | netbsd* \
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | bitrig* | openbsd* | solidbsd* | libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \ | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \
| -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | chorusrdb* | cegcc* | glidix* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \ | linux-newlib* | linux-musl* | linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | interix* | uwin* | mks* | rhapsody* | darwin* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | openstep* | oskit* | conix* | pw32* | nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | storm-chaos* | tops10* | tenex* | tops20* | its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | os2* | vos* | palmos* | uclinux* | nucleus* \
| -morphos* | -superux* | -rtmk* | -windiss* \ | morphos* | superux* | rtmk* | windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \
| -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| -midnightbsd*) | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) qnx*)
case $basic_machine in case $cpu in
x86-* | i*86-*) x86 | i*86)
;; ;;
*) *)
os=-nto$os os=nto-$os
;; ;;
esac esac
;; ;;
-nto-qnx*) hiux*)
os=hiuxwe2
;;
nto-qnx*)
;; ;;
-nto*) nto*)
os=`echo $os | sed -e 's|nto|nto-qnx|'` os=`echo $os | sed -e 's|nto|nto-qnx|'`
;; ;;
-sim | -xray | -os68k* | -v88r* \ sim | xray | os68k* | v88r* \
| -windows* | -osx | -abug | -netware* | -os9* \ | windows* | osx | abug | netware* | os9* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) | macos* | mpw* | magic* | mmixware* | mon960* | lnews*)
;;
linux-dietlibc)
os=linux-dietlibc
;;
linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
lynx*178)
os=lynxos178
;; ;;
-mac*) lynx*5)
os=lynxos5
;;
lynx*)
os=lynxos
;;
mac*)
os=`echo "$os" | sed -e 's|mac|macos|'` os=`echo "$os" | sed -e 's|mac|macos|'`
;; ;;
-linux-dietlibc) opened*)
os=-linux-dietlibc os=openedition
;; ;;
-linux*) os400*)
os=`echo $os | sed -e 's|linux|linux-gnu|'` os=os400
;; ;;
-sunos5*) sunos5*)
os=`echo "$os" | sed -e 's|sunos5|solaris2|'` os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
;; ;;
-sunos6*) sunos6*)
os=`echo "$os" | sed -e 's|sunos6|solaris3|'` os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
;; ;;
-opened*) wince*)
os=-openedition os=wince
;;
-os400*)
os=-os400
;; ;;
-wince*) utek*)
os=-wince os=bsd
;; ;;
-utek*) dynix*)
os=-bsd os=bsd
;; ;;
-dynix*) acis*)
os=-bsd os=aos
;; ;;
-acis*) atheos*)
os=-aos os=atheos
;; ;;
-atheos*) syllable*)
os=-atheos os=syllable
;; ;;
-syllable*) 386bsd)
os=-syllable os=bsd
;;
-386bsd)
os=-bsd
;; ;;
-ctix* | -uts*) ctix* | uts*)
os=-sysv os=sysv
;; ;;
-nova*) nova*)
os=-rtmk-nova os=rtmk-nova
;; ;;
-ns2) ns2)
os=-nextstep2 os=nextstep2
;; ;;
-nsk*) nsk*)
os=-nsk os=nsk
;; ;;
# Preserve the version number of sinix5. # Preserve the version number of sinix5.
-sinix5.*) sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'` os=`echo $os | sed -e 's|sinix|sysv|'`
;; ;;
-sinix*) sinix*)
os=-sysv4 os=sysv4
;; ;;
-tpf*) tpf*)
os=-tpf os=tpf
;; ;;
-triton*) triton*)
os=-sysv3 os=sysv3
;; ;;
-oss*) oss*)
os=-sysv3 os=sysv3
;; ;;
-svr4*) svr4*)
os=-sysv4 os=sysv4
;; ;;
-svr3) svr3)
os=-sysv3 os=sysv3
;; ;;
-sysvr4) sysvr4)
os=-sysv4 os=sysv4
;; ;;
# This must come after -sysvr4. # This must come after sysvr4.
-sysv*) sysv*)
;; ;;
-ose*) ose*)
os=-ose os=ose
;; ;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
os=-mint os=mint
;; ;;
-zvmoe) zvmoe)
os=-zvmoe os=zvmoe
;; ;;
-dicos*) dicos*)
os=-dicos os=dicos
;; ;;
-pikeos*) pikeos*)
# Until real need of OS specific support for # Until real need of OS specific support for
# particular features comes up, bare metal # particular features comes up, bare metal
# configurations are quite functional. # configurations are quite functional.
case $basic_machine in case $cpu in
arm*) arm*)
os=-eabi os=eabi
;; ;;
*) *)
os=-elf os=elf
;; ;;
esac esac
;; ;;
-nacl*) nacl*)
;; ;;
-ios) ios)
;; ;;
-none) none)
;;
*-eabi)
;; ;;
*) *)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
exit 1 exit 1
;; ;;
...@@ -1554,254 +1533,261 @@ else ...@@ -1554,254 +1533,261 @@ else
# will signal an error saying that MANUFACTURER isn't an operating # will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point. # system, and we'll never get to this point.
case $basic_machine in case $cpu-$vendor in
score-*) score-*)
os=-elf os=elf
;; ;;
spu-*) spu-*)
os=-elf os=elf
;; ;;
*-acorn) *-acorn)
os=-riscix1.2 os=riscix1.2
;; ;;
arm*-rebel) arm*-rebel)
os=-linux os=linux
;; ;;
arm*-semi) arm*-semi)
os=-aout os=aout
;; ;;
c4x-* | tic4x-*) c4x-* | tic4x-*)
os=-coff os=coff
;; ;;
c8051-*) c8051-*)
os=-elf os=elf
;;
clipper-intergraph)
os=clix
;; ;;
hexagon-*) hexagon-*)
os=-elf os=elf
;; ;;
tic54x-*) tic54x-*)
os=-coff os=coff
;; ;;
tic55x-*) tic55x-*)
os=-coff os=coff
;; ;;
tic6x-*) tic6x-*)
os=-coff os=coff
;; ;;
# This must come before the *-dec entry. # This must come before the *-dec entry.
pdp10-*) pdp10-*)
os=-tops20 os=tops20
;; ;;
pdp11-*) pdp11-*)
os=-none os=none
;; ;;
*-dec | vax-*) *-dec | vax-*)
os=-ultrix4.2 os=ultrix4.2
;; ;;
m68*-apollo) m68*-apollo)
os=-domain os=domain
;; ;;
i386-sun) i386-sun)
os=-sunos4.0.2 os=sunos4.0.2
;; ;;
m68000-sun) m68000-sun)
os=-sunos3 os=sunos3
;; ;;
m68*-cisco) m68*-cisco)
os=-aout os=aout
;; ;;
mep-*) mep-*)
os=-elf os=elf
;; ;;
mips*-cisco) mips*-cisco)
os=-elf os=elf
;; ;;
mips*-*) mips*-*)
os=-elf os=elf
;; ;;
or32-*) or32-*)
os=-coff os=coff
;; ;;
*-tti) # must be before sparc entry or we get the wrong os. *-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3 os=sysv3
;; ;;
sparc-* | *-sun) sparc-* | *-sun)
os=-sunos4.1.1 os=sunos4.1.1
;; ;;
pru-*) pru-*)
os=-elf os=elf
;; ;;
*-be) *-be)
os=-beos os=beos
;; ;;
*-ibm) *-ibm)
os=-aix os=aix
;; ;;
*-knuth) *-knuth)
os=-mmixware os=mmixware
;; ;;
*-wec) *-wec)
os=-proelf os=proelf
;; ;;
*-winbond) *-winbond)
os=-proelf os=proelf
;; ;;
*-oki) *-oki)
os=-proelf os=proelf
;; ;;
*-hp) *-hp)
os=-hpux os=hpux
;; ;;
*-hitachi) *-hitachi)
os=-hiux os=hiux
;; ;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv os=sysv
;; ;;
*-cbm) *-cbm)
os=-amigaos os=amigaos
;; ;;
*-dg) *-dg)
os=-dgux os=dgux
;; ;;
*-dolphin) *-dolphin)
os=-sysv3 os=sysv3
;; ;;
m68k-ccur) m68k-ccur)
os=-rtu os=rtu
;; ;;
m88k-omron*) m88k-omron*)
os=-luna os=luna
;; ;;
*-next) *-next)
os=-nextstep os=nextstep
;; ;;
*-sequent) *-sequent)
os=-ptx os=ptx
;; ;;
*-crds) *-crds)
os=-unos os=unos
;; ;;
*-ns) *-ns)
os=-genix os=genix
;; ;;
i370-*) i370-*)
os=-mvs os=mvs
;; ;;
*-gould) *-gould)
os=-sysv os=sysv
;; ;;
*-highlevel) *-highlevel)
os=-bsd os=bsd
;; ;;
*-encore) *-encore)
os=-bsd os=bsd
;; ;;
*-sgi) *-sgi)
os=-irix os=irix
;; ;;
*-siemens) *-siemens)
os=-sysv4 os=sysv4
;; ;;
*-masscomp) *-masscomp)
os=-rtu os=rtu
;; ;;
f30[01]-fujitsu | f700-fujitsu) f30[01]-fujitsu | f700-fujitsu)
os=-uxpv os=uxpv
;; ;;
*-rom68k) *-rom68k)
os=-coff os=coff
;; ;;
*-*bug) *-*bug)
os=-coff os=coff
;; ;;
*-apple) *-apple)
os=-macos os=macos
;; ;;
*-atari*) *-atari*)
os=-mint os=mint
;;
*-wrs)
os=vxworks
;; ;;
*) *)
os=-none os=none
;; ;;
esac esac
fi fi
# Here we handle the case where we know the os, and the CPU type, but not the # Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer. # manufacturer. We pick the logical manufacturer.
vendor=unknown case $vendor in
case $basic_machine in unknown)
*-unknown)
case $os in case $os in
-riscix*) riscix*)
vendor=acorn vendor=acorn
;; ;;
-sunos*) sunos*)
vendor=sun vendor=sun
;; ;;
-cnk*|-aix*) cnk*|-aix*)
vendor=ibm vendor=ibm
;; ;;
-beos*) beos*)
vendor=be vendor=be
;; ;;
-hpux*) hpux*)
vendor=hp vendor=hp
;; ;;
-mpeix*) mpeix*)
vendor=hp vendor=hp
;; ;;
-hiux*) hiux*)
vendor=hitachi vendor=hitachi
;; ;;
-unos*) unos*)
vendor=crds vendor=crds
;; ;;
-dgux*) dgux*)
vendor=dg vendor=dg
;; ;;
-luna*) luna*)
vendor=omron vendor=omron
;; ;;
-genix*) genix*)
vendor=ns vendor=ns
;; ;;
-mvs* | -opened*) clix*)
vendor=intergraph
;;
mvs* | opened*)
vendor=ibm vendor=ibm
;; ;;
-os400*) os400*)
vendor=ibm vendor=ibm
;; ;;
-ptx*) ptx*)
vendor=sequent vendor=sequent
;; ;;
-tpf*) tpf*)
vendor=ibm vendor=ibm
;; ;;
-vxsim* | -vxworks* | -windiss*) vxsim* | vxworks* | windiss*)
vendor=wrs vendor=wrs
;; ;;
-aux*) aux*)
vendor=apple vendor=apple
;; ;;
-hms*) hms*)
vendor=hitachi vendor=hitachi
;; ;;
-mpw* | -macos*) mpw* | macos*)
vendor=apple vendor=apple
;; ;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
vendor=atari vendor=atari
;; ;;
-vos*) vos*)
vendor=stratus vendor=stratus
;; ;;
esac esac
basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
;; ;;
esac esac
echo "$basic_machine$os" echo "$cpu-$vendor-$os"
exit exit
# Local variables: # Local variables:
......
...@@ -9,6 +9,9 @@ pylint>=1.8.0 ; python_version < "3.4" ...@@ -9,6 +9,9 @@ pylint>=1.8.0 ; python_version < "3.4"
pylint >= 2.3.1 ; python_version >= "3.4" and platform_python_implementation == "CPython" pylint >= 2.3.1 ; python_version >= "3.4" and platform_python_implementation == "CPython"
astroid >= 2.2.5 ; python_version >= "3.4" and platform_python_implementation == "CPython" astroid >= 2.2.5 ; python_version >= "3.4" and platform_python_implementation == "CPython"
# We need this at runtime to use the libev-CFFI and libuv backends
cffi >= 1.12.2 ; platform_python_implementation == 'CPython'
# benchmarks use this # benchmarks use this
perf >= 1.6.0 perf >= 1.6.0
......
...@@ -10,98 +10,100 @@ ...@@ -10,98 +10,100 @@
set -e set -e
set -x set -x
# This is to guard against multiple builds in parallel. The various installers will tend
# to stomp all over eachother if you do this and they haven't previously successfully
# succeeded. We use a lock file to block progress so only one install runs at a time.
# This script should be pretty fast once files are cached, so the lost of concurrency
# is not a major problem.
# This should be using the lockfile command, but that's not available on the
# containerized travis and we can't install it without sudo.
# Is is unclear if this is actually useful. I was seeing behaviour that suggested
# concurrent runs of the installer, but I can't seem to find any evidence of this lock
# ever not being acquired.
# Where installations go
BASE=${BUILD_RUNTIMES-$PWD/.runtimes} BASE=${BUILD_RUNTIMES-$PWD/.runtimes}
PYENV=$BASE/pyenv
echo $BASE echo $BASE
mkdir -p $BASE mkdir -p $BASE
LOCKFILE="$BASE/.install-lockfile"
while true; do
if mkdir $LOCKFILE 2>/dev/null; then
echo "Successfully acquired installer."
break
else
echo "Failed to acquire lock. Is another installer running? Waiting a bit."
fi
sleep $[ ( $RANDOM % 10) + 1 ].$[ ( $RANDOM % 100) ]s
if (( $(date '+%s') > 300 + $(stat --format=%X $LOCKFILE) )); then
echo "We've waited long enough"
rm -rf $LOCKFILE
fi
done
trap "rm -rf $LOCKFILE" EXIT
PYENV=$BASE/pyenv
if [ ! -d "$PYENV/.git" ]; then if [ ! -d "$PYENV/.git" ]; then
rm -rf $PYENV rm -rf $PYENV
git clone https://github.com/pyenv/pyenv.git $BASE/pyenv git clone https://github.com/pyenv/pyenv.git $BASE/pyenv
else else
back=$PWD back=$PWD
cd $PYENV cd $PYENV
git fetch || echo "Fetch failed to complete. Ignoring" # We don't fetch or reset after the initial creation;
git reset --hard origin/master # doing so causes the Travis cache to need re-packed and uploaded,
cd $back # and it's pretty large.
# So if we need to incorporate changes from pyenv, either temporarily
# turn this back on, or remove the Travis caches.
# git fetch || echo "Fetch failed to complete. Ignoring"
# git reset --hard origin/master
cd $back
fi fi
SNAKEPIT=$BASE/snakepit SNAKEPIT=$BASE/snakepit
##
# install(exact-version, bin-alias, dir-alias)
#
# Produce a python executable at $SNAKEPIT/bin-alias
# having the exact version given as exact-version.
#
# Also produces a $SNAKEPIT/dir-alias/ pointing to the root
# of the python install.
##
install () { install () {
VERSION="$1" VERSION="$1"
ALIAS="$2" ALIAS="$2"
mkdir -p $BASE/versions DIR_ALIAS="$3"
SOURCE=$BASE/versions/$ALIAS
DESTINATION=$BASE/versions/$VERSION
if [ ! -e "$SOURCE" ]; then
mkdir -p $SNAKEPIT
mkdir -p $BASE/versions mkdir -p $BASE/versions
$BASE/pyenv/plugins/python-build/bin/python-build $VERSION $SOURCE mkdir -p $SNAKEPIT
fi
rm -f $SNAKEPIT/$ALIAS if [ ! -e "$DESTINATION" ]; then
mkdir -p $SNAKEPIT mkdir -p $SNAKEPIT
ls -l $SNAKEPIT mkdir -p $BASE/versions
ls -l $BASE/versions $BASE/pyenv/plugins/python-build/bin/python-build $VERSION $DESTINATION
ls -l $SOURCE/ fi
ls -l $SOURCE/bin
ln -s $SOURCE/bin/python $SNAKEPIT/$ALIAS # Travis CI doesn't take symlink changes (or creation!) into
$SOURCE/bin/python -m pip.__main__ install --upgrade pip wheel virtualenv # account on its caching, So we need to write an actual file if we
# actually changed something. For python version upgrades, this is
# usually handled automatically (obviously) because we installed
# python. But if we make changes *just* to symlink locations above,
# nothing happens. So for every symlink, write a file...with identical contents,
# so that we don't get *spurious* caching. (Travis doesn't check for mod times,
# just contents, so echoing each time doesn't cause it to re-cache.)
# Overwrite an existing alias
ln -sf $DESTINATION/bin/python $SNAKEPIT/$ALIAS
ln -sf $DESTINATION $SNAKEPIT/$DIR_ALIAS
echo $VERSION $ALIAS $DIR_ALIAS > $SNAKEPIT/$ALIAS.installed
$SNAKEPIT/$ALIAS --version
# Set the PATH to include the install's bin directory so pip
# doesn't nag.
PATH="$DESTINATION/bin/:$PATH" $SNAKEPIT/$ALIAS -m pip install --upgrade pip wheel virtualenv
ls -l $SNAKEPIT
} }
for var in "$@"; do for var in "$@"; do
case "${var}" in case "${var}" in
2.7) 2.7)
install 2.7.16 python2.7.16 install 2.7.16 python2.7 2.7.d
;; ;;
3.5) 3.5)
install 3.5.6 python3.5.6 install 3.5.6 python3.5 3.5.d
;; ;;
3.6) 3.6)
install 3.6.8 python3.6.8 install 3.6.8 python3.6 3.6.d
;; ;;
3.7) 3.7)
install 3.7.2 python3.7.2 install 3.7.2 python3.7 3.7.d
;; ;;
pypy) pypy2.7)
install pypy2.7-7.1.0 pypy710 install pypy2.7-7.1.0 pypy2.7 pypy2.7.d
;; ;;
pypy3) pypy3.6)
install pypy3.6-7.1.0 pypy3.6_710 install pypy3.6-7.1.0 pypy3.6 pypy3.6.d
;; ;;
esac esac
done done
...@@ -20,6 +20,7 @@ from _setuputils import PYPY, WIN ...@@ -20,6 +20,7 @@ from _setuputils import PYPY, WIN
from _setuputils import IGNORE_CFFI from _setuputils import IGNORE_CFFI
from _setuputils import SKIP_LIBUV from _setuputils import SKIP_LIBUV
from _setuputils import ConfiguringBuildExt from _setuputils import ConfiguringBuildExt
from _setuputils import GeventClean
from _setuputils import BuildFailed from _setuputils import BuildFailed
from _setuputils import cythonize1 from _setuputils import cythonize1
...@@ -325,6 +326,17 @@ def run_setup(ext_modules, run_make): ...@@ -325,6 +326,17 @@ def run_setup(ext_modules, run_make):
# TODO: Generalize this. # TODO: Generalize this.
if LIBEV_CFFI_MODULE in cffi_modules and not WIN: if LIBEV_CFFI_MODULE in cffi_modules and not WIN:
system(libev_configure_command) system(libev_configure_command)
# This changed to the libev directory, and ran configure .
# It then copied the generated config.h back to the previous
# directory, which happened to be beside us. In the embedded case,
# we're building in a different directory, so it copied it back to build
# directory, but here, we're building in the embedded directory, so
# it gave us useless files.
bad_file = None
for bad_file in ('config.h', 'configure-output.txt'):
if os.path.exists(bad_file):
os.remove(bad_file)
del bad_file
setup( setup(
name='gevent', name='gevent',
...@@ -347,7 +359,10 @@ def run_setup(ext_modules, run_make): ...@@ -347,7 +359,10 @@ def run_setup(ext_modules, run_make):
packages=find_packages('src'), packages=find_packages('src'),
include_package_data=True, include_package_data=True,
ext_modules=ext_modules, ext_modules=ext_modules,
cmdclass=dict(build_ext=ConfiguringBuildExt), cmdclass={
'build_ext': ConfiguringBuildExt,
'clean': GeventClean,
},
install_requires=install_requires, install_requires=install_requires,
setup_requires=setup_requires, setup_requires=setup_requires,
extras_require={ extras_require={
......
...@@ -18,6 +18,7 @@ from .sysinfo import PY2 ...@@ -18,6 +18,7 @@ from .sysinfo import PY2
from .sysinfo import RESOLVER_ARES from .sysinfo import RESOLVER_ARES
from .sysinfo import RUN_LEAKCHECKS from .sysinfo import RUN_LEAKCHECKS
from . import six from . import six
from . import travis
# Import this while we're probably single-threaded/single-processed # Import this while we're probably single-threaded/single-processed
# to try to avoid issues with PyPy 5.10. # to try to avoid issues with PyPy 5.10.
...@@ -63,103 +64,172 @@ def _dir_from_package_name(package): ...@@ -63,103 +64,172 @@ def _dir_from_package_name(package):
return package_dir return package_dir
def run_many(tests, class ResultCollector(object):
configured_failing_tests=(),
failfast=False,
quiet=False,
configured_run_alone_tests=()):
# pylint:disable=too-many-locals,too-many-statements
global NWORKERS
start = time.time()
total = 0
failed = {}
passed = {}
total_cases = [0]
total_skipped = [0]
NWORKERS = min(len(tests), NWORKERS) or 1
pool = ThreadPool(NWORKERS) def __init__(self):
util.BUFFER_OUTPUT = NWORKERS > 1 or quiet self.total = 0
self.failed = {}
self.passed = {}
self.total_cases = 0
self.total_skipped = 0
def run_one(cmd, **kwargs): def __iadd__(self, result):
kwargs['quiet'] = quiet if not result:
result = util.run(cmd, **kwargs) self.failed[result.name] = result #[cmd, kwargs]
if result:
if failfast:
sys.exit(1)
failed[result.name] = [cmd, kwargs]
else: else:
passed[result.name] = True self.passed[result.name] = True
total_cases[0] += result.run_count self.total_cases += result.run_count
total_skipped[0] += result.skipped_count self.total_skipped += result.skipped_count
return self
class Runner(object):
TIME_WAIT_REAP = 0.1
TIME_WAIT_SPAWN = 0.05
def __init__(self,
tests,
configured_failing_tests=(),
failfast=False,
quiet=False,
configured_run_alone_tests=()):
self._tests = tests
self._configured_failing_tests = configured_failing_tests
self._failfast = failfast
self._quiet = quiet
self._configured_run_alone_tests = configured_run_alone_tests
results = [] self.results = ResultCollector()
self.results.total = len(self._tests)
self._running_jobs = []
def reap(): self._worker_count = min(len(tests), NWORKERS) or 1
for r in results[:]:
def _run_one(self, cmd, **kwargs):
kwargs['quiet'] = self._quiet
result = util.run(cmd, **kwargs)
if not result and self._failfast:
sys.exit(1)
self.results += result
def _reap(self):
"Clean up the list of running jobs, returning how many are still outstanding."
for r in self._running_jobs[:]:
if not r.ready(): if not r.ready():
continue continue
if r.successful(): if r.successful():
results.remove(r) self._running_jobs.remove(r)
else: else:
r.get() r.get()
sys.exit('Internal error in testrunner.py: %r' % (r, )) sys.exit('Internal error in testrunner.py: %r' % (r, ))
return len(results) return len(self._running_jobs)
def reap_all(): def _reap_all(self):
while reap() > 0: while self._reap() > 0:
time.sleep(0.1) time.sleep(self.TIME_WAIT_REAP)
def spawn(cmd, options): def _spawn(self, pool, cmd, options):
while True: while True:
if reap() < NWORKERS: if self._reap() < self._worker_count:
r = pool.apply_async(run_one, (cmd, ), options or {}) job = pool.apply_async(self._run_one, (cmd, ), options or {})
results.append(r) self._running_jobs.append(job)
return return
time.sleep(0.05) time.sleep(self.TIME_WAIT_SPAWN)
run_alone = [] def __call__(self):
util.log("Running tests in parallel with concurrency %s" % (self._worker_count,),)
# Setting global state, in theory we can be used multiple times.
# This is fine as long as we are single threaded and call these
# sequentially.
util.BUFFER_OUTPUT = self._worker_count > 1 or self._quiet
try: start = time.time()
try:
self._run_tests()
except KeyboardInterrupt:
self._report(time.time() - start, exit=False)
util.log('(partial results)\n')
raise
except:
traceback.print_exc()
raise
self._reap_all()
self._report(time.time() - start, exit=True)
def _run_tests(self):
"Runs the tests, produces no report."
run_alone = []
tests = self._tests
pool = ThreadPool(self._worker_count)
try: try:
util.log("Running tests in parallel with concurrency %s" % (NWORKERS,),)
for cmd, options in tests: for cmd, options in tests:
total += 1
options = options or {} options = options or {}
if matches(configured_run_alone_tests, cmd): if matches(self._configured_run_alone_tests, cmd):
run_alone.append((cmd, options)) run_alone.append((cmd, options))
else: else:
spawn(cmd, options) self._spawn(pool, cmd, options)
pool.close() pool.close()
pool.join() pool.join()
if run_alone: if run_alone:
util.log("Running tests marked standalone") util.log("Running tests marked standalone")
for cmd, options in run_alone: for cmd, options in run_alone:
run_one(cmd, **options) self._run_one(cmd, **options)
except KeyboardInterrupt: except KeyboardInterrupt:
try: try:
util.log('Waiting for currently running to finish...') util.log('Waiting for currently running to finish...')
reap_all() self._reap_all()
except KeyboardInterrupt: except KeyboardInterrupt:
pool.terminate() pool.terminate()
report(total, failed, passed, exit=False, took=time.time() - start,
configured_failing_tests=configured_failing_tests,
total_cases=total_cases[0], total_skipped=total_skipped[0])
util.log('(partial results)\n')
raise raise
except: except:
traceback.print_exc() pool.terminate()
pool.terminate() raise
raise
def _report(self, elapsed_time, exit=False):
results = self.results
report(
results.total, results.failed, results.passed,
exit=exit,
took=elapsed_time,
configured_failing_tests=self._configured_failing_tests,
total_cases=results.total_cases,
total_skipped=results.total_skipped
)
class TravisFoldingRunner(object):
def __init__(self, runner, travis_fold_msg):
self._runner = runner
self._travis_fold_msg = travis_fold_msg
self._travis_fold_name = str(int(time.time()))
# A zope-style acquisition proxy would be convenient here.
run_tests = runner._run_tests
def _run_tests():
self._begin_fold()
try:
run_tests()
finally:
self._end_fold()
reap_all() runner._run_tests = _run_tests
report(total, failed, passed, took=time.time() - start,
configured_failing_tests=configured_failing_tests, def _begin_fold(self):
total_cases=total_cases[0], total_skipped=total_skipped[0]) travis.fold_start(self._travis_fold_name,
self._travis_fold_msg)
def _end_fold(self):
travis.fold_end(self._travis_fold_name)
def __call__(self):
return self._runner()
def discover( def discover(
tests=None, ignore_files=None, tests=None, ignore_files=None,
...@@ -296,7 +366,7 @@ def report(total, failed, passed, exit=True, took=None, ...@@ -296,7 +366,7 @@ def report(total, failed, passed, exit=True, took=None,
configured_failing_tests=(), configured_failing_tests=(),
total_cases=0, total_skipped=0): total_cases=0, total_skipped=0):
# pylint:disable=redefined-builtin,too-many-branches,too-many-locals # pylint:disable=redefined-builtin,too-many-branches,too-many-locals
runtimelog = util.runtimelog runtimelog = util.runtimelog # XXX: Global state!
if runtimelog: if runtimelog:
util.log('\nLongest-running tests:') util.log('\nLongest-running tests:')
runtimelog.sort() runtimelog.sort()
...@@ -422,6 +492,8 @@ def main(): ...@@ -422,6 +492,8 @@ def main():
parser.add_argument("--verbose", action="store_false", dest='quiet') parser.add_argument("--verbose", action="store_false", dest='quiet')
parser.add_argument("--debug", action="store_true", default=False) parser.add_argument("--debug", action="store_true", default=False)
parser.add_argument("--package", default="gevent.tests") parser.add_argument("--package", default="gevent.tests")
parser.add_argument("--travis-fold", metavar="MSG",
help="Emit Travis CI log fold markers around the output.")
parser.add_argument('tests', nargs='*') parser.add_argument('tests', nargs='*')
options = parser.parse_args() options = parser.parse_args()
...@@ -439,19 +511,22 @@ def main(): ...@@ -439,19 +511,22 @@ def main():
coverage = False coverage = False
if options.coverage or os.environ.get("GEVENTTEST_COVERAGE"): if options.coverage or os.environ.get("GEVENTTEST_COVERAGE"):
coverage = True if PYPY and RUNNING_ON_CI:
os.environ['COVERAGE_PROCESS_START'] = os.path.abspath(".coveragerc") print("Ignoring coverage option on PyPy on CI; slow")
if PYPY: else:
os.environ['COVERAGE_PROCESS_START'] = os.path.abspath(".coveragerc-pypy") coverage = True
this_dir = os.path.dirname(__file__) os.environ['COVERAGE_PROCESS_START'] = os.path.abspath(".coveragerc")
site_dir = os.path.join(this_dir, 'coveragesite') if PYPY:
site_dir = os.path.abspath(site_dir) os.environ['COVERAGE_PROCESS_START'] = os.path.abspath(".coveragerc-pypy")
os.environ['PYTHONPATH'] = site_dir + os.pathsep + os.environ.get("PYTHONPATH", "") this_dir = os.path.dirname(__file__)
# We change directory often, use an absolute path to keep all the site_dir = os.path.join(this_dir, 'coveragesite')
# coverage files (which will have distinct suffixes because of parallel=true in .coveragerc site_dir = os.path.abspath(site_dir)
# in this directory; makes them easier to combine and use with coverage report) os.environ['PYTHONPATH'] = site_dir + os.pathsep + os.environ.get("PYTHONPATH", "")
os.environ['COVERAGE_FILE'] = os.path.abspath(".") + os.sep + ".coverage" # We change directory often, use an absolute path to keep all the
print("Enabling coverage to", os.environ['COVERAGE_FILE'], "with site", site_dir) # coverage files (which will have distinct suffixes because of parallel=true in .coveragerc
# in this directory; makes them easier to combine and use with coverage report)
os.environ['COVERAGE_FILE'] = os.path.abspath(".") + os.sep + ".coverage"
print("Enabling coverage to", os.environ['COVERAGE_FILE'], "with site", site_dir)
_setup_environ(debug=options.debug) _setup_environ(debug=options.debug)
...@@ -490,7 +565,7 @@ def main(): ...@@ -490,7 +565,7 @@ def main():
# Put this directory on the path so relative imports work. # Put this directory on the path so relative imports work.
package_dir = _dir_from_package_name(options.package) package_dir = _dir_from_package_name(options.package)
os.environ['PYTHONPATH'] = os.environ.get('PYTHONPATH', "") + os.pathsep + package_dir os.environ['PYTHONPATH'] = os.environ.get('PYTHONPATH', "") + os.pathsep + package_dir
run_many( runner = Runner(
tests, tests,
configured_failing_tests=FAILING_TESTS, configured_failing_tests=FAILING_TESTS,
failfast=options.failfast, failfast=options.failfast,
...@@ -498,6 +573,11 @@ def main(): ...@@ -498,6 +573,11 @@ def main():
configured_run_alone_tests=RUN_ALONE, configured_run_alone_tests=RUN_ALONE,
) )
if options.travis_fold:
runner = TravisFoldingRunner(runner, options.travis_fold)
runner()
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -8,15 +8,15 @@ from __future__ import print_function ...@@ -8,15 +8,15 @@ from __future__ import print_function
import sys import sys
commands = {} commands = {}
def command(func): def command(func):
commands[func.__name__] = func commands[func.__name__] = lambda: func(*sys.argv[2:])
return func
@command @command
def fold_start(): def fold_start(name, msg):
name = sys.argv[2]
msg = sys.argv[3]
sys.stdout.write('travis_fold:start:') sys.stdout.write('travis_fold:start:')
sys.stdout.write(name) sys.stdout.write(name)
sys.stdout.write(chr(0o33)) sys.stdout.write(chr(0o33))
...@@ -26,8 +26,7 @@ def fold_start(): ...@@ -26,8 +26,7 @@ def fold_start():
sys.stdout.write('[33;0m\n') sys.stdout.write('[33;0m\n')
@command @command
def fold_end(): def fold_end(name):
name = sys.argv[2]
sys.stdout.write("\ntravis_fold:end:") sys.stdout.write("\ntravis_fold:end:")
sys.stdout.write(name) sys.stdout.write(name)
sys.stdout.write("\r\n") sys.stdout.write("\r\n")
......
...@@ -257,10 +257,24 @@ def start(command, quiet=False, **kwargs): ...@@ -257,10 +257,24 @@ def start(command, quiet=False, **kwargs):
class RunResult(object): class RunResult(object):
"""
The results of running an external command.
If the command was successful, this has a boolean
value of True; otherwise, a boolean value of false.
The integer value of this object is the command's exit code.
"""
def __init__(self, code, def __init__(self,
command,
run_kwargs,
code,
output=None, name=None, output=None, name=None,
run_count=0, skipped_count=0): run_count=0, skipped_count=0):
self.command = command
self.run_kwargs = run_kwargs
self.code = code self.code = code
self.output = output self.output = output
self.name = name self.name = name
...@@ -269,7 +283,7 @@ class RunResult(object): ...@@ -269,7 +283,7 @@ class RunResult(object):
def __bool__(self): def __bool__(self):
return bool(self.code) return not bool(self.code)
__nonzero__ = __bool__ __nonzero__ = __bool__
...@@ -322,6 +336,7 @@ def _find_test_status(took, out): ...@@ -322,6 +336,7 @@ def _find_test_status(took, out):
def run(command, **kwargs): # pylint:disable=too-many-locals def run(command, **kwargs): # pylint:disable=too-many-locals
"Execute *command*, returning a `RunResult`"
buffer_output = kwargs.pop('buffer_output', BUFFER_OUTPUT) buffer_output = kwargs.pop('buffer_output', BUFFER_OUTPUT)
quiet = kwargs.pop('quiet', QUIET) quiet = kwargs.pop('quiet', QUIET)
verbose = not quiet verbose = not quiet
...@@ -361,7 +376,8 @@ def run(command, **kwargs): # pylint:disable=too-many-locals ...@@ -361,7 +376,8 @@ def run(command, **kwargs): # pylint:disable=too-many-locals
log('- %s %s', name, status) log('- %s %s', name, status)
if took >= MIN_RUNTIME: if took >= MIN_RUNTIME:
runtimelog.append((-took, name)) runtimelog.append((-took, name))
return RunResult(result, out, name, run_count, skipped_count) return RunResult(command, kwargs, result,
output=out, name=name, run_count=run_count, skipped_count=skipped_count)
class NoSetupPyFound(Exception): class NoSetupPyFound(Exception):
......
...@@ -21,10 +21,6 @@ from gevent.testing.sysinfo import LIBUV ...@@ -21,10 +21,6 @@ from gevent.testing.sysinfo import LIBUV
IGNORED_TESTS = [] IGNORED_TESTS = []
FAILING_TESTS = [ FAILING_TESTS = [
# Sometimes fails with AssertionError: ...\nIOError: close() called during concurrent operation on the same file object.\n'
# Sometimes it contains "\nUnhandled exception in thread started by \nsys.excepthook is missing\nlost sys.stderr\n"
"FLAKY test__subprocess_interrupted.py",
# test__issue6 (see comments in test file) is really flaky on both Travis and Appveyor; # test__issue6 (see comments in test file) is really flaky on both Travis and Appveyor;
# on Travis we could just run the test again (but that gets old fast), but on appveyor # on Travis we could just run the test again (but that gets old fast), but on appveyor
# we don't have that option without a new commit---and sometimes we really need a build # we don't have that option without a new commit---and sometimes we really need a build
...@@ -233,6 +229,7 @@ if PYPY: ...@@ -233,6 +229,7 @@ if PYPY:
'FLAKY test__backdoor.py', 'FLAKY test__backdoor.py',
] ]
if RESOLVER_NOT_SYSTEM: if RESOLVER_NOT_SYSTEM:
FAILING_TESTS += [ FAILING_TESTS += [
...@@ -243,7 +240,10 @@ if PYPY: ...@@ -243,7 +240,10 @@ if PYPY:
# AssertionError: Lists differ: # AssertionError: Lists differ:
# (10, 1, 6, '', ('2607:f8b0:4004:810::200e', 80, 0L, 0L)) # (10, 1, 6, '', ('2607:f8b0:4004:810::200e', 80, 0L, 0L))
# (10, 1, 6, '', ('2607:f8b0:4004:805::200e', 80, 0, 0)) # (10, 1, 6, '', ('2607:f8b0:4004:805::200e', 80, 0, 0))
'test__socket_dns.py', #
# Somehow it seems most of these are fixed with PyPy3.6-7 under dnspython,
# (once we commented out TestHostname)?
'FLAKY test__socket_dns.py',
] ]
if LIBUV: if LIBUV:
...@@ -260,10 +260,14 @@ if PYPY: ...@@ -260,10 +260,14 @@ if PYPY:
# This fails to get the correct results, sometimes. I can't reproduce locally # This fails to get the correct results, sometimes. I can't reproduce locally
'FLAKY test__example_udp_server.py', 'FLAKY test__example_udp_server.py',
'FLAKY test__example_udp_client.py', 'FLAKY test__example_udp_client.py',
]
IGNORED_TESTS += [
# PyPy 7.0 and 7.1 on Travis with Ubunto Xenial 16.04 # PyPy 7.0 and 7.1 on Travis with Ubunto Xenial 16.04
# can't allocate SSL Context objects, either in Python 2.7 # can't allocate SSL Context objects, either in Python 2.7
# or 3.6. There must be some library incompatibility. # or 3.6. There must be some library incompatibility.
# No point even running them.
# XXX: Remember to turn this back on.
'test_ssl.py', 'test_ssl.py',
] ]
......
...@@ -106,7 +106,7 @@ def TESTRUNNER(tests=None): ...@@ -106,7 +106,7 @@ def TESTRUNNER(tests=None):
def main(): def main():
from gevent.testing import testrunner from gevent.testing import testrunner
return testrunner.run_many(list(TESTRUNNER(sys.argv[1:]))) return testrunner.Runner(list(TESTRUNNER(sys.argv[1:])))()
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -48,13 +48,13 @@ class _AbstractTestMixin(util.ExampleMixin): ...@@ -48,13 +48,13 @@ class _AbstractTestMixin(util.ExampleMixin):
def test_runs(self): def test_runs(self):
start = time.time() start = time.time()
min_time, max_time = self.time_range min_time, max_time = self.time_range
if util.run([sys.executable, '-u', self.filename], if not util.run([sys.executable, '-u', self.filename],
timeout=max_time, timeout=max_time,
cwd=self.cwd, cwd=self.cwd,
quiet=True, quiet=True,
buffer_output=True, buffer_output=True,
nested=True, nested=True,
setenv={'GEVENT_DEBUG': 'error'}): setenv={'GEVENT_DEBUG': 'error'}):
self.fail("Failed example: " + self.filename) self.fail("Failed example: " + self.filename)
else: else:
took = time.time() - start took = time.time() - start
......
...@@ -380,7 +380,12 @@ add(TestTypeError, 25) ...@@ -380,7 +380,12 @@ add(TestTypeError, 25)
class TestHostname(TestCase): class TestHostname(TestCase):
pass pass
add(TestHostname, socket.gethostname) add(
TestHostname,
socket.gethostname,
skip=greentest.RUNNING_ON_TRAVIS and greentest.RESOLVER_DNSPYTHON,
skip_reason="Sometimes get a different result for getaddrinfo",
)
class TestLocalhost(TestCase): class TestLocalhost(TestCase):
......
...@@ -14,7 +14,21 @@ else: ...@@ -14,7 +14,21 @@ else:
out, err = subprocess.Popen([sys.executable, '-W', 'ignore', out, err = subprocess.Popen([sys.executable, '-W', 'ignore',
__file__, 'runtestcase'], __file__, 'runtestcase'],
stderr=subprocess.PIPE).communicate() stderr=subprocess.PIPE).communicate()
if b'refs' in err: # Something to do with debug mode python builds? # We've seen three. unexpected forms out output.
#
# The first involves 'refs'; I don't remember what that was
# about, but I think it had to do with debug builds of Python.
#
# The second is the classic "Unhandled exception in thread
# started by \nsys.excepthook is missing\nlost sys.stderr".
# This is a race condition between closing sys.stderr and
# writing buffered data to a pipe that hasn't been read. We
# only see this using GEVENT_FILE=thread (which makes sense).
#
# The third is similar to the second: "AssertionError:
# ...\nIOError: close() called during concurrent operation on
# the same file object.\n"
if b'refs' in err or b'sys.excepthook' in err or b'concurrent' in err:
assert err.startswith(b'bye'), repr(err) # pragma: no cover assert err.startswith(b'bye'), repr(err) # pragma: no cover
else: else:
assert err.strip() == b'bye', repr(err) assert err.strip() == b'bye', repr(err)
...@@ -14,13 +14,6 @@ whitelist_externals = ...@@ -14,13 +14,6 @@ whitelist_externals =
commands = commands =
python -m gevent.tests python -m gevent.tests
[testenv:py27-full]
basepython = python2.7
commands =
make allbackendtest
[testenv:lint] [testenv:lint]
skip_install = true skip_install = true
skipsdist = true skipsdist = true
...@@ -49,4 +42,4 @@ setenv = ...@@ -49,4 +42,4 @@ setenv =
basepython = basepython =
python2.7 python2.7
commands = commands =
make leaktest GEVENTTEST_LEAKCHECK=1 python -mgevent.tests --config known_failures.py --quiet --ignore tests_that_dont_do_leakchecks.txt
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment