Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion relenv/build/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,65 @@ def build_sqlite(env, dirs, logfp):
runcmd(["make", "install"], env=env, stderr=logfp, stdout=logfp)


def build_ncurses(env, dirs, logfp):
"""
Build ncurses.

:param env: The environment dictionary
:type env: dict
:param dirs: The working directories
:type dirs: ``relenv.build.common.Dirs``
:param logfp: A handle for the log file
:type logfp: file
"""
configure = pathlib.Path(dirs.source) / "configure"
if env["RELENV_BUILD_ARCH"] == "aarch64" or env["RELENV_HOST_ARCH"] == "aarch64":
os.chdir(dirs.tmpbuild)
runcmd([str(configure)], stderr=logfp, stdout=logfp)
runcmd(["make", "-C", "include"], stderr=logfp, stdout=logfp)
runcmd(["make", "-C", "progs", "tic"], stderr=logfp, stdout=logfp)
os.chdir(dirs.source)

# Configure with a prefix of '/' so things will be installed to '/lib'
# instead of '/usr/local/lib'. The root of the install will be specified
# via the DESTDIR make argument.
runcmd(
[
str(configure),
"--prefix=/",
"--with-shared",
"--enable-termcap",
"--with-termlib",
"--without-cxx-shared",
"--without-static",
"--without-cxx",
"--enable-widec",
"--without-normal",
"--disable-stripping",
f"--with-pkg-config={dirs.prefix}/lib/pkgconfig",
"--enable-pc-files",
f"--build={env['RELENV_BUILD']}",
f"--host={env['RELENV_HOST']}",
],
env=env,
stderr=logfp,
stdout=logfp,
)
runcmd(["make", "-j8"], env=env, stderr=logfp, stdout=logfp)
ticdir = str(pathlib.Path(dirs.tmpbuild) / "progs" / "tic")
runcmd(
[
"make",
f"DESTDIR={dirs.prefix}",
f"TIC_PATH={ticdir}",
"install",
],
env=env,
stderr=logfp,
stdout=logfp,
)


def tarball_version(href):
if href.endswith("tar.gz"):
try:
Expand Down Expand Up @@ -666,7 +725,7 @@ class Dirs:
"""

def __init__(self, dirs, name, arch, version):
# XXX name is the specific to a step where as everything
# XXX name is specific to a step whereas everything
# else here is generalized to the entire build
self.name = name
self.version = version
Expand Down
42 changes: 36 additions & 6 deletions relenv/build/darwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
import io

from ..common import arches, DARWIN, MACOS_DEVELOPMENT_TARGET
from .common import runcmd, finalize, build_openssl, build_sqlite, builds
from .common import (
runcmd,
finalize,
build_openssl,
build_sqlite,
builds,
build_ncurses,
tarball_version,
)

ARCHES = arches[DARWIN]

Expand All @@ -22,17 +30,24 @@ def populate_env(env, dirs):
"""
env["CC"] = "clang"
ldflags = [
"-Wl,-rpath,{prefix}/lib",
"-L{prefix}/lib",
f"-Wl,-rpath,{dirs.prefix}/lib",
f"-L{dirs.prefix}/lib",
]
env["LDFLAGS"] = " ".join(ldflags).format(prefix=dirs.prefix)
env["MACOSX_DEPLOYMENT_TARGET"] = MACOS_DEVELOPMENT_TARGET
cflags = [
"-L{prefix}/lib",
"-I{prefix}/include",
"-I{prefix}/include/readline",
f"-L{dirs.prefix}/lib",
f"-I{dirs.prefix}/include",
f"-I{dirs.prefix}/include/readline",
f"-I{dirs.prefix}/include/ncursesw",
]
env["CFLAGS"] = " ".join(cflags).format(prefix=dirs.prefix)
cppflags = [
f"-I{dirs.prefix}/include",
f"-I{dirs.prefix}/include/readline",
f"-I{dirs.prefix}/include/ncursesw",
]
env["CPPFLAGS"] = " ".join(cppflags)


def build_python(env, dirs, logfp):
Expand Down Expand Up @@ -104,13 +119,28 @@ def build_python(env, dirs, logfp):
},
)


build.add(
name="ncurses",
build_func=build_ncurses,
download={
"url": "https://ftp.gnu.org/pub/gnu/ncurses/ncurses-{version}.tar.gz",
# XXX: Need to work out tinfo linkage
"version": "6.5",
"checksum": "cde3024ac3f9ef21eaed6f001476ea8fffcaa381",
"checkfunc": tarball_version,
},
)


build.add(
"python",
build_func=build_python,
wait_on=[
"openssl",
"XZ",
"SQLite",
"ncurses",
],
download={
"url": "https://www.python.org/ftp/python/{version}/Python-{version}.tar.xz",
Expand Down
73 changes: 6 additions & 67 deletions relenv/build/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ def populate_env(env, dirs):
f"-I{dirs.toolchain}/{env['RELENV_HOST']}/sysroot/usr/include",
]
env["CFLAGS"] = " ".join(cflags)
# CPPFLAGS are needed for Python's setup.py to find the 'nessicery bits'
# CPPFLAGS are needed for Python's setup.py to find the 'necessary bits'
# for things like zlib and sqlite.
cpplags = [
cppflags = [
f"-I{dirs.prefix}/include",
f"-I{dirs.prefix}/include/readline",
f"-I{dirs.prefix}/include/ncursesw",
f"-I{dirs.toolchain}/{env['RELENV_HOST']}/sysroot/usr/include",
]
# env["CXXFLAGS"] = " ".join(cpplags)
env["CPPFLAGS"] = " ".join(cpplags)
# env["CXXFLAGS"] = " ".join(cppflags)
env["CPPFLAGS"] = " ".join(cppflags)
env["PKG_CONFIG_PATH"] = f"{dirs.prefix}/lib/pkgconfig"


Expand Down Expand Up @@ -166,65 +166,6 @@ def build_gdbm(env, dirs, logfp):
runcmd(["make", "install"], env=env, stderr=logfp, stdout=logfp)


def build_ncurses(env, dirs, logfp):
"""
Build ncurses.

:param env: The environment dictionary
:type env: dict
:param dirs: The working directories
:type dirs: ``relenv.build.common.Dirs``
:param logfp: A handle for the log file
:type logfp: file
"""
configure = pathlib.Path(dirs.source) / "configure"
if env["RELENV_BUILD_ARCH"] == "aarch64" or env["RELENV_HOST_ARCH"] == "aarch64":
os.chdir(dirs.tmpbuild)
runcmd([str(configure)], stderr=logfp, stdout=logfp)
runcmd(["make", "-C", "include"], stderr=logfp, stdout=logfp)
runcmd(["make", "-C", "progs", "tic"], stderr=logfp, stdout=logfp)
os.chdir(dirs.source)

# Configure with a prefix of '/' so things will be installed to '/lib'
# instead of '/usr/local/lib'. The root of the install will be specified
# via the DESTDIR make argument.
runcmd(
[
str(configure),
"--prefix=/",
"--with-shared",
"--enable-termcap",
"--with-termlib",
"--without-cxx-shared",
"--without-static",
"--without-cxx",
"--enable-widec",
"--without-normal",
"--disable-stripping",
f"--with-pkg-config={dirs.prefix}/lib/pkgconfig",
"--enable-pc-files",
f"--build={env['RELENV_BUILD']}",
f"--host={env['RELENV_HOST']}",
],
env=env,
stderr=logfp,
stdout=logfp,
)
runcmd(["make", "-j8"], env=env, stderr=logfp, stdout=logfp)
ticdir = str(pathlib.Path(dirs.tmpbuild) / "progs" / "tic")
runcmd(
[
"make",
f"DESTDIR={dirs.prefix}",
f"TIC_PATH={ticdir}",
"install",
],
env=env,
stderr=logfp,
stdout=logfp,
)


def build_readline(env, dirs, logfp):
"""
Build readline library.
Expand Down Expand Up @@ -535,10 +476,8 @@ def build_python(env, dirs, logfp):
download={
"url": "https://ftp.gnu.org/pub/gnu/ncurses/ncurses-{version}.tar.gz",
# XXX: Need to work out tinfo linkage
# "version": "6.5",
# "checksum": "cde3024ac3f9ef21eaed6f001476ea8fffcaa381",
"version": "6.4",
"checksum": "bb5eb3f34b3ecd5bac8d0b58164b847f135b3d62",
"version": "6.5",
"checksum": "cde3024ac3f9ef21eaed6f001476ea8fffcaa381",
"checkfunc": tarball_version,
},
)
Expand Down
Loading