1 parent
0751b65860
commit
ba9b8fb242
1 file changed
+70
@@ -0,0 +1,70 @@
|
||||
import os
|
||||
import glob
|
||||
import subprocess
|
||||
|
||||
from lib import cpp
|
||||
from lib.make import *
|
||||
|
||||
|
||||
version("2.78")
|
||||
description("Linux capabilities library")
|
||||
maintainer("sisungo <[email protected]>")
|
||||
source_url("https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.78.tar.gz")
|
||||
|
||||
builddep("shortcut/c")
|
||||
builddep("shortcut/autotools")
|
||||
builddep("linux-dev @target")
|
||||
builddep("bash")
|
||||
|
||||
supported_arch(lambda arch: "linux" in arch)
|
||||
|
||||
|
||||
def build():
|
||||
# FIXME: Cannot build docs, so make it force-ignored
|
||||
subprocess.run(["touch", "progs/capshdoc.c.cf"], check=True)
|
||||
cpp.make([f"CC={os.environ.get('CC', 'cc')}"])
|
||||
cpp.make_install()
|
||||
|
||||
on_build(build)
|
||||
|
||||
|
||||
def fix_pc(path):
|
||||
with open(path) as fd:
|
||||
pc = fd.read()
|
||||
pc = pc.replace("prefix=/usr\n", "prefix=/\n")
|
||||
pc = pc.replace("includedir=/usr/include\n", f"includedir={get_prefix('libcap-dev')}/include\n")
|
||||
pc = pc.replace("libdir=/\n", f"libdir={get_prefix('libcap')}/lib\n")
|
||||
with open(path, "wt+") as fd:
|
||||
fd.write(pc)
|
||||
|
||||
def pack(composer):
|
||||
composer.makedir("lib")
|
||||
for i in glob.glob("*.so*"):
|
||||
composer.add(i, f"lib/{i}")
|
||||
|
||||
def pack_tools(composer):
|
||||
composer.add("sbin", "bin")
|
||||
|
||||
def pack_dev(composer):
|
||||
composer.makedir("lib")
|
||||
fix_pc("pkgconfig/libcap.pc")
|
||||
fix_pc("pkgconfig/libpsx.pc")
|
||||
composer.add("pkgconfig", "lib/pkgconfig")
|
||||
composer.add("include")
|
||||
composer.add("libcap.a", "lib/libcap.a")
|
||||
composer.add("libpsx.a", "lib/libpsx.a")
|
||||
|
||||
package("libcap")
|
||||
dep("semi-libc @same-arch")
|
||||
on_pack(pack)
|
||||
|
||||
package("libcap-tools")
|
||||
dep("semi-libc @same-arch")
|
||||
dep("libcap (same)")
|
||||
on_pack(pack_tools)
|
||||
|
||||
package("libcap-dev")
|
||||
dep("semi-libc-dev @same-arch")
|
||||
dep("libcap (same)")
|
||||
dep("linux-dev @same-arch")
|
||||
on_pack(pack_dev)
|
||||
Reference in new issue
Block a user