Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Issue 11363043: Finish details of newlib install (Closed)

Created:
8 years, 1 month ago by Roland McGrath
Modified:
8 years, 1 month ago
Reviewers:
bradn
CC:
native-client-reviews_googlegroups.com
Visibility:
Public.

Description

Finish details of newlib install The newlib build for NaCl requires a few magic steps after what the newlib makefiles handle directly. BUG= http://code.google.com/p/nativeclient/issues/detail?id=3086 TEST= trybots R=bradnelson@google.com Committed: https://src.chromium.org/viewvc/native_client?view=rev&revision=10165

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+59 lines, -5 lines) Patch
M toolchain_build/command.py View 1 chunk +27 lines, -0 lines 0 comments Download
M toolchain_build/toolchain_build.py View 3 chunks +32 lines, -5 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
Roland McGrath
8 years, 1 month ago (2012-11-01 22:16:27 UTC) #1
bradn
8 years, 1 month ago (2012-11-01 22:41:12 UTC) #2
Lgtm
On Nov 1, 2012 3:16 PM, <mcgrathr@chromium.org> wrote:

> Reviewers: bradn,
>
> Description:
> Finish details of newlib install
>
> The newlib build for NaCl requires a few magic steps after
> what the newlib makefiles handle directly.
>
> BUG=
http://code.google.com/p/**nativeclient/issues/detail?id=**3086<http://code.g...
> TEST= trybots
>
> R=bradnelson@google.com
>
>
> Please review this at
https://codereview.chromium.**org/11363043/<https://codereview.chromium.org/1...
>
> SVN Base:
svn://svn.chromium.org/native_**client/trunk/src/native_client<http://svn.chromium.org/native_client/trunk/src/native_client>
>
> Affected files:
>   M toolchain_build/command.py
>   M toolchain_build/toolchain_**build.py
>
>
> Index: toolchain_build/command.py
> diff --git a/toolchain_build/command.py b/toolchain_build/command.py
> index 57634f50288cbb2a98ca988d47906b**5697439fd5..**
> fee519497e0e4a8dc96128c019c96f**8124948fd0 100755
> --- a/toolchain_build/command.py
> +++ b/toolchain_build/command.py
> @@ -127,3 +127,30 @@ def RemoveDirectory(path):
>    """Convenience method for generating a command to remove a directory
> tree."""
>    # TODO(mcgrathr): Windows
>    return Command(['rm', '-rf', path])
> +
> +
> +def Remove(path):
> +  """Convenience method for generating a command to remove a file."""
> +  # TODO(mcgrathr): Replace with something less hacky.
> +  return Command([
> +      sys.executable, '-c',
> +      'import sys, os; os.remove(sys.argv[1])', path
> +      ])
> +
> +
> +def Rename(src, dst):
> +  """Convenience method for generating a command to rename a file."""
> +  # TODO(mcgrathr): Replace with something less hacky.
> +  return Command([
> +      sys.executable, '-c',
> +      'import sys, os; os.rename(sys.argv[1], sys.argv[2])', src, dst
> +      ])
> +
> +
> +def WriteData(data, dst):
> +  """Convenience method to write a file with fixed contents."""
> +  # TODO(mcgrathr): Replace with something less hacky.
> +  return Command([
> +      sys.executable, '-c',
> +      'import sys; open(sys.argv[1], "wb").write(%r)' % data, dst
> +      ])
> Index: toolchain_build/toolchain_**build.py
> diff --git a/toolchain_build/toolchain_**build.py
> b/toolchain_build/toolchain_**build.py
> index ea9c8795a0db7c8945f2d96a7600ff**27953635dd..**
> 53dae5ead26a9474126ab9963c02a3**5a0996b7ad 100755
> --- a/toolchain_build/toolchain_**build.py
> +++ b/toolchain_build/toolchain_**build.py
> @@ -62,10 +62,32 @@ CONFIGURE_HOST_TOOL = CONFIGURE_HOST_LIB + [
>      '--without-zlib',
>  ]
>
> +
> +def NewlibLibcScript(arch):
> +  template = """/*
> + * This is a linker script that gets installed as libc.a for the
> + * newlib-based NaCl toolchain.  It brings in the constituent
> + * libraries that make up what -lc means semantically.
> + */
> +OUTPUT_FORMAT(%s)
> +GROUP ( libcrt_common.a libnacl.a )
> +"""
> +  if arch == 'arm':
> +    # Listing three formats instead of one makes -EL/-EB switches work
> +    # for the endian-switchable ARM backend.
> +    format_list = ['elf32-littlearm-nacl',
> +                   'elf32-bigarm-nacl',
> +                   'elf32-littlearm-nacl']
> +  else:
> +    raise Exception('TODO(mcgrathr): OUTPUT_FORMAT for %s' % arch)
> +  return template % ', '.join(['"' + fmt + '"' for fmt in format_list])
> +
> +
>  def ConfigureTargetArgs(arch):
>    config_target = arch + '-nacl'
>    return ['--target=' + config_target, '--with-sysroot=/' + config_target]
>
> +
>  def CommandsInBuild(command_lines)**:
>    return [command.Mkdir('build')] + [command.Command(cmd, cwd='build')
>                                       for cmd in command_lines]
> @@ -265,6 +287,9 @@ def TargetLibs(target):
>        newlib_sys_nacl,
>        ]))
>
> +  def NewlibFile(subdir, name):
> +    return os.path.join('%(output)s', target + '-nacl', subdir, name)
> +
>    libs = {
>        'newlib_' + target: {
>            'dependencies': lib_deps,
> @@ -286,11 +311,13 @@ def TargetLibs(target):
>                    ],
>                MAKE_PARALLEL_CMD,
>                MAKE_DESTDIR_CMD + ['install-strip'],
> -              # TODO(mcgrathr): Needs some additional steps:
> -              # rm pthread.h
> -              # mv libc.a libcrt_common.a
> -              # Write libc.a with linker script text.
> -              ]),
> +              ]) + [
> +                  command.Remove(NewlibFile('**include', 'pthread.h')),
> +                  command.Rename(NewlibFile('**lib', 'libc.a'),
> +                                 NewlibFile('lib', 'libcrt_common.a')),
> +                  command.WriteData(**NewlibLibcScript(target),
> +                                    NewlibFile('lib', 'libc.a')),
> +                  ],
>            },
>
>        # TODO(mcgrathr): gcc_libs
>
>
>

-- 
You received this message because you are subscribed to the Google Groups
"Native-Client-Reviews" group.
To post to this group, send email to native-client-reviews@googlegroups.com.
To unsubscribe from this group, send email to
native-client-reviews+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/native-client-reviews?hl=en.

Powered by Google App Engine
This is Rietveld 408576698