2022-09-23 16:15:26 -07:00
|
|
|
# MAIN: https://www.perl.org/
|
|
|
|
# REPO: https://github.com/Perl/perl5
|
|
|
|
# FORK: https://github.com/G4Vi/perl5/tree/cosmo
|
|
|
|
FROM localhost/notwa-util AS downloader
|
|
|
|
|
2022-10-01 04:37:34 -07:00
|
|
|
ARG PERL_COMMIT=0240d1d8b66c1eabab08ea646ff2d9020b797c4d
|
2022-10-02 03:25:26 -07:00
|
|
|
ARG PERL_SHA256=08800feacf38cae6b0067896c8d585a20f6ec2ccfc8bce08b93d0dfaabab7ae9
|
2022-09-23 16:15:26 -07:00
|
|
|
|
2022-09-23 17:22:17 -07:00
|
|
|
ARG PERLTIDY_VERSION=20220613
|
|
|
|
ARG PERLTIDY_SHA256=50496a6952904ef28f495919fc0a67801a63c87779c61308ce1ca5b32467c5d4
|
|
|
|
|
2022-09-23 16:15:26 -07:00
|
|
|
RUN --mount=type=cache,id=common,target=/media/common,sharing=locked \
|
|
|
|
--mount=type=tmpfs,target=/tmp : \
|
|
|
|
&& cd /media/common \
|
2022-09-23 17:22:17 -07:00
|
|
|
&& name=perl \
|
2022-09-23 16:15:26 -07:00
|
|
|
&& export remote_fn="$PERL_COMMIT.tar.gz" \
|
|
|
|
&& export local_fn="$name-$remote_fn" \
|
2022-09-23 17:22:17 -07:00
|
|
|
&& export remote_url="https://github.com/G4Vi/perl5/archive/$remote_fn" \
|
2022-09-23 16:15:26 -07:00
|
|
|
&& export dest=/$name \
|
|
|
|
&& export sha256="$PERL_SHA256" \
|
|
|
|
&& acquire \
|
2022-09-23 17:22:17 -07:00
|
|
|
\
|
|
|
|
&& name=perltidy \
|
|
|
|
&& export remote_fn="Perl-Tidy-$PERLTIDY_VERSION.tar.gz" \
|
|
|
|
&& export local_fn="$name-$PERLTIDY_VERSION.tar.gz" \
|
|
|
|
&& export remote_url="https://cpan.metacpan.org/authors/id/S/SH/SHANCOCK/$remote_fn" \
|
|
|
|
&& export dest=/$name \
|
|
|
|
&& export sha256="$PERLTIDY_SHA256" \
|
|
|
|
&& acquire \
|
2022-09-23 16:15:26 -07:00
|
|
|
;
|
|
|
|
|
|
|
|
FROM localhost/cosmo AS builder
|
|
|
|
|
|
|
|
# TODO: this shouldn't be necessary!
|
|
|
|
RUN apk add --no-cache make
|
|
|
|
|
2022-09-23 17:22:17 -07:00
|
|
|
COPY --from=downloader /perl /perl
|
2022-09-23 16:15:26 -07:00
|
|
|
RUN : \
|
|
|
|
&& cd cosmopolitan \
|
|
|
|
&& . ./env \
|
|
|
|
&& a="dist/$flavor" \
|
|
|
|
&& mkdir o o/ape o/ape/public o/libc o/libc/crt \
|
|
|
|
&& cp -t o/ape \
|
|
|
|
"$a/ape-copy-self.o" \
|
|
|
|
"$a/ape-no-modify-self.o" \
|
|
|
|
"$a/ape.elf" \
|
|
|
|
"$a/ape.lds" \
|
|
|
|
"$a/ape.o" \
|
|
|
|
&& cp -t o/ape/public \
|
|
|
|
"$a/public/ape.lds" \
|
|
|
|
&& cp -t o/libc/crt \
|
|
|
|
"$a/crt.o" \
|
|
|
|
&& cp -t o \
|
|
|
|
"$a/cosmopolitan.a" \
|
|
|
|
"$a/cosmopolitan.h" \
|
|
|
|
\
|
|
|
|
&& tar zxf dist/headers.tar.gz \
|
|
|
|
\
|
|
|
|
&& for f in \
|
|
|
|
bin/unzip.com \
|
|
|
|
bin/zip.com \
|
|
|
|
;do : \
|
|
|
|
&& cp -- "$f" /a.out \
|
|
|
|
&& /cosmopolitan/bin/ape bin/assimilate.com /a.out \
|
|
|
|
&& install -m0755 /a.out "/usr/bin/$(basename "${f%.com}")" \
|
|
|
|
;done \
|
|
|
|
\
|
|
|
|
&& rm /usr/bin/strings \
|
|
|
|
&& for f in gcc/bin/* \
|
|
|
|
;do : \
|
|
|
|
&& g="$(basename "$f")" \
|
|
|
|
&& ln -s "$(realpath "$f")" "/usr/bin/${g#x86_64-linux-musl-}" \
|
|
|
|
;done \
|
|
|
|
;
|
|
|
|
|
2022-09-23 17:22:17 -07:00
|
|
|
WORKDIR perl
|
2022-09-23 16:15:26 -07:00
|
|
|
|
2022-10-01 11:02:27 -07:00
|
|
|
COPY --chmod=0755 --from=localhost/notwa-util /nu/shed /usr/bin/
|
2022-09-23 16:15:26 -07:00
|
|
|
RUN : \
|
2022-10-01 10:36:12 -07:00
|
|
|
&& shed hints/cosmo.sh '/x86_64-linux-musl/d' \
|
|
|
|
&& shed Makefile.SH 's/.*-musl-objcopy/\tobjcopy/g' \
|
|
|
|
&& shed MANIFEST '/^cosmo\//d' \
|
2022-09-25 20:09:25 -07:00
|
|
|
\
|
2022-09-23 16:15:26 -07:00
|
|
|
&& COSMO_MODE="" COSMO_REPO="/cosmopolitan" sh Configure -d -e \
|
|
|
|
-Dprefix="/zip" \
|
|
|
|
-Dusedevel \
|
2022-09-23 17:08:10 -07:00
|
|
|
-Uversiononly \
|
2022-09-23 16:15:26 -07:00
|
|
|
-Doptimize="-Os" \
|
|
|
|
-Dmyhostname="cosmo" \
|
|
|
|
-Dmydomain="invalid" \
|
|
|
|
-Dcf_by="cosmo" \
|
|
|
|
-DDEBUGGING \
|
|
|
|
;
|
|
|
|
|
|
|
|
RUN make -j2
|
|
|
|
|
|
|
|
RUN make -j2 minitest devtty=/dev/zero | tee minitest_results.txt
|
|
|
|
|
|
|
|
RUN : \
|
2022-10-01 04:37:34 -07:00
|
|
|
&& mkdir "/perl/cosmo" \
|
2022-09-23 17:22:17 -07:00
|
|
|
&& mkdir "/perl/cosmo/o" \
|
|
|
|
&& mkdir "/perl/cosmo/o/tmp" \
|
|
|
|
&& cp "/perl/perl.com" "/perl/cosmo/o/tmp/perl.com" \
|
|
|
|
&& make "DESTDIR=/perl/cosmo/o/tmp" install.perl \
|
2022-09-23 16:15:26 -07:00
|
|
|
;
|
|
|
|
RUN : \
|
2022-09-23 17:22:17 -07:00
|
|
|
&& cd "/perl/cosmo/o/tmp/zip" \
|
2022-09-23 17:08:10 -07:00
|
|
|
&& rm "bin/perl" "bin/perl5.36.0" \
|
2022-09-23 16:15:26 -07:00
|
|
|
&& find lib -name '*.a' -delete \
|
|
|
|
&& find lib -name '*.h' -delete \
|
|
|
|
&& find -name '*.pod' -delete \
|
|
|
|
&& cp "../perl.com" "../perl.com.bak" \
|
2022-09-23 17:08:10 -07:00
|
|
|
&& chmod u+w "../perl.com" \
|
2022-09-23 16:15:26 -07:00
|
|
|
&& zip -qr "../perl.com" "lib" \
|
|
|
|
&& mv "../perl.com" "../../perl.com" \
|
|
|
|
;
|
2022-09-23 17:22:17 -07:00
|
|
|
COPY --from=downloader /perltidy /perltidy
|
2022-09-23 16:15:26 -07:00
|
|
|
RUN : \
|
2022-09-23 17:22:17 -07:00
|
|
|
&& cd "/perltidy" \
|
|
|
|
&& /perl/cosmo/o/perl.com pm2pl \
|
2022-09-23 17:36:48 -07:00
|
|
|
&& mv "perltidy-"*".pl" /perl/perltidy.pl \
|
2022-09-23 17:22:17 -07:00
|
|
|
&& cd "/perl/cosmo/o/tmp/zip" \
|
2022-09-23 16:15:26 -07:00
|
|
|
&& find -type f -name '*.pm' -exec \
|
2022-09-23 17:22:17 -07:00
|
|
|
/cosmopolitan/o/ape/ape.elf ../../perl.com /perl/perltidy.pl \
|
2022-09-23 16:15:26 -07:00
|
|
|
--mangle --delete-all-comments --backup-and-modify-in-place --backup-file-extension=/ {} \
|
|
|
|
+ \
|
2022-09-23 17:08:10 -07:00
|
|
|
;
|
|
|
|
RUN : \
|
2022-09-23 17:22:17 -07:00
|
|
|
&& cd "/perl/cosmo/o/tmp/zip" \
|
2022-09-23 16:15:26 -07:00
|
|
|
&& cp "../perl.com.bak" "../perl.com" \
|
2022-09-23 17:08:10 -07:00
|
|
|
&& chmod u+w "../perl.com" \
|
|
|
|
&& zip -qr "../perl.com" "bin" \
|
2022-09-23 16:15:26 -07:00
|
|
|
&& zip -qr "../perl.com" "lib" \
|
|
|
|
&& mv "../perl.com" "../../perl.com" \
|
|
|
|
;
|
|
|
|
|
|
|
|
FROM scratch AS runner
|
2022-10-01 11:02:27 -07:00
|
|
|
COPY --chmod=0755 --from=localhost/notwa-util /nu/busybox /bin/busybox
|
2022-09-23 16:15:26 -07:00
|
|
|
COPY --chmod=0755 --from=builder /cosmopolitan/bin/ape /bin/ape
|
2022-09-23 17:22:17 -07:00
|
|
|
COPY --chmod=0755 --from=builder /perl/cosmo/o/perl.com /bin/perl.com
|
|
|
|
COPY --chmod=0755 --from=builder /perl/perl.elf /bin/perl.com.dbg
|
|
|
|
COPY --from=builder /perl/minitest_results.txt /minitest_results.txt
|
2022-09-23 16:15:26 -07:00
|
|
|
ENTRYPOINT ["/bin/ape", "/bin/perl.com"]
|