From patchwork Tue Dec 17 14:30:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 36904 Received: (qmail 5498 invoked by alias); 17 Dec 2019 14:31:09 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 5439 invoked by uid 89); 17 Dec 2019 14:31:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:3527 X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576593065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5ns4Erz68NJLczXpXa2QucZ7aHPR3pKMyLE6sYrbyEU=; b=FDPZLx0GkEvWO8Ng5/ShCLTtfLldkozH5eYr+LS1PfC5/n/GbaGbIkgXCmkvMuBIwYjAo8 seaRduHzY/ZuukC02GVEY0zXBjAwMVYAjwWNXsMsY1sxuOKZa6LJeiLOE/f9bD01ELXhnG 4aWiIkNKKAhJa+Ow7BDhimCdS9XRFrU= From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 3/5] build-many-glibcs.py: Introduce LinuxHeadersPolicyForBuild In-Reply-To: References: Message-Id: Date: Tue, 17 Dec 2019 15:30:59 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 And move install_linux_headers to the top level. Reviewed-by: Siddhesh Poyarekar --- 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')