mirror of
https://github.com/cahirwpz/amigaos-cross-toolchain
synced 2026-09-11 19:59:18 +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:
|
||||
|
||||
* GNU gcc 4.x **32-bit version!**
|
||||
* GNU make 3.x
|
||||
* perl 5.10
|
||||
* GNU gcc 4.x **32-bit version!** or Clang
|
||||
* libncurses5-dev **32-bit version!**
|
||||
* GNU make
|
||||
* python-dev
|
||||
* perl
|
||||
* git
|
||||
* subversion
|
||||
* wget
|
||||
* 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.
|
||||
@@ -99,7 +99,6 @@ Follow steps listed below:
|
||||
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
|
||||
```
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#!/usr/bin/env python -B
|
||||
|
||||
from logging import debug, info, error
|
||||
from glob import glob
|
||||
from os import path
|
||||
from fnmatch import fnmatch
|
||||
from glob import glob
|
||||
from logging import debug, info, error
|
||||
from os import path
|
||||
import contextlib
|
||||
import distutils.spawn
|
||||
import shutil
|
||||
import os
|
||||
import shutil
|
||||
import site
|
||||
import subprocess
|
||||
import sys
|
||||
import tarfile
|
||||
import tempfile
|
||||
import urllib2
|
||||
import zipfile
|
||||
import tempfile
|
||||
|
||||
|
||||
VARS = {}
|
||||
|
||||
@@ -165,7 +165,7 @@ def remove(*names):
|
||||
@fill_in_args
|
||||
def mkdir(*names):
|
||||
for name in flatten(names):
|
||||
if not path.isdir(name):
|
||||
if name and not path.isdir(name):
|
||||
debug('makedir "%s"', topdir(name))
|
||||
os.makedirs(name)
|
||||
|
||||
@@ -237,9 +237,9 @@ def download(url, name):
|
||||
size = None
|
||||
|
||||
if size:
|
||||
info('download: %s (size: %d)' % (name, size))
|
||||
info('download: %s (size: %d)', name, size)
|
||||
else:
|
||||
info('download: %s' % name)
|
||||
info('download: %s', name)
|
||||
|
||||
with open(name, 'wb') as f:
|
||||
done = 0
|
||||
@@ -263,10 +263,17 @@ def download(url, name):
|
||||
|
||||
@fill_in_args
|
||||
def unarc(name):
|
||||
info('extract files from "%s"' % topdir(name))
|
||||
info('extract files from "%s"', topdir(name))
|
||||
|
||||
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:
|
||||
if name.endswith('.tar.gz') or name.endswith('.tar.bz2'):
|
||||
module = tarfile
|
||||
@@ -282,6 +289,14 @@ def unarc(name):
|
||||
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
|
||||
def cwd(name):
|
||||
old = os.getcwd()
|
||||
@@ -337,6 +352,13 @@ def recipe(name, nargs=0):
|
||||
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)
|
||||
def fetch(name, url):
|
||||
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',
|
||||
'rmtree', 'mkdir', 'copy', 'copytree', 'unarc', 'fetch', 'cwd',
|
||||
'symlink', 'remove', 'move', 'find', 'textfile', 'env', 'path',
|
||||
'recipe', 'unpack', 'patch', 'configure', 'make']
|
||||
'add_site_dir', 'python_setup', 'recipe', 'unpack', 'patch',
|
||||
'configure', 'make']
|
||||
|
||||
+9
-10
@@ -13,7 +13,7 @@ import string
|
||||
import sys
|
||||
|
||||
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/gawk/gawk-3.1.8.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['CXX'] = ' '.join([find_executable(CXX), ARCH])
|
||||
|
||||
find_executable('perl')
|
||||
find_executable('patch')
|
||||
find_executable('make')
|
||||
find_executable('git')
|
||||
@@ -218,6 +219,8 @@ def build():
|
||||
path.join('{host}', 'bin'),
|
||||
environ['PATH']])
|
||||
|
||||
add_site_dir('{host}')
|
||||
|
||||
with cwd('{archives}'):
|
||||
for url in URLS:
|
||||
if type(url) == tuple:
|
||||
@@ -226,13 +229,8 @@ def build():
|
||||
name = path.basename(url)
|
||||
fetch(name, url)
|
||||
|
||||
unpack('{lha}')
|
||||
configure('{lha}',
|
||||
'--disable-shared',
|
||||
'--prefix={host}',
|
||||
copy_source=True)
|
||||
make('{lha}')
|
||||
make('{lha}', 'install')
|
||||
unpack('python-lha', work_dir='{build}')
|
||||
python_setup('python-lha')
|
||||
|
||||
unpack('{m4}')
|
||||
configure('{m4}', '--prefix={host}')
|
||||
@@ -509,6 +507,8 @@ def install_sdk(*names):
|
||||
path.join('{host}', 'bin'),
|
||||
environ['PATH']])
|
||||
|
||||
add_site_dir('{host}')
|
||||
|
||||
for name in names:
|
||||
filename = path.join('{top}/sdk', name + '.sdk')
|
||||
|
||||
@@ -558,8 +558,7 @@ if __name__ == "__main__":
|
||||
binutils_ver=args.binutils,
|
||||
gcc_ver=args.gcc)
|
||||
|
||||
setvar(lha='lhasa-0.3.0',
|
||||
m4='m4-1.4.17',
|
||||
setvar(m4='m4-1.4.17',
|
||||
gawk='gawk-3.1.8',
|
||||
flex='flex-2.5.4',
|
||||
bison='bison-1.35',
|
||||
|
||||
+16
-19
@@ -12,13 +12,13 @@ import platform
|
||||
import sys
|
||||
|
||||
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/mpfr/mpfr-3.1.3.tar.bz2',
|
||||
'ftp://ftp.gnu.org/gnu/texinfo/texinfo-4.12.tar.gz',
|
||||
'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://soulsphere.org/projects/lhasa/lhasa-0.3.0.tar.gz',
|
||||
('http://hyperion-entertainment.biz/index.php/downloads' +
|
||||
'?view=download&format=raw&file=69', 'SDK_53.24.lha'),
|
||||
('svn://svn.code.sf.net/p/adtools/code/trunk/binutils', 'binutils-2.18'),
|
||||
@@ -82,6 +82,8 @@ def build():
|
||||
path.join('{host}', 'bin'),
|
||||
environ['PATH']])
|
||||
|
||||
add_site_dir('{host}')
|
||||
|
||||
with cwd('{archives}'):
|
||||
for url in URLS:
|
||||
if type(url) == tuple:
|
||||
@@ -90,17 +92,11 @@ def build():
|
||||
name = path.basename(url)
|
||||
fetch(name, url)
|
||||
|
||||
unpack('{lha}')
|
||||
configure('{lha}',
|
||||
'--disable-shared',
|
||||
'--prefix={host}',
|
||||
copy_source=True)
|
||||
make('{lha}')
|
||||
make('{lha}', 'install')
|
||||
unpack('python-lha', work_dir='{build}')
|
||||
python_setup('python-lha')
|
||||
|
||||
unpack('{texinfo}')
|
||||
configure('{texinfo}',
|
||||
'--prefix={host}')
|
||||
configure('{texinfo}', '--prefix={host}')
|
||||
make('{texinfo}')
|
||||
make('{texinfo}', 'install')
|
||||
|
||||
@@ -164,13 +160,13 @@ def build():
|
||||
|
||||
with env(**gcc_env):
|
||||
configure('{gcc}',
|
||||
'--with-bugurl="http://sf.net/p/adtools"',
|
||||
'--prefix={target}',
|
||||
'--target=ppc-amigaos',
|
||||
'--with-bugurl="http://sf.net/p/adtools"',
|
||||
'--with-gmp={host}',
|
||||
'--with-mpfr={host}',
|
||||
'--with-isl={host}',
|
||||
'--with-cloog={host}',
|
||||
'--prefix={target}',
|
||||
'--enable-languages=c,c++',
|
||||
'--enable-haifa',
|
||||
'--enable-sjlj-exceptions',
|
||||
@@ -202,8 +198,9 @@ if __name__ == "__main__":
|
||||
panic('Build on %s architecture not supported!', platform.machine())
|
||||
|
||||
parser = argparse.ArgumentParser(description='Build cross toolchain.')
|
||||
parser.add_argument('action', choices=['build', 'clean'], default='build',
|
||||
help='perform action')
|
||||
parser.add_argument('action',
|
||||
choices=['build', 'clean'],
|
||||
default='build', help='perform action')
|
||||
parser.add_argument('--binutils', choices=['2.18', '2.23.2'], default='2.18',
|
||||
help='desired binutils version')
|
||||
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')
|
||||
args = parser.parse_args()
|
||||
|
||||
setvar(top=path.abspath('.'),
|
||||
setvar(top=path.abspath(path.dirname(sys.argv[0])),
|
||||
binutils_ver=args.binutils,
|
||||
gcc_ver=args.gcc)
|
||||
|
||||
setvar(lha='lhasa-0.3.0',
|
||||
gmp='gmp-5.1.3',
|
||||
setvar(gmp='gmp-5.1.3',
|
||||
mpfr='mpfr-3.1.3',
|
||||
mpc='mpc-1.0.3',
|
||||
isl='isl-0.12.2',
|
||||
@@ -241,4 +237,5 @@ if __name__ == "__main__":
|
||||
if not path.exists('{target}'):
|
||||
mkdir('{target}')
|
||||
|
||||
eval(args.action + "()")
|
||||
action = args.action.replace('-', '_')
|
||||
globals()[action].__call__(*args.args)
|
||||
|
||||
Reference in New Issue
Block a user