-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathbuild
executable file
·81 lines (64 loc) · 2.22 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/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 ldns package."""
import logging
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 = ("%(p)s.tar.gz",)
PATCHES = (
"%(pn)s-no-getproto.patch",
"%(pn)s-CVE-2017-1000231.patch",
"%(pn)s-CVE-2017-1000232.patch",
"%(pn)s-ssl-engine.patch",
"%(pn)s-ssl-headers.patch",
)
def src_configure(metadata):
"""Configure the source."""
if os.path.exists("Makefile"):
logging.info("Makefile exists; skipping ./configure step")
return
tc = metadata["toolchain"]
EXTRA_CFLAGS = [
# The configure script tests these structs (and finds them), but then
# forgets to create the right defines for them. Force the logic when
# we build to avoid failures.
"-DHAVE_STRUCT_SOCKADDR_STORAGE",
"-DHAVE_STRUCT_IN6_ADDR",
"-DHAVE_STRUCT_SOCKADDR_IN6",
]
cmd = [
"./configure",
f"--build={tc.cbuild}",
f"--host={tc.chost}",
# The prefix path matches what is used at runtime.
"--prefix=/",
"--cache-file=../config.cache",
f"CFLAGS={' '.join(EXTRA_CFLAGS)}",
"--with-drill",
"--disable-dane-verify",
"--disable-gost",
# The ldns configure logic is quite poor and searches the filesystem
# instead of querying the compiler. Force it to our sysroot.
f"--with-ssl={tc.sysroot}",
]
ssh_client.run(cmd)
def src_compile(_metadata):
"""Compile the source."""
ssh_client.emake("setup-builddir")
ssh_client.emake("lib")
ssh_client.emake("drill")
def src_install(metadata):
"""Install the package."""
tc = metadata["toolchain"]
# List install targets ourselves to avoid installing man pages.
# This package has a lot (~500) and can be a little slow.
ssh_client.emake(
"install-h", "install-lib", "install-config", f"DESTDIR={tc.sysroot}"
)
ssh_client.build_package(sys.modules[__name__], "pnacl")