From e6abefc65a06d5ffb0a465ae1afd517baa319828 Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Sat, 2 Dec 2023 10:37:45 -0800 Subject: [PATCH] working rust 1.54 bootstrap build w/ required dep updates --- Makefile | 20 + packages/bash/Dockerfile | 13 +- packages/bootstrap/Dockerfile | 2 +- packages/gcc/Dockerfile | 9 +- packages/musl/Dockerfile | 4 + packages/musl/lfs64-2.patch | 240 +++++++++++ packages/musl/lfs64.patch | 735 ++++++++++++++++++++++++++++++++++ packages/rust/Dockerfile | 65 +++ packages/zlib/Dockerfile | 28 ++ 9 files changed, 1107 insertions(+), 9 deletions(-) create mode 100644 packages/musl/lfs64-2.patch create mode 100644 packages/musl/lfs64.patch create mode 100644 packages/rust/Dockerfile create mode 100644 packages/zlib/Dockerfile diff --git a/Makefile b/Makefile index fe12f0c..f3e1a23 100644 --- a/Makefile +++ b/Makefile @@ -105,6 +105,14 @@ out/py-setuptools.oci.tgz: \ out/python.oci.tgz docker build -t imgrep/py-setuptools --output type=oci,dest=$@ packages/py-setuptools +out/zlib.oci.tgz: \ + out/busybox.oci.tgz \ + out/gcc.oci.tgz \ + out/binutils.oci.tgz \ + out/musl.oci.tgz \ + out/make.oci.tgz + docker build -t imgrep/zlib --output type=oci,dest=$@ packages/zlib + out/llvm.oci.tgz: \ out/gcc.oci.tgz \ out/python.oci.tgz \ @@ -117,6 +125,18 @@ out/llvm.oci.tgz: \ out/musl.oci.tgz docker build -t imgrep/llvm --output type=oci,dest=$@ packages/llvm +out/rust.oci.tgz: \ + out/gcc.oci.tgz \ + out/bash.oci.tgz \ + out/zlib.oci.tgz \ + out/python.oci.tgz \ + out/binutils.oci.tgz \ + out/cmake.oci.tgz \ + out/make.oci.tgz \ + out/busybox.oci.tgz \ + out/musl.oci.tgz + docker build -t imgrep/rust --output type=oci,dest=$@ packages/rust + test: docker build -t imgrep/test-c tests/c docker build -t imgrep/test-go tests/go diff --git a/packages/bash/Dockerfile b/packages/bash/Dockerfile index bad27cd..087e783 100644 --- a/packages/bash/Dockerfile +++ b/packages/bash/Dockerfile @@ -7,10 +7,13 @@ ENV SOURCE_HASH=13720965b5f4fc3a0d4b61dd37e7565c741da9a5be24edc2ae00182fc1b3588c RUN wget ${SOURCE_SITE}/bash-${SOURCE_VERSION}.tar.gz RUN echo "${SOURCE_HASH} bash-${SOURCE_VERSION}.tar.gz" | sha256sum -c RUN tar -xzf bash-${SOURCE_VERSION}.tar.gz -RUN \ - cd bash-${SOURCE_VERSION} \ - && ./configure --enable-static-link \ - && make install +WORKDIR bash-${SOURCE_VERSION} +RUN set -eux; \ + ./configure \ + --prefix=/usr \ + --enable-static-link; \ + make DESTDIR=/home/user/rootfs +RUN make install DESTDIR=/home/user/rootfs FROM scratch -COPY --from=build /usr/local/bin/bash / +COPY --from=build /home/user/rootfs / diff --git a/packages/bootstrap/Dockerfile b/packages/bootstrap/Dockerfile index 41e0858..9803277 100644 --- a/packages/bootstrap/Dockerfile +++ b/packages/bootstrap/Dockerfile @@ -2,4 +2,4 @@ FROM alpine@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851 RUN set -ex; \ apk update; \ - apk add gcc g++ libc-dev make linux-headers + apk add gcc g++ libc-dev make linux-headers patch diff --git a/packages/gcc/Dockerfile b/packages/gcc/Dockerfile index 3a91040..7b49368 100644 --- a/packages/gcc/Dockerfile +++ b/packages/gcc/Dockerfile @@ -2,9 +2,10 @@ FROM imgrep/musl:latest as musl FROM imgrep/bootstrap:latest as build ENV GCC_SITE https://mirrors.kernel.org/gnu/gcc -ENV GCC_VERSION 13.2.0 -ENV GCC_HASH e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da +ENV GCC_VERSION 12.2.0 +ENV GCC_HASH e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff +RUN echo wget ${GCC_SITE}/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz RUN wget ${GCC_SITE}/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz RUN echo "${GCC_HASH} gcc-${GCC_VERSION}.tar.xz" | sha256sum -c RUN tar -xf gcc-${GCC_VERSION}.tar.xz @@ -35,7 +36,9 @@ RUN set -ex; \ --enable-link-serialization=2 \ --enable-linker-build-id; \ make -j "$(nproc)" -RUN make DESTDIR=/home/user/rootfs/ install-strip +RUN set -eux; \ + make DESTDIR=/home/user/rootfs/ install-strip; \ + ln -s gcc /home/user/rootfs/usr/bin/cc COPY --from=musl /lib/* /home/user/rootfs/lib/ FROM scratch diff --git a/packages/musl/Dockerfile b/packages/musl/Dockerfile index f18d42c..41351ba 100644 --- a/packages/musl/Dockerfile +++ b/packages/musl/Dockerfile @@ -11,7 +11,11 @@ RUN wget ${SRC_SITE}/releases/musl-$SRC_VERSION.tar.gz RUN echo "${SRC_HASH} musl-${SRC_VERSION}.tar.gz" | sha256sum -c RUN tar -xzf musl-${SRC_VERSION}.tar.gz WORKDIR musl-${SRC_VERSION} +ADD lfs64.patch . +ADD lfs64-2.patch . RUN set -eux; \ + patch -p1 < lfs64.patch; \ + patch -p1 < lfs64-2.patch; \ ./configure \ --build=x86_64-linux-musl \ --host=x86_64-linux-musl \ diff --git a/packages/musl/lfs64-2.patch b/packages/musl/lfs64-2.patch new file mode 100644 index 0000000..eda916a --- /dev/null +++ b/packages/musl/lfs64-2.patch @@ -0,0 +1,240 @@ +accompanies the prior patch, since keeping the symbols but not the headers +breaks things that test link tests but then expect header symbols. +-- +From c3fdda71bb1733081b72a244cbaef03a33d84531 Mon Sep 17 00:00:00 2001 +From: psykose +Date: Tue, 11 Apr 2023 21:28:51 +0200 +Subject: [PATCH] Revert "remove LFS64 programming interfaces (macro-only) from + _GNU_SOURCE" + +This reverts commit 25e6fee27f4a293728dd15b659170e7b9c7db9bc. +--- + include/aio.h | 2 +- + include/dirent.h | 2 +- + include/fcntl.h | 2 +- + include/ftw.h | 2 +- + include/glob.h | 2 +- + include/stdio.h | 2 +- + include/stdlib.h | 2 +- + include/sys/mman.h | 2 +- + include/sys/resource.h | 2 +- + include/sys/sendfile.h | 2 +- + include/sys/stat.h | 2 +- + include/sys/statfs.h | 2 +- + include/sys/statvfs.h | 2 +- + include/sys/types.h | 2 +- + include/sys/uio.h | 2 +- + include/unistd.h | 2 +- + 16 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/include/aio.h b/include/aio.h +index a938fcad..453c41b7 100644 +--- a/include/aio.h ++++ b/include/aio.h +@@ -49,7 +49,7 @@ int aio_fsync(int, struct aiocb *); + + int lio_listio(int, struct aiocb *__restrict const *__restrict, int, struct sigevent *__restrict); + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define aiocb64 aiocb + #define aio_read64 aio_read + #define aio_write64 aio_write +diff --git a/include/dirent.h b/include/dirent.h +index 2d8fffb2..650ecf64 100644 +--- a/include/dirent.h ++++ b/include/dirent.h +@@ -56,7 +56,7 @@ int getdents(int, struct dirent *, size_t); + int versionsort(const struct dirent **, const struct dirent **); + #endif + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define dirent64 dirent + #define readdir64 readdir + #define readdir64_r readdir_r +diff --git a/include/fcntl.h b/include/fcntl.h +index 515f255d..b664cdc4 100644 +--- a/include/fcntl.h ++++ b/include/fcntl.h +@@ -195,7 +195,7 @@ ssize_t tee(int, int, size_t, unsigned); + #define loff_t off_t + #endif + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define F_GETLK64 F_GETLK + #define F_SETLK64 F_SETLK + #define F_SETLKW64 F_SETLKW +diff --git a/include/ftw.h b/include/ftw.h +index d0445e8a..b15c062a 100644 +--- a/include/ftw.h ++++ b/include/ftw.h +@@ -29,7 +29,7 @@ struct FTW { + int ftw(const char *, int (*)(const char *, const struct stat *, int), int); + int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int); + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define ftw64 ftw + #define nftw64 nftw + #endif +diff --git a/include/glob.h b/include/glob.h +index fed06745..4a562a20 100644 +--- a/include/glob.h ++++ b/include/glob.h +@@ -39,7 +39,7 @@ void globfree(glob_t *); + #define GLOB_NOMATCH 3 + #define GLOB_NOSYS 4 + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define glob64 glob + #define globfree64 globfree + #define glob64_t glob_t +diff --git a/include/stdio.h b/include/stdio.h +index cb858618..d1ed01f0 100644 +--- a/include/stdio.h ++++ b/include/stdio.h +@@ -205,7 +205,7 @@ typedef struct _IO_cookie_io_functions_t { + FILE *fopencookie(void *, const char *, cookie_io_functions_t); + #endif + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define tmpfile64 tmpfile + #define fopen64 fopen + #define freopen64 freopen +diff --git a/include/stdlib.h b/include/stdlib.h +index b117a452..b507ca33 100644 +--- a/include/stdlib.h ++++ b/include/stdlib.h +@@ -163,7 +163,7 @@ double strtod_l(const char *__restrict, char **__restrict, struct __locale_struc + long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *); + #endif + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define mkstemp64 mkstemp + #define mkostemp64 mkostemp + #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +diff --git a/include/sys/mman.h b/include/sys/mman.h +index 3d5d0f9c..80a3baae 100644 +--- a/include/sys/mman.h ++++ b/include/sys/mman.h +@@ -141,7 +141,7 @@ int mincore (void *, size_t, unsigned char *); + int shm_open (const char *, int, mode_t); + int shm_unlink (const char *); + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define mmap64 mmap + #define off64_t off_t + #endif +diff --git a/include/sys/resource.h b/include/sys/resource.h +index e8bfbe1f..3068328d 100644 +--- a/include/sys/resource.h ++++ b/include/sys/resource.h +@@ -95,7 +95,7 @@ int prlimit(pid_t, int, const struct rlimit *, struct rlimit *); + + #define RLIM_NLIMITS RLIMIT_NLIMITS + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define RLIM64_INFINITY RLIM_INFINITY + #define RLIM64_SAVED_CUR RLIM_SAVED_CUR + #define RLIM64_SAVED_MAX RLIM_SAVED_MAX +diff --git a/include/sys/sendfile.h b/include/sys/sendfile.h +index 253a041b..e7570d8e 100644 +--- a/include/sys/sendfile.h ++++ b/include/sys/sendfile.h +@@ -10,7 +10,7 @@ extern "C" { + + ssize_t sendfile(int, int, off_t *, size_t); + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define sendfile64 sendfile + #define off64_t off_t + #endif +diff --git a/include/sys/stat.h b/include/sys/stat.h +index e6d0049c..10d446c4 100644 +--- a/include/sys/stat.h ++++ b/include/sys/stat.h +@@ -98,7 +98,7 @@ int lchmod(const char *, mode_t); + #define S_IEXEC S_IXUSR + #endif + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define stat64 stat + #define fstat64 fstat + #define lstat64 lstat +diff --git a/include/sys/statfs.h b/include/sys/statfs.h +index 7a2e11cd..6f4c6230 100644 +--- a/include/sys/statfs.h ++++ b/include/sys/statfs.h +@@ -18,7 +18,7 @@ typedef struct __fsid_t { + int statfs (const char *, struct statfs *); + int fstatfs (int, struct statfs *); + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define statfs64 statfs + #define fstatfs64 fstatfs + #define fsblkcnt64_t fsblkcnt_t +diff --git a/include/sys/statvfs.h b/include/sys/statvfs.h +index 57a6b806..793490b6 100644 +--- a/include/sys/statvfs.h ++++ b/include/sys/statvfs.h +@@ -42,7 +42,7 @@ int fstatvfs (int, struct statvfs *); + #define ST_NODIRATIME 2048 + #define ST_RELATIME 4096 + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define statvfs64 statvfs + #define fstatvfs64 fstatvfs + #define fsblkcnt64_t fsblkcnt_t +diff --git a/include/sys/types.h b/include/sys/types.h +index 3363374f..0c35541d 100644 +--- a/include/sys/types.h ++++ b/include/sys/types.h +@@ -71,7 +71,7 @@ typedef unsigned long long u_quad_t; + #include + #endif + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define blkcnt64_t blkcnt_t + #define fsblkcnt64_t fsblkcnt_t + #define fsfilcnt64_t fsfilcnt_t +diff --git a/include/sys/uio.h b/include/sys/uio.h +index 90e5939e..00f73a2f 100644 +--- a/include/sys/uio.h ++++ b/include/sys/uio.h +@@ -29,7 +29,7 @@ ssize_t writev (int, const struct iovec *, int); + #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + ssize_t preadv (int, const struct iovec *, int, off_t); + ssize_t pwritev (int, const struct iovec *, int, off_t); +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define preadv64 preadv + #define pwritev64 pwritev + #define off64_t off_t +diff --git a/include/unistd.h b/include/unistd.h +index 5bc7f798..0e8149e4 100644 +--- a/include/unistd.h ++++ b/include/unistd.h +@@ -198,7 +198,7 @@ ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned); + pid_t gettid(void); + #endif + +-#if defined(_LARGEFILE64_SOURCE) ++#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) + #define lseek64 lseek + #define pread64 pread + #define pwrite64 pwrite +-- +2.40.0 + diff --git a/packages/musl/lfs64.patch b/packages/musl/lfs64.patch new file mode 100644 index 0000000..0ac8286 --- /dev/null +++ b/packages/musl/lfs64.patch @@ -0,0 +1,735 @@ +re-add when: + +gcc-gdc builds without this +rust builds without this + +https://github.com/rust-lang/libc/pull/2935 +https://github.com/rust-lang/rust/pull/106246 +https://github.com/rust-lang/libc/pull/3068 + +-- +From a3a133b520457d13bd7a2fe6794278a3e578f347 Mon Sep 17 00:00:00 2001 +From: psykose +Date: Tue, 11 Apr 2023 19:51:56 +0200 +Subject: [PATCH] Revert "remove LFS64 symbol aliases; replace with dynamic + linker remapping" + +This reverts commit 246f1c811448f37a44b41cd8df8d0ef9736d95f4. +--- + compat/time32/__xstat.c | 8 +++---- + compat/time32/aio_suspend_time32.c | 2 ++ + compat/time32/fstat_time32.c | 2 ++ + compat/time32/fstatat_time32.c | 2 ++ + compat/time32/lstat_time32.c | 2 ++ + compat/time32/stat_time32.c | 2 ++ + ldso/dynlink.c | 34 ------------------------------ + src/aio/aio.c | 7 ++++++ + src/aio/aio_suspend.c | 4 ++++ + src/aio/lio_listio.c | 2 ++ + src/dirent/alphasort.c | 2 ++ + src/dirent/readdir.c | 2 ++ + src/dirent/readdir_r.c | 2 ++ + src/dirent/scandir.c | 2 ++ + src/dirent/versionsort.c | 3 +++ + src/fcntl/creat.c | 2 ++ + src/fcntl/open.c | 2 ++ + src/fcntl/openat.c | 2 ++ + src/fcntl/posix_fadvise.c | 2 ++ + src/fcntl/posix_fallocate.c | 2 ++ + src/legacy/ftw.c | 2 ++ + src/linux/fallocate.c | 3 +++ + src/linux/getdents.c | 2 ++ + src/linux/prlimit.c | 3 +++ + src/linux/sendfile.c | 2 ++ + src/misc/getrlimit.c | 2 ++ + src/misc/lockf.c | 2 ++ + src/misc/nftw.c | 2 ++ + src/misc/setrlimit.c | 2 ++ + src/mman/mmap.c | 2 ++ + src/regex/glob.c | 3 +++ + src/stat/__xstat.c | 5 +++++ + src/stat/fstat.c | 4 ++++ + src/stat/fstatat.c | 4 ++++ + src/stat/lstat.c | 4 ++++ + src/stat/stat.c | 4 ++++ + src/stat/statvfs.c | 5 +++++ + src/stdio/fgetpos.c | 2 ++ + src/stdio/fopen.c | 2 ++ + src/stdio/freopen.c | 2 ++ + src/stdio/fseek.c | 2 ++ + src/stdio/fsetpos.c | 2 ++ + src/stdio/ftell.c | 2 ++ + src/stdio/tmpfile.c | 2 ++ + src/temp/mkostemp.c | 2 ++ + src/temp/mkostemps.c | 1 + + src/temp/mkstemp.c | 2 ++ + src/temp/mkstemps.c | 2 ++ + src/unistd/ftruncate.c | 2 ++ + src/unistd/lseek.c | 1 + + src/unistd/mipsn32/lseek.c | 1 + + src/unistd/pread.c | 2 ++ + src/unistd/preadv.c | 2 ++ + src/unistd/pwrite.c | 2 ++ + src/unistd/pwritev.c | 2 ++ + src/unistd/truncate.c | 2 ++ + src/unistd/x32/lseek.c | 1 + + 57 files changed, 135 insertions(+), 38 deletions(-) + +diff --git a/compat/time32/__xstat.c b/compat/time32/__xstat.c +index e52b5de..acfbd3c 100644 +--- a/compat/time32/__xstat.c ++++ b/compat/time32/__xstat.c +@@ -3,22 +3,22 @@ + + struct stat32; + +-int __fxstat(int ver, int fd, struct stat32 *buf) ++int __fxstat64(int ver, int fd, struct stat32 *buf) + { + return __fstat_time32(fd, buf); + } + +-int __fxstatat(int ver, int fd, const char *path, struct stat32 *buf, int flag) ++int __fxstatat64(int ver, int fd, const char *path, struct stat32 *buf, int flag) + { + return __fstatat_time32(fd, path, buf, flag); + } + +-int __lxstat(int ver, const char *path, struct stat32 *buf) ++int __lxstat64(int ver, const char *path, struct stat32 *buf) + { + return __lstat_time32(path, buf); + } + +-int __xstat(int ver, const char *path, struct stat32 *buf) ++int __xstat64(int ver, const char *path, struct stat32 *buf) + { + return __stat_time32(path, buf); + } +diff --git a/compat/time32/aio_suspend_time32.c b/compat/time32/aio_suspend_time32.c +index d99cb65..ed5119b 100644 +--- a/compat/time32/aio_suspend_time32.c ++++ b/compat/time32/aio_suspend_time32.c +@@ -7,3 +7,5 @@ int __aio_suspend_time32(const struct aiocb *const cbs[], int cnt, const struct + return aio_suspend(cbs, cnt, ts32 ? (&(struct timespec){ + .tv_sec = ts32->tv_sec, .tv_nsec = ts32->tv_nsec}) : 0); + } ++ ++weak_alias(aio_suspend, aio_suspend64); +diff --git a/compat/time32/fstat_time32.c b/compat/time32/fstat_time32.c +index e5d5202..3e08439 100644 +--- a/compat/time32/fstat_time32.c ++++ b/compat/time32/fstat_time32.c +@@ -13,3 +13,5 @@ int __fstat_time32(int fd, struct stat32 *restrict st32) + if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim)); + return r; + } ++ ++weak_alias(fstat, fstat64); +diff --git a/compat/time32/fstatat_time32.c b/compat/time32/fstatat_time32.c +index 31d42e6..85dcb00 100644 +--- a/compat/time32/fstatat_time32.c ++++ b/compat/time32/fstatat_time32.c +@@ -13,3 +13,5 @@ int __fstatat_time32(int fd, const char *restrict path, struct stat32 *restrict + if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim)); + return r; + } ++ ++weak_alias(fstatat, fstatat64); +diff --git a/compat/time32/lstat_time32.c b/compat/time32/lstat_time32.c +index 28cb5a0..c1257a1 100644 +--- a/compat/time32/lstat_time32.c ++++ b/compat/time32/lstat_time32.c +@@ -13,3 +13,5 @@ int __lstat_time32(const char *restrict path, struct stat32 *restrict st32) + if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim)); + return r; + } ++ ++weak_alias(lstat, lstat64); +diff --git a/compat/time32/stat_time32.c b/compat/time32/stat_time32.c +index b154b0f..8c6121d 100644 +--- a/compat/time32/stat_time32.c ++++ b/compat/time32/stat_time32.c +@@ -13,3 +13,5 @@ int __stat_time32(const char *restrict path, struct stat32 *restrict st32) + if (!r) memcpy(st32, &st, offsetof(struct stat, st_atim)); + return r; + } ++ ++weak_alias(stat, stat64); +diff --git a/ldso/dynlink.c b/ldso/dynlink.c +index ceca3c9..0ae3e94 100644 +--- a/ldso/dynlink.c ++++ b/ldso/dynlink.c +@@ -343,40 +343,6 @@ static struct symdef find_sym(struct dso *dso, const char *s, int need_def) + return find_sym2(dso, s, need_def, 0); + } + +-static struct symdef get_lfs64(const char *name) +-{ +- const char *p; +- static const char lfs64_list[] = +- "aio_cancel\0aio_error\0aio_fsync\0aio_read\0aio_return\0" +- "aio_suspend\0aio_write\0alphasort\0creat\0fallocate\0" +- "fgetpos\0fopen\0freopen\0fseeko\0fsetpos\0fstat\0" +- "fstatat\0fstatfs\0fstatvfs\0ftello\0ftruncate\0ftw\0" +- "getdents\0getrlimit\0glob\0globfree\0lio_listio\0" +- "lockf\0lseek\0lstat\0mkostemp\0mkostemps\0mkstemp\0" +- "mkstemps\0mmap\0nftw\0open\0openat\0posix_fadvise\0" +- "posix_fallocate\0pread\0preadv\0prlimit\0pwrite\0" +- "pwritev\0readdir\0scandir\0sendfile\0setrlimit\0" +- "stat\0statfs\0statvfs\0tmpfile\0truncate\0versionsort\0" +- "__fxstat\0__fxstatat\0__lxstat\0__xstat\0"; +- size_t l; +- char buf[16]; +- for (l=0; name[l]; l++) { +- if (l >= sizeof buf) goto nomatch; +- buf[l] = name[l]; +- } +- if (!strcmp(name, "readdir64_r")) +- return find_sym(&ldso, "readdir_r", 1); +- if (l<2 || name[l-2]!='6' || name[l-1]!='4') +- goto nomatch; +- buf[l-=2] = 0; +- for (p=lfs64_list; *p; p++) { +- if (!strcmp(buf, p)) return find_sym(&ldso, buf, 1); +- while (*p) p++; +- } +-nomatch: +- return (struct symdef){ 0 }; +-} +- + static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stride) + { + unsigned char *base = dso->base; +@@ -430,7 +396,6 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri + def = (sym->st_info>>4) == STB_LOCAL + ? (struct symdef){ .dso = dso, .sym = sym } + : find_sym(ctx, name, type==REL_PLT); +- if (!def.sym) def = get_lfs64(name); + if (!def.sym && (sym->st_shndx != SHN_UNDEF + || sym->st_info>>4 != STB_WEAK)) { + if (dso->lazy && (type==REL_PLT || type==REL_GOT)) { +diff --git a/src/aio/aio.c b/src/aio/aio.c +index d7e063b..37309d3 100644 +--- a/src/aio/aio.c ++++ b/src/aio/aio.c +@@ -430,3 +430,10 @@ void __aio_atfork(int who) + * We are not a lock holder anyway; the thread in the parent was. */ + pthread_rwlock_init(&maplock, 0); + } ++ ++weak_alias(aio_cancel, aio_cancel64); ++weak_alias(aio_error, aio_error64); ++weak_alias(aio_fsync, aio_fsync64); ++weak_alias(aio_read, aio_read64); ++weak_alias(aio_write, aio_write64); ++weak_alias(aio_return, aio_return64); +diff --git a/src/aio/aio_suspend.c b/src/aio/aio_suspend.c +index 1f0c9aa..290b43f 100644 +--- a/src/aio/aio_suspend.c ++++ b/src/aio/aio_suspend.c +@@ -73,3 +73,7 @@ int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec + } + } + } ++ ++#if !_REDIR_TIME64 ++weak_alias(aio_suspend, aio_suspend64); ++#endif +diff --git a/src/aio/lio_listio.c b/src/aio/lio_listio.c +index a672812..0799c15 100644 +--- a/src/aio/lio_listio.c ++++ b/src/aio/lio_listio.c +@@ -139,3 +139,5 @@ int lio_listio(int mode, struct aiocb *restrict const *restrict cbs, int cnt, st + + return 0; + } ++ ++weak_alias(lio_listio, lio_listio64); +diff --git a/src/dirent/alphasort.c b/src/dirent/alphasort.c +index ab2624e..bee672e 100644 +--- a/src/dirent/alphasort.c ++++ b/src/dirent/alphasort.c +@@ -5,3 +5,5 @@ int alphasort(const struct dirent **a, const struct dirent **b) + { + return strcoll((*a)->d_name, (*b)->d_name); + } ++ ++weak_alias(alphasort, alphasort64); +diff --git a/src/dirent/readdir.c b/src/dirent/readdir.c +index 5a03b36..569fc70 100644 +--- a/src/dirent/readdir.c ++++ b/src/dirent/readdir.c +@@ -25,3 +25,5 @@ struct dirent *readdir(DIR *dir) + dir->tell = de->d_off; + return de; + } ++ ++weak_alias(readdir, readdir64); +diff --git a/src/dirent/readdir_r.c b/src/dirent/readdir_r.c +index 0d5de5f..e2a818f 100644 +--- a/src/dirent/readdir_r.c ++++ b/src/dirent/readdir_r.c +@@ -25,3 +25,5 @@ int readdir_r(DIR *restrict dir, struct dirent *restrict buf, struct dirent **re + *result = buf; + return 0; + } ++ ++weak_alias(readdir_r, readdir64_r); +diff --git a/src/dirent/scandir.c b/src/dirent/scandir.c +index 7456b9b..7ee195d 100644 +--- a/src/dirent/scandir.c ++++ b/src/dirent/scandir.c +@@ -43,3 +43,5 @@ int scandir(const char *path, struct dirent ***res, + *res = names; + return cnt; + } ++ ++weak_alias(scandir, scandir64); +diff --git a/src/dirent/versionsort.c b/src/dirent/versionsort.c +index 9769610..d4c4892 100644 +--- a/src/dirent/versionsort.c ++++ b/src/dirent/versionsort.c +@@ -6,3 +6,6 @@ int versionsort(const struct dirent **a, const struct dirent **b) + { + return strverscmp((*a)->d_name, (*b)->d_name); + } ++ ++#undef versionsort64 ++weak_alias(versionsort, versionsort64); +diff --git a/src/fcntl/creat.c b/src/fcntl/creat.c +index c9c4391..8f8aab6 100644 +--- a/src/fcntl/creat.c ++++ b/src/fcntl/creat.c +@@ -4,3 +4,5 @@ int creat(const char *filename, mode_t mode) + { + return open(filename, O_CREAT|O_WRONLY|O_TRUNC, mode); + } ++ ++weak_alias(creat, creat64); +diff --git a/src/fcntl/open.c b/src/fcntl/open.c +index 4c3c827..1d817a2 100644 +--- a/src/fcntl/open.c ++++ b/src/fcntl/open.c +@@ -19,3 +19,5 @@ int open(const char *filename, int flags, ...) + + return __syscall_ret(fd); + } ++ ++weak_alias(open, open64); +diff --git a/src/fcntl/openat.c b/src/fcntl/openat.c +index 83a9e0d..ad165ec 100644 +--- a/src/fcntl/openat.c ++++ b/src/fcntl/openat.c +@@ -15,3 +15,5 @@ int openat(int fd, const char *filename, int flags, ...) + + return syscall_cp(SYS_openat, fd, filename, flags|O_LARGEFILE, mode); + } ++ ++weak_alias(openat, openat64); +diff --git a/src/fcntl/posix_fadvise.c b/src/fcntl/posix_fadvise.c +index 07346d2..75b8e1a 100644 +--- a/src/fcntl/posix_fadvise.c ++++ b/src/fcntl/posix_fadvise.c +@@ -14,3 +14,5 @@ int posix_fadvise(int fd, off_t base, off_t len, int advice) + __SYSCALL_LL_E(len), advice); + #endif + } ++ ++weak_alias(posix_fadvise, posix_fadvise64); +diff --git a/src/fcntl/posix_fallocate.c b/src/fcntl/posix_fallocate.c +index 80a65cb..c57a24a 100644 +--- a/src/fcntl/posix_fallocate.c ++++ b/src/fcntl/posix_fallocate.c +@@ -6,3 +6,5 @@ int posix_fallocate(int fd, off_t base, off_t len) + return -__syscall(SYS_fallocate, fd, 0, __SYSCALL_LL_E(base), + __SYSCALL_LL_E(len)); + } ++ ++weak_alias(posix_fallocate, posix_fallocate64); +diff --git a/src/legacy/ftw.c b/src/legacy/ftw.c +index e757fc6..506bd29 100644 +--- a/src/legacy/ftw.c ++++ b/src/legacy/ftw.c +@@ -7,3 +7,5 @@ int ftw(const char *path, int (*fn)(const char *, const struct stat *, int), int + * actually undefined, but works on all real-world machines. */ + return nftw(path, (int (*)())fn, fd_limit, FTW_PHYS); + } ++ ++weak_alias(ftw, ftw64); +diff --git a/src/linux/fallocate.c b/src/linux/fallocate.c +index 9146350..7d68bc8 100644 +--- a/src/linux/fallocate.c ++++ b/src/linux/fallocate.c +@@ -7,3 +7,6 @@ int fallocate(int fd, int mode, off_t base, off_t len) + return syscall(SYS_fallocate, fd, mode, __SYSCALL_LL_E(base), + __SYSCALL_LL_E(len)); + } ++ ++#undef fallocate64 ++weak_alias(fallocate, fallocate64); +diff --git a/src/linux/getdents.c b/src/linux/getdents.c +index 97f76e1..796c1e5 100644 +--- a/src/linux/getdents.c ++++ b/src/linux/getdents.c +@@ -8,3 +8,5 @@ int getdents(int fd, struct dirent *buf, size_t len) + if (len>INT_MAX) len = INT_MAX; + return syscall(SYS_getdents, fd, buf, len); + } ++ ++weak_alias(getdents, getdents64); +diff --git a/src/linux/prlimit.c b/src/linux/prlimit.c +index fcf45aa..3df9ffb 100644 +--- a/src/linux/prlimit.c ++++ b/src/linux/prlimit.c +@@ -21,3 +21,6 @@ int prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlim + } + return r; + } ++ ++#undef prlimit64 ++weak_alias(prlimit, prlimit64); +diff --git a/src/linux/sendfile.c b/src/linux/sendfile.c +index fc1577d..9afe6dd 100644 +--- a/src/linux/sendfile.c ++++ b/src/linux/sendfile.c +@@ -5,3 +5,5 @@ ssize_t sendfile(int out_fd, int in_fd, off_t *ofs, size_t count) + { + return syscall(SYS_sendfile, out_fd, in_fd, ofs, count); + } ++ ++weak_alias(sendfile, sendfile64); +diff --git a/src/misc/getrlimit.c b/src/misc/getrlimit.c +index a5558d8..bf67630 100644 +--- a/src/misc/getrlimit.c ++++ b/src/misc/getrlimit.c +@@ -26,3 +26,5 @@ int getrlimit(int resource, struct rlimit *rlim) + return ret; + #endif + } ++ ++weak_alias(getrlimit, getrlimit64); +diff --git a/src/misc/lockf.c b/src/misc/lockf.c +index 0162442..16a80be 100644 +--- a/src/misc/lockf.c ++++ b/src/misc/lockf.c +@@ -28,3 +28,5 @@ int lockf(int fd, int op, off_t size) + errno = EINVAL; + return -1; + } ++ ++weak_alias(lockf, lockf64); +diff --git a/src/misc/nftw.c b/src/misc/nftw.c +index 71bc62e..e1bcf1a 100644 +--- a/src/misc/nftw.c ++++ b/src/misc/nftw.c +@@ -140,3 +140,5 @@ int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, str + pthread_setcancelstate(cs, 0); + return r; + } ++ ++weak_alias(nftw, nftw64); +diff --git a/src/misc/setrlimit.c b/src/misc/setrlimit.c +index edb413f..5b713cf 100644 +--- a/src/misc/setrlimit.c ++++ b/src/misc/setrlimit.c +@@ -49,3 +49,5 @@ int setrlimit(int resource, const struct rlimit *rlim) + return __syscall_ret(ret); + #endif + } ++ ++weak_alias(setrlimit, setrlimit64); +diff --git a/src/mman/mmap.c b/src/mman/mmap.c +index 43e5e02..eff88d8 100644 +--- a/src/mman/mmap.c ++++ b/src/mman/mmap.c +@@ -37,3 +37,5 @@ void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off) + } + + weak_alias(__mmap, mmap); ++ ++weak_alias(mmap, mmap64); +diff --git a/src/regex/glob.c b/src/regex/glob.c +index a490644..9de080e 100644 +--- a/src/regex/glob.c ++++ b/src/regex/glob.c +@@ -306,3 +306,6 @@ void globfree(glob_t *g) + g->gl_pathc = 0; + g->gl_pathv = NULL; + } ++ ++weak_alias(glob, glob64); ++weak_alias(globfree, globfree64); +diff --git a/src/stat/__xstat.c b/src/stat/__xstat.c +index b4560df..630936a 100644 +--- a/src/stat/__xstat.c ++++ b/src/stat/__xstat.c +@@ -22,6 +22,11 @@ int __xstat(int ver, const char *path, struct stat *buf) + return stat(path, buf); + } + ++weak_alias(__fxstat, __fxstat64); ++weak_alias(__fxstatat, __fxstatat64); ++weak_alias(__lxstat, __lxstat64); ++weak_alias(__xstat, __xstat64); ++ + #endif + + int __xmknod(int ver, const char *path, mode_t mode, dev_t *dev) +diff --git a/src/stat/fstat.c b/src/stat/fstat.c +index fd28b8a..27db0cc 100644 +--- a/src/stat/fstat.c ++++ b/src/stat/fstat.c +@@ -11,3 +11,7 @@ int __fstat(int fd, struct stat *st) + } + + weak_alias(__fstat, fstat); ++ ++#if !_REDIR_TIME64 ++weak_alias(fstat, fstat64); ++#endif +diff --git a/src/stat/fstatat.c b/src/stat/fstatat.c +index 0450637..74c51cf 100644 +--- a/src/stat/fstatat.c ++++ b/src/stat/fstatat.c +@@ -151,3 +151,7 @@ int __fstatat(int fd, const char *restrict path, struct stat *restrict st, int f + } + + weak_alias(__fstatat, fstatat); ++ ++#if !_REDIR_TIME64 ++weak_alias(fstatat, fstatat64); ++#endif +diff --git a/src/stat/lstat.c b/src/stat/lstat.c +index 6822fca..6fe004d 100644 +--- a/src/stat/lstat.c ++++ b/src/stat/lstat.c +@@ -5,3 +5,7 @@ int lstat(const char *restrict path, struct stat *restrict buf) + { + return fstatat(AT_FDCWD, path, buf, AT_SYMLINK_NOFOLLOW); + } ++ ++#if !_REDIR_TIME64 ++weak_alias(lstat, lstat64); ++#endif +diff --git a/src/stat/stat.c b/src/stat/stat.c +index 23570e7..ea70efc 100644 +--- a/src/stat/stat.c ++++ b/src/stat/stat.c +@@ -5,3 +5,7 @@ int stat(const char *restrict path, struct stat *restrict buf) + { + return fstatat(AT_FDCWD, path, buf, 0); + } ++ ++#if !_REDIR_TIME64 ++weak_alias(stat, stat64); ++#endif +diff --git a/src/stat/statvfs.c b/src/stat/statvfs.c +index bfbb5fe..f65d1b5 100644 +--- a/src/stat/statvfs.c ++++ b/src/stat/statvfs.c +@@ -56,3 +56,8 @@ int fstatvfs(int fd, struct statvfs *buf) + fixup(buf, &kbuf); + return 0; + } ++ ++weak_alias(statvfs, statvfs64); ++weak_alias(statfs, statfs64); ++weak_alias(fstatvfs, fstatvfs64); ++weak_alias(fstatfs, fstatfs64); +diff --git a/src/stdio/fgetpos.c b/src/stdio/fgetpos.c +index 392f732..50813d2 100644 +--- a/src/stdio/fgetpos.c ++++ b/src/stdio/fgetpos.c +@@ -7,3 +7,5 @@ int fgetpos(FILE *restrict f, fpos_t *restrict pos) + *(long long *)pos = off; + return 0; + } ++ ++weak_alias(fgetpos, fgetpos64); +diff --git a/src/stdio/fopen.c b/src/stdio/fopen.c +index 80bc341..e1b91e1 100644 +--- a/src/stdio/fopen.c ++++ b/src/stdio/fopen.c +@@ -29,3 +29,5 @@ FILE *fopen(const char *restrict filename, const char *restrict mode) + __syscall(SYS_close, fd); + return 0; + } ++ ++weak_alias(fopen, fopen64); +diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c +index 1641a4c..96bfbb4 100644 +--- a/src/stdio/freopen.c ++++ b/src/stdio/freopen.c +@@ -51,3 +51,5 @@ fail: + fclose(f); + return NULL; + } ++ ++weak_alias(freopen, freopen64); +diff --git a/src/stdio/fseek.c b/src/stdio/fseek.c +index c742580..c07f7e9 100644 +--- a/src/stdio/fseek.c ++++ b/src/stdio/fseek.c +@@ -46,3 +46,5 @@ int fseek(FILE *f, long off, int whence) + } + + weak_alias(__fseeko, fseeko); ++ ++weak_alias(fseeko, fseeko64); +diff --git a/src/stdio/fsetpos.c b/src/stdio/fsetpos.c +index 779cb3c..77ab8d8 100644 +--- a/src/stdio/fsetpos.c ++++ b/src/stdio/fsetpos.c +@@ -4,3 +4,5 @@ int fsetpos(FILE *f, const fpos_t *pos) + { + return __fseeko(f, *(const long long *)pos, SEEK_SET); + } ++ ++weak_alias(fsetpos, fsetpos64); +diff --git a/src/stdio/ftell.c b/src/stdio/ftell.c +index 1e1a08d..1a2afbb 100644 +--- a/src/stdio/ftell.c ++++ b/src/stdio/ftell.c +@@ -37,3 +37,5 @@ long ftell(FILE *f) + } + + weak_alias(__ftello, ftello); ++ ++weak_alias(ftello, ftello64); +diff --git a/src/stdio/tmpfile.c b/src/stdio/tmpfile.c +index 2fa8803..ae49398 100644 +--- a/src/stdio/tmpfile.c ++++ b/src/stdio/tmpfile.c +@@ -27,3 +27,5 @@ FILE *tmpfile(void) + } + return 0; + } ++ ++weak_alias(tmpfile, tmpfile64); +diff --git a/src/temp/mkostemp.c b/src/temp/mkostemp.c +index e3dfdd9..d8dcb80 100644 +--- a/src/temp/mkostemp.c ++++ b/src/temp/mkostemp.c +@@ -5,3 +5,5 @@ int mkostemp(char *template, int flags) + { + return __mkostemps(template, 0, flags); + } ++ ++weak_alias(mkostemp, mkostemp64); +diff --git a/src/temp/mkostemps.c b/src/temp/mkostemps.c +index 093d238..ef24eea 100644 +--- a/src/temp/mkostemps.c ++++ b/src/temp/mkostemps.c +@@ -26,3 +26,4 @@ int __mkostemps(char *template, int len, int flags) + } + + weak_alias(__mkostemps, mkostemps); ++weak_alias(__mkostemps, mkostemps64); +diff --git a/src/temp/mkstemp.c b/src/temp/mkstemp.c +index 76c835b..166b8af 100644 +--- a/src/temp/mkstemp.c ++++ b/src/temp/mkstemp.c +@@ -4,3 +4,5 @@ int mkstemp(char *template) + { + return __mkostemps(template, 0, 0); + } ++ ++weak_alias(mkstemp, mkstemp64); +diff --git a/src/temp/mkstemps.c b/src/temp/mkstemps.c +index f8eabfe..6b7531b 100644 +--- a/src/temp/mkstemps.c ++++ b/src/temp/mkstemps.c +@@ -5,3 +5,5 @@ int mkstemps(char *template, int len) + { + return __mkostemps(template, len, 0); + } ++ ++weak_alias(mkstemps, mkstemps64); +diff --git a/src/unistd/ftruncate.c b/src/unistd/ftruncate.c +index 54ff34b..b41be0f 100644 +--- a/src/unistd/ftruncate.c ++++ b/src/unistd/ftruncate.c +@@ -5,3 +5,5 @@ int ftruncate(int fd, off_t length) + { + return syscall(SYS_ftruncate, fd, __SYSCALL_LL_O(length)); + } ++ ++weak_alias(ftruncate, ftruncate64); +diff --git a/src/unistd/lseek.c b/src/unistd/lseek.c +index f5b6668..b4984f3 100644 +--- a/src/unistd/lseek.c ++++ b/src/unistd/lseek.c +@@ -12,3 +12,4 @@ off_t __lseek(int fd, off_t offset, int whence) + } + + weak_alias(__lseek, lseek); ++weak_alias(__lseek, lseek64); +diff --git a/src/unistd/mipsn32/lseek.c b/src/unistd/mipsn32/lseek.c +index 0f6cbca..60e74a5 100644 +--- a/src/unistd/mipsn32/lseek.c ++++ b/src/unistd/mipsn32/lseek.c +@@ -17,3 +17,4 @@ off_t __lseek(int fd, off_t offset, int whence) + } + + weak_alias(__lseek, lseek); ++weak_alias(__lseek, lseek64); +diff --git a/src/unistd/pread.c b/src/unistd/pread.c +index b03fb0a..5681b04 100644 +--- a/src/unistd/pread.c ++++ b/src/unistd/pread.c +@@ -5,3 +5,5 @@ ssize_t pread(int fd, void *buf, size_t size, off_t ofs) + { + return syscall_cp(SYS_pread, fd, buf, size, __SYSCALL_LL_PRW(ofs)); + } ++ ++weak_alias(pread, pread64); +diff --git a/src/unistd/preadv.c b/src/unistd/preadv.c +index 890ab40..8376d60 100644 +--- a/src/unistd/preadv.c ++++ b/src/unistd/preadv.c +@@ -8,3 +8,5 @@ ssize_t preadv(int fd, const struct iovec *iov, int count, off_t ofs) + return syscall_cp(SYS_preadv, fd, iov, count, + (long)(ofs), (long)(ofs>>32)); + } ++ ++weak_alias(preadv, preadv64); +diff --git a/src/unistd/pwrite.c b/src/unistd/pwrite.c +index 869b69f..ca37657 100644 +--- a/src/unistd/pwrite.c ++++ b/src/unistd/pwrite.c +@@ -5,3 +5,5 @@ ssize_t pwrite(int fd, const void *buf, size_t size, off_t ofs) + { + return syscall_cp(SYS_pwrite, fd, buf, size, __SYSCALL_LL_PRW(ofs)); + } ++ ++weak_alias(pwrite, pwrite64); +diff --git a/src/unistd/pwritev.c b/src/unistd/pwritev.c +index becf9de..f5a612c 100644 +--- a/src/unistd/pwritev.c ++++ b/src/unistd/pwritev.c +@@ -8,3 +8,5 @@ ssize_t pwritev(int fd, const struct iovec *iov, int count, off_t ofs) + return syscall_cp(SYS_pwritev, fd, iov, count, + (long)(ofs), (long)(ofs>>32)); + } ++ ++weak_alias(pwritev, pwritev64); +diff --git a/src/unistd/truncate.c b/src/unistd/truncate.c +index 077351e..9729680 100644 +--- a/src/unistd/truncate.c ++++ b/src/unistd/truncate.c +@@ -5,3 +5,5 @@ int truncate(const char *path, off_t length) + { + return syscall(SYS_truncate, path, __SYSCALL_LL_O(length)); + } ++ ++weak_alias(truncate, truncate64); +diff --git a/src/unistd/x32/lseek.c b/src/unistd/x32/lseek.c +index 5f93292..3263642 100644 +--- a/src/unistd/x32/lseek.c ++++ b/src/unistd/x32/lseek.c +@@ -12,3 +12,4 @@ off_t __lseek(int fd, off_t offset, int whence) + } + + weak_alias(__lseek, lseek); ++weak_alias(__lseek, lseek64); diff --git a/packages/rust/Dockerfile b/packages/rust/Dockerfile new file mode 100644 index 0000000..2a22af9 --- /dev/null +++ b/packages/rust/Dockerfile @@ -0,0 +1,65 @@ +FROM imgrep/busybox as busybox +FROM imgrep/gcc as gcc +FROM imgrep/binutils as binutils +FROM imgrep/musl as musl +FROM imgrep/bash as bash +FROM imgrep/make as make +FROM imgrep/cmake as cmake +FROM imgrep/python as python +FROM imgrep/curl as curl +FROM imgrep/zlib as zlib +FROM imgrep/openssl as openssl +FROM imgrep/llvm as llvm +FROM imgrep/perl as perl + +FROM busybox as stage0 +ENV SRC_SITE=https://codeload.github.com/lrvick/mrustc/legacy.tar.gz +ENV SRC_VERSION=df243f74b3267b20430b818277c7e9e1de9951ad +ENV SRC_HASH=e675b5d9f53c0456d2b513ca1b7743c0257abfc96f4d4cab9807c8c37e53301d +COPY --from=curl . / +RUN curl ${SRC_SITE}/${SRC_VERSION} -o mrustc.tar.gz +RUN echo "${SRC_HASH} mrustc.tar.gz" | sha256sum -c +RUN tar -xzf mrustc.tar.gz +RUN mv lrvick-mrustc-* mrustc +WORKDIR mrustc +COPY --from=binutils . / +COPY --from=bash . / +COPY --from=make . / +COPY --from=cmake . / +COPY --from=python . / +COPY --from=zlib . / +COPY --from=openssl . / +COPY --from=llvm . / +COPY --from=perl . / +COPY --from=gcc . / +COPY --from=musl . / + +ENV RUSTC_TARGET=x86_64-unknown-linux-musl +ENV MRUSTC_TARGET_VER=1.54 +ENV RUSTC_VERSION=1.54.0 +ENV MRUSTC_DEBUG=Expand +ENV MRUSTC_DUMP_PROCMACRO=dump_prefix +ENV RUSTC_INSTALL_BINDIR=bin +ENV OUTDIR_SUF= +RUN make +RUN make RUSTCSRC +RUN make -f minicargo.mk LIBS +RUN make test +RUN make local_tests +RUN make -f minicargo.mk output/rustc +RUN make -f minicargo.mk output/cargo +RUN ./output/rustc --version +RUN ./output/cargo --version +RUN set -eux; \ + mkdir -p /home/user/rootfs/usr/bin; \ + mv output/rustc output/cargo /home/user/rootfs/usr/bin/ + +COPY --from=musl /lib/* /home/user/rootfs/lib/ +COPY --from=gcc /usr/lib/* /home/user/rootfs/usr/lib/ +COPY --from=gcc /usr/lib64/* /home/user/rootfs/usr/lib/ + +FROM scratch +COPY --from=stage0 /home/user/rootfs / +USER 100:100 +ENTRYPOINT ["/usr/bin/rustc"] +CMD ["--version"] diff --git a/packages/zlib/Dockerfile b/packages/zlib/Dockerfile new file mode 100644 index 0000000..45d3562 --- /dev/null +++ b/packages/zlib/Dockerfile @@ -0,0 +1,28 @@ +FROM imgrep/busybox:latest as busybox +FROM imgrep/gcc:latest as gcc +FROM imgrep/binutils:latest as binutils +FROM imgrep/musl:latest as musl +FROM imgrep/make:latest as make + +FROM busybox as build +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=musl . / +ENV SRC_SITE=https://www.zlib.net/ +ENV SRC_VERSION=1.3 +ENV SRC_HASH=ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e +RUN wget ${SRC_SITE}/zlib-${SRC_VERSION}.tar.gz +RUN echo "${SRC_HASH} zlib-${SRC_VERSION}.tar.gz" | sha256sum -c +RUN tar -xf zlib-${SRC_VERSION}.tar.gz +WORKDIR zlib-${SRC_VERSION} +RUN set -eux; \ + ./configure \ + --prefix=/usr \ + --libdir=/lib \ + --shared; \ + make; +RUN make DESTDIR=/home/user/rootfs install + +FROM scratch +COPY --from=build /home/user/rootfs /