unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Carlos O'Donell <carlos@redhat.com>
Cc: Florian Weimer <fweimer@redhat.com>,
	Joseph Myers <joseph@codesourcery.com>,
	Szabolcs Nagy <szabolcs.nagy@arm.com>,
	libc-alpha@sourceware.org
Subject: [RFC PATCH glibc 06/13] build-many-glibcs.py: Introduce LinuxHeadersPolicyForBuild
Date: Mon,  6 Jan 2020 10:57:06 -0500	[thread overview]
Message-ID: <20200106155713.397-7-mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <20200106155713.397-1-mathieu.desnoyers@efficios.com>

From: Florian Weimer <fweimer@redhat.com>

And move install_linux_headers to the top level.
---
 scripts/build-many-glibcs.py | 91 +++++++++++++++++++-----------------
 1 file changed, 48 insertions(+), 43 deletions(-)

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 193d49727b..56160a16fc 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -1160,6 +1160,53 @@ class Context(object):
                 print('Script changed, bot re-execing.')
                 self.exec_self()
 
+class LinuxHeadersPolicyForBuild(object):
+    """Names and directories for installing Linux headers.  Build variant."""
+
+    def __init__(self, config):
+        self.arch = config.arch
+        self.srcdir = config.ctx.component_srcdir('linux')
+        self.builddir = config.component_builddir('linux')
+        self.headers_dir = os.path.join(config.sysroot, 'usr')
+
+def install_linux_headers(policy, cmdlist):
+    """Install Linux kernel headers."""
+    arch_map = {'aarch64': 'arm64',
+                'alpha': 'alpha',
+                'arm': 'arm',
+                'csky': 'csky',
+                'hppa': 'parisc',
+                'i486': 'x86',
+                'i586': 'x86',
+                'i686': 'x86',
+                'i786': 'x86',
+                'ia64': 'ia64',
+                'm68k': 'm68k',
+                'microblaze': 'microblaze',
+                'mips': 'mips',
+                'nios2': 'nios2',
+                'powerpc': 'powerpc',
+                's390': 's390',
+                'riscv32': 'riscv',
+                'riscv64': 'riscv',
+                'sh': 'sh',
+                'sparc': 'sparc',
+                'x86_64': 'x86'}
+    linux_arch = None
+    for k in arch_map:
+        if policy.arch.startswith(k):
+            linux_arch = arch_map[k]
+            break
+    assert linux_arch is not None
+    cmdlist.push_subdesc('linux')
+    cmdlist.create_use_dir(policy.builddir)
+    cmdlist.add_command('install-headers',
+                        ['make', '-C', policy.srcdir, 'O=%s' % policy.builddir,
+                         'ARCH=%s' % linux_arch,
+                         'INSTALL_HDR_PATH=%s' % policy.headers_dir,
+                         'headers_install'])
+    cmdlist.cleanup_dir()
+    cmdlist.pop_subdesc()
 
 class Config(object):
     """A configuration for building a compiler and associated libraries."""
@@ -1218,7 +1265,7 @@ class Config(object):
                                '--disable-readline',
                                '--disable-sim'])
         if self.os.startswith('linux'):
-            self.install_linux_headers(cmdlist)
+            install_linux_headers(LinuxHeadersPolicyForBuild(self), cmdlist)
         self.build_gcc(cmdlist, True)
         if self.os == 'gnu':
             self.install_gnumach_headers(cmdlist)
@@ -1266,48 +1313,6 @@ class Config(object):
         cmdlist.cleanup_dir()
         cmdlist.pop_subdesc()
 
-    def install_linux_headers(self, cmdlist):
-        """Install Linux kernel headers."""
-        arch_map = {'aarch64': 'arm64',
-                    'alpha': 'alpha',
-                    'arm': 'arm',
-                    'csky': 'csky',
-                    'hppa': 'parisc',
-                    'i486': 'x86',
-                    'i586': 'x86',
-                    'i686': 'x86',
-                    'i786': 'x86',
-                    'ia64': 'ia64',
-                    'm68k': 'm68k',
-                    'microblaze': 'microblaze',
-                    'mips': 'mips',
-                    'nios2': 'nios2',
-                    'powerpc': 'powerpc',
-                    's390': 's390',
-                    'riscv32': 'riscv',
-                    'riscv64': 'riscv',
-                    'sh': 'sh',
-                    'sparc': 'sparc',
-                    'x86_64': 'x86'}
-        linux_arch = None
-        for k in arch_map:
-            if self.arch.startswith(k):
-                linux_arch = arch_map[k]
-                break
-        assert linux_arch is not None
-        srcdir = self.ctx.component_srcdir('linux')
-        builddir = self.component_builddir('linux')
-        headers_dir = os.path.join(self.sysroot, 'usr')
-        cmdlist.push_subdesc('linux')
-        cmdlist.create_use_dir(builddir)
-        cmdlist.add_command('install-headers',
-                            ['make', '-C', srcdir, 'O=%s' % builddir,
-                             'ARCH=%s' % linux_arch,
-                             'INSTALL_HDR_PATH=%s' % headers_dir,
-                             'headers_install'])
-        cmdlist.cleanup_dir()
-        cmdlist.pop_subdesc()
-
     def install_gnumach_headers(self, cmdlist):
         """Install GNU Mach headers."""
         srcdir = self.ctx.component_srcdir('gnumach')
-- 
2.17.1


  parent reply	other threads:[~2020-01-06 15:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 15:57 [RFC PATCH glibc 00/13] Restartable Sequences enablement Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 01/13] Introduce <elf_machine_sym_no_match.h> Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 02/13] Implement __libc_early_init Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 03/13] nptl: Start new threads with all signals blocked [BZ #25098] Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 04/13] Linux: Add tables with system call numbers Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 05/13] Linux: Use system call tables during build Mathieu Desnoyers
2020-01-06 15:57 ` Mathieu Desnoyers [this message]
2020-01-06 15:57 ` [RFC PATCH glibc 07/13] build-many-glibcs.py: Introduce glibc build policy classes Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 08/13] build-many-glibcs.py: Implement update-syscalls command Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 09/13] glibc: Perform rseq(2) registration at C startup and thread creation (v13) Mathieu Desnoyers
2020-01-07 12:23   ` Florian Weimer
2020-01-07 20:44     ` Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 10/13] glibc: sched_getcpu(): use rseq cpu_id TLS on Linux (v5) Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 11/13] support record failure: allow use from constructor Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 12/13] support: implement xpthread key create/delete (v3) Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 13/13] rseq registration tests (v7) Mathieu Desnoyers
2020-01-07 12:25 ` [RFC PATCH glibc 00/13] Restartable Sequences enablement Florian Weimer
2020-01-07 20:45   ` Mathieu Desnoyers
  -- strict thread matches above, loose matches on Subject: below --
2019-12-20 21:36 Mathieu Desnoyers
2019-12-20 21:36 ` [RFC PATCH glibc 06/13] build-many-glibcs.py: Introduce LinuxHeadersPolicyForBuild Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200106155713.397-7-mathieu.desnoyers@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=carlos@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=szabolcs.nagy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).