diff --git a/gub/commands.py b/gub/commands.py index f867882a5..e59ce8a17 100644 --- a/gub/commands.py +++ b/gub/commands.py @@ -6,6 +6,7 @@ import sys import traceback # +from gub import build_platform from gub import loggedos from gub import misc from gub import octal @@ -341,9 +342,23 @@ def execute (self, logger): globs.append ('no-globs-for-%(dest)s' % locals ()) _v = logger.verbose_flag () - cmd = 'tar -C %(root)s/%(suffix_dir)s --ignore-failed --exclude="*~"%(_v)s -zcf %(dest)s ' % locals () - cmd += ' '.join (globs) - loggedos.system (logger, cmd) + + tar_flags = [ + '--exclude="*~"%(_v)s', + '-C %(root)s/%(suffix_dir)s', + '-c', + '-f %(dest)s', + '-z', + ] + + # '--ignore-failed' is required to build binutils on GNU/Linux systems. + # Default tar on Darwin is BSD, which does not have '--ignore-failed'. + if 'darwin' not in build_platform.machine(): + tar_flags.append('--ignore-failed') + + tar_cmd = ' '.join(['tar'] + tar_flags + globs) % locals () + + loggedos.system (logger, tar_cmd) # FIXME class ForcedAutogenMagic (SerializedCommand): diff --git a/gub/config_cache.py b/gub/config_cache.py index 1a6ab039c..a82f1ecf4 100644 --- a/gub/config_cache.py +++ b/gub/config_cache.py @@ -207,11 +207,13 @@ config_cache['linux-64'] = config_cache['linux-x86'] config_cache['freebsd-64'] = config_cache['freebsd-x86'] +config_cache['darwin-64'] = config_cache['darwin-x86'] config_cache['arm'] += config_cache['32'] config_cache['cygwin'] += config_cache['32'] config_cache['darwin-ppc'] += config_cache['32'] config_cache['darwin-x86'] += config_cache['32'] +config_cache['darwin-64'] += config_cache['64'] config_cache['freebsd-64'] += config_cache['64'] config_cache['freebsd-x86'] += config_cache['32'] config_cache['linux-64'] += config_cache['64'] diff --git a/gub/installer.py b/gub/installer.py index 708bbdfc9..79f73d812 100644 --- a/gub/installer.py +++ b/gub/installer.py @@ -472,6 +472,7 @@ def get_installer (settings, *arguments): 'darwin-ppc' : DarwinBundle, 'darwin-x86' : DarwinBundle, + 'darwin-64' : DarwinBundle, 'freebsd-x86' : Shar, 'freebsd4-x86' : Shar, 'freebsd6-x86' : Shar, diff --git a/gub/settings.py b/gub/settings.py index 4fa7d45d7..afbeea92c 100644 --- a/gub/settings.py +++ b/gub/settings.py @@ -19,6 +19,7 @@ 'cygwin': 'i686-cygwin', 'darwin-ppc': 'powerpc-apple-darwin8', 'darwin-x86': 'i686-apple-darwin8', + 'darwin-64': 'x86_64-apple-darwin', 'freebsd4-x86': 'i686-freebsd4', 'freebsd6-x86': 'i686-freebsd6', diff --git a/gub/specs/bzip2.py b/gub/specs/bzip2.py index 43f6c0e85..f0044bb3b 100644 --- a/gub/specs/bzip2.py +++ b/gub/specs/bzip2.py @@ -1,5 +1,6 @@ from gub import tools from gub import target +from gub import build_platform class Bzip2 (target.MakeBuild): source = 'http://http.debian.net/debian/pool/main/b/bzip2/bzip2_1.0.6.orig.tar.bz2' @@ -14,9 +15,17 @@ def install (self): class Bzip2__tools (tools.MakeBuild): source = 'http://http.debian.net/debian/pool/main/b/bzip2/bzip2_1.0.6.orig.tar.bz2' + patches = [] compile_flags = ' -f Makefile-libbz2_so' install_flags = (tools.MakeBuild.install_flags + ' PREFIX=%(install_prefix)s') + + # On darwin hosts, we need to substitute 'soname' for 'install_name' + if 'darwin' in build_platform.machine(): + patches = patches + [ + 'bzip2-1.0.6-darwin-soname.patch', + ] + def install (self): tools.MakeBuild.install (self) self.system ('cp -pv %(builddir)s/libbz2.so* %(install_prefix)s/lib') diff --git a/gub/specs/file.py b/gub/specs/file.py index ffe04df84..a766385aa 100644 --- a/gub/specs/file.py +++ b/gub/specs/file.py @@ -1,3 +1,4 @@ +from gub import build_platform from gub import tools import os @@ -7,3 +8,6 @@ class File__tools (tools.AutoBuild): 'libtool', 'zlib', ] + + if 'darwin' in build_platform.machine(): + compile_command = 'DYLD_LIBRARY_PATH="%(system_prefix)s/lib" ' + tools.AutoBuild.compile_command diff --git a/gub/specs/osx-lilypad.py b/gub/specs/osx-lilypad.py index 3c6532b0b..24d0b6081 100644 --- a/gub/specs/osx-lilypad.py +++ b/gub/specs/osx-lilypad.py @@ -1,12 +1,10 @@ from gub import build class Osx_lilypad (build.NullBuild): - pass + source = 'http://lilypond.org/downloads/gub-sources/osx-lilypad-universal/osx-lilypad-universal-0.6.3.tar.gz' class Osx_lilypad__darwin__ppc (build.NullBuild): # yes, we really need the old version here # later versions were built on OSX 10.7, which doesn't have pcc support source = 'http://lilypond.org/downloads/gub-sources/osx-lilypad-universal/osx-lilypad-universal-0.4.tar.gz' -class Osx_lilypad__darwin__x86 (build.NullBuild): - source = 'http://lilypond.org/downloads/gub-sources/osx-lilypad-universal/osx-lilypad-universal-0.6.3.tar.gz' diff --git a/gub/specs/perl-extutils-makemaker.py b/gub/specs/perl-extutils-makemaker.py index 8703f09b6..f5440a2d7 100644 --- a/gub/specs/perl-extutils-makemaker.py +++ b/gub/specs/perl-extutils-makemaker.py @@ -1,5 +1,5 @@ from gub import tools class Perl_extutils_makemaker (tools.CpanBuild): - source = 'http://search.cpan.org/CPAN/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.55_02.tar.gz' + source = 'https://cpan.metacpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.34.tar.gz' diff --git a/gub/specs/perl-xml-parser.py b/gub/specs/perl-xml-parser.py index 3a4fce3e5..89959d44a 100644 --- a/gub/specs/perl-xml-parser.py +++ b/gub/specs/perl-xml-parser.py @@ -1,5 +1,7 @@ from gub import tools class Perl_xml_parser (tools.CpanBuild): - source = 'http://search.cpan.org/CPAN/authors/id/M/MS/MSERGEANT/XML-Parser-2.36.tar.gz' - dependencies = ['expat'] + source = 'https://cpan.metacpan.org/authors/id/T/TO/TODDR/XML-Parser-2.44.tar.gz' + dependencies = [ + 'expat', + ] diff --git a/gub/specs/perl.py b/gub/specs/perl.py index c95f89d89..9c9c0631c 100644 --- a/gub/specs/perl.py +++ b/gub/specs/perl.py @@ -1,39 +1,45 @@ -import re -# -from gub import misc +from gub import build_platform from gub import tools -# And this is supposed to be one of the most compiled packages? -# So why doesn't anyone fix configuring/compiling it? Shees. -class Perl__tools (tools.AutoBuild): - source = 'http://www.cpan.org/src/5.0/perl-5.10.0.tar.gz' +class Perl__tools(tools.AutoBuild): + source = 'https://www.cpan.org/src/5.0/perl-5.28.1.tar.gz' srcdir_build_broken = True - def patch (self): - tools.AutoBuild.patch (self) - self.file_sub ([('-c (/dev/null)', r'-e \1')], '%(srcdir)s/Configure') configure_binary = '%(autodir)s/configure.gnu' -# -Dcc=%(CC)s -# -Dprefix=%(prefix_dir)s -- BOOTSTRAP - configure_command = misc.join_lines ('''%(configure_binary)s - -Dprefix=%(system_prefix)s - -Dcc='%(toolchain_prefix)sgcc %(target_gcc_flags)s' - -Dtargetarch=%(target_architecture)s - -Dusrinc=%(system_prefix)s/include - -Dincpth=/ - -Dlibpth=%(system_prefix)s/lib - -Dsitelib=%(system_prefix)s/lib/perl5/5.10.0 - -Dsitearch=%(system_prefix)s/lib/perl5/5.10.0 - -Dusedl - -Duseshrplib - -Dlibperl=libperl.so - -Dcccdlflags=-fPIC - -Dlocallibpth=/ - -Aldflags='%(rpath)s' - -Alibs='-lm -lrt -ldl' -''') - def configure (self): - tools.AutoBuild.configure (self) - for i in ['%(builddir)s/makefile', '%(builddir)s/x2p/makefile']: - # Ugh, missing some command? - self.file_sub ([('^0$','')], i) -# def install_command (self): + + + if 'darwin' in build_platform.machine(): + librt_flag = '-lSystem' + target_arch_flag = '' # TODO: fix for cross-compilation + else: + librt_flag = '-lrt' + target_arch_flag = '-Dtargetarch=%(target_architecture)s' + + configure_command = ' '.join([ + '%(configure_binary)s', + '-Aldflags="%(rpath)s"', + '-Alibs="-lm -ldl %(librt_flag)s"', + '-Dcc="%(toolchain_prefix)sgcc %(target_gcc_flags)s"', + '-Dcccdlflags=-fPIC', + '-Dincpth=/', + '-Dlibperl=libperl.so', + '-Dlibpth=%(system_prefix)s/lib', + '-Dlocallibpth=/', + '-Dprefix=%(system_prefix)s', + '-Dsitearch=%(system_prefix)s/lib/perl5/5.28.1', + '-Dsitelib=%(system_prefix)s/lib/perl5/5.28.1', + target_arch_flag, + '-Dusedl', + '-Duseshrplib', + '-Dusrinc=%(system_prefix)s/include', + ]) + + def patch(self): + tools.AutoBuild.patch(self) + self.file_sub([('-c (/dev/null)', r'-e \1')], '%(srcdir)s/Configure') + + def configure(self): + tools.AutoBuild.configure(self) + if 'darwin' not in build_platform.machine(): + for i in ['%(builddir)s/makefile', '%(builddir)s/x2p/makefile']: + # Ugh, missing some command? + self.file_sub([('^0$','')], i) diff --git a/gub/specs/pkg-config.py b/gub/specs/pkg-config.py index c3f9df252..18da7924f 100644 --- a/gub/specs/pkg-config.py +++ b/gub/specs/pkg-config.py @@ -1,3 +1,4 @@ +from gub import build_platform from gub import tools class Pkg_config__tools (tools.AutoBuild): @@ -5,3 +6,8 @@ class Pkg_config__tools (tools.AutoBuild): 'libtool', 'system::g++', ] + + def __init__ (self, settings, source): + tools.AutoBuild.__init__ (self, settings, source) + if 'darwin' in build_platform.machine(): + self.configure_variables += 'CFLAGS="-I%(system_prefix)s/include -std=gnu89"' diff --git a/gub/specs/tar.py b/gub/specs/tar.py index 7cf16b92f..097ff09b9 100644 --- a/gub/specs/tar.py +++ b/gub/specs/tar.py @@ -3,7 +3,7 @@ from gub import tools class Tar__tools (tools.AutoBuild): - source = 'http://ftp.gnu.org/pub/gnu/tar/tar-1.28.tar.gz' + source = 'https://ftp.gnu.org/gnu/tar/tar-1.31.tar.gz' def __init__ (self, settings, source): tools.AutoBuild.__init__ (self, settings, source) if isinstance (self.source, repository.TarBall): diff --git a/gub/specs/xzutils.py b/gub/specs/xzutils.py index 2e937fa61..4c930fd05 100644 --- a/gub/specs/xzutils.py +++ b/gub/specs/xzutils.py @@ -2,5 +2,5 @@ from gub import tools class Xzutils__tools (tools.AutoBuild): - source = 'http://tukaani.org/xz/xz-5.0.7.tar.bz2' + source = 'https://tukaani.org/xz/xz-5.0.7.tar.bz2' dependencies = ['tools::bzip2'] diff --git a/gub/target.py b/gub/target.py index 4f142c98a..afa150a41 100644 --- a/gub/target.py +++ b/gub/target.py @@ -150,8 +150,8 @@ def get_substitution_dict (self, env={}): 'NM': '%(toolchain_prefix)snm', 'PKG_CONFIG_PATH': '%(system_prefix)s/lib/pkgconfig', 'PATH': '%(cross_prefix)s/bin:%(tools_archmatch_prefix)s/bin:%(tools_prefix)s/bin:%(tools_cross_prefix)s/bin:' + os.environ['PATH'], - 'PERL5LIB': 'foo:%(tools_prefix)s/lib/perl5/5.10.0' - + ':%(tools_prefix)s/lib/perl5/5.10.0/%(build_architecture)s' + 'PERL5LIB': 'foo:%(tools_prefix)s/lib/perl5/5.28.1' + + ':%(tools_prefix)s/lib/perl5/5.28.1/%(build_architecture)s' + ':%(tools_prefix)s/share/autoconf' + misc.append_path (os.environ.get ('PERL5LIB', '')), 'PKG_CONFIG': '''pkg-config \ diff --git a/gub/tools.py b/gub/tools.py index 8218375b1..201f5cc41 100644 --- a/gub/tools.py +++ b/gub/tools.py @@ -169,8 +169,8 @@ def get_substitution_dict (self, env={}): # 'LIBRESTRICT_IGNORE': '%(system_prefix)s/bin/make:%(system_prefix)s/gcc:%(system_prefix)s/g++:%(system_prefix)s/ld', #etc. + misc.append_path (os.environ.get ('LIBRARY_PATH', '')), 'PATH': '%(system_prefix)s/bin:%(system_cross_prefix)s/bin:' + os.environ['PATH'], - 'PERL5LIB': 'foo:%(tools_prefix)s/lib/perl5/5.10.0' - + ':%(tools_prefix)s/lib/perl5/5.10.0/%(build_architecture)s' + 'PERL5LIB': 'foo:%(tools_prefix)s/lib/perl5/5.28.1' + + ':%(tools_prefix)s/lib/perl5/5.28.1/%(build_architecture)s' + ':%(tools_prefix)s/share/autoconf' + misc.append_path (os.environ.get ('PERL5LIB', '')), } diff --git a/patches/bzip2-1.0.6-darwin-soname.patch b/patches/bzip2-1.0.6-darwin-soname.patch new file mode 100644 index 000000000..fa5a4dc1d --- /dev/null +++ b/patches/bzip2-1.0.6-darwin-soname.patch @@ -0,0 +1,11 @@ +--- bzip2-1.0.6/Makefile-libbz2_so.old 2019-02-02 11:45:09.000000000 -0800 ++++ bzip2-1.0.6/Makefile-libbz2_so 2019-02-02 11:45:17.000000000 -0800 +@@ -35,7 +35,7 @@ + bzlib.o + + all: $(OBJS) +- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS) ++ $(CC) -shared -Wl,-install_name -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS) + $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.6 + rm -f libbz2.so.1.0 + ln -s libbz2.so.1.0.6 libbz2.so.1.0 diff --git a/test-lily/test-binary.py b/test-lily/test-binary.py index 7bd1b4568..c672e5c5a 100755 --- a/test-lily/test-binary.py +++ b/test-lily/test-binary.py @@ -40,6 +40,7 @@ def system (c, ignore_error=False): 'linux-64': 'shar', 'darwin-ppc' : 'darwin', 'darwin-x86' : 'darwin', + 'darwin-64' : 'darwin', 'freebsd-x86': 'shar', 'freebsd-64': 'shar', } diff --git a/test-lily/upload.py b/test-lily/upload.py index f8b8437ce..041f33b0a 100644 --- a/test-lily/upload.py +++ b/test-lily/upload.py @@ -32,6 +32,7 @@ def argv0_relocation (): 'linux-ppc', 'darwin-ppc', 'darwin-x86', + 'darwin-64', 'documentation', 'test-output', 'freebsd-x86',