| #!/usr/bin/env python3 |
| # Copyright 2018 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| """Build naclsdk package.""" |
| |
| import os |
| from pathlib import Path |
| import sys |
| |
| FILESDIR = Path(__file__).resolve().parent |
| sys.path.insert(0, str(FILESDIR.parent.parent / "bin")) |
| |
| import ssh_client # pylint: disable=wrong-import-position |
| |
| |
| ARCHIVES = ("naclsdk_linux-%(PV)s.tar.xz",) |
| S = "%(workdir)s" |
| |
| |
| def src_install(metadata): |
| """Install the package.""" |
| pepper = "pepper_" + metadata["PV"].split(".")[0] |
| |
| # This is what the webports did historically. |
| srcdir = os.path.join(pepper, "include", "pnacl") |
| dstdir = os.path.join( |
| pepper, "toolchain", "linux_pnacl", "le32-nacl", "usr", "include" |
| ) |
| for root, _, files in os.walk(srcdir): |
| for header in files: |
| relpath = os.path.join(os.path.relpath(root, srcdir), header) |
| ssh_client.copy( |
| os.path.join(srcdir, relpath), os.path.join(dstdir, relpath) |
| ) |
| |
| path = ssh_client.OUTPUT / "naclsdk" |
| ssh_client.symlink(metadata["S"] / pepper, path) |
| |
| |
| ssh_client.build_package(sys.modules[__name__], "build") |