From patchwork Fri Dec 20 21:36:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 1214319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-108287-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="P92RGy3H"; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.b="M09Rfa3a"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47fhvP1wHBz9sRG for ; Sat, 21 Dec 2019 08:38:41 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=ky7VQcGc4oucgnMqQpWqnsP2x68OzJz P92dcd6DJsx/1ZYk2rxx7hxKCZx9oflN+7fYUXTbu3ObcRH6KjiF851Ynf37ZeBh G84zBWm+O9HldWbkyXSaGdmdAnOYJT11tCLdgns9LyBOKLuYW80hdz8MO+onFd7A N5eRykb9fM7s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=hNNmfEyIkOD23lZfl5UnEojcROw=; b=P92RG y3HtCd/1ypbPSz4kIYNe869gshlsHSa2G3rhanOYzhCV5qE4nFwpC2Y6aE5gZiTn Z1PMozBgCr1tI7wIgC97p1l7h5RPcqtzwQ55PJILer+FWGmB7N5xu4RPAQpDXb0G 1BiHDOuN/VhGS0dJLbSqXIKaUcZf2eE648RHkA= Received: (qmail 127226 invoked by alias); 20 Dec 2019 21:38:22 -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 127145 invoked by uid 89); 20 Dec 2019 21:38:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail.efficios.com DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 3B059690A02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1576877898; bh=yO7wRTgkordLaNar3WpClo94YCIM7DKUBQWjN2ZCOkE=; h=From:To:Date:Message-Id; b=M09Rfa3a+UGZqilbgvcXtlkDrLTjRXOG7e8BMRtgsU6lpkqLykiTuTUY2kJmLDNZG cIBC2cojY8mmnLifxh+ijsf1N9sS+icT9NxLUuJK8ExPYnogLmUnPPcK6Z+KBe/E4k 4JrvB73IDyxJyQVy+4vJQVkSbgVUevjYYq020fzdJ5c4HLTUpGf/3g9qh3V579KXBu tTYJfe8QdVwiPvU10tNcVa0ci05B9BhlcMCiWDBgeFRwFa9qNiVzK9Cb8rXHfd5v4Q Dg3AdmY4VEK38ELZyUr/oMMXzTeY3iUtJcKpLLQuNaAYBYVWRVJe4Qhc0bbWN9M9W3 mWj0zMYT+Ubqg== From: Mathieu Desnoyers To: Carlos O'Donell Cc: Florian Weimer , Joseph Myers , Szabolcs Nagy , libc-alpha@sourceware.org Subject: [RFC PATCH glibc 06/13] build-many-glibcs.py: Introduce LinuxHeadersPolicyForBuild Date: Fri, 20 Dec 2019 16:36:43 -0500 Message-Id: <20191220213650.11281-7-mathieu.desnoyers@efficios.com> In-Reply-To: <20191220213650.11281-1-mathieu.desnoyers@efficios.com> References: <20191220213650.11281-1-mathieu.desnoyers@efficios.com> From: Florian Weimer 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')