Fix ppc-amigaos toolchain build (#93)

* Build PowerPC toolchain via CircleCI.
* Update docker image to contain subversion.

[skip ci]
This commit is contained in:
Krystian Bacławski
2017-11-12 14:23:16 +01:00
committed by GitHub
parent fb136e9b71
commit 66015fb110
6 changed files with 92 additions and 49 deletions
+1 -1
View File
@@ -11,4 +11,4 @@ RUN apt-get -q update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends \ RUN apt-get install -y --no-install-recommends \
git-core make gettext patch bison flex gperf ca-certificates \ git-core make gettext patch bison flex gperf ca-certificates \
gcc g++ gcc-multilib libc6-dev libncurses-dev \ gcc g++ gcc-multilib libc6-dev libncurses-dev \
python2.7 libpython2.7-dev python-setuptools python2.7 libpython2.7-dev python-setuptools subversion
+12
View File
@@ -25,11 +25,23 @@ jobs:
key: m68k-amigaos-{{ .Branch }}-{{ .Revision }} key: m68k-amigaos-{{ .Branch }}-{{ .Revision }}
- run: './toolchain-m68k --quiet test' - run: './toolchain-m68k --quiet test'
powerpc:
<<: *defaults
steps:
- checkout
- run: './toolchain-ppc --quiet build'
- store_artifacts:
path: ppc-amigaos
- save_cache:
key: ppc-amigaos-{{ .Branch }}-{{ .Revision }}
paths: ppc-amigaos
workflows: workflows:
version: 2 version: 2
amigaos-cross-toolchain: amigaos-cross-toolchain:
jobs: jobs:
- m68k - m68k
- powerpc
- m68k-tests: - m68k-tests:
requires: requires:
- m68k - m68k
+3 -3
View File
@@ -3,15 +3,15 @@
# > docker login # > docker login
# > docker push cahirwpz/amigaos-cross-toolchain:latest # > docker push cahirwpz/amigaos-cross-toolchain:latest
FROM debian:9.0 FROM debian:jessie
WORKDIR /root WORKDIR /root
RUN apt-get -q update && apt-get upgrade -y RUN apt-get -q update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends \ RUN apt-get install -y --no-install-recommends \
git make gettext patch bison flex gperf ca-certificates \ git-core make gettext patch bison flex gperf ca-certificates \
gcc g++ gcc-multilib libc6-dev libncurses-dev \ gcc g++ gcc-multilib libc6-dev libncurses-dev \
python2.7 libpython2.7-dev python-setuptools python2.7 libpython2.7-dev python-setuptools subversion
RUN git clone https://github.com/cahirwpz/amigaos-cross-toolchain.git && \ RUN git clone https://github.com/cahirwpz/amigaos-cross-toolchain.git && \
cd amigaos-cross-toolchain && \ cd amigaos-cross-toolchain && \
./toolchain-m68k --prefix=/usr/local build && \ ./toolchain-m68k --prefix=/usr/local build && \
+1 -5
View File
@@ -417,11 +417,7 @@ def fetch(name, url):
else: else:
info('File "%s" already downloaded.', name) info('File "%s" already downloaded.', name)
elif url.startswith('svn'): elif url.startswith('svn'):
if not path.exists(name): execute('svn', 'export', '--quiet', url, name)
execute('svn', 'checkout', url, name)
else:
with cwd(name):
execute('svn', 'update')
elif url.startswith('git'): elif url.startswith('git'):
if not path.exists(name): if not path.exists(name):
execute('git', 'clone', url, name) execute('git', 'clone', url, name)
+13 -11
View File
@@ -255,17 +255,6 @@ def build():
environ['LANG'] = 'C' environ['LANG'] = 'C'
environ['TERM'] = 'xterm' environ['TERM'] = 'xterm'
with cwd('{archives}'):
for url in URLS:
if type(url) == tuple:
url, name = url[0], url[1]
else:
name = path.basename(url)
fetch(name, url)
execute('git', 'submodule', 'init');
execute('git', 'submodule', 'update');
add_site_dir('{prefix}') add_site_dir('{prefix}')
""" """
@@ -316,9 +305,22 @@ def build():
require_header([path.join(py_ver, 'Python.h')], require_header([path.join(py_ver, 'Python.h')],
lang='c', errmsg='python-dev package missing') lang='c', errmsg='python-dev package missing')
execute('git', 'submodule', 'init', 'submodules/python-lhafile');
execute('git', 'submodule', 'update', 'submodules/python-lhafile');
unpack('python-lha', work_dir='{build}') unpack('python-lha', work_dir='{build}')
pysetup('python-lha') pysetup('python-lha')
with cwd('{archives}'):
for url in URLS:
if type(url) == tuple:
url, name = url[0], url[1]
else:
name = path.basename(url)
fetch(name, url)
execute('git', 'submodule', 'init');
execute('git', 'submodule', 'update');
unpack('{automake}') unpack('{automake}')
unpack('{m4}') unpack('{m4}')
+62 -29
View File
@@ -1,9 +1,9 @@
#!/usr/bin/python -B #!/usr/bin/python2.7 -B
# Build cross toolchain for AmigaOS 4.x / PowerPC target. # Build cross toolchain for AmigaOS 4.x / PowerPC target.
from fnmatch import fnmatch from fnmatch import fnmatch
from logging import info from logging import info, getLogger
from os import environ from os import environ
import argparse import argparse
import logging import logging
@@ -11,8 +11,7 @@ import platform
import sys import sys
URLS = \ URLS = \
['git://github.com/FrodeSolheim/python-lhafile', ['ftp://ftp.gnu.org/gnu/gmp/gmp-5.1.3.tar.bz2',
'ftp://ftp.gnu.org/gnu/gmp/gmp-5.1.3.tar.bz2',
'ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz', 'ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz',
'ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.3.tar.bz2', 'ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.3.tar.bz2',
'ftp://ftp.gnu.org/gnu/texinfo/texinfo-4.12.tar.gz', 'ftp://ftp.gnu.org/gnu/texinfo/texinfo-4.12.tar.gz',
@@ -39,9 +38,9 @@ def update_autotools(dst):
@recipe('{sdk}-prepare') @recipe('{sdk}-prepare')
def prepare_sdk(): def prepare_sdk():
info('preparing {sdk}') info('preparing AmigaOS 4.x SDK')
target = path.join('{target}', 'ppc-amigaos/SDK') target = path.join('{prefix}', 'ppc-amigaos/SDK')
unpack('{sdk}', work_dir='{archives}', top_dir='SDK_Install', dst_dir='SDK') unpack('{sdk}', work_dir='{archives}', top_dir='SDK_Install', dst_dir='SDK')
unpack('SDK/base', top_dir='Include', dst_dir=path.join(target, 'include')) unpack('SDK/base', top_dir='Include', dst_dir=path.join(target, 'include'))
@@ -54,29 +53,59 @@ def build():
if var not in ['_', 'LOGNAME', 'HOME', 'SHELL', 'TMPDIR', 'PWD']: if var not in ['_', 'LOGNAME', 'HOME', 'SHELL', 'TMPDIR', 'PWD']:
del environ[var] del environ[var]
environ['PATH'] = '/usr/bin:/bin' PATH = ['/usr/bin', '/bin']
environ['PATH'] = ":".join(PATH)
environ['LANG'] = 'C' environ['LANG'] = 'C'
environ['TERM'] = 'xterm' environ['TERM'] = 'xterm'
add_site_dir('{prefix}')
"""
Make sure we always choose known compiler (from the distro) and not one in
user's path that could shadow the original one.
"""
if platform.system() == 'Darwin': if platform.system() == 'Darwin':
CC, CXX = 'clang', 'clang++' CC, CXX = 'clang', 'clang++'
else: else:
CC, CXX = 'gcc', 'g++' CC, CXX = 'gcc', 'g++'
environ['CC'] = find_executable(CC) CC = find_executable(CC)
environ['CXX'] = find_executable(CXX) CXX = find_executable(CXX)
FLAGS = '-g -O2'
if getLogger().isEnabledFor(logging.DEBUG):
FLAGS += ' -Wall'
else:
FLAGS += ' -w'
environ['MAKEFLAGS'] = '--silent'
environ['CC'] = CC
environ['CXX'] = CXX
environ['PATH'] = ':'.join([path.join('{prefix}', 'bin'),
path.join('{host}', 'bin'),
environ['PATH']])
setvar(cc=environ['CC'], cxx=environ['CXX'])
"""
When we have a working compiler in our path, we shoule also check if the
required programs, headers and libraries are present.
"""
find_executable('patch') find_executable('patch')
find_executable('bison') find_executable('bison')
find_executable('flex') find_executable('flex')
find_executable('make') find_executable('make')
find_executable('svn') find_executable('svn')
environ['PATH'] = ":".join([path.join('{target}', 'bin'), py_ver = 'python%d.%d' % (sys.version_info.major, sys.version_info.minor)
path.join('{host}', 'bin'), require_header([path.join(py_ver, 'Python.h')],
environ['PATH']]) lang='c', errmsg='python-dev package missing')
add_site_dir('{host}') execute('git', 'submodule', 'init', 'submodules/python-lhafile');
execute('git', 'submodule', 'update', 'submodules/python-lhafile');
unpack('python-lha', work_dir='{build}')
pysetup('python-lha')
with cwd('{archives}'): with cwd('{archives}'):
for url in URLS: for url in URLS:
@@ -88,11 +117,6 @@ def build():
unpack('{automake}') unpack('{automake}')
py_ver = 'python%d.%d' % (sys.version_info.major, sys.version_info.minor)
require_header([path.join(py_ver, 'Python.h')],
lang='c', errmsg='python-dev package missing')
unpack('python-lha', work_dir='{build}')
python_setup('python-lha')
unpack('{texinfo}') unpack('{texinfo}')
update_autotools('{sources}/{texinfo}/build-aux') update_autotools('{sources}/{texinfo}/build-aux')
@@ -150,8 +174,8 @@ def build():
with env(CFLAGS='-Wno-error'): with env(CFLAGS='-Wno-error'):
update_autotools('{archives}/{binutils}') update_autotools('{archives}/{binutils}')
configure('{binutils}', configure('{binutils}',
'--prefix={target}', '--prefix={prefix}',
'--target=ppc-amigaos', '--target={target}',
from_dir='{archives}/{binutils}') from_dir='{archives}/{binutils}')
make('{binutils}') make('{binutils}')
make('{binutils}', 'install') make('{binutils}', 'install')
@@ -167,8 +191,8 @@ def build():
update_autotools('{archives}/{gcc}') update_autotools('{archives}/{gcc}')
with env(**gcc_env): with env(**gcc_env):
configure('{gcc}', configure('{gcc}',
'--prefix={target}', '--prefix={prefix}',
'--target=ppc-amigaos', '--target={target}',
'--with-bugurl="http://sf.net/p/adtools"', '--with-bugurl="http://sf.net/p/adtools"',
'--with-gmp={host}', '--with-gmp={host}',
'--with-mpfr={host}', '--with-mpfr={host}',
@@ -215,13 +239,15 @@ if __name__ == "__main__":
help='desired binutils version') help='desired binutils version')
parser.add_argument('--gcc', choices=['4.2.4', '4.9.1'], default='4.2.4', parser.add_argument('--gcc', choices=['4.2.4', '4.9.1'], default='4.2.4',
help='desired gcc version') help='desired gcc version')
parser.add_argument('-q', '--quiet', action='store_true')
parser.add_argument('--prefix', type=str, default=None, parser.add_argument('--prefix', type=str, default=None,
help='installation directory') help='installation directory')
args = parser.parse_args() args = parser.parse_args()
setvar(top=path.abspath(path.dirname(sys.argv[0])), setvar(top=path.abspath(path.dirname(sys.argv[0])),
binutils_ver=args.binutils, binutils_ver=args.binutils,
gcc_ver=args.gcc) gcc_ver=args.gcc,
py_ver='python%d.%d' % (sys.version_info.major, sys.version_info.minor))
setvar(gmp='gmp-5.1.3', setvar(gmp='gmp-5.1.3',
mpfr='mpfr-3.1.3', mpfr='mpfr-3.1.3',
@@ -233,21 +259,28 @@ if __name__ == "__main__":
binutils='binutils-{binutils_ver}', binutils='binutils-{binutils_ver}',
sdk='SDK_53.24', sdk='SDK_53.24',
gcc='gcc-{gcc_ver}', gcc='gcc-{gcc_ver}',
gpp='g++-{gcc_ver}',
target='ppc-amigaos',
python=sys.executable,
sitedir=path.join('lib', '{py_ver}', 'site-packages'),
patches=path.join('{top}', 'patches'), patches=path.join('{top}', 'patches'),
stamps=path.join('{top}', '.build-ppc', 'stamps'), stamps=path.join('{top}', '.build-ppc', 'stamps'),
build=path.join('{top}', '.build-ppc', 'build'), build=path.join('{top}', '.build-ppc', 'build'),
sources=path.join('{top}', '.build-ppc', 'sources'), sources=path.join('{top}', '.build-ppc', 'sources'),
host=path.join('{top}', '.build-ppc', 'host'), host=path.join('{top}', '.build-ppc', 'host'),
tmpdir=path.join('{top}', '.build-ppc', 'tmpdir'), tmpdir=path.join('{top}', '.build-ppc', 'tmp'),
target=path.join('{top}', 'ppc-amigaos'), prefix=path.join('{top}', 'ppc-amigaos'),
archives=path.join('{top}', '.build-ppc', 'archives'), archives=path.join('{top}', '.build-ppc', 'archives'),
submodules=path.join('{top}', 'submodules')) submodules=path.join('{top}', 'submodules'))
if args.prefix is not None: if args.quiet:
setvar(target=args.prefix) getLogger().setLevel(logging.INFO)
if not path.exists('{target}'): if args.prefix is not None:
mkdir('{target}') setvar(prefix=args.prefix)
if not path.exists('{prefix}'):
mkdir('{prefix}')
action = args.action.replace('-', '_') action = args.action.replace('-', '_')
globals()[action].__call__(*args.args) globals()[action].__call__(*args.args)