Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
Remove binutils and cleanup cross/binutils
Browse files Browse the repository at this point in the history
In particular, libiberty is not installed in cross-builds.
  • Loading branch information
hahnjo committed Oct 20, 2019
1 parent badbbfc commit 6439621
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 61 deletions.
1 change: 0 additions & 1 deletion gub/cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def change_target_package (package):
bootstrap_names = [
'system::gcc',
'tools::librestrict',
# 'tools::binutils',
'tools::make',
'tools::libtool',
'tools::file',
Expand Down
48 changes: 0 additions & 48 deletions gub/specs/binutils.py

This file was deleted.

44 changes: 32 additions & 12 deletions gub/specs/cross/binutils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import re
import os
#
from gub import build
from gub import cross
from gub import loggedos
from gub import misc
from gub.specs import binutils

class Binutils (cross.AutoBuild):
source = 'http://ftp.gnu.org/pub/gnu/binutils/binutils-2.25.tar.bz2'
Expand All @@ -23,25 +26,43 @@ class Binutils (cross.AutoBuild):
+ misc.join_lines ('''
LDFLAGS='-L%(tools_prefix)s/lib %(rpath)s %(libs)s'
'''))
#CC='gcc -L%(tools_prefix)s/lib %(rpath)s %(libs)s'
#LD_LIBRARY_PATH=%(tools_prefix)s/lib
# binutils' makefile uses:
# MULTIOSDIR = `$(CC) $(LIBCFLAGS) -print-multi-os-directory`
# which differs on each system. Setting it avoids inconsistencies.
make_flags = misc.join_lines ('''
MULTIOSDIR=../../lib
''')
#CCLD='$(CC) -L%(tools_prefix)s/lib %(rpath)s'

def install (self):
cross.AutoBuild.install (self)
binutils.install_missing_plain_binaries (self)
binutils.install_librestrict_stat_helpers (self)
binutils.remove_fedora9_untwanted_but_mysteriously_built_libiberies (self)
remove_fedora17_untwanted_but_mysteriously_built_libiberies (self)
install_missing_plain_binaries (self)
install_librestrict_stat_helpers (self)

def add_g_file_names (logger, file_name):
dir_name = os.path.dirname (file_name)
base_name = os.path.basename (file_name)
gnu_base_name = 'g' + base_name
if '-' in base_name:
gnu_base_name = re.sub ('-([^/g][^/-]*)$', r'-g\1', base_name)
gnu_file_name = os.path.join (dir_name, gnu_base_name)
loggedos.link (logger, file_name, gnu_file_name)

def install_librestrict_stat_helpers (self):
# LIBRESTRICT stats PATH to find gnm and gstrip
for d in [
'%(install_prefix)s%(cross_dir)s/bin',
'%(install_prefix)s%(cross_dir)s/%(target_architecture)s/bin',
]:
self.map_find_files (add_g_file_names, d, '(^|.*/)([^/g][^-/]*|.*-[^/g][^-/]*)$')

def remove_fedora17_untwanted_but_mysteriously_built_libiberies (self):
self.system ('rm -f %(install_prefix)s%(cross_dir)s/lib/libiberty.a')
self.system ('rm -f %(install_prefix)s%(cross_dir)s/lib64/libiberty.a')
def install_missing_plain_binaries (self):
def copy (logger, full_name):
base_name = (os.path.basename (self.expand (full_name))
.replace (self.expand ('%(toolchain_prefix)s'), ''))
plain_name = self.expand ('%(install_prefix)s%(cross_dir)s/%(target_architecture)s/bin/%(base_name)s', env=locals ())
if not os.path.exists (plain_name):
loggedos.system (logger, 'cp %(full_name)s %(plain_name)s' % locals ())
self.map_find_files (copy, '%(install_prefix)s%(cross_dir)s/bin', self.expand ('%(toolchain_prefix)s.*'))

class Binutils__mingw (Binutils):
dependencies = Binutils.dependencies + [
Expand All @@ -54,5 +75,4 @@ def configure (self):
# w32.libtool_fix_allow_undefined to find all libtool files
self.system ('cd %(builddir)s && make %(compile_flags)s configure-host configure-target')
# Must ONLY do target stuff, otherwise cross executables cannot find their libraries
# self.map_locate (lambda logger,file: build.libtool_update (logger, self.expand ('%(tools_prefix)s/bin/libtool'), file), '%(builddir)s', 'libtool')
self.map_locate (lambda logger, file: build.libtool_update (logger, self.expand ('%(tools_prefix)s/bin/libtool'), file), '%(builddir)s/libiberty', 'libtool')

0 comments on commit 6439621

Please sign in to comment.