forked from semios/ports
76 lines
1.9 KiB
Python
76 lines
1.9 KiB
Python
import os
|
|
|
|
from lib import rust
|
|
from lib.make import *
|
|
|
|
|
|
version("0.1.0-alpha.2")
|
|
description("Linux device userspace daemon.")
|
|
maintainer("sisungo <[email protected]>")
|
|
source_managed("gitea://gitea.semilabs.org/semios/lxdeviced#0.1.0-alpha.2", "rust")
|
|
|
|
builddep("shortcut/rust")
|
|
|
|
|
|
def build():
|
|
rust.build()
|
|
|
|
on_build(build)
|
|
|
|
|
|
PKGCONF_LIBUDEV="""
|
|
prefix=/
|
|
exec_prefix=/
|
|
libdir=
|
|
includedir=
|
|
|
|
Name: libudev
|
|
Description: Udev library -- compatible, powered by lxdeviced
|
|
Version: 260
|
|
Cflags: -I${includedir}
|
|
Libs: -L${libdir} -ludev
|
|
"""
|
|
|
|
|
|
def pack(composer):
|
|
composer.makedirs("share/device")
|
|
composer.add_dir("misc/rules", "share/device/rules")
|
|
composer.add_dir("misc/airup", "share/services")
|
|
oldpwd = os.getcwd()
|
|
os.chdir(rust.artifacts_dir())
|
|
composer.makedir("bin")
|
|
composer.addfile("lxdeviced", "bin/lxdeviced")
|
|
composer.addfile("device", "bin/device")
|
|
os.chdir(oldpwd)
|
|
|
|
def pack_libudev(composer):
|
|
oldpwd = os.getcwd()
|
|
os.chdir(rust.artifacts_dir())
|
|
composer.makedir("lib")
|
|
composer.addfile("libudev.so", "lib/libudev.so")
|
|
os.chdir(oldpwd)
|
|
|
|
def pack_libudev_dev(composer):
|
|
oldpwd = os.getcwd()
|
|
composer.makedir("include")
|
|
composer.addfile("libcompat/udev/include/libudev.h", "include/libudev.h")
|
|
composer.makedirs("lib/pkgconfig")
|
|
pkgconf = PKGCONF_LIBUDEV.replace("libdir=", f"libdir={get_prefix('lxdeviced-libudev')}/lib")
|
|
pkgconf = PKGCONF_LIBUDEV.replace("includedir=", f"includedir={get_prefix('lxdeviced-libudev-dev')}/include")
|
|
with open(f"{composer.workdir}/bundle/lib/pkgconfig/libudev.pc", "wt+") as file:
|
|
file.write(pkgconf)
|
|
os.chdir(oldpwd)
|
|
|
|
|
|
package("lxdeviced")
|
|
on_pack(pack)
|
|
dep("semi-libc @same-arch")
|
|
|
|
package("lxdeviced-libudev")
|
|
on_pack(pack_libudev)
|
|
dep("semi-libc @same-arch")
|
|
|
|
package("lxdeviced-libudev-dev")
|
|
on_pack(pack_libudev_dev)
|
|
dep("lxdeviced-libudev (same)")
|