Compare commits

..
1 Commits
Author SHA1 Message Date
sisungo b7d9d9b7d6 feat: add package perl
Signed-off-by: sisungo <[email protected]>
2026-07-03 22:30:54 +08:00
6 changed files with 75 additions and 49 deletions
-4
View File
@@ -1,5 +1,4 @@
import os
import stat
import subprocess
from lib import common
@@ -20,7 +19,4 @@ def autostrip(composer):
continue
if not _is_elf(ent.path):
continue
oldperm = stat.S_IMODE(os.stat(ent.path).st_mode)
os.chmod(ent.path, 0o777)
subprocess.run([strip, ent.path], check=True)
os.chmod(ent.path, oldperm)
-39
View File
@@ -30,45 +30,6 @@ def download(url, output):
last_percent = percent
try:
if url.startswith("file://"):
file_path = url[7:]
if not os.path.exists(file_path):
raise Exception("File not found: " + file_path)
total_size = os.path.getsize(file_path)
if total_size <= 0:
print("Copying...")
with open(file_path, "rb") as src, open(output, "wb") as dst:
while True:
chunk = src.read(8192)
if not chunk:
break
dst.write(chunk)
print("Download completed: " + output)
return output
sys.stdout.write("downloading... 0%")
sys.stdout.flush()
with open(file_path, "rb") as src, open(output, "wb") as dst:
downloaded = 0
block_size = 8192
while True:
chunk = src.read(block_size)
if not chunk:
break
dst.write(chunk)
downloaded += len(chunk)
percent = int(downloaded * 100 / total_size)
report_progress(percent)
if last_percent != 100:
report_progress(100)
sys.stdout.write("\n")
print("Download completed: " + output)
return output
req = urllib.request.Request(url, method="GET")
req.add_header(
"User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
+1
View File
@@ -18,6 +18,7 @@ def build():
)
cpp.make()
cpp.make_install()
os.chmod("bin/bmake", 0o655)
on_build(build)
+1 -6
View File
@@ -34,12 +34,7 @@ dep("libzstd @same-arch")
package("libarchive-tools")
cpp.use_auto_pack(["bin"])
dep("libarchive (same)")
provide("tar")
provide("cpio")
provide("unzip")
link("bin/bsdtar", "/bin/tar")
link("bin/bsdcpio", "/bin/cpio")
link("bin/bsdunzip", "/bin/unzip")
provide("bsdtar")
package("libarchive-dev")
cpp.use_auto_pack(["dev"])
+1
View File
@@ -12,6 +12,7 @@ def build():
cpp.configure()
cpp.make([f"CC={os.environ['CC']}"])
cpp.make_install()
subprocess.run(["sh", "-c", "chmod +w bin/* sbin/*"], check=True)
on_build(build)
+72
View File
@@ -0,0 +1,72 @@
import os
import subprocess
from lib import arch, cpp
from lib.make import *
upstream_version = "5.42.2"
version(upstream_version)
source_url("https://www.cpan.org/src/5.0/perl-5.42.2.tar.gz")
block_hook("autolink")
def build():
subprocess.run(
[
"./Configure",
"-de",
f"-Dcc={os.environ.get('CC', 'cc')}",
f"-Doptimize={os.environ.get('CFLAGS', '')}",
"-Dusethreads",
"-Duseshrplib",
"-Dprefix=/",
"-Dvendorprefix=/",
f"-Dprivlib={get_prefix('libperl')}/share/core_perl",
f"-Darchlib={get_prefix('libperl')}/lib/core_perl",
f"-Dsitelib=/lib/{arch.get_target()}/perl5/site_perl",
f"-Dsitearch=/lib/{arch.get_target()}/perl5/site_arch",
f"-Dvendorlib=/lib/{arch.get_target()}/perl5/vendor_perl",
f"-Dvendorarch=/lib/{arch.get_target()}/perl5/vendor_arch",
f"-Dscriptdir={get_prefix('perl')}/bin/core_perl",
"-Dsitescript=/bin/site_perl",
"-Dvendorscript=/bin/vendor_perl",
"-Dinc_version_list=none",
"-Dman1dir=/share/man/man1",
"-Dman3dir=/share/man/man3",
"-Dman1ext=1perl",
"-Dman3ext=3perl",
f"-Dlddlflags=-shared {os.environ.get('LDFLAGS', '')}",
f"-Dldflags={os.environ.get('LDFLAGS', '')}",
],
check=True,
)
cpp.make()
cpp.make_install()
on_build(build)
def pack_libperl(composer):
composer.makedir("lib")
composer.makedir("share")
composer.add_dir("lib/core_perl", "lib/core_perl")
composer.add_dir("share/core_perl", "share/core_perl")
package("libperl")
dep("semi-libc @same-arch")
on_pack(pack_libperl)
def pack_perl(composer):
composer.add_dir("bin", "bin")
package("perl")
dep("libperl (same)")
cpp.use_auto_pack(["bin"])
link("bin/perl", "/bin/perl")
link(f"bin/perl{upstream_version}", f"/bin/perl{upstream_version}")