40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
version = "1.0.8"
|
|
revision = 1
|
|
metadata = meta(
|
|
description = "Block-sorting file compressor",
|
|
license = "bzip2-1.0.6",
|
|
website = "https://sourceware.org/bzip2/",
|
|
)
|
|
source = tarball_source(
|
|
url = f"https://sourceware.org/pub/bzip2/bzip2-{version}.tar.gz",
|
|
sha256 = "?",
|
|
strip_components = 1,
|
|
)
|
|
host_deps = ["binutils", "gcc"]
|
|
|
|
# bzip2 ships only a plain Makefile, no configure script.
|
|
|
|
def build(ctx):
|
|
# Copy sources into the build dir so the in-tree Makefile can write here.
|
|
ctx.run(["cp", "-rp", ctx.source_dir / ".", ctx.build_dir])
|
|
jobs = "-j" + str(ctx.jobs)
|
|
common = [
|
|
"CC=" + options.target_triple + "-gcc",
|
|
"AR=" + options.target_triple + "-ar",
|
|
"RANLIB=" + options.target_triple + "-ranlib",
|
|
"CFLAGS=" + options.cflags + " -D_FILE_OFFSET_BITS=64",
|
|
]
|
|
ctx.run(["make", jobs, "-f", "Makefile-libbz2_so"] + common)
|
|
ctx.run(["make", jobs, "libbz2.a", "bzip2", "bzip2recover"] + common)
|
|
|
|
def install(ctx, pkg):
|
|
ctx.run(["make", "install", "PREFIX=" + pkg.dest_dir + ctx.prefix])
|
|
# Install the shared library that the auxiliary Makefile produced.
|
|
libdir = pkg.dest_dir + ctx.prefix / "lib"
|
|
bindir = pkg.dest_dir + ctx.prefix / "bin"
|
|
ctx.run(["mkdir", "-p", libdir, bindir])
|
|
ctx.run(["cp", "-a", "libbz2.so." + version, libdir])
|
|
ctx.run(["ln", "-sf", "libbz2.so." + version, libdir + "/libbz2.so.1.0"])
|
|
ctx.run(["ln", "-sf", "libbz2.so." + version, libdir + "/libbz2.so.1"])
|
|
ctx.run(["ln", "-sf", "libbz2.so." + version, libdir + "/libbz2.so"])
|