Compare commits

..
1 Commits
Author SHA1 Message Date
sisungo 8563002537 feat: add package ugrep
Signed-off-by: sisungo <[email protected]>
2026-07-06 14:49:58 +08:00
10 changed files with 51 additions and 217 deletions
+1 -12
View File
@@ -1,7 +1,6 @@
import json
import os
import shutil
import subprocess
import sys
if sys.version_info >= (3, 14):
@@ -46,14 +45,4 @@ class PkgComposer:
shutil.copy2(src, f"{self.workdir}/bundle/{dst}", follow_symlinks=False)
def add_dir(self, src: str, dst: str, merge: bool = False):
target = f"{self.workdir}/bundle/{dst}"
if not os.path.exists(src):
raise FileNotFoundError(f"Source directory not found: {src}")
os.makedirs(os.path.dirname(target), exist_ok=True)
if merge and os.path.exists(target) and os.path.isdir(target):
cmd = ["cp", "-a", f"{src}/.", target]
else:
cmd = ["cp", "-a", src, target]
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
raise RuntimeError(f"cp command failed: {result.stderr}")
shutil.copytree(src, f"{self.workdir}/bundle/{dst}", dirs_exist_ok=merge)
-29
View File
@@ -1,29 +0,0 @@
from lib import arch, cpp
from lib.make import *
version("7.0.3")
source_url("https://github.com/gavinhoward/bc/releases/download/7.0.3/bc-7.0.3.tar.gz")
def build():
predefined_build_type = "GDH"
if "-linux" in arch.get_target():
predefined_build_type = "GNU"
cpp.configure(
[
"--disable-nls",
"--opt=3",
f"--predefined-build-type={predefined_build_type}",
f"--prefix={get_prefix('bc')}",
]
)
cpp.make()
cpp.make_install()
on_build(build)
package("bc")
dep("semi-libc @same-arch")
provide("dc")
cpp.use_auto_pack(["bin"])
-22
View File
@@ -1,22 +0,0 @@
import os
from lib import cpp
from lib.make import *
version("2.0")
source_url("https://www.invisible-island.net/archives/byacc/byacc-2.0.tgz")
def build():
cpp.configure([f"--prefix={get_prefix('byacc')}", "--enable-btyacc"])
cpp.make()
cpp.make_install()
os.rename("bin/yacc", "bin/byacc")
on_build(build)
package("byacc")
dep("semi-libc @same-arch")
cpp.use_auto_pack(["bin", "lib", "dev"])
link("bin/byacc", "/bin/yacc")
-23
View File
@@ -1,23 +0,0 @@
from lib import cpp
from lib.make import *
version("2.6.4")
source_url("https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz")
def build():
cpp.configure(
[
f"--prefix={get_prefix('flex')}",
"--disable-nls",
]
)
cpp.make()
cpp.make_install()
on_build(build)
package("flex")
dep("semi-libc @same-arch")
cpp.use_auto_pack(["bin", "lib", "dev"])
-33
View File
@@ -1,33 +0,0 @@
import os
from lib import cpp
from lib.make import *
version("4.10")
source_url("https://ftp.gnu.org/gnu/sed/sed-4.10.tar.gz")
block_hook("autolink")
def build():
cpp.configure(
[
"--prefix=/",
f"--bindir={get_prefix('gnu-sed')}/bin",
"--disable-i18n",
"--disable-nls",
]
)
cpp.make()
cpp.make_install()
os.rename("bin/sed", "bin/gsed")
on_build(build)
package("gnu-sed")
provide("sed")
dep("semi-libc @same-arch")
cpp.use_auto_pack(["bin"])
link("bin/gsed", "/bin/gsed")
link("bin/gsed", "/bin/sed")
-26
View File
@@ -1,26 +0,0 @@
import subprocess
from lib.make import *
version("15.1.2")
source_url("https://gitea.semilabs.org/semios/grep/archive/v15.1.2.tar.gz")
def build():
subprocess.run(["./build.sh"], check=True)
on_build(build)
def pack_grep(composer):
composer.makedir("bin")
composer.addfile("grep", "bin/grep")
package("grep")
dep("semi-libc @same-arch")
dep("libpcre2 @same-arch")
on_pack(pack_grep)
link("bin/grep", "/bin/egrep")
link("bin/grep", "/bin/fgrep")
-24
View File
@@ -1,24 +0,0 @@
import shutil
import subprocess
from lib.make import *
version("15.1.1")
source_url("https://gitea.semilabs.org/semios/patch/archive/v15.1.1.tar.gz")
def build():
subprocess.run(["./build.sh"], check=True)
on_build(build)
def pack_patch(composer):
composer.makedir("bin")
composer.addfile("patch", "bin/patch")
package("patch")
dep("semi-libc @same-arch")
on_pack(pack_patch)
-35
View File
@@ -1,35 +0,0 @@
from lib import cpp
from lib.make import *
version("10.47")
source_url(
"https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.47/pcre2-10.47.tar.gz"
)
def build():
cpp.configure(
[
"--prefix=/",
f"--libdir={get_prefix('libpcre2')}/lib",
f"--bindir={get_prefix('pcre2-tools')}/bin",
"--enable-jit",
]
)
cpp.make()
cpp.make_install()
on_build(build)
package("libpcre2")
dep("semi-libc @same-arch")
cpp.use_auto_pack(["lib"])
package("pcre2-tools")
dep("libpcre2 (same)")
cpp.use_auto_pack(["bin"])
dep("libpcre2-dev")
dep("semi-libc @same-arch")
cpp.use_auto_pack(["dev"])
+5 -13
View File
@@ -1,24 +1,16 @@
import subprocess
from lib import rust
from lib.make import *
version("15.1.1")
source_url("https://gitea.semilabs.org/semios/sed/archive/v15.1.1.tar.gz")
version("0.1.1")
source_url("https://github.com/uutils/sed/releases/download/0.1.1/source.tar.gz")
def build():
subprocess.run(["./build.sh"])
rust.build()
on_build(build)
def pack_sed(composer):
composer.makedir("bin")
composer.addfile("sed", "bin/sed")
package("sed")
dep("semi-libc @same-arch")
dep("libpcre2 @same-arch")
on_pack(pack_sed)
rust.use_auto_pack(["bin"])
+45
View File
@@ -0,0 +1,45 @@
from lib import cpp
from lib.make import *
version("7.8.2")
source_url("https://github.com/Genivia/ugrep/archive/refs/tags/v7.8.2.tar.gz")
def build():
cpp.configure(
[
"--prefix=/",
f"--bindir={get_prefix('ugrep')}/bin",
f"--datarootdir={get_prefix('ugrep')}/share",
"--disable-7zip",
"--without-zlib",
"--without-bzlib",
"--without-lzma",
"--without-lz4",
"--without-zstd",
"--without-brotli",
"--without-bzip3",
"--without-pcre2",
"--without-boost-regex",
]
)
cpp.make()
cpp.make_install()
on_build(build)
def pack_ugrep(composer):
composer.add_dir("bin", "bin")
composer.makedir("share")
composer.add_dir("share/ugrep", "share/ugrep")
package("ugrep")
dep("semi-libc @same-arch")
provide("grep")
link("bin/ugrep", "/bin/grep")
link("bin/ugrep", "/bin/egrep")
link("bin/ugrep", "/bin/fgrep")
on_pack(pack_ugrep)