diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 00b34cc..b256322 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -13,7 +13,9 @@ jobs: submodules: true - name: Download archives - run: ./toolchain-m68k --quiet download + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + ./toolchain-m68k --quiet download - name: Build toolchain run: ./toolchain-m68k --quiet build --prefix=/usr/local diff --git a/.gitmodules b/.gitmodules index 6f9f0fb..6395182 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,9 +7,6 @@ [submodule "submodules/sfdc"] path = submodules/sfdc url = https://github.com/adtools/sfdc -[submodule "submodules/python-lhafile"] - path = submodules/python-lhafile - url = https://github.com/FrodeSolheim/python-lhafile [submodule "submodules/fd2pragma"] path = submodules/fd2pragma url = https://github.com/adtools/fd2pragma.git @@ -19,6 +16,3 @@ [submodule "submodules/fs-uae"] path = submodules/fs-uae url = https://github.com/FrodeSolheim/fs-uae.git -[submodule "submodules/python-amidev"] - path = submodules/python-amidev - url = https://github.com/cahirwpz/python-amidev.git diff --git a/Dockerfile b/Dockerfile index e9fdca8..44c3072 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,5 +12,6 @@ RUN apt-get install -y --no-install-recommends \ automake bison ca-certificates flex git-core gettext gperf \ gcc g++ libc6-dev libglib2.0-dev libncurses-dev libpng-dev \ libsdl2-dev libsdl2-ttf-dev libopenal-dev libtool make patch \ - pkg-config python3 libpython3-dev python3-setuptools quilt \ - subversion texinfo zip + pkg-config python3 python3-dev python3-pip quilt texinfo zip +COPY requirements.txt . +RUN pip3 install setuptools wheel && pip3 install -r requirements.txt diff --git a/common.py b/common.py index 2d84a44..5a23b10 100644 --- a/common.py +++ b/common.py @@ -7,12 +7,10 @@ from logging import debug, info, error from os import path import contextlib -from distutils import spawn, sysconfig -import fileinput +from distutils import spawn import os from multiprocessing import cpu_count import shutil -import site import subprocess import sys import tarfile @@ -67,35 +65,6 @@ def panic(*args): sys.exit(1) -@fill_in_args -def cmpver(op, v1, v2): - assert op in ['eq', 'lt', 'gt'] - - v1 = [int(x) for x in v1.split('.')] - v2 = [int(x) for x in v2.split('.')] - - def _cmp(l1, l2): - if not len(l1) and not len(l2): - return 0 - if not len(l1): - return -1 - if not len(l2): - return 1 - - if l1[0] < l2[0]: - return -1 - if l1[0] > l2[0]: - return 1 - if l1[0] == l2[0]: - return _cmp(l1[1:], l2[1:]) - - res = _cmp(v1, v2) - - return ((op == 'eq' and res == 0) or - (op == 'lt' and res < 0) or - (op == 'gt' and res > 0)) - - @fill_in_args def topdir(name): if not path.isabs(name): @@ -299,25 +268,6 @@ def unarc(name): raise RuntimeError('Unrecognized archive: "%s"', name) -@fill_in_args -def fix_python_shebang(filename, prefix): - PYTHON = fill_in('{python}') - SITEDIR = path.join(prefix, '{sitedir}') - for line in fileinput.input(files=[filename], inplace=True): - line = line.rstrip() - if line.startswith('#!'): - print('#!/usr/bin/env PYTHONPATH=%s %s' % (SITEDIR, PYTHON)) - else: - print(line.rstrip()) - - -@fill_in_args -def add_site_dir(dirname, py_ver): - dirname = path.join(dirname, 'lib', py_ver, 'site-packages') - info('adding "%s" to python site dirs', topdir(dirname)) - site.addsitedir(dirname) - - @contextlib.contextmanager def cwd(name): old = os.getcwd() @@ -374,38 +324,6 @@ def wrapper(*args, **kwargs): return real_decorator -def extend_pythonpath(prefix): - SITEDIR = path.join(prefix, '{sitedir}') - try: - return ':'.join([os.environ['PYTHONPATH'], SITEDIR]) - except KeyError: - return SITEDIR - - -@recipe('pyinstall', 1) -def pyinstall(name, **kwargs): - prefix = kwargs.get('prefix', '{prefix}') - mkdir(path.join(prefix, '{sitedir}')) - with env(PYTHONPATH=extend_pythonpath(prefix)): - execute('{python}', '-m', 'easy_install', '--prefix=' + prefix, name) - -@recipe('pyfixbin', 1) -def pyfixbin(name, names, **kwargs): - prefix = kwargs.get('prefix', '{prefix}') - for name in names: - fix_python_shebang(path.join(prefix, 'bin', name), prefix) - - -@recipe('pysetup', 1) -def pysetup(name, **kwargs): - prefix = kwargs.get('prefix', '{prefix}') - mkdir(path.join(prefix, '{sitedir}')) - with env(PYTHONPATH=extend_pythonpath(prefix)): - with cwd(path.join('{build}', name)): - execute('{python}', 'setup.py', 'build') - execute('{python}', 'setup.py', 'install', '--prefix=' + prefix) - - @recipe('fetch', 1) def fetch(name, url): if url.startswith('http') or url.startswith('ftp'): @@ -530,8 +448,7 @@ def require_header(headers, lang='c', errmsg='', symbol=None, value=None): panic(errmsg) -__all__ = ['setvar', 'panic', 'cmpver', 'find_executable', 'chmod', 'execute', - 'rmtree', 'mkdir', 'copy', 'copytree', 'unarc', 'fetch', 'cwd', - 'symlink', 'remove', 'move', 'find', 'textfile', 'env', 'path', - 'add_site_dir', 'pysetup', 'pyinstall', 'recipe', 'unpack', 'patch', - 'configure', 'make', 'require_header', 'touch', 'pyfixbin'] +__all__ = ['setvar', 'panic', 'find_executable', 'chmod', 'execute', 'rmtree', + 'mkdir', 'copy', 'copytree', 'fetch', 'cwd', 'symlink', 'remove', + 'move', 'find', 'textfile', 'env', 'path', 'recipe', 'unpack', + 'patch', 'configure', 'make', 'require_header', 'touch'] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d6d38c1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +lhafile diff --git a/submodules/python-amidev b/submodules/python-amidev deleted file mode 160000 index 6accf46..0000000 --- a/submodules/python-amidev +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6accf463feb0a5763bf0fb66603f4cc354dd99f4 diff --git a/submodules/python-lhafile b/submodules/python-lhafile deleted file mode 160000 index 8f800bb..0000000 --- a/submodules/python-lhafile +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8f800bbcb47431f9ed4d36d847621525217a72d8 diff --git a/toolchain-m68k b/toolchain-m68k index 4732221..f02661b 100755 --- a/toolchain-m68k +++ b/toolchain-m68k @@ -9,8 +9,6 @@ from os import environ import argparse import logging import platform -import re -import string import sys environ['DONTWRITEBYTECODE'] = 'y' @@ -23,14 +21,16 @@ URLS = \ 'https://ftp.gnu.org/gnu/texinfo/texinfo-4.12.tar.gz', 'https://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz', ('https://github.com/askeksa/Shrinkler/archive/refs/tags/v4.7.tar.gz', - 'shrinkler-4.7.tar.gz'), + 'Shrinkler-4.7.tar.gz'), ('ftp://ftp.uk.freesbie.org/sites/distfiles.gentoo.org/distfiles/' + 'flex-2.5.4a.tar.gz', 'flex-2.5.4.tar.gz'), ('http://hp.alinea-computer.de/AmigaOS/NDK39.lha', 'NDK_3.9.lha'), - ('http://server.owl.de/~frank/tags/vasm1_8h.tar.gz', 'vasm.tar.gz')] + ('http://phoenix.owl.de/tags/vasm1_9c.tar.gz', 'vasm.tar.gz')] -from common import * # NOQA +from common import (setvar, execute, rmtree, configure, unpack, path, panic, + mkdir, env, make, touch, patch, require_header, copy, cwd, recipe, + find_executable, textfile, chmod, copytree, move, find, fetch) @recipe('target-prepare') @@ -147,8 +147,6 @@ def download(): def build(): - py_ver = 'python%d.%d' % (sys.version_info.major, sys.version_info.minor) - for var in list(environ.keys()): if var not in ['_', 'LOGNAME', 'HOME', 'SHELL', 'TMPDIR', 'PWD']: del environ[var] @@ -175,12 +173,13 @@ def build(): environ['LANG'] = 'C' environ['TERM'] = 'xterm' - add_site_dir('{prefix}', py_ver) - CC = find_executable(CC) CXX = find_executable(CXX) FLAGS = '-s -O2 -pipe' + if platform.system() == 'Darwin': + FLAGS += ' -Wno-unused-command-line-argument' + if getLogger().isEnabledFor(logging.DEBUG): FLAGS += ' -Wall' else: @@ -213,14 +212,6 @@ def build(): require_header(['ncurses.h', 'ncurses/ncurses.h'], lang='c', errmsg='libncurses-dev package missing') - # require_header([path.join(py_ver, 'Python.h')], - # 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}') - pysetup('python-lha') - download() execute('quilt', 'push', '-a', ignore_errors=True) @@ -362,9 +353,6 @@ def build(): make('{fsuae}', parallel=True) make('{fsuae}', 'install') - unpack('python-amidev', work_dir='{build}') - pysetup('python-amidev') - unpack('{shrinkler}', work_dir='{build}') make('{shrinkler}') install_shrinkler() @@ -403,8 +391,7 @@ if __name__ == "__main__": help='installation directory') args = parser.parse_args() - setvar(top=path.abspath(path.dirname(sys.argv[0])), - py_ver='python%d.%d' % (sys.version_info.major, sys.version_info.minor)) + setvar(top=path.abspath(path.dirname(sys.argv[0]))) setvar(m4='m4-1.4.17', gawk='gawk-3.1.8', @@ -417,10 +404,9 @@ if __name__ == "__main__": binutils='binutils-gdb', fsuae='fs-uae', gcc='gcc-2.95.3', - shrinkler='shrinkler-4.7', + shrinkler='Shrinkler-4.7', target='m68k-amigaos', python=sys.executable, - sitedir=path.join('lib', '{py_ver}', 'site-packages'), patches=path.join('{top}', 'patches'), stamps=path.join('{top}', '.build-m68k', 'stamps'), build=path.join('{top}', '.build-m68k', 'build'),