Compare commits

..
1 Commits
Author SHA1 Message Date
sisungo aee73b0820 feat: add package graphite
Signed-off-by: sisungo <[email protected]>
2026-08-19 19:58:58 +08:00
3 changed files with 58 additions and 43 deletions
+10 -42
View File
@@ -4,7 +4,6 @@ import sys
import tarfile
import urllib.parse
import urllib.request
import zipfile
def filename(url):
@@ -129,25 +128,6 @@ def tar_common_root(tar: tarfile.TarFile) -> str | None:
return root
def zip_common_root(zip_file: zipfile.ZipFile) -> str | None:
members = zip_file.infolist()
if not members:
return None
root = None
for member in members:
path = member.filename.replace('\\', '/').lstrip('./').lstrip('/')
if not path:
continue
this_root = path.split('/')[0]
if this_root in ('', '.', '..'):
continue
if root is None:
root = this_root
elif this_root != root:
return None
return root
def sources_dir_name() -> str:
with open("./target/sources.tag") as file:
return file.read()
@@ -159,28 +139,16 @@ def source_url(url: str):
download_path = f"./target/{filename(url)}"
download(url, download_path)
if download_path.endswith(".zip"):
with zipfile.ZipFile(download_path, "r") as zip:
common_root = zip_common_root(zip)
else:
with tarfile.open(download_path, "r") as tar:
common_root = tar_common_root(tar)
extract_dir = "./target"
sources_dir = f"./target/{common_root}"
if common_root in ["", ".", None]:
extract_dir = "./target/sources"
sources_dir = "./target/sources"
if download_path.endswith(".zip"):
with zipfile.ZipFile(download_path, "r") as zip:
zip.extractall(extract_dir)
else:
with tarfile.open(download_path, "r") as tar:
tar.extractall(extract_dir)
with open("./target/sources.tag", "wt+") as file:
file.write(sources_dir)
with tarfile.open(download_path, "r") as tar:
common_root = tar_common_root(tar)
extract_dir = "./target"
sources_dir = f"./target/{common_root}"
if common_root in ["", ".", "None"]:
extract_dir = "./target/sources"
sources_dir = "./target/sources"
tar.extractall(extract_dir)
with open("./target/sources.tag", "wt+") as file:
file.write(sources_dir)
def _git_repo_name(url: str) -> str:
+48
View File
@@ -0,0 +1,48 @@
import os
import lib.cpp as cpp
from lib.make import *
version("1.3.15")
description("Graphite is a \"smart font\" system developed specifically to handle the complexities of lesser-known languages of the world.")
maintainer("sisungo <[email protected]>")
source_url("https://github.com/silnrsi/graphite/releases/download/1.3.15/graphite2-1.3.15.tgz")
builddep("shortcut/c++")
builddep("shortcut/cmake")
def build():
cpp.cmake([
f"-DCMAKE_INSTALL_PREFIX={get_prefix('libgraphite-dev')}",
])
cpp.ninja()
cpp.ninja_install()
on_build(build)
def pack_dev(composer):
composer.add_dir("bin", "bin")
composer.add_dir("include", "include")
composer.add_dir("share", "share")
composer.makedir("lib")
composer.add_dir("lib/pkgconfig", "lib/pkgconfig")
for i in os.listdir("lib"):
if not os.path.isfile(f"lib/{i}"):
continue
if ".so" in i:
os.symlink(f"{get_prefix('libgraphite')}/lib/{i}", f"{composer.workdir}/bundle/lib/{i}")
else:
composer.addfile(f"lib/{i}", f"lib/{i}")
package("libgraphite")
dep("semi-libc @same-arch")
cpp.use_auto_pack(["lib"])
package("libgraphite-dev")
dep("libgraphite (same)")
dep("semi-libc-dev @same-arch")
on_pack(pack_dev)
-1
View File
@@ -119,7 +119,6 @@ def cmd_build_package(package: str):
"version": pkgver,
"arch": pkgarch,
"description": pkginfo[lib.make._key_description],
"maintainers": pkginfo[lib.make._key_maintainers],
"dependencies": pkginfo[lib.make._key_dependencies],
"provides": pkginfo[lib.make._key_provides],
"recommendations": pkginfo[lib.make._key_recommendations],