From patchwork Mon Jan 6 15:57:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 1218281 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-108465-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="jkVWTFcZ"; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.b="c6ySnqLm"; 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 47s0Xh6vRzz9s29 for ; Tue, 7 Jan 2020 02:58:12 +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=oksi2tsjEL0OwiCqcup2GcPcwArSfUQ bakNo3ApkvI6kf0hM03tb7pSEhagcH/eWfCQKxlmrcj9qgXbJO0LhEh29qsLUFow iXqnbVad5gXTfv1dhu2X+SFISmrUDP5SU7h9kDsMT0mtVbtJpiraiQT+sX8bYwZ6 5EK22HpQob9E= 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=mlg1/0HUUagNpKNnYEvrFPu5+b0=; b=jkVWT FcZTg9zAUnQ6+oaiJgi4FBVvu9xb78Zl1VyGVcJSjVFJ+1RfS4eHi0wB0qU0Pni1 w174uWemvqpHx4EFO3qVI0J1EtfEWDS5nCOw5115fPSQxTRk3eY0zS+MglUGDG3v iBFtlhqK42fJo0XXzy0JKJPHr4eH95HD+ArvgQ= Received: (qmail 95233 invoked by alias); 6 Jan 2020 15:57:31 -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 95139 invoked by uid 89); 6 Jan 2020 15:57:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.5 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=parisc X-HELO: mail.efficios.com DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 2634A1EA1B8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1578326241; bh=czcG+n6Qg2IAi29tBAMymh3L2XrUzfjCRs5xRkXzafw=; h=From:To:Date:Message-Id; b=c6ySnqLmk0LOocaRVwZtmYHqITTqvgrV5A6zKI8UMgnI0NtoTBLah1T2QV0katxFn KJFiUmm3uh05s7y9Ns2pVMV/lheyOMcz7hsbBSPI9nFK2KeVlO9c2DxgSazdikWvmq CNFjJMZZNytZzoIity1PUudwhn6rKg25r8N08RoifAkVR4OJueU0FZQUNnN63BtShU jaTs4KIsh+Szl32lw+Usw6Ic+scRyCfI8zwfx4Sp4P2jRDRcQfggt7YQNF/hJMUn8f fFI7DD5rjN4XEMeOHuF6fxWQIyy+NyutNe2w9o8JE9iH8odo/aDKg8zV15Ca0c83Vi lbBcZ0cIlri9Q== 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: Mon, 6 Jan 2020 10:57:06 -0500 Message-Id: <20200106155713.397-7-mathieu.desnoyers@efficios.com> In-Reply-To: <20200106155713.397-1-mathieu.desnoyers@efficios.com> References: <20200106155713.397-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')