From c0a5739dde1c426d737505fd6d250a3cc55d9d60 Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 13 Oct 2025 00:09:12 -0300 Subject: [PATCH] ports: perl --- host-recipes/perl-cross | 8 + patches/perl-cross/jinx-working-patch.patch | 39 +++ recipes/perl | 21 ++ source-recipes/perl | 259 ++++++++++++++++++++ source-recipes/perl-cross | 10 + 5 files changed, 337 insertions(+) create mode 100644 host-recipes/perl-cross create mode 100644 patches/perl-cross/jinx-working-patch.patch create mode 100644 recipes/perl create mode 100644 source-recipes/perl create mode 100644 source-recipes/perl-cross diff --git a/host-recipes/perl-cross b/host-recipes/perl-cross new file mode 100644 index 00000000..f074fff3 --- /dev/null +++ b/host-recipes/perl-cross @@ -0,0 +1,8 @@ +name=perl-cross +revision=1 +from_source=perl-cross + +package() { + mkdir -p ${dest_dir}/${prefix}/share/perl-cross/ + cp -rp ${source_dir}/* ${dest_dir}/${prefix}/share/perl-cross/ +} diff --git a/patches/perl-cross/jinx-working-patch.patch b/patches/perl-cross/jinx-working-patch.patch new file mode 100644 index 00000000..0dbf8893 --- /dev/null +++ b/patches/perl-cross/jinx-working-patch.patch @@ -0,0 +1,39 @@ +diff --git perl-cross-clean/cnf/configure_tool.sh perl-cross-workdir/cnf/configure_tool.sh +index 5b6d099..3a70872 100644 +--- perl-cross-clean/cnf/configure_tool.sh ++++ perl-cross-workdir/cnf/configure_tool.sh +@@ -274,6 +274,10 @@ if not hinted 'osname'; then + define osname "midipix" + result "Midipix" + ;; ++ *-astral*) ++ define osname "astral" ++ result "Astral" ++ ;; + *) + result "no" + ;; +diff --git perl-cross-workdir/cnf/hints/astral perl-cross-workdir/cnf/hints/astral +new file mode 100644 +index 0000000..b448683 +--- /dev/null ++++ perl-cross-workdir/cnf/hints/astral +@@ -0,0 +1,18 @@ ++d_voidsig='define' ++d_nanosleep='define' ++d_clock_gettime='define' ++ ++usemallocwrap='define' ++ ++libswanted='m crypt pthread nm ndbm gdbm dbm db dl gdbm_compat' ++ ++st_ino_sign=1 ++st_ino_size=8 ++ ++d_fcntl_can_lock='undef' ++ ++d_setlocale='undef' ++d_nl_langinfo_l='undef' ++d_nl_langinfo='undef' ++ ++d_sigsetjmp='undef' diff --git a/recipes/perl b/recipes/perl new file mode 100644 index 00000000..4f561e0f --- /dev/null +++ b/recipes/perl @@ -0,0 +1,21 @@ +name=perl +revision=1 +from_source=perl +imagedeps="build-essential" +hostdeps="xgcc xbinutils perl-cross" +deps="base bzip2 libxcrypt zlib libintl gettext" + +configure() { + cp -rp ${source_dir}/* . + cp -rp /usr/local/share/perl-cross/* . + CFLAGS="${CFLAGS} -DNO_LOCALE" ./configure --target=x86_64-astral --prefix=${prefix} -Dvendorprefix=${prefix} --target-tools-prefix=x86_64-astral- --mode=cross --targetarch=x86_64-astral --sysroot=${sysroot_dir} + bash +} + +build() { + CFLAGS="${CFLAGS} -DNO_LOCALE" make #-j${parallelism} +} + +package() { + CFLAGS="${CFLAGS} -DNO_LOCALE" make install DESTDIR="${dest_dir}" +} diff --git a/source-recipes/perl b/source-recipes/perl new file mode 100644 index 00000000..ed4adb00 --- /dev/null +++ b/source-recipes/perl @@ -0,0 +1,259 @@ +name=perl +version=5.40.2 +source_method=tarball +tarball_url="https://www.cpan.org/src/5.0/perl-${version}.tar.gz" +tarball_sha512=78a186f6511e672ebac4c4627c446d3faaeab05fd6b190a7056b8e674eea33762bf1dc7ac9d695f9959366c34ecdc4c49030d7dad29ff42d1a53ce7c5d558d10 +hostdeps="autoconf automake libtool pkgconfig" +allow_network=yes + +prepare() { + # get some modules + # TODO: verify integrity? + + curl https://cpan.metacpan.org/authors/id/M/ML/MLEHMANN/common-sense-3.75.tar.gz > cpan/common-sense.tar.gz + curl https://cpan.metacpan.org/authors/id/J/JS/JSTOWE/TermReadKey-2.38.tar.gz > cpan/term-readkey.tar.gz + curl https://cpan.metacpan.org/authors/id/A/AT/ATOOMIC/Time-HiRes-1.9764.tar.gz > cpan/time-hires.tar.gz + + cd cpan + # common-sense + echo preparing common::sense + tar -xf common-sense.tar.gz + mv common-sense-* common-sense + + # term-readkey + echo preparing term::readkey + tar -xf term-readkey.tar.gz + mv TermReadKey-* Term-ReadKey + + # term-readkey has a very stupid step in its build process that involves running perl with it linked to check for its configuration + # patch it to not do that and use a known preset one + #mkdir -v Term-ReadKey-Tmp + #mv -v Term-ReadKey/ReadKey.pm.PL Term-ReadKey-Tmp/ + + patch -F 3 -l --no-backup-if-mismatch -p1 -d Term-ReadKey <<- 'EOF' + diff --git perl-term-readkey-clean/ReadKey.pm.PL perl-term-readkey-workdir/ReadKey.pm.PL + index 1ebbdd3..13dc559 100644 + --- perl-term-readkey-clean/ReadKey.pm.PL + +++ perl-term-readkey-workdir/ReadKey.pm.PL + @@ -505,133 +505,9 @@ sub GetTerminalSize + !FIRSTPART + + close OUT; + -# preload the XS module needed for the blockoptions() expansions below + -# does not work with miniperl + -package Term::ReadKey; + -require DynaLoader; + -our @ISA = qw(DynaLoader); + - + -print "Bootstrapping the XS for blockoptions: "; + -bootstrap Term::ReadKey or die; + -print blockoptions()."\n"; + - + open OUT, ">>", $file or die "Can't append to $file: $!"; + print OUT "# blockoptions: \n"; + -if ( &blockoptions() & 1 ) # Use nodelay + -{ + - print OUT "#nodelay\n"; + - if ( &blockoptions() & 2 ) #poll + - { + - print OUT <<'!NO!SUBS!'; + -# poll + -sub ReadKey { + - my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + - if (defined $_[0] && $_[0] > 0) { + - if ($_[0]) { + - return undef if &pollfile($File,$_[0]) == 0; + - } + - } + - if (defined $_[0] && $_[0] < 0) { &setnodelay($File,1); } + - my $value = getc $File; + - if (defined $_[0] && $_[0] < 0) { &setnodelay($File,0); } + - $value; + -} + -sub ReadLine { + - my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + - if (defined $_[0] && $_[0] > 0) { + - if ($_[0]) { + - return undef if &pollfile($File,$_[0]) == 0; + - } + - } + - if (defined $_[0] && $_[0] < 0) { &setnodelay($File,1) }; + - my $value = scalar(<$File>); + - if (defined $_[0] && $_[0] < 0) { &setnodelay($File,0) }; + - $value; + -} + -!NO!SUBS! + - + - } + - elsif ( &blockoptions() & 4 ) #select + - { + - print OUT <<'!NO!SUBS!'; + -#select + -sub ReadKey { + - my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + - if (defined $_[0] && $_[0] > 0) { + - if ($_[0]) { return undef if &selectfile($File,$_[0]) == 0 } + - } + - if (defined $_[0] && $_[0] < 0) { &setnodelay($File,1); } + - my $value = getc $File; + - if (defined $_[0] && $_[0] < 0) { &setnodelay($File,0); } + - $value; + -} + -sub ReadLine { + - my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + - if (defined $_[0] && $_[0] > 0) { + - if ($_[0]) { return undef if &selectfile($File,$_[0]) == 0 } + - } + - if (defined $_[0] && $_[0] < 0) { &setnodelay($File,1) }; + - my $value = scalar(<$File>); + - if (defined $_[0] && $_[0] < 0) { &setnodelay($File,0) }; + - $value; + -} + -!NO!SUBS! + - + - } + - else + - { #nothing + - print OUT <<'!NO!SUBS!'; + -sub ReadKey { + - my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + - if (defined $_[0] && $_[0] > 0) { + - # Nothing better seems to exist, so I just use time-of-day + - # to timeout the read. This isn't very exact, though. + - $starttime = time; + - $endtime = $starttime + $_[0]; + - &setnodelay($File,1); + - my $value; + - while (time < $endtime) { # This won't catch wraparound! + - $value = getc $File; + - last if defined($value); + - } + - &setnodelay($File,0); + - return $value; + - } + - if (defined $_[0] && $_[0] < 0) { &setnodelay($File,1); } + - my $value = getc $File; + - if (defined $_[0] && $_[0] < 0) { &setnodelay($File,0); } + - $value; + -} + -sub ReadLine { + - my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + - if (defined $_[0] && $_[0] > 0) { + - # Nothing better seems to exist, so I just use time-of-day + - # to timeout the read. This isn't very exact, though. + - $starttime = time; + - $endtime = $starttime + $_[0]; + - &setnodelay($File,1); + - my $value; + - while (time < $endtime) { # This won't catch wraparound! + - $value = scalar(<$File>); + - last if defined($value); + - } + - &setnodelay($File,0); + - return $value; + - } + - if (defined $_[0] && $_[0] < 0) { &setnodelay($File,1) }; + - my $value = scalar(<$File>); + - if (defined $_[0] && $_[0] < 0) { &setnodelay($File,0) }; + - $value; + -} + -!NO!SUBS! + - + - } + -} + -else { + print OUT "#no nodelay\n"; + - + - if ( &blockoptions() & 2 ) # Use poll + - { + print OUT <<'!NO!SUBS!'; + #poll + sub ReadKey { + @@ -649,77 +525,6 @@ sub ReadLine { + scalar(<$File>); + } + !NO!SUBS! + - + - } + - elsif ( &blockoptions() & 4 ) # Use select + - { + - print OUT <<'!NO!SUBS!'; + -#select + -sub ReadKey { + - my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + - if (defined $_[0] && $_[0] != 0) { + - return undef if &selectfile($File,$_[0]) == 0 + - } + - getc $File; + -} + -sub ReadLine { + - my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + - if (defined $_[0] && $_[0] != 0) { + - return undef if &selectfile($File,$_[0]) == 0; + - } + - scalar(<$File>); + -} + -!NO!SUBS! + - + - } + - elsif ( &blockoptions() & 8 ) # Use Win32 + - { + - print OUT <<'!NO!SUBS!'; + -#Win32 + -sub ReadKey { + - my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + - if ($_[0] || $CurrentMode >= 3) { + - Win32PeekChar($File, $_[0]); + - } else { + - getc $File; + - } + - #if ($_[0]!=0) {return undef if !Win32PeekChar($File, $_[0])}; + - #getc $File; + -} + -sub ReadLine { + - my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + - #if ($_[0]!=0) {return undef if !Win32PeekChar($File, $_[0])}; + - #scalar(<$File>); + - if ($_[0]) { + - croak("Non-blocking ReadLine is not supported on this architecture") + - } + - scalar(<$File>); + -} + -!NO!SUBS! + - + - } + - else + - { + - print OUT <<'!NO!SUBS!'; + -sub ReadKey { + - my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + - if ($_[0]) { + - croak("Non-blocking ReadKey is not supported on this architecture") + - } + - getc $File; + -} + -sub ReadLine { + - my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + - if ($_[0]) { + - croak("Non-blocking ReadLine is not supported on this architecture") + - } + - scalar(<$File>); + -} + -!NO!SUBS! + - + - } + -} + - + print OUT <<'EOF'; + 1; + # ex: set ro: + EOF + + # time-hires + echo preparing time::hires + tar -xf time-hires.tar.gz + mv Time-HiRes-* Time-HiRes + + + true +} diff --git a/source-recipes/perl-cross b/source-recipes/perl-cross new file mode 100644 index 00000000..bb7ac0c4 --- /dev/null +++ b/source-recipes/perl-cross @@ -0,0 +1,10 @@ +name=perl-cross +version=1.6.2 +source_method=tarball +tarball_url="https://github.com/arsv/perl-cross/releases/download/${version}/perl-cross-${version}.tar.gz" +tarball_sha512=51b45bf972304634d706d09e27d457636e43f9f27f739004eca529b21245ba78612dcb08b54225fc7ca19511983642c37915939ea8aa1c1a4560093474d9e76b +hostdeps="automake" + +prepare() { + cp -v $(find /usr/local/share/automake* -name config.sub) cnf +}