mirror of
https://frontier.innolan.net/github/amigaos-cross-toolchain6.git
synced 2024-10-19 10:29:55 +00:00
Use python-lha module instead of external lha binary.
This commit is contained in:
@ -64,13 +64,13 @@ AmigaOS specific documents:
|
|||||||
|
|
||||||
You have to have following packages installed in your system:
|
You have to have following packages installed in your system:
|
||||||
|
|
||||||
* GNU gcc 4.x **32-bit version!**
|
* GNU gcc 4.x **32-bit version!** or Clang
|
||||||
* GNU make 3.x
|
|
||||||
* perl 5.10
|
|
||||||
* libncurses5-dev **32-bit version!**
|
* libncurses5-dev **32-bit version!**
|
||||||
|
* GNU make
|
||||||
|
* python-dev
|
||||||
|
* perl
|
||||||
* git
|
* git
|
||||||
* subversion
|
* subversion
|
||||||
* wget
|
|
||||||
* patch
|
* patch
|
||||||
|
|
||||||
*For MacOSX users*: you'll likely need to have [MacPorts](http://www.macports.org) or [Homebrew](http://brew.sh) installed in order to build the toolchain.
|
*For MacOSX users*: you'll likely need to have [MacPorts](http://www.macports.org) or [Homebrew](http://brew.sh) installed in order to build the toolchain.
|
||||||
@ -99,7 +99,6 @@ Follow steps listed below:
|
|||||||
4. *(optional)* Install additional SDKs (e.g. AHI, CyberGraphX, Magic User Interface, etc.):
|
4. *(optional)* Install additional SDKs (e.g. AHI, CyberGraphX, Magic User Interface, etc.):
|
||||||
|
|
||||||
```
|
```
|
||||||
# export PATH=/opt/m68k-amigaos/bin:$PATH
|
|
||||||
# ./toolchain-m68k --prefix=/opt/m68k-amigaos install-sdk ahi cgx mui
|
# ./toolchain-m68k --prefix=/opt/m68k-amigaos install-sdk ahi cgx mui
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
47
common.py
47
common.py
@ -1,20 +1,20 @@
|
|||||||
#!/usr/bin/env python -B
|
#!/usr/bin/env python -B
|
||||||
|
|
||||||
from logging import debug, info, error
|
|
||||||
from glob import glob
|
|
||||||
from os import path
|
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
|
from glob import glob
|
||||||
|
from logging import debug, info, error
|
||||||
|
from os import path
|
||||||
import contextlib
|
import contextlib
|
||||||
import distutils.spawn
|
import distutils.spawn
|
||||||
import shutil
|
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
import site
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tarfile
|
import tarfile
|
||||||
|
import tempfile
|
||||||
import urllib2
|
import urllib2
|
||||||
import zipfile
|
import zipfile
|
||||||
import tempfile
|
|
||||||
|
|
||||||
|
|
||||||
VARS = {}
|
VARS = {}
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ def remove(*names):
|
|||||||
@fill_in_args
|
@fill_in_args
|
||||||
def mkdir(*names):
|
def mkdir(*names):
|
||||||
for name in flatten(names):
|
for name in flatten(names):
|
||||||
if not path.isdir(name):
|
if name and not path.isdir(name):
|
||||||
debug('makedir "%s"', topdir(name))
|
debug('makedir "%s"', topdir(name))
|
||||||
os.makedirs(name)
|
os.makedirs(name)
|
||||||
|
|
||||||
@ -237,9 +237,9 @@ def download(url, name):
|
|||||||
size = None
|
size = None
|
||||||
|
|
||||||
if size:
|
if size:
|
||||||
info('download: %s (size: %d)' % (name, size))
|
info('download: %s (size: %d)', name, size)
|
||||||
else:
|
else:
|
||||||
info('download: %s' % name)
|
info('download: %s', name)
|
||||||
|
|
||||||
with open(name, 'wb') as f:
|
with open(name, 'wb') as f:
|
||||||
done = 0
|
done = 0
|
||||||
@ -263,10 +263,17 @@ def download(url, name):
|
|||||||
|
|
||||||
@fill_in_args
|
@fill_in_args
|
||||||
def unarc(name):
|
def unarc(name):
|
||||||
info('extract files from "%s"' % topdir(name))
|
info('extract files from "%s"', topdir(name))
|
||||||
|
|
||||||
if name.endswith('.lha'):
|
if name.endswith('.lha'):
|
||||||
execute('lha', '-x', name)
|
import lhafile
|
||||||
|
arc = lhafile.LhaFile(name)
|
||||||
|
for item in arc.infolist():
|
||||||
|
filename = os.sep.join(item.filename.split('\\'))
|
||||||
|
debug('extract "%s"', filename)
|
||||||
|
mkdir(path.dirname(filename))
|
||||||
|
with open(filename, 'w') as f:
|
||||||
|
f.write(arc.read(item.filename))
|
||||||
else:
|
else:
|
||||||
if name.endswith('.tar.gz') or name.endswith('.tar.bz2'):
|
if name.endswith('.tar.gz') or name.endswith('.tar.bz2'):
|
||||||
module = tarfile
|
module = tarfile
|
||||||
@ -282,6 +289,14 @@ def unarc(name):
|
|||||||
arc.close()
|
arc.close()
|
||||||
|
|
||||||
|
|
||||||
|
@fill_in_args
|
||||||
|
def add_site_dir(dirname):
|
||||||
|
dirname = path.join(dirname, 'lib', 'python%d.%d' % sys.version_info[:2],
|
||||||
|
'site-packages')
|
||||||
|
info('adding "%s" to python site dirs', topdir(dirname))
|
||||||
|
site.addsitedir(dirname)
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def cwd(name):
|
def cwd(name):
|
||||||
old = os.getcwd()
|
old = os.getcwd()
|
||||||
@ -337,6 +352,13 @@ def recipe(name, nargs=0):
|
|||||||
return real_decorator
|
return real_decorator
|
||||||
|
|
||||||
|
|
||||||
|
@recipe('python-setup', 1)
|
||||||
|
def python_setup(name):
|
||||||
|
with cwd(path.join('{build}', name)):
|
||||||
|
execute('python', 'setup.py', 'build')
|
||||||
|
execute('python', 'setup.py', 'install', '--prefix={host}')
|
||||||
|
|
||||||
|
|
||||||
@recipe('fetch', 1)
|
@recipe('fetch', 1)
|
||||||
def fetch(name, url):
|
def fetch(name, url):
|
||||||
if url.startswith('http') or url.startswith('ftp'):
|
if url.startswith('http') or url.startswith('ftp'):
|
||||||
@ -429,4 +451,5 @@ def make(name, target=None, **makevars):
|
|||||||
__all__ = ['setvar', 'panic', 'cmpver', 'find_executable', 'chmod', 'execute',
|
__all__ = ['setvar', 'panic', 'cmpver', 'find_executable', 'chmod', 'execute',
|
||||||
'rmtree', 'mkdir', 'copy', 'copytree', 'unarc', 'fetch', 'cwd',
|
'rmtree', 'mkdir', 'copy', 'copytree', 'unarc', 'fetch', 'cwd',
|
||||||
'symlink', 'remove', 'move', 'find', 'textfile', 'env', 'path',
|
'symlink', 'remove', 'move', 'find', 'textfile', 'env', 'path',
|
||||||
'recipe', 'unpack', 'patch', 'configure', 'make']
|
'add_site_dir', 'python_setup', 'recipe', 'unpack', 'patch',
|
||||||
|
'configure', 'make']
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import string
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
URLS = \
|
URLS = \
|
||||||
['http://soulsphere.org/projects/lhasa/lhasa-0.3.0.tar.gz',
|
['git://github.com/FrodeSolheim/python-lhafile',
|
||||||
'ftp://ftp.gnu.org/gnu/m4/m4-1.4.17.tar.gz',
|
'ftp://ftp.gnu.org/gnu/m4/m4-1.4.17.tar.gz',
|
||||||
'ftp://ftp.gnu.org/gnu/gawk/gawk-3.1.8.tar.gz',
|
'ftp://ftp.gnu.org/gnu/gawk/gawk-3.1.8.tar.gz',
|
||||||
'ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz',
|
'ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz',
|
||||||
@ -210,6 +210,7 @@ def build():
|
|||||||
environ['CC'] = ' '.join([find_executable(CC), ARCH])
|
environ['CC'] = ' '.join([find_executable(CC), ARCH])
|
||||||
environ['CXX'] = ' '.join([find_executable(CXX), ARCH])
|
environ['CXX'] = ' '.join([find_executable(CXX), ARCH])
|
||||||
|
|
||||||
|
find_executable('perl')
|
||||||
find_executable('patch')
|
find_executable('patch')
|
||||||
find_executable('make')
|
find_executable('make')
|
||||||
find_executable('git')
|
find_executable('git')
|
||||||
@ -218,6 +219,8 @@ def build():
|
|||||||
path.join('{host}', 'bin'),
|
path.join('{host}', 'bin'),
|
||||||
environ['PATH']])
|
environ['PATH']])
|
||||||
|
|
||||||
|
add_site_dir('{host}')
|
||||||
|
|
||||||
with cwd('{archives}'):
|
with cwd('{archives}'):
|
||||||
for url in URLS:
|
for url in URLS:
|
||||||
if type(url) == tuple:
|
if type(url) == tuple:
|
||||||
@ -226,13 +229,8 @@ def build():
|
|||||||
name = path.basename(url)
|
name = path.basename(url)
|
||||||
fetch(name, url)
|
fetch(name, url)
|
||||||
|
|
||||||
unpack('{lha}')
|
unpack('python-lha', work_dir='{build}')
|
||||||
configure('{lha}',
|
python_setup('python-lha')
|
||||||
'--disable-shared',
|
|
||||||
'--prefix={host}',
|
|
||||||
copy_source=True)
|
|
||||||
make('{lha}')
|
|
||||||
make('{lha}', 'install')
|
|
||||||
|
|
||||||
unpack('{m4}')
|
unpack('{m4}')
|
||||||
configure('{m4}', '--prefix={host}')
|
configure('{m4}', '--prefix={host}')
|
||||||
@ -509,6 +507,8 @@ def install_sdk(*names):
|
|||||||
path.join('{host}', 'bin'),
|
path.join('{host}', 'bin'),
|
||||||
environ['PATH']])
|
environ['PATH']])
|
||||||
|
|
||||||
|
add_site_dir('{host}')
|
||||||
|
|
||||||
for name in names:
|
for name in names:
|
||||||
filename = path.join('{top}/sdk', name + '.sdk')
|
filename = path.join('{top}/sdk', name + '.sdk')
|
||||||
|
|
||||||
@ -558,8 +558,7 @@ if __name__ == "__main__":
|
|||||||
binutils_ver=args.binutils,
|
binutils_ver=args.binutils,
|
||||||
gcc_ver=args.gcc)
|
gcc_ver=args.gcc)
|
||||||
|
|
||||||
setvar(lha='lhasa-0.3.0',
|
setvar(m4='m4-1.4.17',
|
||||||
m4='m4-1.4.17',
|
|
||||||
gawk='gawk-3.1.8',
|
gawk='gawk-3.1.8',
|
||||||
flex='flex-2.5.4',
|
flex='flex-2.5.4',
|
||||||
bison='bison-1.35',
|
bison='bison-1.35',
|
||||||
|
|||||||
@ -12,13 +12,13 @@ import platform
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
URLS = \
|
URLS = \
|
||||||
['ftp://ftp.gnu.org/gnu/gmp/gmp-5.1.3.tar.bz2',
|
['git://github.com/FrodeSolheim/python-lhafile',
|
||||||
|
'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',
|
||||||
'http://isl.gforge.inria.fr/isl-0.12.2.tar.bz2',
|
'http://isl.gforge.inria.fr/isl-0.12.2.tar.bz2',
|
||||||
'http://www.bastoul.net/cloog/pages/download/cloog-0.18.4.tar.gz',
|
'http://www.bastoul.net/cloog/pages/download/cloog-0.18.4.tar.gz',
|
||||||
'http://soulsphere.org/projects/lhasa/lhasa-0.3.0.tar.gz',
|
|
||||||
('http://hyperion-entertainment.biz/index.php/downloads' +
|
('http://hyperion-entertainment.biz/index.php/downloads' +
|
||||||
'?view=download&format=raw&file=69', 'SDK_53.24.lha'),
|
'?view=download&format=raw&file=69', 'SDK_53.24.lha'),
|
||||||
('svn://svn.code.sf.net/p/adtools/code/trunk/binutils', 'binutils-2.18'),
|
('svn://svn.code.sf.net/p/adtools/code/trunk/binutils', 'binutils-2.18'),
|
||||||
@ -82,6 +82,8 @@ def build():
|
|||||||
path.join('{host}', 'bin'),
|
path.join('{host}', 'bin'),
|
||||||
environ['PATH']])
|
environ['PATH']])
|
||||||
|
|
||||||
|
add_site_dir('{host}')
|
||||||
|
|
||||||
with cwd('{archives}'):
|
with cwd('{archives}'):
|
||||||
for url in URLS:
|
for url in URLS:
|
||||||
if type(url) == tuple:
|
if type(url) == tuple:
|
||||||
@ -90,17 +92,11 @@ def build():
|
|||||||
name = path.basename(url)
|
name = path.basename(url)
|
||||||
fetch(name, url)
|
fetch(name, url)
|
||||||
|
|
||||||
unpack('{lha}')
|
unpack('python-lha', work_dir='{build}')
|
||||||
configure('{lha}',
|
python_setup('python-lha')
|
||||||
'--disable-shared',
|
|
||||||
'--prefix={host}',
|
|
||||||
copy_source=True)
|
|
||||||
make('{lha}')
|
|
||||||
make('{lha}', 'install')
|
|
||||||
|
|
||||||
unpack('{texinfo}')
|
unpack('{texinfo}')
|
||||||
configure('{texinfo}',
|
configure('{texinfo}', '--prefix={host}')
|
||||||
'--prefix={host}')
|
|
||||||
make('{texinfo}')
|
make('{texinfo}')
|
||||||
make('{texinfo}', 'install')
|
make('{texinfo}', 'install')
|
||||||
|
|
||||||
@ -164,13 +160,13 @@ def build():
|
|||||||
|
|
||||||
with env(**gcc_env):
|
with env(**gcc_env):
|
||||||
configure('{gcc}',
|
configure('{gcc}',
|
||||||
'--with-bugurl="http://sf.net/p/adtools"',
|
'--prefix={target}',
|
||||||
'--target=ppc-amigaos',
|
'--target=ppc-amigaos',
|
||||||
|
'--with-bugurl="http://sf.net/p/adtools"',
|
||||||
'--with-gmp={host}',
|
'--with-gmp={host}',
|
||||||
'--with-mpfr={host}',
|
'--with-mpfr={host}',
|
||||||
'--with-isl={host}',
|
'--with-isl={host}',
|
||||||
'--with-cloog={host}',
|
'--with-cloog={host}',
|
||||||
'--prefix={target}',
|
|
||||||
'--enable-languages=c,c++',
|
'--enable-languages=c,c++',
|
||||||
'--enable-haifa',
|
'--enable-haifa',
|
||||||
'--enable-sjlj-exceptions',
|
'--enable-sjlj-exceptions',
|
||||||
@ -202,8 +198,9 @@ if __name__ == "__main__":
|
|||||||
panic('Build on %s architecture not supported!', platform.machine())
|
panic('Build on %s architecture not supported!', platform.machine())
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Build cross toolchain.')
|
parser = argparse.ArgumentParser(description='Build cross toolchain.')
|
||||||
parser.add_argument('action', choices=['build', 'clean'], default='build',
|
parser.add_argument('action',
|
||||||
help='perform action')
|
choices=['build', 'clean'],
|
||||||
|
default='build', help='perform action')
|
||||||
parser.add_argument('--binutils', choices=['2.18', '2.23.2'], default='2.18',
|
parser.add_argument('--binutils', choices=['2.18', '2.23.2'], default='2.18',
|
||||||
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',
|
||||||
@ -212,12 +209,11 @@ if __name__ == "__main__":
|
|||||||
help='installation directory')
|
help='installation directory')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
setvar(top=path.abspath('.'),
|
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)
|
||||||
|
|
||||||
setvar(lha='lhasa-0.3.0',
|
setvar(gmp='gmp-5.1.3',
|
||||||
gmp='gmp-5.1.3',
|
|
||||||
mpfr='mpfr-3.1.3',
|
mpfr='mpfr-3.1.3',
|
||||||
mpc='mpc-1.0.3',
|
mpc='mpc-1.0.3',
|
||||||
isl='isl-0.12.2',
|
isl='isl-0.12.2',
|
||||||
@ -241,4 +237,5 @@ if __name__ == "__main__":
|
|||||||
if not path.exists('{target}'):
|
if not path.exists('{target}'):
|
||||||
mkdir('{target}')
|
mkdir('{target}')
|
||||||
|
|
||||||
eval(args.action + "()")
|
action = args.action.replace('-', '_')
|
||||||
|
globals()[action].__call__(*args.args)
|
||||||
|
|||||||
Reference in New Issue
Block a user