├── .gitmodules ├── LICENSE ├── README.md ├── build-scripts ├── build-cross-tools.sh ├── build-toolchain.sh ├── tc-Adjust_CT.sh ├── tc-Adjust_TC.sh ├── tc-bash.sh ├── tc-binutils.sh ├── tc-bison.sh ├── tc-bzip2.sh ├── tc-coreutils.sh ├── tc-dejagnu.sh ├── tc-diffutils.sh ├── tc-expect.sh ├── tc-file.sh ├── tc-findutils.sh ├── tc-flex.sh ├── tc-gawk.sh ├── tc-gcc.sh ├── tc-gettext-tiny.sh ├── tc-grep.sh ├── tc-gzip.sh ├── tc-headers.sh ├── tc-libstdcxx.sh ├── tc-m4.sh ├── tc-make.sh ├── tc-musl.sh ├── tc-nano.sh ├── tc-ncurses.sh ├── tc-patch.sh ├── tc-perl.sh ├── tc-pkgtools.sh ├── tc-sed.sh ├── tc-tar.sh ├── tc-tcl.sh ├── tc-texinfo.sh ├── tc-vim.sh ├── tc-xz.sh └── toolchain.conf ├── contrib └── mlfs-bash_startup_scripts │ ├── .bash_logout │ ├── .bash_profile │ ├── .bashrc │ ├── .profile │ ├── bash_completion.sh │ ├── bashrc │ ├── dircolors.sh │ ├── extrapaths.sh │ ├── i18n.sh │ ├── inputrc │ ├── profile │ ├── readline.sh │ └── umask.sh ├── doc ├── 000-Preparation ├── 1-cross-tools │ ├── 0-Build_Notes │ ├── 1-kernel_headers │ ├── 2-binutils │ ├── 3-gcc_static │ ├── 4-musl │ ├── 5-gcc_final │ └── 6-file ├── 2-toolchain │ ├── 00-Build_Notes │ ├── 01-musl │ ├── 02-adjust_cross-tools │ ├── 03-binutils │ ├── 04-gcc │ ├── 05-kernel-headers │ ├── 06-adjust_tools │ ├── 07-libstdcxx │ ├── 08-tcl │ ├── 09-expect │ ├── 10-dejagnu │ ├── 11-m4 │ ├── 12-ncurses │ ├── 12a-netbsd-curses │ ├── 13-bash │ ├── 14-bison │ ├── 15-bzip2 │ ├── 16-coreutils │ ├── 17-diffutils │ ├── 18-file │ ├── 19-findutils │ ├── 20-gawk │ ├── 21-gettext-tiny │ ├── 22-grep │ ├── 23-gzip │ ├── 24-make │ ├── 25-patch │ ├── 26-perl │ ├── 27-sed │ ├── 28-tar │ ├── 29-texinfo │ ├── 30-xz │ ├── 31-flex │ ├── 32-nano │ ├── 33-vim │ └── 34-Stripping_and_Ownership └── 3-Chroot │ ├── 001-Prepare_VKFS │ ├── 002-Enter_Chroot │ ├── 003-Create_Directories │ ├── 004-Create_Essential_Files_and_Links │ ├── 005-Kernel_Headers │ ├── 006-Man_pages │ ├── 007-Musl │ ├── 008-Adjust_Toolchain │ ├── 009-Skalibs │ ├── 010-utmps │ ├── 011-Time_Zone_Utilities │ ├── 012-Argp-standalone │ ├── 013-Zlib │ ├── 013a-Zlib-ng │ ├── 014-File │ ├── 015-Readline │ ├── 016-M4 │ ├── 017-Bc │ ├── 018-Binutils │ ├── 019-GMP │ ├── 020-MPFR │ ├── 021-MPC │ ├── 022-Shadow │ ├── 023-GCC │ ├── 024-Bzip2 │ ├── 025-Zstd │ ├── 026-Pkgconf │ ├── 027-netBSD-curses │ ├── 027a-Ncurses │ ├── 028-Attr │ ├── 029-ACL │ ├── 030-Libcap │ ├── 031-Sed │ ├── 032-Psmisc │ ├── 033-Iana-etc │ ├── 034-Bison │ ├── 035-Flex │ ├── 036-Grep │ ├── 037-Bash │ ├── 038-Libtool │ ├── 039-GDBM │ ├── 040-Gperf │ ├── 041-Expat │ ├── 042-Inetutils │ ├── 043-Perl │ ├── 044-XML-Parser │ ├── 045-Intltool │ ├── 046-Autoconf │ ├── 047-Automake │ ├── 048-Musl-FTS │ ├── 049-Musl-Obstack │ ├── 051-Xz │ ├── 052-Kmod │ ├── 053-Gettext-Tiny │ ├── 054-Musl-Legacy-Compat │ ├── 055-Libelf │ ├── 056-Libffi │ ├── 057-LibreSSL │ ├── 057a-OpenSSL │ ├── 058-Python3 │ ├── 059-Ninja │ ├── 059a-Samurai │ ├── 060-Meson │ ├── 061-Procps-ng │ ├── 062-Coreutils │ ├── 063-Check │ ├── 064-Diffutils │ ├── 065-Gawk │ ├── 066-Findutils │ ├── 067-Groff │ ├── 068-Grub │ ├── 069-Less │ ├── 070-Gzip │ ├── 071-IPRoute2 │ ├── 072-KBD │ ├── 073-Libpipeline │ ├── 074-Make │ ├── 075-Patch │ ├── 076-Man-DB │ ├── 077-Tar │ ├── 078-Texinfo │ ├── 079-Vim │ ├── 080-Util-Linux │ ├── 081-E2fsprogs │ ├── 082-Eudev │ ├── 083-Cpio │ ├── 083a-NSSS │ ├── 084-Execline │ ├── 085-S6 │ ├── 086-S6-RC │ ├── 087-S6-Linux-Utils │ ├── 088-S6-Portable-Utils │ ├── 089-S6-Linux-init │ ├── 090-Stripping │ ├── 091-Clean-up │ ├── 092-Bootscripts │ ├── 093-Network-Configuration │ ├── 094-Bash-Startup-Scripts │ ├── 095-Fstab │ ├── 096-Linux-Kernel │ ├── 097-Initramfs │ ├── 098-Boot-Loader │ └── 099-The-End ├── download_sources.sh ├── extra ├── lfs_chroot.sh ├── lfs_mount.sh └── lfs_umount.sh ├── files ├── __stack_chk_fail_local.c ├── config.guess-musl ├── config.sub-musl ├── elfutils-void │ └── error.h ├── initramfs-init ├── kbd-void │ └── error.h ├── musl-alpine │ └── ldconfig ├── musl-legacy-compat-void │ ├── cdefs.h │ ├── queue.h │ └── tree.h ├── musl │ ├── getconf.1 │ ├── getconf.c │ ├── getent.1 │ ├── getent.c │ └── iconv.c ├── skalibs-alpine │ └── skalibs.pc ├── udev-mlfs-20220325 │ ├── 55-mlfs.rules │ ├── 55-mlfs.txt │ ├── 81-cdrom.rules │ ├── 83-cdrom-symlinks.rules │ ├── ChangeLog │ ├── Makefile.mlfs │ ├── README │ ├── contrib │ │ └── debian │ │ │ ├── 81-cdrom.rules │ │ │ ├── 83-cdrom-symlinks.rules │ │ │ └── write_cd_aliases │ ├── init-net-rules.sh │ ├── rule_generator.functions │ ├── write_cd_rules │ └── write_net_rules ├── util-linux-adelie │ └── ttydefaults.h └── utmps-alpine │ └── utmps.pc ├── patches ├── argp-standalone-adelie │ └── gnu89-inline.patch ├── argp-standalone-mlfs │ └── generate_configure_script.patch ├── binutils-alpine │ ├── 0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch │ ├── bfd-close-file-desriptor-if-there-is-no-archive-fd.patch │ ├── binutils-ld-fix-static-linking.patch │ └── defang-no-split.patch ├── bzip2-clear │ ├── 0001-Autotoolize-bzip2.patch │ └── 0002-Improve-file-access.patch ├── bzip2-mlfs │ └── bzip2-reconfigured.patch ├── coreutils-alpine │ └── ls.patch ├── coreutils-mlfs │ └── coreutils-autoconf.patch.xz ├── cpio-2.12-void │ ├── 0001-Fix-out-of-bounds-read.patch │ ├── 0002-Fix-signed-integer-overflow-big-block-sizes.patch │ ├── 0003-CVE-2016-2037-1-byte-out-of-bounds-write.patch │ └── 0004-Fix-sigfault-when-appending-to-archive.patch ├── e2fsprogs-adelie │ └── header-fix.patch ├── expect-5.45.3 │ ├── allow-cross-compile.patch │ ├── dont-configure-testsuites.patch │ └── dont-put-toolchain-in-libpath.patch ├── findutils-4.6.0-void │ ├── gnulib-freadahead.patch │ ├── gnulib-fseeko.patch │ ├── gnulib-mountlist.patch │ └── gnulib-stdio-impl.patch ├── gcc-alpine │ ├── 0001-posix_memalign.patch │ ├── 0002-gcc-poison-system-directories.patch │ ├── 0003-Turn-on-Wl-z-relro-z-now-by-default.patch │ ├── 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch │ ├── 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch │ ├── 0006-Enable-Wformat-and-Wformat-security-by-default.patch │ ├── 0007-Enable-Wtrampolines-by-default.patch │ ├── 0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch │ ├── 0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch │ ├── 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch │ ├── 0011-libiberty-copy-PIC-objects-during-build-process.patch │ ├── 0012-libitm-disable-FORTIFY.patch │ ├── 0013-libgcc_s.patch │ ├── 0014-nopie.patch │ ├── 0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch │ ├── 0016-dlang-update-zlib-binding.patch │ ├── 0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch │ ├── 0018-ada-fix-shared-linking.patch │ ├── 0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch │ ├── 0020-add-fortify-headers-paths.patch │ ├── 0021-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch │ ├── 0022-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch │ ├── 0023-Pure-64-bit-MIPS.patch │ ├── 0024-use-pure-64-bit-configuration-where-appropriate.patch │ ├── 0025-always-build-libgcc_eh.a.patch │ ├── 0026-ada-libgnarl-compatibility-for-musl.patch │ ├── 0027-ada-musl-support-fixes.patch │ ├── 0028-gcc-go-Use-_off_t-type-instead-of-_loff_t.patch │ ├── 0029-gcc-go-Don-t-include-sys-user.h.patch │ ├── 0030-gcc-go-Fix-ucontext_t-on-PPC64.patch │ ├── 0031-gcc-go-Fix-handling-of-signal-34-on-musl.patch │ ├── 0032-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch │ ├── 0033-gcc-go-Fix-st_-a-m-c-tim-fields-in-generated-sysinfo.patch │ ├── 0034-gcc-go-signal-34-is-special-on-musl-libc.patch │ ├── 0035-gcc-go-Prefer-_off_t-over-_off64_t.patch │ ├── 0036-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c.patch │ ├── 0037-gcc-go-link-to-libucontext.patch │ ├── 0038-gcc-go-Disable-printing-of-unaccessible-ppc64-struct.patch │ ├── 0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch │ ├── 0041-Use-generic-errstr.go-implementation-on-musl.patch │ ├── 0042-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch │ ├── 0043-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch │ └── apply_patches_ct.sh ├── gcc-mlfs-11.2.0 │ ├── fix_fenv_header.patch │ ├── fix_fenv_header_1.patch │ └── fix_fenv_header_2.patch ├── gettext-tiny-alpine │ ├── flip-macro-logic.patch │ ├── line-length.patch │ └── respect-cflags.patch ├── grub-alpine │ ├── alpine-mkconfig.patch │ ├── fix-gcc-no-pie-specs.patch │ └── lang-C.UTF-8.patch ├── inetutils-mlfs │ └── logwtmp.patch ├── kbd-lfs │ └── kbd-2.3.0-backspace-1.patch ├── kernel │ ├── include-uapi-linux-swab-Fix-potentially-missing-__always_inline.patch │ └── more-uarches-for-kernel-5.8+.patch ├── libffi-alpine │ └── pax-dlmmap.patch ├── m4-alpine │ └── musl-realpath.patch ├── musl-alpine │ ├── 0001-riscv64-define-ELF_NFPREG.patch │ ├── handle-aux-at_base.patch │ └── syscall-cp-epoll.patch ├── musl-mlfs │ ├── change-scheduler-functions-Linux-compatib.patch │ ├── fix-utmp-wtmp-paths.patch │ └── i686-fix-rounding.patch ├── perl-alpine │ ├── musl-locale.patch │ └── musl-stack-size.patch ├── posixtz-adelie │ └── 0001-posixtz-fix-up-lseek.patch ├── procps-adelie │ └── use-utmpx.patch ├── procps-mlfs │ └── use_utmpx.patch ├── python3-void │ ├── musl-find_library.patch │ └── tweak-MULTIARCH-for-powerpc-linux-musl.patch ├── util-linux-mlfs │ └── use-tiparm-when-compiling-with-netbsd_curses.patch ├── util-linux-void │ └── fix-musl.patch ├── xz-alpine │ └── xzgrep-ZDI-CAN-16587.patch └── zlib-ng-mlfs │ └── configure-fix-interpreter.patch ├── sources.list └── sources.md5 /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "contrib/MLFS-S6-Bootscripts"] 2 | path = contrib/MLFS-S6-Bootscripts 3 | url = https://github.com/dslm4515/MLFS-S6-Bootscripts 4 | -------------------------------------------------------------------------------- /build-scripts/tc-bash.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="bash" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | printf "ac_cv_func_mmap_fixed_mapped=yes 17 | ac_cv_func_strcoll_works=yes 18 | ac_cv_func_working_mktime=yes 19 | bash_cv_func_sigsetjmp=present 20 | bash_cv_getcwd_malloc=yes 21 | bash_cv_job_control_missing=present 22 | bash_cv_printf_a_format=yes 23 | bash_cv_sys_named_pipes=present 24 | bash_cv_ulimit_maxfds=yes 25 | bash_cv_under_sys_siglist=yes 26 | bash_cv_unusable_rtsigs=no 27 | gt_cv_int_divbyzero_sigfpe=yes" > config.cache && 28 | ./configure --prefix=/tools \ 29 | --without-bash-malloc \ 30 | --build=${MLFS_HOST} \ 31 | --host=${MLFS_TARGET} \ 32 | --cache-file=config.cache && 33 | make ${MJ} && make install && 34 | 35 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 36 | -------------------------------------------------------------------------------- /build-scripts/tc-binutils.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | tar xf ${SRC_PKGS}/binutils* && 4 | cd binutils* && 5 | 6 | export CC="${MLFS_TARGET}-gcc" && 7 | export CXX="${MLFS_TARGET}-g++" && 8 | export AR="${MLFS_TARGET}-ar" && 9 | export AS="${MLFS_TARGET}-as" && 10 | export RANLIB="${MLFS_TARGET}-ranlib" && 11 | export LD="${MLFS_TARGET}-ld" && 12 | export STRIP="${MLFS_TARGET}-strip" && 13 | 14 | case ${MLFS_CPU} in 15 | x86_64) ln -sv lib /tools/lib64 ;; 16 | esac && 17 | 18 | mkdir -v build && cd build && 19 | ../configure --prefix=/tools \ 20 | --with-lib-path=/tools/lib \ 21 | --build=${MLFS_HOST} \ 22 | --host=${MLFS_TARGET} \ 23 | --target=${MLFS_TARGET} \ 24 | --disable-nls \ 25 | --disable-werror \ 26 | --with-sysroot && 27 | 28 | make ${MJ} && make install && 29 | make -C ld clean ${MJ} && 30 | make -C ld LIB_PATH=/usr/lib:/lib ${MJ} && 31 | cp -v ld/ld-new /tools/bin && 32 | cd ${SRC_ROOT} && rm -rf binutils* 33 | -------------------------------------------------------------------------------- /build-scripts/tc-bison.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="bison" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools && 19 | make ${MJ} && make install && 20 | 21 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 22 | -------------------------------------------------------------------------------- /build-scripts/tc-bzip2.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="bzip2" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | cp Makefile{,.orig} && 17 | sed -e "/^all:/s/ test//" Makefile.orig > Makefile && 18 | sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile && 19 | sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile && 20 | make -f Makefile-libbz2_so CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" ${MJ} && 21 | make ${MJ} clean && 22 | make CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" ${MJ} && 23 | make PREFIX=/tools install && 24 | 25 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 26 | -------------------------------------------------------------------------------- /build-scripts/tc-coreutils.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="coreutils" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | autoreconf -vif && 17 | patch -Np0 -i ../patches/coreutils-void/0001-ls-restore-8.31-behavior-on-removed-directories.patch && 18 | printf "fu_cv_sys_stat_statfs2_bsize=no 19 | ac_cv_func_syncfs=no 20 | gl_cv_func_working_mkstemp=yes 21 | gl_cv_func_working_acl_get_file=yes" > config.cache && 22 | sed -i '/test.lock/s/^/#/' gnulib-tests/gnulib.mk && 23 | ./configure --build=${MLFS_HOST} \ 24 | --host=${MLFS_TARGET} \ 25 | --prefix=/tools \ 26 | --enable-install-program=hostname \ 27 | --cache-file=config.cache && 28 | make ${MJ} && make install && 29 | 30 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 31 | -------------------------------------------------------------------------------- /build-scripts/tc-dejagnu.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="dejagnu" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools && 19 | make ${MJ} && make install && 20 | 21 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 22 | -------------------------------------------------------------------------------- /build-scripts/tc-diffutils.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="diffutils" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools && 19 | make ${MJ} && make install && 20 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 21 | -------------------------------------------------------------------------------- /build-scripts/tc-expect.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="expect" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | patch -Np1 -i ../patches/expect-5.45.3/dont-put-toolchain-in-libpath.patch && 17 | patch -Np1 -i ../patches/expect-5.45.3/dont-configure-testsuites.patch && 18 | patch -Np1 -i ../patches/expect-5.45.3/allow-cross-compile.patch && 19 | 20 | cp -v ../files/config.guess-musl tclconfig/config.guess && 21 | cp -v ../files/config.sub-musl tclconfig/config.sub && 22 | cp -v configure{,.orig} && 23 | sed 's:/usr/local/bin:/bin:' configure.orig > configure && 24 | 25 | ./configure --build=${MLFS_HOST} \ 26 | --host=${MLFS_TARGET} \ 27 | --prefix=/tools \ 28 | --with-tcl=/tools/lib \ 29 | --with-tclinclude=/tools/include && 30 | make ${MJ} && make SCRIPTS="" install && 31 | 32 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 33 | -------------------------------------------------------------------------------- /build-scripts/tc-file.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="file" 4 | tar xf ${SRC_PKGS}/${PKGNAME}-* && 5 | cd ${PKGNAME}-* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools && 19 | make ${MJ} && make install && 20 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}-* 21 | -------------------------------------------------------------------------------- /build-scripts/tc-findutils.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="findutils" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gl/lib/*.c && 17 | sed -i '/unistd/a #include ' gl/lib/mountlist.c && 18 | echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h && 19 | ./configure --build=${MLFS_HOST} \ 20 | --host=${MLFS_TARGET} \ 21 | --prefix=/tools && 22 | make ${MJ} && make install && 23 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 24 | -------------------------------------------------------------------------------- /build-scripts/tc-flex.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="flex" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ac_cv_func_malloc_0_nonnull=yes \ 17 | ac_cv_func_realloc_0_nonnull=yes \ 18 | HELP2MAN=/tools/bin/true \ 19 | ./configure --build=${MLFS_HOST} \ 20 | --host=${MLFS_TARGET} \ 21 | --prefix=/tools && 22 | make ${MJ} && make install && 23 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 24 | -------------------------------------------------------------------------------- /build-scripts/tc-gawk.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="gawk" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools && 19 | make ${MJ} && make install && 20 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 21 | -------------------------------------------------------------------------------- /build-scripts/tc-gettext-tiny.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="gettext-tiny" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | 17 | make ${MJ} LIBINTL=MUSL prefix=/tools && 18 | cp -v msgfmt msgmerge xgettext /tools/bin && 19 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 20 | -------------------------------------------------------------------------------- /build-scripts/tc-grep.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="grep" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools && 19 | make ${MJ} && make install && 20 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 21 | -------------------------------------------------------------------------------- /build-scripts/tc-gzip.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="gzip" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools && 19 | make ${MJ} && make install && 20 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 21 | -------------------------------------------------------------------------------- /build-scripts/tc-headers.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | #tar xf ${SRC_PKGS}/linux-* && 4 | cd linux-* && 5 | 6 | export CC="${MLFS_TARGET}-gcc" && 7 | export CXX="${MLFS_TARGET}-g++" && 8 | export AR="${MLFS_TARGET}-ar" && 9 | export AS="${MLFS_TARGET}-as" && 10 | export RANLIB="${MLFS_TARGET}-ranlib" && 11 | export LD="${MLFS_TARGET}-ld" && 12 | export STRIP="${MLFS_TARGET}-strip" && 13 | 14 | make mrproper ${MJ} && 15 | ARCH=${MLFS_ARCH} make headers ${MJ} && 16 | find usr/include \( -name .install -o -name ..install.cmd \) -delete && 17 | cp -rv usr/include/* /tools/include && 18 | rm -v /tools/include/Makefile && 19 | 20 | cd ${SRC_ROOT} 21 | -------------------------------------------------------------------------------- /build-scripts/tc-libstdcxx.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | tar xf ${SRC_PKGS}/gcc* && 4 | cd gcc* && 5 | export VER=$(echo $PWD | cut -d - -f 2 | cut -d _ -f 1 ) && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | bash ../patches/gcc-10.3.1_git20210424-alpine/apply_patches_ct.sh && \ 16 | 17 | mkdir -v build && cd build && 18 | ../libstdc++-v3/configure \ 19 | --target=${MLFS_TARGET} \ 20 | --build=${MLFS_HOST} \ 21 | --host=${MLFS_TARGET} \ 22 | --prefix=/tools \ 23 | --disable-multilib \ 24 | --disable-nls \ 25 | --disable-libstdcxx-threads \ 26 | --disable-libstdcxx-pch \ 27 | --with-gxx-include-dir=/tools/${MLFS_TARGET}/include/c++/${VER} && 28 | make ${MJ} && make install && 29 | cd ${SRC_ROOT} && rm -rf gcc-* 30 | -------------------------------------------------------------------------------- /build-scripts/tc-m4.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="m4" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --prefix=/tools \ 17 | --build=${MLFS_HOST} \ 18 | --host=${MLFS_TARGET} && 19 | make ${MJ} && make install && 20 | 21 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 22 | -------------------------------------------------------------------------------- /build-scripts/tc-make.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="make" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools \ 19 | --without-guile && 20 | make ${MJ} && make install && 21 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 22 | -------------------------------------------------------------------------------- /build-scripts/tc-musl.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | tar xf ${SRC_PKGS}/musl-1* && 4 | cd musl-1* && 5 | 6 | ./configure \ 7 | CROSS_COMPILE=${MLFS_TARGET}- \ 8 | --prefix=/ \ 9 | --target=${MLFS_TARGET} && 10 | make ${MJ} && make DESTDIR=/tools install && 11 | mkdir -pv /tools/etc && 12 | case ${MLFS_ARCH} in 13 | x86_64) rm -v /tools/lib/ld-musl-x86_64.so.1 14 | ln -sv libc.so /tools/lib/ld-musl-x86_64.so.1 15 | export barch="x86_64" 16 | ;; 17 | i686) rm -v /tools/lib/ld-musl-i386.so.1 18 | ln -sv libc.so /tools/lib/ld-musl-i386.so.1 19 | export barch=i386 20 | ;; 21 | arm*) rm -v /tools/lib/ld-musl-arm.so.1 22 | rm -v /tools/lib/ld-musl-armhf.so.1 23 | ln -sv libc.so /tools/lib/ld-musl-arm.so.1 24 | ln -sv libc.so /tools/lib/ld-musl-armhf.so.1 25 | export barch=arm 26 | echo "/tools/lib" > /tools/etc/ld-musl-armhf.path 27 | ;; 28 | aarch64) rm -v /tools/lib/ld-musl-aarch64.so.1 29 | ln -sv libc.so /tools/lib/ld-musl-aarch64.so.1 30 | export barch="aarch64" 31 | ;; 32 | esac && 33 | 34 | echo "/tools/lib" > /tools/etc/ld-musl-${barch}.path && 35 | unset barch && 36 | cd ${SRC_ROOT} && rm -rf musl-1* 37 | -------------------------------------------------------------------------------- /build-scripts/tc-nano.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="nano" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | export LDFLAGS="-L/tools/lib" && 15 | export CPPFLAGS="-I/tools/include" && 16 | echo "Building $PKGNAME..." && 17 | ./configure --build=${MLFS_HOST} \ 18 | --host=${MLFS_TARGET} \ 19 | --prefix=/tools \ 20 | --enable-tiny && 21 | make ${MJ} && make install && unset LDFLAGS CPPFLAGS && 22 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 23 | -------------------------------------------------------------------------------- /build-scripts/tc-ncurses.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="ncurses" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | sed -i s/mawk// configure && 17 | ./configure --prefix=/tools \ 18 | --build=${MLFS_HOST} \ 19 | --host=${MLFS_TARGET} \ 20 | --with-shared \ 21 | --without-debug \ 22 | --without-ada \ 23 | --enable-widec \ 24 | --enable-overwrite && 25 | make ${MJ} && make install && 26 | 27 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 28 | -------------------------------------------------------------------------------- /build-scripts/tc-patch.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="patch-" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools && 19 | make ${MJ} && make install && 20 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 21 | -------------------------------------------------------------------------------- /build-scripts/tc-perl.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="perl" 4 | tar xf ${SRC_PKGS}/${PKGNAME}-5* && 5 | tar xf ${SRC_PKGS}/${PKGNAME}-cross* && 6 | cd ${PKGNAME}-5* && 7 | export VER="5.32.0" && 8 | export CC="${MLFS_TARGET}-gcc" && 9 | export CXX="${MLFS_TARGET}-g++" && 10 | export AR="${MLFS_TARGET}-ar" && 11 | export AS="${MLFS_TARGET}-as" && 12 | export RANLIB="${MLFS_TARGET}-ranlib" && 13 | export LD="${MLFS_TARGET}-ld" && 14 | export STRIP="${MLFS_TARGET}-strip" && 15 | 16 | echo "Building $PKGNAME..." && 17 | cp -r ../perl-cross-*/* ./ && 18 | patch -p1 < ../patches/perl-5.30-alpine/musl-locale.patch && 19 | ./configure --prefix=/tools \ 20 | --target=${MLFS_TARGET} && 21 | make ${MJ} && 22 | cp -v perl cpan/podlators/scripts/pod2man /tools/bin && 23 | mkdir -pv /tools/lib/perl5/${VER} && 24 | cp -Rv lib/* /tools/lib/perl5/${VER} && 25 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* ${PKGNAME}-* 26 | -------------------------------------------------------------------------------- /build-scripts/tc-pkgtools.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="pkgtools" 4 | cd ${SRC_PKGS}/${PKGNAME} && 5 | for prog in installpkg makepkg removepkg explodepkg \ 6 | pkgdiff upgradepkg; do 7 | install -v -m755 $prog /tools/bin/ 8 | done && 9 | 10 | cd ${SRC_ROOT} 11 | -------------------------------------------------------------------------------- /build-scripts/tc-sed.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="sed" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools && 19 | make ${MJ} && make install && 20 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 21 | -------------------------------------------------------------------------------- /build-scripts/tc-tar.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="tar-1.3" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools && 19 | make ${MJ} && make install && 20 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 21 | -------------------------------------------------------------------------------- /build-scripts/tc-tcl.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | tar xf ${SRC_PKGS}/tcl* && 4 | cd tcl* && 5 | 6 | export CC="${MLFS_TARGET}-gcc" && 7 | export CXX="${MLFS_TARGET}-g++" && 8 | export AR="${MLFS_TARGET}-ar" && 9 | export AS="${MLFS_TARGET}-as" && 10 | export RANLIB="${MLFS_TARGET}-ranlib" && 11 | export LD="${MLFS_TARGET}-ld" && 12 | export STRIP="${MLFS_TARGET}-strip" && 13 | 14 | echo "Building TCL..." && 15 | cd unix && 16 | ac_cv_func_strtod=yes \ 17 | tcl_cv_strtod_buggy=1 \ 18 | ./configure --build=${MLFS_HOST} \ 19 | --host=${MLFS_TARGET} \ 20 | --prefix=/tools && 21 | make ${MJ} && make install && 22 | chmod -v u+w /tools/lib/libtcl8.6.so && 23 | make install-private-headers && 24 | ln -sv tclsh8.6 /tools/bin/tclsh && 25 | 26 | cd ${SRC_ROOT} && rm -rf tcl* 27 | -------------------------------------------------------------------------------- /build-scripts/tc-texinfo.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="texinfo" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools && 19 | make ${MJ} && make install && 20 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 21 | -------------------------------------------------------------------------------- /build-scripts/tc-vim.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="vim" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | export LDFLAGS="-L/tools/lib" && 15 | export CPPFLAGS="-I/tools/include" && 16 | echo "Building $PKGNAME..." && 17 | ./configure --build=${MLFS_HOST} \ 18 | --host=${MLFS_TARGET} \ 19 | --prefix=/tools \ 20 | --disable-gui \ 21 | --without-x && 22 | make ${MJ} && make install && unset LDFLAGS CPPFLAGS && 23 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 24 | -------------------------------------------------------------------------------- /build-scripts/tc-xz.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | export PKGNAME="xz" 4 | tar xf ${SRC_PKGS}/${PKGNAME}* && 5 | cd ${PKGNAME}* && 6 | 7 | export CC="${MLFS_TARGET}-gcc" && 8 | export CXX="${MLFS_TARGET}-g++" && 9 | export AR="${MLFS_TARGET}-ar" && 10 | export AS="${MLFS_TARGET}-as" && 11 | export RANLIB="${MLFS_TARGET}-ranlib" && 12 | export LD="${MLFS_TARGET}-ld" && 13 | export STRIP="${MLFS_TARGET}-strip" && 14 | 15 | echo "Building $PKGNAME..." && 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools && 19 | make ${MJ} && make install && 20 | cd ${SRC_ROOT} && rm -rf ${PKGNAME}* 21 | -------------------------------------------------------------------------------- /build-scripts/toolchain.conf: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Auto-build toolchain for MLFS-8.00 4 | # Please check Build Config section before running script 5 | 6 | #### Build Config 7 | export MLFS_HOST="$(echo $MACHTYPE | \ 8 | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")" 9 | export MLFS_TARGET="armv7l-mlfs-linux-musleabihf" 10 | export MLFS_ARCH="arm" 11 | export MLFS_CPU="armv7-a+neon-vfpv4" 12 | export MLFS_CPU_ARCH="arm" 13 | export BUILD_ROOT="/mnt/mlfs" 14 | export SRC_ROOT=${BUILD_ROOT}/sources 15 | export SRC_PKGS=${SRC_ROOT}/packages 16 | export SRC_PATCHES=${SRC_ROOT}/patches 17 | export SRC_FILES=${SRC_ROOT}/files 18 | export MJ="-j8" 19 | export CSPEC="--with-tune=cortex-a15.cortex-a7 \ 20 | --with-float=hard \ 21 | --with-abi=aapcs-linux \ 22 | --with-mode=thumb " 23 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/.bash_logout: -------------------------------------------------------------------------------- 1 | # Begin ~/.bash_logout 2 | # Written for Beyond Linux From Scratch 3 | # by James Robertson 4 | 5 | # Personal items to perform on logout. 6 | 7 | # End ~/.bash_logout 8 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/.bash_profile: -------------------------------------------------------------------------------- 1 | if [ -f "$HOME/.bashrc" ] ; then 2 | source $HOME/.bashrc 3 | fi 4 | 5 | if [ -d "$HOME/bin" ] ; then 6 | export PATH=$HOME/bin:$PATH 7 | fi 8 | 9 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/.bashrc: -------------------------------------------------------------------------------- 1 | if [ -f "/etc/bashrc" ] ; then 2 | source /etc/bashrc 3 | fi 4 | 5 | export LANG=en_US.utf8 6 | #export SUDO_ASKPASS="/usr/libexec/openssh/ssh-askpass" 7 | 8 | 9 | #export XORG_PREFIX="/usr" 10 | #export XORG_CONFIG="--prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-static" 11 | #export PATH=$PATH:/opt/xorg/bin 12 | #export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/xorg/lib/pkgconfig:/opt/xorg/share/pkgconfig 13 | #export ACLOCAL="aclocal -I /opt/xorg/share/aclocal" 14 | export ACLOCAL="aclocal -I /usr/share/aclocal" 15 | 16 | #export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/qt5/lib/pkgconfig 17 | #export PATH=$PATH:/opt/qt5/bin 18 | 19 | export PS1_GIT="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\n\$ " 20 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/.profile: -------------------------------------------------------------------------------- 1 | # Begin ~/.profile 2 | # Personal environment variables and startup programs. 3 | 4 | if [ -d "$HOME/bin" ] ; then 5 | pathprepend $HOME/bin 6 | fi 7 | 8 | # Set up user specific i18n variables 9 | #export LANG=_.<@modifiers> 10 | 11 | # End ~/.profile 12 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/bash_completion.sh: -------------------------------------------------------------------------------- 1 | for script in /etc/bash_completion.d/*.sh ; do 2 | if [ -r $script ] ; then 3 | . $script 4 | fi 5 | done 6 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/bashrc: -------------------------------------------------------------------------------- 1 | alias ls='ls --color=auto' 2 | alias grep='grep --color=auto' 3 | 4 | # Setup a red prompt for root and a green one for users. 5 | RESET="\[\033[0m\]" 6 | NORMAL="\[\e[0m\]" 7 | RED="\[\e[1;31m\]" 8 | GREEN="\[\e[1;32m\]" 9 | if [[ $EUID == 0 ]] ; then 10 | PS1="\A | $RED\u [ $NORMAL\w$RED ]\n# $NORMAL$RESET" 11 | else 12 | PS1="\A | $GREEN\u [ $NORMAL\w$GREEN ]\n\$ $NORMAL$RESET" 13 | fi 14 | unset RED GREEN NORMAL 15 | 16 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/dircolors.sh: -------------------------------------------------------------------------------- 1 | if [ -f "/etc/dircolors" ] ; then 2 | eval $(dircolors -b /etc/dircolors) 3 | fi 4 | 5 | if [ -f "$HOME/.dircolors" ] ; then 6 | eval $(dircolors -b $HOME/.dircolors) 7 | fi 8 | 9 | alias ls='ls --color=auto' 10 | alias grep='grep --color=auto' 11 | 12 | 13 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/extrapaths.sh: -------------------------------------------------------------------------------- 1 | 2 | if [ -d /usr/local/lib/pkgconfig ] ; then 3 | export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig 4 | fi 5 | 6 | if [ -d /usr/local/bin ] ; then 7 | export PATH=/usr/local/bin:$PATH 8 | fi 9 | 10 | if [ -d /usr/local/sbin -a $EUID -eq 0 ] ; then 11 | export PATH=/usr/local/sbin:$PATH 12 | fi 13 | 14 | export MANPATH=/usr/share/man 15 | export INFOPATH=/usr/share/info 16 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/i18n.sh: -------------------------------------------------------------------------------- 1 | export=en_US.utf8 2 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/inputrc: -------------------------------------------------------------------------------- 1 | # Begin /etc/inputrc 2 | # Modified by Chris Lynn 3 | 4 | # Allow the command prompt to wrap to the next line 5 | set horizontal-scroll-mode Off 6 | 7 | # Enable 8bit input 8 | set meta-flag On 9 | set input-meta On 10 | 11 | # Turns off 8th bit stripping 12 | set convert-meta Off 13 | 14 | # Keep the 8th bit for display 15 | set output-meta On 16 | 17 | # none, visible or audible 18 | set bell-style none 19 | 20 | # All of the following map the escape sequence of the value 21 | # contained in the 1st argument to the readline specific functions 22 | "\eOd": backward-word 23 | "\eOc": forward-word 24 | 25 | # for linux console 26 | "\e[1~": beginning-of-line 27 | "\e[4~": end-of-line 28 | "\e[5~": beginning-of-history 29 | "\e[6~": end-of-history 30 | "\e[3~": delete-char 31 | "\e[2~": quoted-insert 32 | 33 | # for xterm 34 | "\eOH": beginning-of-line 35 | "\eOF": end-of-line 36 | 37 | # for Konsole 38 | "\e[H": beginning-of-line 39 | "\e[F": end-of-line 40 | 41 | # End /etc/inputrc 42 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/profile: -------------------------------------------------------------------------------- 1 | # Setup a red prompt for root and a green one for users. 2 | RESET="\[\033[0m\]" 3 | NORMAL="\[\e[0m\]" 4 | RED="\[\e[1;31m\]" 5 | GREEN="\[\e[1;32m\]" 6 | if [[ $EUID == 0 ]] ; then 7 | PS1="\A | $RED\u [ $NORMAL\w$RED ]\n# $NORMAL$RESET" 8 | else 9 | PS1="\A | $GREEN\u [ $NORMAL\w$GREEN ]\n\$ $NORMAL$RESET" 10 | fi 11 | unset RED GREEN NORMAL 12 | 13 | export PATH=/bin:/usr/bin 14 | export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkconfig 15 | 16 | #if root, add paths and remove history 17 | if [ $EUID -eq 0 ] ; then 18 | export PATH=/sbin:/usr/sbin:$PATH 19 | unset HISTFILE 20 | fi 21 | 22 | # Setup some environment variables 23 | export HISTSIZE=1000 24 | export HISTIGNORE="&:[bf]g:exit" 25 | 26 | #Set some defaultsfor graphical systems 27 | export XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/share/} 28 | export XDG_CONFIG_DIRS=${XDG_CONFIG_DIRS:-/etc/xdg/} 29 | export XDG_RUNTIME_DIRS=${XDG_RUNTIME_DIRS:-/tmp/-$USER} 30 | 31 | 32 | #Run script ins /etc/profile.d 33 | for script in /etc/profile.d/*.sh ; do 34 | if [ -r $script ] ; then 35 | . $script 36 | fi 37 | done 38 | 39 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/readline.sh: -------------------------------------------------------------------------------- 1 | # Setup the INPUTRC environment variable. 2 | if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then 3 | INPUTRC=/etc/inputrc 4 | fi 5 | export INPUTRC 6 | -------------------------------------------------------------------------------- /contrib/mlfs-bash_startup_scripts/umask.sh: -------------------------------------------------------------------------------- 1 | if [ "$(id -gn)" = "$(id -un)" -a $EUID -gt 99 ] ; then 2 | umask 002 3 | else 4 | umask 022 5 | fi 6 | -------------------------------------------------------------------------------- /doc/1-cross-tools/0-Build_Notes: -------------------------------------------------------------------------------- 1 | # General Build Notes for cross-tools 2 | 3 | # This small tool chain will be used to create another tool chain (tools) 4 | # that will use Musl libc instead of the default of GLIBC. Once the /tools 5 | # is built, /cross-tools will not longer be used for the rest of the build. 6 | 7 | # Cross-tools is not sandboxed and will depend on libraries and binaries 8 | # found in the host. Therefore cross-tools built on a Glibc host will not 9 | # run/work on a Musl host and vice verssa. 10 | 11 | # In general, fixes and patches will not be applied to most packages as this 12 | # tool chain will not be used for the final build. Cross-tools should be 13 | # built by the mlfs user and not root. 14 | 15 | # Each package should be unpacked in /mnt/mlfs/source, and change 16 | # to the unpacked source directory. For example: 17 | cd /mnt/mlfs/sources 18 | tar xf pkgs/foo-1.2.3.tar.gz 19 | cd foo-1.2.3 20 | 21 | # Then patch and compile per instruction 22 | patch -Np1 -i ../patches/foo-mlfs/fix-it.patch 23 | ./configure --prefix=/cross-tools 24 | make 25 | make install 26 | 27 | # After the package is installed, change directories and remove 28 | # unpacked source directory unless instructed: 29 | cd .. 30 | rm -rf foo-1.2.3 31 | -------------------------------------------------------------------------------- /doc/1-cross-tools/1-kernel_headers: -------------------------------------------------------------------------------- 1 | # Cross-Tools: Kernel Headers 2 | # Build & install as user mlfs 3 | 4 | # Clean sources 5 | make mrproper 6 | 7 | # Install 8 | 9 | ## For kernel up to 5.2.x: 10 | # make ARCH=${MLFS_ARCH} INSTALL_HDR_PATH=/cross-tools/${MLFS_TARGET} headers_install 11 | 12 | ## For kernels 5.3.x+: 13 | make ARCH=${MLFS_ARCH} headers 14 | mkdir -pv /cross-tools/${MLFS_TARGET}/include 15 | 16 | cp -rv usr/include/* /cross-tools/${MLFS_TARGET}/include 17 | 18 | # Remove unnecessary files that don't need to be in /cross-tools/.../include 19 | # directory 20 | # Note: .*.cmd files are extremely useful when compiling the entire kernel, 21 | # since they're avoid unnecessary invocations of GNU make. 22 | # But, since we just need the headers, we can delete them from our 23 | # cross-toolchain. 24 | # Reference: https://www.kernel.org/doc/ols/2003/ols2003-pages-185-200.pdf 25 | find /cross-tools/${MLFS_TARGET}/include -name '.*.cmd' -exec rm -vf {} \; 26 | rm -v /cross-tools/${MLFS_TARGET}/include/Makefile 27 | -------------------------------------------------------------------------------- /doc/1-cross-tools/2-binutils: -------------------------------------------------------------------------------- 1 | # Cross-Tools: GNU Binutils 2 | # Build and install as mlfs 3 | 4 | # Create build directory in-tree 5 | mkdir -v build && cd build 6 | 7 | # configure source 8 | ../configure \ 9 | --prefix=/cross-tools \ 10 | --target=${MLFS_TARGET} \ 11 | --with-sysroot=/cross-tools/${MLFS_TARGET} \ 12 | --disable-nls \ 13 | --disable-multilib \ 14 | --disable-werror \ 15 | --enable-deterministic-archives \ 16 | --disable-compressed-debug-sections 17 | 18 | # build to check host can build 19 | make configure-host 20 | 21 | # Build and install 22 | make && make install 23 | -------------------------------------------------------------------------------- /doc/1-cross-tools/3-gcc_static: -------------------------------------------------------------------------------- 1 | # Cross-Tools: GCC (static) 2 | # Build and install as mlfs 3 | 4 | # GCC now requires the GMP, MPFR and MPC packages to build. 5 | # Unpack them in-tree. 6 | xz -cd ../pkgs/mpfr-4.1.0.tar.xz | tar -xf - 7 | xz -cd ../pkgs/gmp-6.2.1.tar.xz | tar -xf - 8 | gzip -cd ../pkgs/mpc-1.2.1.tar.gz | tar -xf - 9 | mv -v mpfr-4.1.0 mpfr 10 | mv -v gmp-6.2.1 gmp 11 | mv -v mpc-1.2.1 mpc 12 | 13 | # The GCC documentation recommends building GCC in 14 | # a dedicated build directory 15 | mkdir -v build && cd build 16 | 17 | # Configure source 18 | CFLAGS='-g0 -O0' \ 19 | CXXFLAGS=$CFLAGS \ 20 | ../configure \ 21 | --prefix=/cross-tools --build=${MLFS_HOST} \ 22 | --host=${MLFS_HOST} --target=${MLFS_TARGET} \ 23 | --with-sysroot=/cross-tools/${MLFS_TARGET} \ 24 | --disable-nls --with-newlib \ 25 | --disable-libitm --disable-libvtv \ 26 | --disable-libssp --disable-shared \ 27 | --disable-libgomp --without-headers \ 28 | --disable-threads --disable-multilib \ 29 | --disable-libatomic --disable-libstdcxx \ 30 | --enable-languages=c --disable-libquadmath \ 31 | --disable-libsanitizer --with-arch=${MLFS_CPU} \ 32 | --disable-decimal-float --enable-clocale=generic 33 | 34 | # Build only the mininum 35 | make all-gcc all-target-libgcc 36 | 37 | # Install 38 | make install-gcc install-target-libgcc 39 | -------------------------------------------------------------------------------- /doc/1-cross-tools/4-musl: -------------------------------------------------------------------------------- 1 | # Cross-Tools: Musl 2 | # Build and install as mlfs 3 | 4 | # Configure source for cross build 5 | ./configure \ 6 | CROSS_COMPILE=${MLFS_TARGET}- \ 7 | --prefix=/ \ 8 | --target=${MLFS_TARGET} 9 | 10 | # Build and install 11 | make && DESTDIR=/cross-tools make install 12 | 13 | # Add missing directory and link 14 | mkdir -v /cross-tools/usr 15 | ln -sv ../include /cross-tools/usr/include 16 | 17 | case $(uname -m) in 18 | x86_64) export ARCH="x86_64" 19 | ;; 20 | i686) export ARCH="i386" 21 | ;; 22 | arm*) export ARCH="arm" 23 | ;; 24 | aarch64) export ARCH="aarch64" 25 | ;; 26 | esac 27 | 28 | # Fix link 29 | rm -vf /cross-tools/lib/ld-musl-${ARCH}.so.1 && 30 | ln -sv libc.so /cross-tools/lib/ld-musl-${ARCH}.so.1 31 | 32 | # Create link for ldd: 33 | ln -sv ../lib/ld-musl-$ARCH.so.1 /cross-tools/bin/ldd 34 | 35 | # Create config for dynamic library loading: 36 | mkdir -v /cross-tools/etc 37 | cat > /cross-tools/etc/ld-musl-$ARCH.path << "EOF" 38 | /cross-tools/lib 39 | /tools/lib 40 | EOF 41 | 42 | # For arm 43 | case $(uname -m) in 44 | arm*) ln -sv libc.so /cross-tools/lib/ld-musl-${ARCH2}.so.1 45 | cp -v /cross-tools/etc/ld-musl-$ARCH.path \ 46 | /cross-tools/etc/ld-musl-$ARCH2.path ;; 47 | esac 48 | unset ARCH ARCH2 49 | -------------------------------------------------------------------------------- /doc/1-cross-tools/5-gcc_final: -------------------------------------------------------------------------------- 1 | # Cross-Tools: GCC Final 2 | # Build and install as mlfs 3 | 4 | # Additional sources to add as GCC requires them 5 | xz -cd ../pkgs/mpfr-4.1.0.tar.xz | tar -xf - 6 | mv -v mpfr-4.1.0 mpfr 7 | xz -cd ../pkgs/gmp-6.2.1.tar.xz | tar -xf - 8 | mv -v gmp-6.2.1 gmp 9 | gunzip -cd ../pkgs/mpc-1.2.1.tar.gz | tar -xf - 10 | mv -v mpc-1.2.1 mpc 11 | 12 | # Apply patches [from Alpine linux] 13 | bash ../patches/gcc-alpine/apply_patches_ct.sh 14 | 15 | # Configure in a dedicated build directory 16 | mkdir build && cd build 17 | AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \ 18 | ../configure \ 19 | --prefix=/cross-tools \ 20 | --build=${MLFS_HOST} \ 21 | --host=${MLFS_HOST} \ 22 | --target=${MLFS_TARGET} \ 23 | --disable-multilib \ 24 | --with-sysroot=/cross-tools \ 25 | --disable-nls \ 26 | --enable-shared \ 27 | --enable-languages=c,c++ \ 28 | --enable-threads=posix \ 29 | --enable-clocale=generic \ 30 | --enable-libstdcxx-time \ 31 | --enable-fully-dynamic-string \ 32 | --disable-symvers \ 33 | --disable-libsanitizer \ 34 | --disable-lto-plugin \ 35 | --disable-libssp 36 | 37 | # Build 38 | make AS_FOR_TARGET="${MLFS_TARGET}-as" \ 39 | LD_FOR_TARGET="${MLFS_TARGET}-ld" 40 | 41 | # Install 42 | make install 43 | -------------------------------------------------------------------------------- /doc/1-cross-tools/6-file: -------------------------------------------------------------------------------- 1 | # Cross-Tools: File 2 | # Build and install as mlfs 3 | 4 | # Configure source 5 | ./configure --prefix=/cross-tools --disable-libseccomp 6 | 7 | # Build and install 8 | make && make install 9 | -------------------------------------------------------------------------------- /doc/2-toolchain/00-Build_Notes: -------------------------------------------------------------------------------- 1 | # General Build Notes for tools 2 | 3 | # This small tool chain will be used to create the final optimized system. 4 | # Once the /tools is built, /cross-tools will not longer be used for the 5 | # rest of the build. This tool chain was designed to be sandboxed and has 6 | # its own libc. * This should still be bult by mlfs user and not root.* 7 | 8 | # In general, some fixes and patches will be applied to 9 | # packages as this tool chain will be used for the final build. 10 | 11 | # ************************************************************************** 12 | # * This is also a good time to choose a package manager/system for 13 | # * creating, deploying, and managing packages. Since package management 14 | # * is outide the scope of this project, it will not be discussed here nor 15 | # * will a package system be used when building the final system. 16 | # ************************************************************************** 17 | # For example, Slackware's pkgtools can be used. Refer to: 18 | # https://github.com/dslm4515/MLFS-pkgtool 19 | 20 | # Each package should be unpacked in /mnt/mlfs/source, and change 21 | # to the unpacked source directory. For example: 22 | cd /mnt/mlfs/sources 23 | tar xf pkgs/foo-1.2.3.tar.gz 24 | cd foo-1.2.3 25 | 26 | # Then patch and compile per instruction 27 | patch -Np1 -i ../patches/foo-mlfs/fix-it.patch 28 | ./configure --prefix=/tools 29 | make 30 | make install 31 | 32 | # After the package is installed, change directories and remove 33 | # unpacked source directory unless instructed: 34 | cd .. 35 | rm -rf foo-1.2.3 36 | -------------------------------------------------------------------------------- /doc/2-toolchain/01-musl: -------------------------------------------------------------------------------- 1 | # Tool Chain: Musl 2 | # Build and install as mlfs 3 | 4 | # Configure 5 | ./configure \ 6 | CROSS_COMPILE=${MLFS_TARGET}- \ 7 | --prefix=/ \ 8 | --target=${MLFS_TARGET} 9 | 10 | # Build and install 11 | make && make DESTDIR=/tools install 12 | 13 | # Make sure symlink is valid: 14 | # /tools/lib/ld-musl-$ARCH.so.1 to /tools/lib/libc.so 15 | 16 | case $(uname -m) in 17 | x86_64) rm -v /tools/lib/ld-musl-x86_64.so.1 18 | ln -sv libc.so /tools/lib/ld-musl-x86_64.so.1 19 | export barch=$(uname -m) 20 | ;; 21 | i686) rm -v /tools/lib/ld-musl-i386.so.1 22 | ln -sv libc.so /tools/lib/ld-musl-i386.so.1 23 | export barch=i386 24 | ;; 25 | arm*) rm -v /tools/lib/ld-musl-arm.so.1 26 | ln -sv libc.so /tools/lib/ld-musl-arm.so.1 27 | export barch=arm 28 | ;; 29 | aarch64) rm -v /tools/lib/ld-musl-aarch64.so.1 30 | ln -sv libc.so /tools/lib/ld-musl-aarch64.so.1 31 | export barch=$(uname -m) 32 | ;; 33 | esac 34 | 35 | # Create dynamic linker config 36 | mkdir -pv /tools/etc && 37 | cat > /tools/etc/ld-musl-${barch}.path << "EOF" 38 | /tools/lib 39 | EOF 40 | 41 | unset barch 42 | -------------------------------------------------------------------------------- /doc/2-toolchain/03-binutils: -------------------------------------------------------------------------------- 1 | # Tool Chain: Binutils 2 | # Build and install as mlfs 3 | 4 | # Set the environment to cross-compile with cross-tools 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Link directories so libraries can be found in both lib & lib64 14 | case $(uname -m) in 15 | x86_64) ln -sv lib /tools/lib64 ;; 16 | esac 17 | 18 | # Configure in dedicated build directory 19 | mkdir -v build && cd build 20 | ../configure --prefix=/tools \ 21 | --with-lib-path=/tools/lib \ 22 | --build=${MLFS_HOST} \ 23 | --host=${MLFS_TARGET} \ 24 | --target=${MLFS_TARGET} \ 25 | --disable-nls \ 26 | --disable-werror \ 27 | --with-sysroot 28 | # Build 29 | make 30 | 31 | # Install 32 | make install 33 | 34 | # Build and install linker that will be used later 35 | # after adjusting toolchain 36 | make -C ld clean 37 | make -C ld LIB_PATH=/usr/lib:/lib 38 | cp -v ld/ld-new /tools/bin 39 | 40 | -------------------------------------------------------------------------------- /doc/2-toolchain/05-kernel-headers: -------------------------------------------------------------------------------- 1 | # Tool Chain: Kernel Headers 2 | # Build and install as mlfs 3 | 4 | # Clean source 5 | make mrproper 6 | 7 | # Extract headers 8 | # For kernels up to 5.2.x: 9 | # ARCH=${MLFS_ARCH} make INSTALL_HDR_PATH=dest headers_install 10 | # For kernels 5.3.x and newer: 11 | ARCH=${MLFS_ARCH} make headers 12 | 13 | # Install 14 | cp -rv usr/include/* /tools/include 15 | 16 | # ... for kernels up to 5.2.x: 17 | # cp -rv dest/include/* /tools/include 18 | 19 | # Remove unnecessary files for this stage: 20 | find /tools/include \( -name '.*' -o -name '.*.cmd' \) -exec rm -vf {} \; 21 | rm -v /tools/include/Makefile 22 | -------------------------------------------------------------------------------- /doc/2-toolchain/07-libstdcxx: -------------------------------------------------------------------------------- 1 | # Tool Chain: libstdcxx (GCC) 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Additional sources to add 14 | # Added "pipping" from xz/gunzip for tar, improves 15 | # compatibility with sane implementations. 16 | xz -cd ../pkgs/gmp-6.2.1.tar.xz | tar -xf - 17 | gunzip -cd ../pkgs/mpc-1.2.1.tar.gz | tar -xf - 18 | xz -cd ../pkgs/mpfr-4.1.0.tar.xz | tar -xf - 19 | mv -v gmp-6.2.1 gmp 20 | mv -v mpc-1.2.1 mpc 21 | mv -v mpfr-4.1.0 mpfr 22 | 23 | # The target build is finding the host libstdc++'s , fix it 24 | patch -Np1 -i ../patches/gcc-mlfs-11.2.0/fix_fenv_header.patch 25 | 26 | # Apply patches [from alpine linux] 27 | bash ../patches/gcc-alpine/apply_patches_ct.sh 28 | 29 | # Configure in a dedicated directory 30 | mkdir -v build && cd build 31 | ../libstdc++-v3/configure \ 32 | --target=${MLFS_TARGET} \ 33 | --build=${MLFS_HOST} \ 34 | --host=${MLFS_TARGET} \ 35 | --prefix=/tools \ 36 | --disable-multilib \ 37 | --disable-nls \ 38 | --disable-libstdcxx-threads \ 39 | --disable-libstdcxx-pch \ 40 | --with-gxx-include-dir=/tools/${MLFS_TARGET}/include/c++/11.2.0 41 | 42 | # Compile 43 | make 44 | 45 | # Install 46 | make install 47 | -------------------------------------------------------------------------------- /doc/2-toolchain/08-tcl: -------------------------------------------------------------------------------- 1 | # Tool Chain: TCL 2 | # Build and install as mlfs 3 | # Can be optional: Package used for testing final system packages 4 | 5 | # Set the environment for cross-compiling if not done already. 6 | CC="${MLFS_TARGET}-gcc" 7 | CXX="${MLFS_TARGET}-g++" 8 | AR="${MLFS_TARGET}-ar" 9 | AS="${MLFS_TARGET}-as" 10 | RANLIB="${MLFS_TARGET}-ranlib" 11 | LD="${MLFS_TARGET}-ld" 12 | STRIP="${MLFS_TARGET}-strip" 13 | 14 | # Configure source 15 | cd unix 16 | ac_cv_func_strtod=yes \ 17 | tcl_cv_strtod_buggy=1 \ 18 | ./configure --build=${MLFS_HOST} \ 19 | --host=${MLFS_TARGET} \ 20 | --prefix=/tools 21 | 22 | # Build and install to toolchain 23 | make && make install 24 | 25 | # Install Headers and create link 26 | chmod -v u+w /tools/lib/libtcl8.6.so 27 | make install-private-headers 28 | ln -sv tclsh8.6 /tools/bin/tclsh 29 | -------------------------------------------------------------------------------- /doc/2-toolchain/09-expect: -------------------------------------------------------------------------------- 1 | # Toolchain: Expect 2 | # Build and install as mlfs 3 | # Can be optional: Package used for testing final system packages 4 | # *No need to use latest version, so far. If so, patches need updating.* 5 | 6 | # Set the environment for cross-compiling if not done already. 7 | CC="${MLFS_TARGET}-gcc" 8 | CXX="${MLFS_TARGET}-g++" 9 | AR="${MLFS_TARGET}-ar" 10 | AS="${MLFS_TARGET}-as" 11 | RANLIB="${MLFS_TARGET}-ranlib" 12 | LD="${MLFS_TARGET}-ld" 13 | STRIP="${MLFS_TARGET}-strip" 14 | 15 | # Patch source to run with musl libc 16 | patch -Np1 -i ../patches/expect-5.45.3/dont-put-toolchain-in-libpath.patch 17 | patch -Np1 -i ../patches/expect-5.45.3/dont-configure-testsuites.patch 18 | patch -Np1 -i ../patches/expect-5.45.3/allow-cross-compile.patch 19 | 20 | # Update files to support Musl Libc for configure 21 | cp -v ../files/config.guess-musl tclconfig/config.guess 22 | cp -v ../files/config.sub-musl tclconfig/config.sub 23 | cp -v configure{,.orig} 24 | sed 's:/usr/local/bin:/bin:' configure.orig > configure 25 | 26 | # Configure source 27 | ./configure --build=${MLFS_HOST} \ 28 | --host=${MLFS_TARGET} \ 29 | --prefix=/tools \ 30 | --with-tcl=/tools/lib \ 31 | --with-tclinclude=/tools/include 32 | 33 | # Build and install to toolchain 34 | make && make SCRIPTS="" install 35 | -------------------------------------------------------------------------------- /doc/2-toolchain/10-dejagnu: -------------------------------------------------------------------------------- 1 | # Toolchain: DejaGNU 2 | # Build and install as mlfs 3 | # Can be optional: Package used for testing final system packages 4 | # *No need to use latest version, so far. If so, patches need updating.* 5 | 6 | # Set the environment for cross-compiling if not done already. 7 | CC="${MLFS_TARGET}-gcc" 8 | CXX="${MLFS_TARGET}-g++" 9 | AR="${MLFS_TARGET}-ar" 10 | AS="${MLFS_TARGET}-as" 11 | RANLIB="${MLFS_TARGET}-ranlib" 12 | LD="${MLFS_TARGET}-ld" 13 | STRIP="${MLFS_TARGET}-strip" 14 | 15 | # Configure source 16 | ./configure --build=${MLFS_HOST} \ 17 | --host=${MLFS_TARGET} \ 18 | --prefix=/tools 19 | 20 | # Build and install to toolchain 21 | make && make install 22 | -------------------------------------------------------------------------------- /doc/2-toolchain/11-m4: -------------------------------------------------------------------------------- 1 | # Toolchain: M4 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} 17 | 18 | # Build and install to toolchain 19 | make && make install 20 | -------------------------------------------------------------------------------- /doc/2-toolchain/12-ncurses: -------------------------------------------------------------------------------- 1 | # Toolchain: Ncurses 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Ensure that gawk is found first during configuration: 14 | sed -i s/mawk// configure 15 | 16 | # Configure source 17 | ./configure --prefix=/tools \ 18 | --build=${MLFS_HOST} \ 19 | --host=${MLFS_TARGET} \ 20 | --with-shared \ 21 | --without-debug \ 22 | --without-ada \ 23 | --enable-widec \ 24 | --enable-overwrite 25 | 26 | # Build and install to toolchain 27 | make && make install 28 | -------------------------------------------------------------------------------- /doc/2-toolchain/12a-netbsd-curses: -------------------------------------------------------------------------------- 1 | # Toolchain: NetBSD-curses 2 | # Build and install as mlfs 3 | 4 | # There is no configure script 5 | CC="${MLFS_TARGET}-gcc" \ 6 | CXX="${MLFS_TARGET}-g++" \ 7 | AR="${MLFS_TARGET}-ar" \ 8 | AS="${MLFS_TARGET}-as" \ 9 | RANLIB="${MLFS_TARGET}-ranlib" \ 10 | LD="${MLFS_TARGET}-ld" \ 11 | STRIP="${MLFS_TARGET}-strip" \ 12 | PREFIX=/tools make all 13 | 14 | # Install to /tools 15 | make PREFIX=/tools all install 16 | -------------------------------------------------------------------------------- /doc/2-toolchain/13-bash: -------------------------------------------------------------------------------- 1 | # Toolchain: bash 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Cross Compiling the configure script 14 | # does not does not determine the correct 15 | # values for the following, Set the values 16 | # manually: 17 | cat > config.cache << "EOF" 18 | ac_cv_func_mmap_fixed_mapped=yes 19 | ac_cv_func_strcoll_works=yes 20 | ac_cv_func_working_mktime=yes 21 | bash_cv_func_sigsetjmp=present 22 | bash_cv_getcwd_malloc=yes 23 | bash_cv_job_control_missing=present 24 | bash_cv_printf_a_format=yes 25 | bash_cv_sys_named_pipes=present 26 | bash_cv_ulimit_maxfds=yes 27 | bash_cv_under_sys_siglist=yes 28 | bash_cv_unusable_rtsigs=no 29 | gt_cv_int_divbyzero_sigfpe=yes 30 | EOF 31 | 32 | # Configure source 33 | ./configure --prefix=/tools \ 34 | --without-bash-malloc \ 35 | --build=${MLFS_HOST} \ 36 | --host=${MLFS_TARGET} \ 37 | --cache-file=config.cache 38 | 39 | # Build and install to toolchain 40 | make && make install 41 | -------------------------------------------------------------------------------- /doc/2-toolchain/14-bison: -------------------------------------------------------------------------------- 1 | # Toolchain: bison 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} 17 | 18 | # Build and install to toolchain 19 | make && make install 20 | -------------------------------------------------------------------------------- /doc/2-toolchain/15-bzip2: -------------------------------------------------------------------------------- 1 | # Toolchain: Bzip2 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Fix the Makefiles for ensures installation of symbolic 14 | # links are relative and the man pages are installed into 15 | # the correct location: 16 | cp Makefile{,.orig} 17 | sed -e "/^all:/s/ test//" Makefile.orig > Makefile 18 | sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile 19 | sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile 20 | 21 | # Prepare source 22 | make -f Makefile-libbz2_so CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" 23 | make clean 24 | 25 | # Build 26 | make CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" 27 | 28 | # Install to tool chain 29 | make PREFIX=/tools install 30 | -------------------------------------------------------------------------------- /doc/2-toolchain/16-coreutils: -------------------------------------------------------------------------------- 1 | # Toolchain: Coreutils 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Re-create configure script ... often fails, so it may be omited if it fails 14 | # Will need to unpack again if it fails 15 | autoreconf -vif 16 | 17 | #patch -Np1 -i ../patches/coreutils-alpine/ls.patch 18 | 19 | # Cross Compiling the configure script 20 | # does not does not determine the correct 21 | # values for the following, Set the values 22 | # manually: 23 | cat > config.cache << EOF 24 | fu_cv_sys_stat_statfs2_bsize=no 25 | ac_cv_func_syncfs=no 26 | gl_cv_func_working_mkstemp=yes 27 | gl_cv_func_working_acl_get_file=yes 28 | EOF 29 | 30 | # Suppress a test which on some machines can loop forever: 31 | sed -i '/test.lock/s/^/#/' gnulib-tests/gnulib.mk 32 | 33 | # Configure source 34 | ./configure --prefix=/tools \ 35 | --build=${MLFS_HOST} \ 36 | --host=${MLFS_TARGET} \ 37 | --enable-install-program=hostname \ 38 | --cache-file=config.cache 39 | 40 | # Build and install to toolchain 41 | make && make install 42 | -------------------------------------------------------------------------------- /doc/2-toolchain/17-diffutils: -------------------------------------------------------------------------------- 1 | # Toolchain: diffutils 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} 17 | 18 | # Build and install to toolchain 19 | make && make install 20 | -------------------------------------------------------------------------------- /doc/2-toolchain/18-file: -------------------------------------------------------------------------------- 1 | # Toolchain: File 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} 17 | 18 | # Build and install to toolchain 19 | make && make install 20 | -------------------------------------------------------------------------------- /doc/2-toolchain/19-findutils: -------------------------------------------------------------------------------- 1 | # Toolchain: Findutils 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gl/lib/*.c && 14 | sed -i '/unistd/a #include ' gl/lib/mountlist.c && 15 | echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h 16 | 17 | # Configure source 18 | ./configure --prefix=/tools \ 19 | --build=${MLFS_HOST} \ 20 | --host=${MLFS_TARGET} 21 | 22 | # Build and install to toolchain 23 | make && make install 24 | -------------------------------------------------------------------------------- /doc/2-toolchain/20-gawk: -------------------------------------------------------------------------------- 1 | # Toolchain: Gawk 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} 17 | 18 | # Build and install to toolchain 19 | make && make install 20 | -------------------------------------------------------------------------------- /doc/2-toolchain/21-gettext-tiny: -------------------------------------------------------------------------------- 1 | # Toolchain: Gettext-tiny 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Build and install to toolchain 14 | make ${MJ} LIBINTL=MUSL prefix=/tools 15 | cp -v msgfmt msgmerge xgettext /tools/bin 16 | -------------------------------------------------------------------------------- /doc/2-toolchain/22-grep: -------------------------------------------------------------------------------- 1 | # Toolchain: Grep 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} 17 | 18 | # Build and install to toolchain 19 | make && make install 20 | -------------------------------------------------------------------------------- /doc/2-toolchain/23-gzip: -------------------------------------------------------------------------------- 1 | # Toolchain: Gzip 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} 17 | 18 | # Build and install to toolchain 19 | make && make install 20 | -------------------------------------------------------------------------------- /doc/2-toolchain/24-make: -------------------------------------------------------------------------------- 1 | # Toolchain: Make 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} \ 17 | --without-guile 18 | 19 | # Build and install to toolchain 20 | make && make install 21 | -------------------------------------------------------------------------------- /doc/2-toolchain/25-patch: -------------------------------------------------------------------------------- 1 | # Toolchain: Patch 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} 17 | 18 | # Build and install to toolchain 19 | make && make install 20 | -------------------------------------------------------------------------------- /doc/2-toolchain/26-perl: -------------------------------------------------------------------------------- 1 | # Toolchain: Perl 5.32.1 2 | # Build and install as mlfs 3 | # perl 5.34.0 will not cross-compile under 4 | # musl, even with latest perl-cross 1.3.6 5 | 6 | # Set the environment for cross-compiling if not done already. 7 | CC="${MLFS_TARGET}-gcc" 8 | CXX="${MLFS_TARGET}-g++" 9 | AR="${MLFS_TARGET}-ar" 10 | AS="${MLFS_TARGET}-as" 11 | RANLIB="${MLFS_TARGET}-ranlib" 12 | LD="${MLFS_TARGET}-ld" 13 | STRIP="${MLFS_TARGET}-strip" 14 | 15 | # Apply perl-cross over perl source 16 | cp -vrf ../perl-cross-1.3.5/* ./ 17 | 18 | # Configure source 19 | ./configure --prefix=/tools \ 20 | --target=${MLFS_TARGET} 21 | 22 | # Build 23 | make 24 | 25 | # Copy only what is needed: 26 | cp -v perl cpan/podlators/scripts/pod2man /tools/bin && 27 | mkdir -pv /tools/lib/perl5/5.32.1 && 28 | cp -Rv lib/* /tools/lib/perl5/5.32.1 29 | 30 | -------------------------------------------------------------------------------- /doc/2-toolchain/27-sed: -------------------------------------------------------------------------------- 1 | # Toolchain: Sed 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} 17 | 18 | # Build and install to toolchain 19 | make && make install 20 | -------------------------------------------------------------------------------- /doc/2-toolchain/28-tar: -------------------------------------------------------------------------------- 1 | # Toolchain: Tar 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} 17 | 18 | # Build and install to toolchain 19 | make && make install 20 | -------------------------------------------------------------------------------- /doc/2-toolchain/29-texinfo: -------------------------------------------------------------------------------- 1 | # Toolchain: Texinfo 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} 17 | 18 | # Build and install to toolchain 19 | make && make install 20 | -------------------------------------------------------------------------------- /doc/2-toolchain/30-xz: -------------------------------------------------------------------------------- 1 | # Toolchain: Xz 2 | # Build and install as mlfs 3 | 4 | # Set the environment for cross-compiling if not done already. 5 | CC="${MLFS_TARGET}-gcc" 6 | CXX="${MLFS_TARGET}-g++" 7 | AR="${MLFS_TARGET}-ar" 8 | AS="${MLFS_TARGET}-as" 9 | RANLIB="${MLFS_TARGET}-ranlib" 10 | LD="${MLFS_TARGET}-ld" 11 | STRIP="${MLFS_TARGET}-strip" 12 | 13 | # Configure source 14 | ./configure --prefix=/tools \ 15 | --build=${MLFS_HOST} \ 16 | --host=${MLFS_TARGET} 17 | 18 | # Build and install to toolchain 19 | make && make install 20 | -------------------------------------------------------------------------------- /doc/2-toolchain/31-flex: -------------------------------------------------------------------------------- 1 | # Toolchain: Flex 2 | # Build and install as mlfs 3 | # Required if building GCC from 4 | # source snapshots 5 | 6 | # Set the environment for cross-compiling if not done already. 7 | CC="${MLFS_TARGET}-gcc" 8 | CXX="${MLFS_TARGET}-g++" 9 | AR="${MLFS_TARGET}-ar" 10 | AS="${MLFS_TARGET}-as" 11 | RANLIB="${MLFS_TARGET}-ranlib" 12 | LD="${MLFS_TARGET}-ld" 13 | STRIP="${MLFS_TARGET}-strip" 14 | 15 | # Configure source 16 | ac_cv_func_malloc_0_nonnull=yes \ 17 | ac_cv_func_realloc_0_nonnull=yes \ 18 | HELP2MAN=/tools/bin/true \ 19 | ./configure --prefix=/tools \ 20 | --build=${MLFS_HOST} \ 21 | --host=${MLFS_TARGET} 22 | 23 | # Build and install to toolchain 24 | make && make install 25 | -------------------------------------------------------------------------------- /doc/2-toolchain/32-nano: -------------------------------------------------------------------------------- 1 | # Toolchain: nano 2 | # Build and install as mlfs 3 | # Optional package: Text editor for convenience or trouble shooting 4 | # ** Nano fails to build, as it is hardcoded to use host's headers. ** 5 | # ** Can be built in chroot, if desired.** 6 | 7 | # Once in chroot ... 8 | # Configure source 9 | ./configure --prefix=/tools \ 10 | --build=${MLFS_HOST} \ 11 | --host=${MLFS_TARGET} \ 12 | --enable-tiny 13 | 14 | # Build and install to toolchain 15 | make && make install 16 | 17 | -------------------------------------------------------------------------------- /doc/2-toolchain/33-vim: -------------------------------------------------------------------------------- 1 | # Toolchain: Vim 2 | # Build and install as mlfs 3 | # Optional package: Text editor for convenience or trouble shooting 4 | 5 | # Configure and use libraries & headers iin /tools 6 | LDFLAGS="-L/tools/lib" \ 7 | CPPFLAGS="-I/tools/include" \ 8 | ./configure --prefix=/tools --enable-gui=no --without-x 9 | 10 | # Build and install to toolchain 11 | make && make install 12 | 13 | # Some users use vim as vi 14 | ln -sv vim /tools/bin/vi 15 | 16 | unset LDFLAGS CPPFLAGS 17 | -------------------------------------------------------------------------------- /doc/2-toolchain/34-Stripping_and_Ownership: -------------------------------------------------------------------------------- 1 | # Stripping 2 | # This step is optional, but if the LFS partition 3 | # is rather small, it is beneficial to learn that 4 | # unnecessary items can be removed. The executables 5 | # and libraries built so far contain about 70 MB 6 | # of unneeded debugging symbols. 7 | 8 | # Remove debug symbols with: 9 | find /tools/lib -type f -exec strip --strip-unneeded {} \; 10 | /usr/bin/strip --strip-unneeded /tools/{,s}bin/* 11 | 12 | # Remove the documentation: 13 | rm -rf /tools/{,share}/{info,man,doc} 14 | 15 | # Remove unneeded files: 16 | find /tools/{lib,libexec} -name \*.la -exec rm -rvf {} \; 17 | 18 | # Changing Ownership 19 | # Currently, the $MLFS/tools directory is owned by 20 | # the user mlfs, a user that exists only on the 21 | # host system. If the $MLFS/tools directory is kept 22 | # as is, the files are owned by a user ID without 23 | # a corresponding account. This is dangerous because 24 | # a user account created later could get this same 25 | # user ID and would own the $MLFS/tools directory 26 | # and all the files therein, thus exposing these 27 | # files to possible malicious manipulation. 28 | 29 | # To avoid this issue, you could add the lfs user 30 | # to the new MLFS system later when creating the 31 | # /etc/passwd file, taking care to assign it the 32 | # same user and group IDs as on the host system. 33 | 34 | # ************************************************ 35 | # The commands in the remainder of this build must 36 | # be performed while logged in as user root and 37 | # no longer as user mlfs. Also, double check that 38 | # $MLFS is set in root's environment. 39 | # ************************************************ 40 | 41 | # Change the ownership of the $MLFS/tools directory 42 | # to user root by running the following command: 43 | chown -R root:root $MLFS/tools 44 | -------------------------------------------------------------------------------- /doc/3-Chroot/001-Prepare_VKFS: -------------------------------------------------------------------------------- 1 | # Prepare Virtual Kernel Filesystems for chroot 2 | # This section is done by root 3 | 4 | export MLFS=/mnt/mlfs 5 | 6 | # Create directories and nodes 7 | mkdir -pv $MLFS/{dev,proc,sys,run} 8 | mknod -m 600 $MLFS/dev/console c 5 1 9 | mknod -m 666 $MLFS/dev/null c 1 3 10 | 11 | # Mount virtual filesystems 12 | mount -v --bind /dev $MLFS/dev 13 | mount -vt devpts devpts $MLFS/dev/pts -o gid=5,mode=620 14 | mount -vt proc proc $MLFS/proc 15 | mount -vt sysfs sysfs $MLFS/sys 16 | mount -vt tmpfs tmpfs $MLFS/run 17 | if [ -h $MLFS/dev/shm ]; then 18 | mkdir -pv $MLFS/$(readlink $MLFS/dev/shm) 19 | fi 20 | 21 | 22 | -------------------------------------------------------------------------------- /doc/3-Chroot/002-Enter_Chroot: -------------------------------------------------------------------------------- 1 | # Enter the Chroot Environment 2 | # This section is done by root 3 | 4 | chroot "$MLFS" /tools/bin/env -i \ 5 | HOME=/root \ 6 | TERM="$TERM" \ 7 | PS1='(mlfs chroot) \u:\w\$ ' \ 8 | PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ 9 | /tools/bin/bash --login +h 10 | 11 | -------------------------------------------------------------------------------- /doc/3-Chroot/003-Create_Directories: -------------------------------------------------------------------------------- 1 | # Create Directories 2 | # This section is done in Chroot environment 3 | 4 | # Create a standard directory tree by issuing the following commands: 5 | mkdir -pv /{boot,etc/{opt,sysconfig},home,mnt,opt} 6 | mkdir -pv /{media/{floppy,cdrom},srv,var} 7 | install -dv -m 0750 /root 8 | install -dv -m 1777 /tmp /var/tmp 9 | mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src} 10 | mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man} 11 | mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo} 12 | mkdir -v /usr/libexec 13 | mkdir -pv /usr/{,local/}share/man/man{1..8} 14 | 15 | mkdir -v /var/{log,mail,spool} 16 | ln -sv /run /var/run 17 | ln -sv /run/lock /var/lock 18 | mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local} 19 | 20 | ln -sv usr/bin /bin 21 | ln -sv usr/sbin /sbin 22 | ln -sv usr/lib /lib 23 | mkdir -pv /usr/lib/firmware 24 | -------------------------------------------------------------------------------- /doc/3-Chroot/005-Kernel_Headers: -------------------------------------------------------------------------------- 1 | # Final System: Kernel Headers 2 | # Use latest kernel version when possible 3 | # This section is done in Chroot environment 4 | 5 | # Clean source tree 6 | make mrproper 7 | 8 | # Extract headers 9 | # !! The recommended make target “headers_install” cannot 10 | # !! be used, because it requires rsync, which is not 11 | # !! available in /tools. The headers are first placed in ./usr 12 | # 13 | # For kernels up to 5.2.x: 14 | #make INSTALL_HDR_PATH=dest headers_install 15 | 16 | # Kernel version greater than 5.9.16 will not compile under musl 17 | patch -Np1 -i ../patches/kernel/include-uapi-linux-swab-Fix-potentially-missing-__always_inline.patch 18 | 19 | # For kernels 5.3.x and newer: 20 | make headers 21 | 22 | # Install Headers 23 | # Kernel up to 5.2.x: 24 | # cp -rv dest/include/* /usr/include 25 | 26 | # Kernels 5.2.x and newer: 27 | cp -rv usr/include/* /usr/include 28 | 29 | # After installed, there still are also some hidden 30 | # files used by the kernel developers (for what?) 31 | # and not needed by MLFS that now can be removed 32 | # from our /usr/include. 33 | find /usr/include -name '.*' -exec rm -vf {} \; 34 | 35 | # The Makefile present also won't be used 36 | rm -v /usr/include/Makefile 37 | -------------------------------------------------------------------------------- /doc/3-Chroot/006-Man_pages: -------------------------------------------------------------------------------- 1 | # Final System: Man Pages 2 | # This section is done in Chroot environment 3 | 4 | make install 5 | -------------------------------------------------------------------------------- /doc/3-Chroot/009-Skalibs: -------------------------------------------------------------------------------- 1 | # Final System: Skalibs 2 | # This section is done in Chroot environment 3 | 4 | # Configure source 5 | ./configure --enable-shared \ 6 | --enable-static \ 7 | --libdir=/usr/lib 8 | 9 | # Build and Install 10 | make 11 | make install 12 | cp -v ../files/skalibs-alpine/skalibs.pc /usr/lib/pkgconfig/ 13 | sed -i "s|@@VERSION@@|2.11.2.0|" -i /usr/lib/pkgconfig/skalibs.pc 14 | -------------------------------------------------------------------------------- /doc/3-Chroot/010-utmps: -------------------------------------------------------------------------------- 1 | # Final System: utmps 2 | # This section is done in Chroot environment 3 | 4 | # Set the version in pkconfig file 5 | cp -v ../files/utmps-alpine/*.pc /tmp/ 6 | sed -i -e "s/@@VERSION@@/0.1.2.0/g" -- /tmp/*.pc 7 | 8 | # Configure source 9 | ./configure --enable-shared \ 10 | --enable-static \ 11 | --enable-allstatic \ 12 | --enable-static-libc \ 13 | --libdir=/usr/lib \ 14 | --with-dynlib=/usr/lib \ 15 | --libexecdir="/usr/lib/utmps" 16 | 17 | # Build and Install 18 | make 19 | make install 20 | install -v -D -m644 /tmp/utmps.pc /usr/lib/pkgconfig/ 21 | 22 | # Create link as some expect header in /usr/include: 23 | ln -sv utmps/utmpx.h /usr/include/utmpx.h 24 | 25 | # Clean up 26 | rm -rf /tmp/*.pc 27 | -------------------------------------------------------------------------------- /doc/3-Chroot/011-Time_Zone_Utilities: -------------------------------------------------------------------------------- 1 | # Final System: TimeZone Utilites & Data 2 | # This section is done in Chroot environment 3 | 4 | # Set the timezones to create 5 | export timezones="africa antarctica asia australasia europe northamerica \ 6 | southamerica etcetera backward factory" 7 | 8 | # Unpack the sources in a build directory 9 | mkdir tzdb && cd tzdb && 10 | tar xf ../pkgs/tzdata2021a.tar.gz && 11 | tar xf ../pkgs/tzcode2021a.tar.gz && 12 | tar xf ../pkgs/posixtz-0.5.tar.xz 13 | 14 | # Apply patch from Adelie Linux 15 | patch -Np1 -i ../patches/posixtz-adelie/0001-posixtz-fix-up-lseek.patch 16 | 17 | # Build utilities 18 | make CFLAGS="$CFLAGS -DHAVE_STDINT_H=1" TZDIR="/usr/share/zoneinfo" 19 | make -C posixtz-0.5 posixtz 20 | 21 | # Create directories to install in 22 | mkdir -pv /usr/share/zoneinfo/right 23 | 24 | # Install 25 | install -m444 -t /usr/share/zoneinfo iso3166.tab zone1970.tab zone.tab 26 | install -m755 zic zdump /usr/sbin 27 | install -m644 zic.8 zdump.8 /usr/share/man/man8 28 | install -v -Dm755 posixtz-0.5/posixtz /usr/bin/posixtz 29 | 30 | # Build the timezones 31 | ./zic -b fat -y ./yearistype -d /usr/share/zoneinfo ${timezones} 32 | ./zic -b fat -y ./yearistype -d /usr/share/zoneinfo/right -L leapseconds ${timezones} 33 | ./zic -b fat -y ./yearistype -d /usr/share/zoneinfo -p America/New_York 34 | unset timezones 35 | 36 | # Set the timezone: 37 | # use tzselect to determine 38 | ln -sv /usr/share/zoneinfo/ /etc/localtime 39 | 40 | -------------------------------------------------------------------------------- /doc/3-Chroot/012-Argp-standalone: -------------------------------------------------------------------------------- 1 | # Final System: Argp-Standalone 2 | # This section is done in Chroot environment 3 | 4 | # Patch source to compile under Musl libc 5 | patch -Np1 -i ../patches/argp-standalone-adelie/gnu89-inline.patch 6 | 7 | # Generate configure script with patch as there are no autotools in /tools 8 | patch -Np1 -i ../patches/argp-standalone-mlfs/generate_configure_script.patch 9 | chmod -v +x configure 10 | 11 | # Configure source 12 | CFLAGS=" -fPIC" ./configure --prefix=/usr \ 13 | --disable-static \ 14 | --sysconfdir=/etc \ 15 | --localstatedir=/var 16 | 17 | # Build 18 | make 19 | 20 | # Install 21 | cp -v libargp.a /usr/lib/ 22 | cp -v argp.h /usr/include/ 23 | -------------------------------------------------------------------------------- /doc/3-Chroot/013-Zlib: -------------------------------------------------------------------------------- 1 | # Final System: Zlib 2 | # This section is done in Chroot environment 3 | 4 | # Configure source 5 | ./configure --prefix=/usr --libdir=/lib --shared 6 | 7 | # Build and Install 8 | make 9 | make pkgconfigdir="/usr/lib/pkgconfig" install 10 | 11 | # Fix misplace files 12 | mv -v /usr/lib/libz.so.* /lib 13 | ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so 14 | -------------------------------------------------------------------------------- /doc/3-Chroot/013a-Zlib-ng: -------------------------------------------------------------------------------- 1 | # Final System: Zlib-ng 2 | # This section is done in Chroot environment 3 | # Alternative to Zlib 4 | 5 | # Fix configure script to call bash directly 6 | patch -Np1 -i ../patches/zlib-ng-mlfs/configure-fix-interpreter.patch 7 | 8 | # Configure source 9 | ./configure --prefix=/usr \ 10 | --libdir=/usr/lib \ 11 | --zlib-compat \ 12 | --sharedlibdir=/usr/lib 13 | 14 | # Build and Install 15 | make 16 | make install 17 | 18 | # Add missing combatibility link 19 | ln -sv libz.so.1.2.11.zlib-ng /usr/lib/libz.so.1.2.11 20 | -------------------------------------------------------------------------------- /doc/3-Chroot/014-File: -------------------------------------------------------------------------------- 1 | # Final System: File 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | ./configure --prefix=/usr 6 | 7 | # Build and install 8 | make && make install 9 | -------------------------------------------------------------------------------- /doc/3-Chroot/015-Readline: -------------------------------------------------------------------------------- 1 | # Final System: Readline 2 | # This section is done in Chroot environment 3 | 4 | # To avoid a rare possibility of a linking bug in ldconfig 5 | sed -i '/MV.*old/d' Makefile.in 6 | sed -i '/{OLDSUFF}/c:' support/shlib-install 7 | 8 | # Configure source 9 | ./configure --prefix=/usr \ 10 | --disable-static \ 11 | --docdir=/usr/share/doc/readline-8.1 12 | 13 | # Build 14 | make SHLIB_LIBS="-L/tools/lib -lncursesw" 15 | 16 | # Install 17 | make SHLIB_LIBS="-L/tools/lib -lncurses" install 18 | -------------------------------------------------------------------------------- /doc/3-Chroot/016-M4: -------------------------------------------------------------------------------- 1 | # Final System: M4 2 | # This section is done in Chroot environment 3 | 4 | # Apply patches from Alpine 5 | patch -Np1 -i ../patches/m4-alpine/musl-realpath.patch 6 | 7 | # Configure 8 | ./configure --prefix=/usr 9 | 10 | # Build and install 11 | make && make install 12 | -------------------------------------------------------------------------------- /doc/3-Chroot/017-Bc: -------------------------------------------------------------------------------- 1 | # Final System: Bc 2 | # This section is done in Chroot environment 3 | 4 | # Configure source 5 | PREFIX=/usr CC=gcc CFLAGS="-std=c99" ./configure.sh -G -O3 6 | 7 | # Build and install 8 | make && make install 9 | -------------------------------------------------------------------------------- /doc/3-Chroot/019-GMP: -------------------------------------------------------------------------------- 1 | # Final System: GMP 2 | # This section is done in Chroot environment 3 | 4 | # By default, GMP configures to optimize for the 5 | # host CPU. If building for a less capable than 6 | # the host's CPU, then: 7 | # cp -v configfsf.guess config.guess 8 | # cp -v configfsf.sub config.sub 9 | 10 | # Configure source 11 | ./configure --prefix=/usr \ 12 | --enable-cxx \ 13 | --disable-static \ 14 | --docdir=/usr/share/doc/gmp-6.2.1 15 | 16 | # Build 17 | make 18 | 19 | # Test if desired: 20 | make check 2>&1 | tee gmp-check-log 21 | # Make sure all 197 tests pass: 22 | awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log 23 | 24 | # Install 25 | make install 26 | -------------------------------------------------------------------------------- /doc/3-Chroot/020-MPFR: -------------------------------------------------------------------------------- 1 | # Final System: MPFR 2 | # This section is done in Chroot environment 3 | 4 | # Configure source 5 | ./configure --prefix=/usr \ 6 | --disable-static \ 7 | --enable-thread-safe \ 8 | --docdir=/usr/share/doc/mpfr-4.1.0 9 | 10 | # Build 11 | make 12 | 13 | # Test: make sure all pass 14 | make check 15 | 16 | # Install 17 | make install 18 | -------------------------------------------------------------------------------- /doc/3-Chroot/021-MPC: -------------------------------------------------------------------------------- 1 | # Final System: MPC 2 | # This section is done in Chroot environment 3 | 4 | # Configure source 5 | ./configure --prefix=/usr \ 6 | --disable-static \ 7 | --docdir=/usr/share/doc/mpc-1.2.1 8 | 9 | # Build and install 10 | make && make install 11 | -------------------------------------------------------------------------------- /doc/3-Chroot/022-Shadow: -------------------------------------------------------------------------------- 1 | # Final System: Shadow 2 | # This section is done in Chroot environment 3 | 4 | # Disable the installation of the groups program and its man pages, 5 | # as Coreutils provides a better version 6 | sed -i 's/groups$(EXEEXT) //' src/Makefile.in 7 | find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; 8 | find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; 9 | find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; 10 | sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \ 11 | -e 's@/var/spool/mail@/var/mail@' etc/login.defs 12 | 13 | # Fix a simple programming error ...fixed in 4.11.1? 14 | #sed -e "224s/rounds/min_rounds/" -i libmisc/salt.c 15 | 16 | # Configure source 17 | touch /usr/bin/passwd && 18 | LIBS="-lutmps -lskarnet" \ 19 | ./configure --with-group-name-max-length=32 \ 20 | --sysconfdir=/etc \ 21 | --enable-utmpx 22 | 23 | # Build, Install, and fix misplaced files 24 | make && make install 25 | mkdir -pv /etc/default 26 | useradd -D --gid 999 27 | 28 | sed -i 's/yes/no/' /etc/default/useradd 29 | 30 | # Enable shadowed passowrds and shadowed group passwords: 31 | pwconv 32 | grpconv 33 | 34 | # Set system root password 35 | passwd root 36 | -------------------------------------------------------------------------------- /doc/3-Chroot/024-Bzip2: -------------------------------------------------------------------------------- 1 | # Final System: Bzip2 2 | # This section is done in Chroot environment 3 | 4 | # Apply patches from Clear Linux 5 | # Modifies build to configure with a script 6 | patch -Np1 -i ../patches/bzip2-clear/0001-Autotoolize-bzip2.patch 7 | patch -Np1 -i ../patches/bzip2-clear/0002-Improve-file-access.patch 8 | 9 | # Create configure script...tool chain needs autotools! 10 | # Use patch instead of using autoreconf of auto-tools. 11 | # autoreconfig -vfi 12 | patch -Np1 -i ../patches/bzip2-mlfs/bzip2-reconfigured.patch 13 | chmod -v +x configure 14 | 15 | # Freeytpe requires this flag set for bzip2 16 | export CFLAGS="-fPIC" 17 | 18 | # Prepare the source 19 | ./configure --prefix=/usr \ 20 | --disable-static 21 | 22 | # Build & Install 23 | make && make install 24 | 25 | # Library has wrong version in file name. Fix it 26 | mv -v /usr/lib/libbz2.so.1.0.0 /lib/libbz2.so.1.0.8 27 | rm -v /usr/lib/{libbz2.so,libbz2.so.1} 28 | ln -sv libbz2.so.1.0.8 /usr/lib/libbz2.so 29 | ln -sv libbz2.so.1.0.8 /usr/lib/libbz2.so.1 30 | 31 | # Create missing links 32 | ln -sv bzip2 /usr/bin/bunzip2 33 | ln -sv bzip2 /usr/bin/bzcat 34 | 35 | unset CFLAGS 36 | -------------------------------------------------------------------------------- /doc/3-Chroot/025-Zstd: -------------------------------------------------------------------------------- 1 | # Final System: Zstd 2 | # This section is done in Chroot environment 3 | 4 | make 5 | make -C contrib/pzstd 6 | 7 | make prefix=/usr install 8 | make prefix=/usr -C contrib/pzstd install 9 | 10 | rm -v /usr/lib/libzstd.a 11 | mv -v /usr/local/bin/pzstd /usr/bin/ 12 | rm -rvf /usr/local 13 | -------------------------------------------------------------------------------- /doc/3-Chroot/026-Pkgconf: -------------------------------------------------------------------------------- 1 | # Final System: Pkgconf 2 | # This section is done in Chroot environment 3 | 4 | # Configure source 5 | ./configure --prefix=/usr \ 6 | --docdir=/usr/share/doc/pkgconf-1.80 \ 7 | --sysconfdir=/etc \ 8 | --localstatedir=/var \ 9 | --with-pkg-config-dir=/usr/lib/pkgconfig:/usr/share/pkgconfig:/opt/qt5/lib/pkgconfig 10 | 11 | # Build and Install 12 | make && make install 13 | 14 | # Create a compatibility link 15 | ln -s pkgconf /usr/bin/pkg-config 16 | -------------------------------------------------------------------------------- /doc/3-Chroot/027-netBSD-curses: -------------------------------------------------------------------------------- 1 | # Final System: netBSD's Curses 2 | # This section is done in Chroot environment 3 | 4 | # There is no script to configure source 5 | # Build 6 | PREFIX=/usr make all 7 | 8 | # Install 9 | make PREFIX=/usr all install 10 | -------------------------------------------------------------------------------- /doc/3-Chroot/027a-Ncurses: -------------------------------------------------------------------------------- 1 | # Final System: Ncurses 2 | # This section is done in Chroot environment 3 | 4 | # Don't install a static library that is not 5 | # handled by configure: 6 | sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in 7 | 8 | # Configure source 9 | ./configure --prefix=/usr \ 10 | --mandir=/usr/share/man \ 11 | --with-shared \ 12 | --without-debug \ 13 | --without-normal \ 14 | --enable-pc-files \ 15 | --enable-widec \ 16 | --with-pkg-config-libdir=/usr/lib/pkgconfig 17 | 18 | # Build and install 19 | make && make install 20 | 21 | # Fix misplaced files 22 | mv -v /usr/lib/libncursesw.so.6* /lib 23 | ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so 24 | 25 | # Allow linker to be able to find non-wide-character Ncurses libraries 26 | for lib in ncurses form panel menu ; do 27 | rm -vf /usr/lib/lib${lib}.so 28 | echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so 29 | ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc 30 | done 31 | 32 | # Make sure that old applications that look for -lcurses at build time are 33 | # still buildable: 34 | rm -vf /usr/lib/libcursesw.so 35 | echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so 36 | ln -sfv libncurses.so /usr/lib/libcurses.so 37 | -------------------------------------------------------------------------------- /doc/3-Chroot/028-Attr: -------------------------------------------------------------------------------- 1 | # Final System: Attr 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr \ 5 | --bindir=/usr/bin \ 6 | --disable-static \ 7 | --sysconfdir=/etc \ 8 | --docdir=/usr/share/doc/attr-2.5.1 9 | 10 | make && make install 11 | -------------------------------------------------------------------------------- /doc/3-Chroot/029-ACL: -------------------------------------------------------------------------------- 1 | # Final System: ACL 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr \ 5 | --bindir=/usr/bin \ 6 | --disable-static \ 7 | --libexecdir=/usr/lib \ 8 | --docdir=/usr/share/doc/acl-2.3.1 9 | 10 | make && make install 11 | -------------------------------------------------------------------------------- /doc/3-Chroot/030-Libcap: -------------------------------------------------------------------------------- 1 | # Final System: Libcap 2 | # This section is done in Chroot environment 3 | 4 | sed -i '/install.*STALIBNAME/d' libcap/Makefile 5 | make prefix=/usr lib=lib 6 | 7 | make prefix=/usr lib=lib PKGCONFIGDIR=/usr/lib/pkgconfig install 8 | 9 | -------------------------------------------------------------------------------- /doc/3-Chroot/031-Sed: -------------------------------------------------------------------------------- 1 | # Final System: Sed 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr --bindir=/usr/bin 5 | 6 | make && make install 7 | -------------------------------------------------------------------------------- /doc/3-Chroot/032-Psmisc: -------------------------------------------------------------------------------- 1 | # Final System: Psmisc 2 | # This section is done in Chroot environment 3 | 4 | # Configure source 5 | ac_cv_func_malloc_0_nonnull=yes \ 6 | ac_cv_func_realloc_0_nonnull=yes \ 7 | ./configure --prefix=/usr \ 8 | --sysconfdir=/etc \ 9 | --localstatedir=/var \ 10 | --disable-selinux \ 11 | --enable-harden-flags \ 12 | --enable-ipv6 13 | # Build 14 | make 15 | 16 | # Install 17 | make install 18 | -------------------------------------------------------------------------------- /doc/3-Chroot/033-Iana-etc: -------------------------------------------------------------------------------- 1 | # Final System: Iana-etc 2 | # This section is done in Chroot environment 3 | 4 | cp services protocols /etc 5 | -------------------------------------------------------------------------------- /doc/3-Chroot/034-Bison: -------------------------------------------------------------------------------- 1 | # Final System: Bison 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.8.2 5 | 6 | make && make install 7 | -------------------------------------------------------------------------------- /doc/3-Chroot/035-Flex: -------------------------------------------------------------------------------- 1 | # Final System: Flex 2 | # This section is done in Chroot environment 3 | 4 | ac_cv_func_malloc_0_nonnull=yes \ 5 | ac_cv_func_realloc_0_nonnull=yes \ 6 | HELP2MAN=/tools/bin/true \ 7 | ./configure --prefix=/usr --docdir=/usr/share/doc/flex-2.6.4 && 8 | 9 | make && make install 10 | 11 | ln -sv flex /usr/bin/lex 12 | -------------------------------------------------------------------------------- /doc/3-Chroot/036-Grep: -------------------------------------------------------------------------------- 1 | # Final System: Grep 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr --bindir=/usr/bin && make && make install 5 | -------------------------------------------------------------------------------- /doc/3-Chroot/037-Bash: -------------------------------------------------------------------------------- 1 | # Final System: Bash 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr \ 5 | --docdir=/usr/share/doc/bash-5.1 \ 6 | --without-bash-malloc \ 7 | --with-installed-readline \ 8 | --with-curses 9 | 10 | make && make install 11 | 12 | -------------------------------------------------------------------------------- /doc/3-Chroot/038-Libtool: -------------------------------------------------------------------------------- 1 | # Final System: Libtool 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr && make && make install 5 | 6 | -------------------------------------------------------------------------------- /doc/3-Chroot/039-GDBM: -------------------------------------------------------------------------------- 1 | # Final System: GDBM 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr \ 5 | --disable-static \ 6 | --enable-libgdbm-compat 7 | make && make install 8 | -------------------------------------------------------------------------------- /doc/3-Chroot/040-Gperf: -------------------------------------------------------------------------------- 1 | # Final System: Gperf 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1 5 | make && make install 6 | -------------------------------------------------------------------------------- /doc/3-Chroot/041-Expat: -------------------------------------------------------------------------------- 1 | # Final System: Expat 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr \ 5 | --disable-static \ 6 | --docdir=/usr/share/doc/expat-2.4.1 7 | make && make install 8 | -------------------------------------------------------------------------------- /doc/3-Chroot/042-Inetutils: -------------------------------------------------------------------------------- 1 | # Final System: Inetutils 2 | # This section is done in Chroot environment 3 | 4 | # Patch source for utmpx support 5 | patch -Np1 -i ../patches/inetutils-mlfs/logwtmp.patch 6 | 7 | # Fix a few files 8 | sed -i 's|_GL_WARN_ON_USE (gets|//_GL_WARN_ON_USE (gets|' lib/stdio.in.h 9 | echo '#define PATH_PROCNET_DEV "/proc/net/dev"' >> ifconfig/system/linux.h 10 | sed -i 's|port : "whois"|port : "nicname"|' whois/whois.c 11 | 12 | # Configure source 13 | ./configure --prefix=/usr \ 14 | --localstatedir=/var \ 15 | --disable-logger \ 16 | --disable-whois \ 17 | --disable-rcp \ 18 | --disable-rexec \ 19 | --disable-rlogin \ 20 | --disable-rsh \ 21 | --disable-servers 22 | 23 | make && make install 24 | -------------------------------------------------------------------------------- /doc/3-Chroot/044-XML-Parser: -------------------------------------------------------------------------------- 1 | # Final System: XML::Parser 2 | # This section is done in Chroot environment 3 | 4 | perl Makefile.PL && make && make install 5 | -------------------------------------------------------------------------------- /doc/3-Chroot/045-Intltool: -------------------------------------------------------------------------------- 1 | # Final System: Intltool 2 | # This section is done in Chroot environment 3 | 4 | sed -i 's:\\\${:\\\$\\{:' intltool-update.in 5 | 6 | ./configure --prefix=/usr && make && make install 7 | 8 | -------------------------------------------------------------------------------- /doc/3-Chroot/046-Autoconf: -------------------------------------------------------------------------------- 1 | # Final System: Autoconf 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr 5 | make && make install 6 | -------------------------------------------------------------------------------- /doc/3-Chroot/047-Automake: -------------------------------------------------------------------------------- 1 | # Final System: Automake 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.16.4 5 | make && make install 6 | -------------------------------------------------------------------------------- /doc/3-Chroot/048-Musl-FTS: -------------------------------------------------------------------------------- 1 | # Final System: Musl-FTS 2 | # This section is done in Chroot environment 3 | 4 | sed -i "/pkgconfig_DATA/i pkgconfigdir=/usr/lib/pkgconfig" Makefile.am 5 | ./bootstrap.sh 6 | 7 | CFLAGS=" -fPIC" \ 8 | ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var 9 | 10 | make && make install 11 | -------------------------------------------------------------------------------- /doc/3-Chroot/049-Musl-Obstack: -------------------------------------------------------------------------------- 1 | # Final System: Musl-Obstack 2 | # This section is done in Chroot environment 3 | 4 | sed -i "/pkgconfig_DATA/i pkgconfigdir=/usr/lib/pkgconfig" Makefile.am 5 | ./bootstrap.sh 6 | 7 | CFLAGS=" -fPIC" \ 8 | ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var 9 | 10 | make && make install 11 | -------------------------------------------------------------------------------- /doc/3-Chroot/051-Xz: -------------------------------------------------------------------------------- 1 | # Final System: Xz 2 | # This section is done in Chroot environment 3 | 4 | # Apply security patch from Alpine Linux: 5 | patch -Np1 -i ../patches/xz-alpine/xzgrep-ZDI-CAN-16587.patch 6 | 7 | ./configure --prefix=/usr \ 8 | --disable-static \ 9 | --docdir=/usr/share/doc/xz-5.2.5 10 | 11 | make && make install 12 | 13 | -------------------------------------------------------------------------------- /doc/3-Chroot/052-Kmod: -------------------------------------------------------------------------------- 1 | # Final System: Kmod 2 | # This section is done in Chroot environment 3 | 4 | ./configure --prefix=/usr \ 5 | --sysconfdir=/etc \ 6 | --with-xz \ 7 | --with-zlib \ 8 | --with-zstd 9 | 10 | make && make install 11 | 12 | for target in depmod insmod lsmod modinfo modprobe rmmod; do 13 | ln -sfv ../bin/kmod /usr/sbin/$target 14 | done 15 | 16 | ln -sfv kmod /usr/bin/lsmod 17 | -------------------------------------------------------------------------------- /doc/3-Chroot/053-Gettext-Tiny: -------------------------------------------------------------------------------- 1 | # Final System: Gettext-Tiny 2 | # This section is done in Chroot environment 3 | 4 | # Apply Patches from Alpine Linux: 5 | patch -Np1 -i ../patches/gettext-tiny-alpine/flip-macro-logic.patch 6 | patch -Np1 -i ../patches/gettext-tiny-alpine/line-length.patch 7 | patch -Np1 -i ../patches/gettext-tiny-alpine/respect-cflags.patch 8 | 9 | # Compile 10 | LIBINTL=MUSL prefix=/usr make 11 | 12 | # Install 13 | make LIBINTL=MUSL prefix=/usr install 14 | -------------------------------------------------------------------------------- /doc/3-Chroot/054-Musl-Legacy-Compat: -------------------------------------------------------------------------------- 1 | # Final System: Musl Legacy Compatibility Headers 2 | # This section is done in Chroot environment 3 | 4 | for h in cdefs queue tree 5 | do 6 | install -v -D -m644 files/musl-legacy-compat-void/$h.h /usr/include/sys 7 | done 8 | -------------------------------------------------------------------------------- /doc/3-Chroot/055-Libelf: -------------------------------------------------------------------------------- 1 | # Final System: Libelf 2 | # This section is done in Chroot environment 3 | 4 | # Add missing files 5 | cp -vr ../files/elfutils-void/error.h lib/ 6 | cp -vr ../files/elfutils-void/error.h src/ 7 | 8 | # Re-create configure script 9 | autoreconf -ifv 10 | 11 | # Configure source 12 | CFLAGS="-DFNM_EXTMATCH=0 -Wno-error -Wno-error=null-dereference -Wl,-z,stack-size=2097152" \ 13 | ./configure --prefix=/usr --disable-debuginfod \ 14 | --enable-libdebuginfod=dummy 15 | # Build only the library 16 | make -C lib && make -C libelf 17 | 18 | # Install library 19 | make -C libelf install 20 | 21 | # Install pkgconfig file for library 22 | install -vm644 config/libelf.pc /usr/lib/pkgconfig 23 | -------------------------------------------------------------------------------- /doc/3-Chroot/056-Libffi: -------------------------------------------------------------------------------- 1 | # Final System: Libffi 2 | # This section is done in Chroot environment 3 | 4 | # Configure source. If host and target are the same machine, 5 | # use -with-gcc-arch=native instead 6 | # Refer to: 7 | # https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/x86-Options.html 8 | case $(uname -m) in 9 | x86_64) export ARCH="x86-64" 10 | export TRUPLE="x86_64-linux-musl" 11 | ;; 12 | i686) export ARCH="i686" 13 | export TRUPLE="i686-linux-musl" 14 | ;; 15 | armv7l) export ARCH="armv7-a" 16 | export TRUPLE="armv7l-linux-musleabihf" 17 | ;; 18 | armv6l) export ARCH="armv6" 19 | export TRUPLE="armv6l-linux-musleabihf" 20 | ;; 21 | aarch64) export ARCH="armv8-a" 22 | export TRUPLE="aarch64-linux-musleabihf" 23 | ;; 24 | esac 25 | 26 | patch -Np1 -i ../patches/libffi-alpine/pax-dlmmap.patch 27 | 28 | ./configure --prefix=/usr \ 29 | --disable-static \ 30 | --includedir=/usr/include \ 31 | --disable-multi-os-directory \ 32 | --with-pic --with-gcc-arch=$ARCH \ 33 | --build=$TRUPLE 34 | unset ARCH TRUPLE 35 | 36 | # Build and install 37 | make && make install 38 | -------------------------------------------------------------------------------- /doc/3-Chroot/057-LibreSSL: -------------------------------------------------------------------------------- 1 | # Final System: LibreSSL 2 | # This section is done in Chroot environment 3 | # If building Rustc-1.45.1, use LibreSSL-3.0.0 instead 4 | 5 | # Run autoreconf 6 | autoreconf -vif 7 | 8 | # Set a few variables ... 9 | case $(uname -m) in 10 | x86_64) export EXTRACONFIG="" 11 | export TRUPLE="x86_64-linux-musl" 12 | ;; 13 | i686) export EXTRACONFIG="--disable-hardening" 14 | export TRUPLE="i686-linux-musl" 15 | ;; 16 | armv7l) export TRUPLE="armv7l-linux-musleabihf" 17 | ;; 18 | armv6l) export TRUPLE="armv6l-linux-musleabihf" 19 | ;; 20 | aarch64) export TRUPLE="aarch64-linux-musleabihf" 21 | ;; 22 | esac 23 | 24 | CFLAGS="-L/usr/lib $CFLAGS" \ 25 | ./configure \ 26 | --build=$TRUPLE \ 27 | --host=$TRUPLE \ 28 | --prefix=/usr \ 29 | --sysconfdir=/etc \ 30 | --mandir=/usr/share/man \ 31 | --localstatedir=/var $EXTRACONFIG 32 | 33 | 34 | unset EXTRACONFIG TRUPLE 35 | 36 | # Build and install 37 | make && make install 38 | 39 | -------------------------------------------------------------------------------- /doc/3-Chroot/057a-OpenSSL: -------------------------------------------------------------------------------- 1 | # Final System: openSSL 2 | # This section is done in Chroot environment 3 | # Required by Python 3.10.x 4 | 5 | # Coreutils not installed yet, link env from /tools 6 | ln -sv /tools/bin/env /usr/bin/ 7 | 8 | # Configure to install in /opt/openssl 9 | ./config --prefix=/opt/openssl \ 10 | --openssldir=/opt/openssl/etc/ssl \ 11 | --libdir=/opt/openssl/lib \ 12 | shared zlib-dynamic 13 | # Compile 14 | make 15 | 16 | # Install 17 | sed -i '/INSTALL_LIBS/s/libcrypto.a libssl.a//' Makefile 18 | make MANSUFFIX=ssl install 19 | 20 | # Add the version to the documentation directory name, to 21 | # be consistent with other packages: 22 | mv -v /opt/openssl/share/doc/openssl /opt/openssl/share/doc/openssl-3.0.2 23 | 24 | # If desired, install some additional documentation: 25 | cp -vfr doc/* /opt/openssl/share/doc/openssl-3.0.2 26 | 27 | -------------------------------------------------------------------------------- /doc/3-Chroot/058-Python3: -------------------------------------------------------------------------------- 1 | # Final System: Python 3 2 | # This section is done in Chroot environment 3 | 4 | patch -Np0 -i ../patches/python3-void/musl-find_library.patch 5 | patch -Np0 -i ../patches/python3-void/tweak-MULTIARCH-for-powerpc-linux-musl.patch 6 | 7 | # Remove to ensure system libraries are used. 8 | rm -r Modules/expat 9 | rm -r Modules/_ctypes/{darwin,libffi}* 10 | 11 | # If building Python 3.10.x with openssl: 12 | export XARGS="--with-openssl=/opt/openssl " 13 | export XARGS+="--with-openssl-rpath=/opt/openssl/lib " 14 | 15 | # Configure source 16 | ./configure --prefix=/usr \ 17 | --enable-shared \ 18 | --with-system-expat \ 19 | --with-system-ffi \ 20 | --with-ensurepip=yes \ 21 | --enable-ipv6 \ 22 | --with-threads \ 23 | --enable-loadable-sqlite-extensions \ 24 | --with-computed-gotos $XARGS 25 | 26 | # Build and install 27 | make && make install 28 | unset XARGS 29 | 30 | # Change permissions to allow stripping later 31 | # For python 3.9.x 32 | chmod -v 755 /usr/lib/libpython3.9.so 33 | 34 | # For python 3.10.x 35 | chmod -v 755 /usr/lib/libpython3.10.so 36 | chmod -v 755 /usr/lib/libpython3.so 37 | 38 | -------------------------------------------------------------------------------- /doc/3-Chroot/059-Ninja: -------------------------------------------------------------------------------- 1 | # Final System: Ninja 2 | # This section is done in Chroot environment 3 | 4 | # If desired, add the capability to use the 5 | # environment variable NINJAJOBS 6 | sed -i '/int Guess/a \ 7 | int j = 0;\ 8 | char* jobs = getenv( "NINJAJOBS" );\ 9 | if ( jobs != NULL ) j = atoi( jobs );\ 10 | if ( j > 0 ) return j;\ 11 | ' src/ninja.cc 12 | 13 | # Configure and build source 14 | python3 configure.py --bootstrap 15 | 16 | # Install 17 | install -vm755 ninja /usr/bin/ 18 | install -vDm644 misc/bash-completion /usr/share/bash-completion/completions/ninja 19 | install -vDm644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja 20 | 21 | -------------------------------------------------------------------------------- /doc/3-Chroot/059a-Samurai: -------------------------------------------------------------------------------- 1 | # Final System: Samurai 2 | # This section is done in Chroot environment 3 | # Alternative to ninja 4 | 5 | # Build 6 | CC=gcc make PREFIX=/usr 7 | 8 | # Install 9 | make PREFIX=/usr install 10 | 11 | # In case ninja is invoked 12 | ln -sv samu /usr/bin/ninja 13 | -------------------------------------------------------------------------------- /doc/3-Chroot/060-Meson: -------------------------------------------------------------------------------- 1 | # Final System: Meson 2 | # This section is done in Chroot environment 3 | 4 | # Build 5 | python3 setup.py build 6 | 7 | # Install 8 | python3 setup.py install --root=dest 9 | cp -rv dest/* / 10 | -------------------------------------------------------------------------------- /doc/3-Chroot/061-Procps-ng: -------------------------------------------------------------------------------- 1 | # Final System: Procps-ng 2 | # This section is done in Chroot environment 3 | 4 | autoreconf -fiv && \ 5 | patch -Np1 -i ../patches/procps-mlfs/use_utmpx.patch && \ 6 | sed -i '1i#include ' proc/escape.c 7 | 8 | LIBS="$LIBS -lutmps -lskarnet" \ 9 | ac_cv_func_malloc_0_nonnull=yes \ 10 | ac_cv_func_realloc_0_nonnull=yes \ 11 | ./configure --prefix=/usr \ 12 | --exec-prefix= \ 13 | --libdir=/usr/lib \ 14 | --docdir=/usr/share/doc/procps-ng-3.3.17 \ 15 | --disable-static \ 16 | --disable-kill \ 17 | --without-systemd --disable-modern-top 18 | 19 | make && make install 20 | 21 | -------------------------------------------------------------------------------- /doc/3-Chroot/062-Coreutils: -------------------------------------------------------------------------------- 1 | # Final System: Coreutils 2 | # This section is done in Chroot environment 3 | 4 | # Recreate configure script 5 | autoreconf -vfi 6 | 7 | # Configure 8 | FORCE_UNSAFE_CONFIGURE=1 \ 9 | CFLAGS="-I/usr/include/utmps" \ 10 | LIBS="-lutmps -lskarnet -lrt" \ 11 | ./configure --prefix=/usr \ 12 | --enable-no-install-program=kill,uptime \ 13 | --disable-rpath \ 14 | --enable-install-program=arch,hostname 15 | 16 | # Build and install 17 | FORCE_UNSAFE_CONFIGURE=1 make && make install 18 | 19 | # Fix file locations 20 | /tools/bin/mv -v /usr/bin/chroot /usr/sbin 21 | /tools/bin/mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8 22 | sed -i s/\"1\"/\"8\"/1 /usr/share/man/man8/chroot.8 23 | 24 | -------------------------------------------------------------------------------- /doc/3-Chroot/063-Check: -------------------------------------------------------------------------------- 1 | # Final System: Check 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | ./configure --prefix=/usr --disable-static && 6 | 7 | # Build & install 8 | make && make install 9 | 10 | # Fix a script 11 | sed -i '1 s/tools/usr/' /usr/bin/checkmk 12 | -------------------------------------------------------------------------------- /doc/3-Chroot/064-Diffutils: -------------------------------------------------------------------------------- 1 | # Final System: Diffutils 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | ./configure --prefix=/usr 6 | 7 | # Build and install 8 | make && make install 9 | -------------------------------------------------------------------------------- /doc/3-Chroot/065-Gawk: -------------------------------------------------------------------------------- 1 | # Final System: Gawk 2 | # This section is done in Chroot environment 3 | 4 | # Ensure some unneeded files are not installed 5 | sed -i 's/extras//' Makefile.in 6 | 7 | # Configure 8 | ./configure --prefix=/usr 9 | 10 | # Build & install 11 | make && make install 12 | -------------------------------------------------------------------------------- /doc/3-Chroot/066-Findutils: -------------------------------------------------------------------------------- 1 | # Final System: Findutils 2 | # This section is done in Chroot environment 3 | 4 | # Configure source 5 | ./configure --prefix=/usr --localstatedir=/var/lib/locate 6 | 7 | # Build in this order: 8 | make 9 | 10 | # Install 11 | make install 12 | 13 | # The updatedb script also needs to be modified to 14 | # correct an explicit path 15 | sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb 16 | -------------------------------------------------------------------------------- /doc/3-Chroot/067-Groff: -------------------------------------------------------------------------------- 1 | # Final System: Groff 2 | # This section is done in Chroot environment 3 | 4 | #For users in the United States, PAGE=letter is appropriate. Elsewhere, PAGE=A4 may be more suitable. 5 | #It can be overridden later by echoing either `A4` or `letter` to the `/etc/papersize` file. 6 | 7 | # Configure 8 | PAGE= ./configure --prefix=/usr 9 | 10 | # Build and install 11 | make -j1 && make install 12 | -------------------------------------------------------------------------------- /doc/3-Chroot/068-Grub: -------------------------------------------------------------------------------- 1 | # Final System: Grub 2 | # This section is done in Chroot environment 3 | 4 | # Apply patches from Apline Linux 5 | patch -Np1 -i ../patches/grub-alpine/lang-C.UTF-8.patch && \ 6 | patch -Np1 -i ../patches/grub-alpine/fix-gcc-no-pie-specs.patch && \ 7 | patch -Np1 -i ../patches/grub-alpine/alpine-mkconfig.patch 8 | 9 | # Regenerate configure script 10 | PYTHON=python3 ./autogen.sh 11 | 12 | ################################################# 13 | # for BIOS-based PCs: 14 | case $(uname -m) in 15 | i686|x86_64) export XCONF="-with-platform=pc" ;; 16 | esac 17 | 18 | ./configure --prefix=/usr \ 19 | --sbindir=/sbin \ 20 | --sysconfdir=/etc \ 21 | --disable-efiemu \ 22 | --disable-werror $XCONF 23 | unset $XCONF 24 | 25 | ################################################# 26 | # for UEFI-based PCs: 27 | export XCONF="--with-platform=efi --disable-efiemu" 28 | case $(uname -m) in 29 | x86_64) export XCONF="$XCONF --target=x86_64" ;; 30 | i686) export XCONF="$XCONF --target=i386" ;; 31 | esac 32 | ./configure --prefix=/usr \ 33 | --sbindir=/sbin \ 34 | --sysconfdir=/etc \ 35 | --disable-werror $XCONF 36 | 37 | # Build and install 38 | make && make install 39 | unset $XCONF 40 | -------------------------------------------------------------------------------- /doc/3-Chroot/069-Less: -------------------------------------------------------------------------------- 1 | # Final System: Less 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | ./configure --prefix=/usr --sysconfdir=/etc && 6 | 7 | # Build and install 8 | make && make install 9 | -------------------------------------------------------------------------------- /doc/3-Chroot/070-Gzip: -------------------------------------------------------------------------------- 1 | # Final System: Gzip 2 | # This section is done in Chroot environment 3 | 4 | # Configure source 5 | DEFS=NO_ASM gl_cv_func_fflush_stdin=yes \ 6 | ./configure --prefix=/usr 7 | 8 | # Build and install 9 | make && make install 10 | 11 | 12 | -------------------------------------------------------------------------------- /doc/3-Chroot/071-IPRoute2: -------------------------------------------------------------------------------- 1 | # Final System: IProute2 2 | # This section is done in Chroot environment 3 | 4 | # The arpd program included in this package will not be 5 | # built since it is dependent on Berkeley DB, which is 6 | # not installed in MLFS 7 | sed -i /ARPD/d Makefile 8 | rm -fv man/man8/arpd.8 9 | 10 | # It is also necessary to disable building two modules that require 11 | # iptables, not installed in MLFS 12 | sed -i 's/.m_ipt.o//' tc/Makefile 13 | 14 | # Build 15 | make NETNS_RUN_DIR=/run/netns 16 | 17 | # Install 18 | make DOCDIR=/usr/share/doc/iproute2-5.17.0 install 19 | -------------------------------------------------------------------------------- /doc/3-Chroot/073-Libpipeline: -------------------------------------------------------------------------------- 1 | # Final System: Libpipeline 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | ./configure --prefix=/usr 6 | 7 | # Build 8 | make 9 | 10 | # Install 11 | make install 12 | -------------------------------------------------------------------------------- /doc/3-Chroot/074-Make: -------------------------------------------------------------------------------- 1 | # Final System: Make 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | ./configure --prefix=/usr 6 | 7 | # Build 8 | make 9 | 10 | # Install 11 | make install 12 | -------------------------------------------------------------------------------- /doc/3-Chroot/075-Patch: -------------------------------------------------------------------------------- 1 | # Final System: Patch 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | ./configure --prefix=/usr 6 | 7 | # Build 8 | make 9 | 10 | # Install 11 | make install 12 | -------------------------------------------------------------------------------- /doc/3-Chroot/076-Man-DB: -------------------------------------------------------------------------------- 1 | # Final system: Man-DB 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | ./configure --prefix=/usr \ 6 | --docdir=/usr/share/doc/man-db-2.10.2 \ 7 | --sysconfdir=/etc \ 8 | --disable-setuid \ 9 | --enable-cache-owner=bin \ 10 | --with-browser=/usr/bin/lynx \ 11 | --with-vgrind=/usr/bin/vgrind \ 12 | --with-grap=/usr/bin/grap \ 13 | --with-systemdtmpfilesdir= \ 14 | --with-systemdsystemunitdir= \ 15 | --with-pager=less \ 16 | --disable-rpath \ 17 | --enable-threads=posix \ 18 | --without-included-regex \ 19 | --enable-automatic-create 20 | 21 | # Build and install 22 | make && make install 23 | -------------------------------------------------------------------------------- /doc/3-Chroot/077-Tar: -------------------------------------------------------------------------------- 1 | # Final System: Tar 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | FORCE_UNSAFE_CONFIGURE=1 \ 6 | gl_cv_struct_dirent_d_ino=yes \ 7 | ./configure --prefix=/usr \ 8 | --bindir=/bin 9 | 10 | # Build & install 11 | make && make install 12 | -------------------------------------------------------------------------------- /doc/3-Chroot/078-Texinfo: -------------------------------------------------------------------------------- 1 | # Final System: Texinfo 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | ./configure --prefix=/usr --disable-static 6 | 7 | # Build 8 | make 9 | 10 | # Install 11 | make install 12 | -------------------------------------------------------------------------------- /doc/3-Chroot/079-Vim: -------------------------------------------------------------------------------- 1 | # Final System: Vim 2 | # This section is done in Chroot environment 3 | 4 | # Change the default location of the vimrc 5 | # configuration file to /etc 6 | echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h 7 | 8 | # Configure 9 | ./configure --prefix=/usr --enable-gui=no --disable-gtktest 10 | 11 | # Build & install 12 | make && make install 13 | 14 | # For some, it is a habit to invoke vi instead of vim 15 | ln -sv vim /usr/bin/vi 16 | 17 | # Fix the docs 18 | for L in /usr/share/man/{,*/}man1/vim.1; do 19 | ln -sv vim.1 $(dirname $L)/vi.1 20 | done 21 | 22 | # No longer built? 23 | #ln -sv ../vim/vim82/doc /usr/share/doc/vim-8.2.4567 24 | 25 | # GVim was not build, requires GTK 26 | rm -v /usr/share/applications/gvim.desktop 27 | rm -rf /usr/share/icons 28 | 29 | # Create a simple configuration 30 | cat > /etc/vimrc << "EOF" 31 | " Begin /etc/vimrc 32 | 33 | " Ensure defaults are set before customizing settings, not after 34 | source $VIMRUNTIME/defaults.vim 35 | let skip_defaults_vim=1 36 | 37 | set nocompatible 38 | set backspace=2 39 | set mouse= 40 | syntax on 41 | if (&term == "xterm") || (&term == "putty") 42 | set background=dark 43 | endif 44 | 45 | " End /etc/vimrc 46 | EOF 47 | 48 | -------------------------------------------------------------------------------- /doc/3-Chroot/080-Util-Linux: -------------------------------------------------------------------------------- 1 | # Final System: Util-Linux 2 | # This section is done in Chroot environment 3 | 4 | # Apply fix from void 5 | patch -Np0 -i ../patches/util-linux-void/fix-musl.patch 6 | 7 | # If building against netBSD's curses, use tiparm 8 | patch -Np1 -i ../patches/util-linux-mlfs/use-tiparm-when-compiling-with-netbsd_curses.patch 9 | 10 | mkdir -pv /var/lib/hwclock 11 | rm -vf /usr/include/{blkid,libmount,uuid} 12 | 13 | cp -v ../files/util-linux-adelie/ttydefaults.h include/ && 14 | 15 | # Regenerate a few scripts 16 | libtoolize --force && aclocal -I m4 && autoconf -v && 17 | automake --add-missing 18 | 19 | # musl needs this for switch_root(8). 20 | export CFLAGS="-D_DIRENT_HAVE_D_TYPE" 21 | 22 | # Regenerate configure script 23 | NOCONFIGURE=1 ./autogen.sh 24 | 25 | LIBS="-lutmps -lskarnet" \ 26 | ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ 27 | --docdir=/usr/share/doc/util-linux-2.37.4 \ 28 | --disable-chfn-chsh \ 29 | --disable-login \ 30 | --disable-nologin \ 31 | --disable-su \ 32 | --disable-setpriv \ 33 | --disable-runuser \ 34 | --disable-pylibmount \ 35 | --disable-static \ 36 | --without-python \ 37 | --without-systemd \ 38 | --without-systemdsystemunitdir \ 39 | --sbindir=/usr/sbin \ 40 | --bindir=/usr/bin \ 41 | --libdir=/usr/lib 42 | make && make install 43 | 44 | unset CFLAGS 45 | -------------------------------------------------------------------------------- /doc/3-Chroot/081-E2fsprogs: -------------------------------------------------------------------------------- 1 | # Final System: E2fsprogs 2 | # This section is done in Chroot environment 3 | 4 | # Build in a dedicated directory 5 | mkdir -v build && cd build 6 | 7 | # configure 8 | e2fsprogs_cv_struct_st_flags=no \ 9 | ../configure --prefix=/usr \ 10 | --with-root-prefix="" \ 11 | --enable-elf-shlibs \ 12 | --disable-libblkid \ 13 | --disable-libuuid \ 14 | --disable-uuidd \ 15 | --disable-fsck \ 16 | --enable-e2initrd-helper \ 17 | --disable-rpath \ 18 | --sbindir=/usr/sbin \ 19 | --libdir=/usr/lib 20 | # build 21 | make 22 | 23 | # Install 24 | make install && make install-libs 25 | 26 | # Fix permissions for stripping later on 27 | chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a 28 | 29 | # Fix docs 30 | gunzip -v /usr/share/info/libext2fs.info.gz 31 | install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info 32 | 33 | -------------------------------------------------------------------------------- /doc/3-Chroot/082-Eudev: -------------------------------------------------------------------------------- 1 | # Final System: Eudev 2 | # This section is done in Chroot environment 3 | 4 | # Regenerate configure script 5 | autoreconf -fiv 6 | 7 | # Configure 8 | ./configure --prefix=/usr \ 9 | --bindir=/usr/sbin \ 10 | --sbindir=/usr/sbin \ 11 | --libexecdir=/usr/lib \ 12 | --libdir=/usr/lib \ 13 | --sysconfdir=/etc \ 14 | --enable-manpages \ 15 | --disable-static 16 | 17 | # Build and install 18 | make && make install 19 | 20 | # Install some useful udev rules 21 | cp -r ../files/udev-mlfs-20220325 ./ 22 | make -f udev-mlfs-20220325/Makefile.mlfs install 23 | -------------------------------------------------------------------------------- /doc/3-Chroot/083-Cpio: -------------------------------------------------------------------------------- 1 | # Final System: Cpio 2 | # Required when building an initrd for boot 3 | 4 | # Recreate configure 5 | autoreconf -ifv 6 | 7 | export CFLAGS="-fcommon" 8 | sed -i '/The name/,+2 d' src/global.c 9 | 10 | # Configure source 11 | ./configure --prefix=/usr \ 12 | --bindir=/usr/bin \ 13 | --enable-mt \ 14 | --with-rmt=/usr/libexec/rmt 15 | 16 | # Build and install 17 | make 18 | make install 19 | 20 | # Clean up 21 | unset CFLAGS 22 | -------------------------------------------------------------------------------- /doc/3-Chroot/083a-NSSS: -------------------------------------------------------------------------------- 1 | # Final System: NSSS 2 | # This section is done in Chroot environment 3 | # This is optional to add nss support 4 | 5 | # Configure 6 | ./configure --prefix=/usr \ 7 | --exec-prefix=/usr \ 8 | --with-dynlib=/usr/lib \ 9 | --libexecdir=/usr/lib/nsss \ 10 | --libdir=/usr/lib \ 11 | --with-dynlib=/usr/lib \ 12 | --enable-shared \ 13 | --enable-static \ 14 | --disable-allstatic 15 | 16 | # Compile 17 | make 18 | 19 | # Install 20 | make install 21 | 22 | -------------------------------------------------------------------------------- /doc/3-Chroot/084-Execline: -------------------------------------------------------------------------------- 1 | # Final System: Execline 2 | # This section is done in Chroot environment 3 | 4 | ./configure --enable-shared \ 5 | --enable-static \ 6 | --enable-allstatic \ 7 | --enable-static-libc \ 8 | --libdir=/usr/lib \ 9 | --with-dynlib=/usr/lib \ 10 | --enable-pedantic-posix \ 11 | --enable-nsss 12 | 13 | make 14 | make install 15 | -------------------------------------------------------------------------------- /doc/3-Chroot/085-S6: -------------------------------------------------------------------------------- 1 | # Final System: S6 2 | # This section is done in Chroot environment 3 | 4 | # Configure source 5 | ./configure --enable-shared \ 6 | --enable-static \ 7 | --enable-allstatic \ 8 | --enable-static-libc \ 9 | --libdir=/usr/lib \ 10 | --libexecdir=/usr/lib/s6 \ 11 | --with-dynlib=/usr/lib 12 | # Build 13 | make 14 | 15 | # Install 16 | make install 17 | -------------------------------------------------------------------------------- /doc/3-Chroot/086-S6-RC: -------------------------------------------------------------------------------- 1 | # Final System: S6-RC 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | ./configure --enable-shared \ 6 | --enable-static \ 7 | --enable-allstatic \ 8 | --enable-static-libc \ 9 | --libdir=/usr/lib \ 10 | --libexecdir=/usr/lib/s6-rc \ 11 | --with-dynlib=/usr/lib 12 | 13 | # Build 14 | make 15 | 16 | # Install 17 | make install 18 | -------------------------------------------------------------------------------- /doc/3-Chroot/087-S6-Linux-Utils: -------------------------------------------------------------------------------- 1 | # Final System: S6-Linux-Utils 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | ./configure --disable-allstatic \ 6 | --prefix=/usr \ 7 | --with=dynlib=/usr/lib 8 | 9 | # Compile 10 | make 11 | 12 | # Install 13 | make install 14 | -------------------------------------------------------------------------------- /doc/3-Chroot/088-S6-Portable-Utils: -------------------------------------------------------------------------------- 1 | # Final System: S6-Portable-Utils 2 | # This section is done in Chroot environment 3 | 4 | # Configure 5 | ./configure --enable-shared \ 6 | --enable-static \ 7 | --enable-allstatic \ 8 | --enable-static-libc \ 9 | --libdir=/usr/lib \ 10 | --libexecdir=/usr/lib/s6-portable-utils \ 11 | --with-dynlib=/usr/lib \ 12 | --bindir=/usr/bin 13 | 14 | # Compile 15 | make 16 | 17 | # Install 18 | make install 19 | 20 | -------------------------------------------------------------------------------- /doc/3-Chroot/089-S6-Linux-init: -------------------------------------------------------------------------------- 1 | # Final System: S6-Linux-init 2 | # This section is done in Chroot environment 3 | 4 | # If NSSS was built, ass flag: 5 | # OPARG="--enable-nsss " 6 | 7 | # Configure 8 | ./configure --enable-shared \ 9 | --enable-static \ 10 | --enable-allstatic \ 11 | --enable-static-libc \ 12 | --libdir=/usr/lib \ 13 | --libexecdir=/usr/lib/s6-linux-init \ 14 | --with-dynlib=/usr/lib \ 15 | --enable-utmps \ 16 | --bindir=/usr/bin ${OPARG} 17 | 18 | # Compile 19 | make 20 | 21 | # Install 22 | make install 23 | 24 | # Configure scripts to match bootscripts: 25 | cat >> /etc/s6-linux-init/skel/rc.init << "EOF" 26 | s6-rc-init -c /etc/s6/db/current /run/service 27 | exec /etc/s6/base/scripts/runlevel "$rl" 28 | EOF 29 | 30 | cat >> /etc/s6-linux-init/skel/rc.shutdown << "EOF" 31 | exec s6-rc -v2 -bDa change 32 | EOF 33 | 34 | cat >> /etc/s6-linux-init/skel/runlevel << "EOF" 35 | exec s6-rc -v2 -up change "$1" 36 | EOF 37 | -------------------------------------------------------------------------------- /doc/3-Chroot/090-Stripping: -------------------------------------------------------------------------------- 1 | # Stripping of Final System 2 | # This section is done in Chroot environment 3 | 4 | exec /tools/bin/bash 5 | /tools/bin/find /usr/lib -type f -name \*.a \ 6 | -exec /tools/bin/strip --strip-debug {} ';' 7 | 8 | /tools/bin/find /lib /usr/lib -type f \( -name \*.so* -a ! -name \*dbg \) \ 9 | -exec /tools/bin/strip --strip-unneeded {} ';' 10 | 11 | /tools/bin/find /{bin,sbin} /usr/{bin,sbin,libexec} -type f \ 12 | -exec /tools/bin/strip --strip-all {} ';' 13 | 14 | -------------------------------------------------------------------------------- /doc/3-Chroot/091-Clean-up: -------------------------------------------------------------------------------- 1 | # Clean up of final system 2 | 3 | # While in chroot... 4 | rm -rvf /tmp/* 5 | exit 6 | 7 | # Re-enter chroot: 8 | export MLFS=/mnt/mlfs 9 | 10 | chroot "$MLFS" /usr/bin/env -i \ 11 | HOME=/root TERM="$TERM" \ 12 | PS1='(Mlfs chroot) \u:\w\$ ' \ 13 | PATH=/bin:/usr/bin:/sbin:/usr/sbin \ 14 | /bin/bash --login 15 | 16 | # Now remove unecessary files: 17 | rm -fv /usr/lib/lib{bfd,opcodes}.a 18 | rm -fv /usr/lib/libbz2.a 19 | rm -fv /usr/lib/lib{com_err,e2p,ext2fs,ss}.a 20 | rm -fv /usr/lib/libltdl.a 21 | rm -fv /usr/lib/libfl.a 22 | rm -fv /usr/lib/libz.a 23 | find /usr/lib /usr/libexec -name \*.la -exec rm -rvf {} \; 24 | 25 | # It is also safe to remove /tools and /cross-tools directories as they're not required anymore 26 | -------------------------------------------------------------------------------- /doc/3-Chroot/093-Network-Configuration: -------------------------------------------------------------------------------- 1 | ### General Network Configuration 2 | ### This section is done in Chroot environment 3 | ### May skip if no networking is needed 4 | 5 | 6 | # Create Network Interface Configuration File(s) 7 | 8 | # For a wifi card: 9 | # Requires wpa_supplicant and dhcpcd 10 | cat > /etc/sysconfig/ifconfig.wlan0 << "EOF" 11 | ONBOOT="yes" 12 | IFACE="wlan0" 13 | SERVICE="wpa" 14 | 15 | WPA_ARGS="" 16 | 17 | WPA_SERVICE="dhcpcd" 18 | DHCP_START="-b -q" 19 | DHCP_STOP="-k" 20 | EOF 21 | 22 | # For a ethernet card with static ip address: 23 | cat > /etc/sysconfig/ifconfig.eth0 << "EOF" 24 | ONBOOT=yes 25 | IFACE=eth0 26 | SERVICE=ipv4-static 27 | IP=192.168.1.2 28 | GATEWAY=192.168.1.1 29 | PREFIX=24 30 | BROADCAST=192.168.1.255 31 | EOF 32 | 33 | # Creating the /etc/resolv.conf File 34 | cat > /etc/resolv.conf << "EOF" 35 | # Begin /etc/resolv.conf 36 | 37 | #domain 38 | #nameserver 39 | #nameserver 40 | 41 | # End /etc/resolv.conf 42 | EOF 43 | 44 | # Set the hostname 45 | # in this eample, 'mlfs': 46 | echo "mlfs" > /etc/hostname 47 | 48 | # Create the /etc/hosts file 49 | cat > /etc/hosts << "EOF" 50 | # Begin /etc/hosts 51 | 52 | 127.0.0.1 localhost localhost.localdomain mlfs.localdomain mlfs 53 | ::1 localhost localhost.localdomain mlfs.localdomain mlfs 54 | ff02::1 ip6-allnodes 55 | ff02::2 ip6-allrouters 56 | 57 | # End /etc/hosts 58 | EOF 59 | -------------------------------------------------------------------------------- /doc/3-Chroot/095-Fstab: -------------------------------------------------------------------------------- 1 | # Final System: Fstab 2 | # This section is done in Chroot environment 3 | 4 | # The /etc/fstab file is used by some programs to determine where file systems 5 | # are to be mounted by default, in which order, and which must be checked (for 6 | # integrity errors) prior to mounting. Create a new file systems table like thisi and modify accordingly: 7 | 8 | cat > /etc/fstab << "EOF" 9 | # Begin /etc/fstab 10 | 11 | # file system mount-point type options dump fsck 12 | # order 13 | 14 | /dev/ / defaults 1 1 15 | /dev/ swap swap pri=1 0 0 16 | none /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0 17 | proc /proc proc nosuid,noexec,nodev 0 0 18 | sysfs /sys sysfs nosuid,noexec,nodev 0 0 19 | devpts /dev/pts devpts gid=5,mode=620 0 0 20 | tmpfs /run tmpfs defaults 0 0 21 | devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 22 | 23 | # On a EFI system, may need to mount the EFI parition 24 | #/dev/sda1 /mnt/uefi vfat defaults 0 0 25 | #/mnt/uefi/EFI /boot/efi none defaults,bind 0 0 26 | 27 | # End /etc/fstab 28 | EOF 29 | -------------------------------------------------------------------------------- /doc/3-Chroot/096-Linux-Kernel: -------------------------------------------------------------------------------- 1 | # Final System: Linux Kernel 2 | # Source: https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.12.10.tar.xz 3 | # This section is done in Chroot environment 4 | # Recomended to use latest kernel version 5 | 6 | # Fix fix header for missing definition of __always_inline in 7 | # 5.12.x kernels for musl systems. 8 | patch -Np1 -i ../patches/kernel/include-uapi-linux-swab-Fix-potentially-missing-__always_inline.patch 9 | 10 | case $(uname -m) in 11 | x86_64*) export ARCH="x86" ;; 12 | i686*) export ARCH="x86" ;; 13 | armv*) export ARCH="arm" ;; 14 | aarch64*) export ARCH="arm64" ;; 15 | esac 16 | 17 | # Prepare for compilation by running the following command: 18 | make mrproper 19 | 20 | # Configure kernel: 21 | make menuconfig 22 | 23 | # Compile the kernel image and modules: 24 | make 25 | 26 | # Install the modules, if the kernel configuration uses them: 27 | make modules_install 28 | 29 | # Install the kernel: 30 | case $ARCH in 31 | x86) cp -iv arch/${ARCH}/boot/bzImage /boot/vmlinuz ;; 32 | arm*) cp -iv arch/${ARCH}/boot/zImage /boot/ 33 | cp -vr arch/${ARCH}/boot/dts/*.dtb /boot/ ;; 34 | esac 35 | 36 | # Install the symbol file for the kernel: 37 | case $ARCH in 38 | x86) cp -iv System.map /boot/System.map 39 | esac 40 | 41 | # Install the kernel configuration file .config produced by the make menuconfig: 42 | cp -iv .config /boot/config 43 | 44 | -------------------------------------------------------------------------------- /doc/3-Chroot/099-The-End: -------------------------------------------------------------------------------- 1 | # The End 2 | 3 | # It may be a good idea to create an /etc/lfs-release file. By having this 4 | # file, it is very easy for you (and for us if you need to ask for help at 5 | # some point) to find out which LFS version is installed on the system. 6 | # Create this file by running: 7 | echo 10.0.0 > /etc/mlfs-release 8 | 9 | # It is also a good idea to create a file to show the status of your new 10 | # system with respect to the Linux Standards Base (LSB). To create this file, run: 11 | cat > /etc/lsb-release << "EOF" 12 | DISTRIB_ID="Musl Linux From Scratch" 13 | DISTRIB_RELEASE="10.0.0" 14 | DISTRIB_CODENAME="" 15 | DISTRIB_DESCRIPTION="Musl Linux From Scratch" 16 | EOF 17 | 18 | # If desired, an os-release file 19 | cat > /usr/lib/os-release << "EOF" 20 | NAME="MLFS" 21 | VERSION="10.0.0" 22 | ID=mlfs 23 | ID_LIKE="lfs" 24 | PRETTY_NAME="Musl Linux From Scratch 10.0.0" 25 | VERSION_ID="10.0.0" 26 | HOME_URL="https://github.com/dslm4515/Musl-LFS" 27 | SUPPORT_URL="https://github.com/dslm4515/Musl-LFS/issues" 28 | BUG_REPORT_URL="https://github.com/dslm4515/Musl-LFS/issues" 29 | EOF 30 | 31 | # freedesktop.org defines that file can be in /etc or /usr/lib 32 | ln -sv ../usr/lib/os-release /etc/ 33 | 34 | ## Rebooting the System 35 | 36 | # Exit chroot and unmount MLFS 37 | logout 38 | umount -v $MLFS/dev/pts 39 | umount -v $MLFS/dev 40 | umount -v $MLFS/run 41 | umount -v $MLFS/proc 42 | umount -v $MLFS/sys 43 | 44 | # Unmount if MLFS is on a seperate partition or HDD/SDD/device 45 | umount -v $MLFS 46 | 47 | # You may reboot your machine [if host and target are the same] 48 | 49 | -------------------------------------------------------------------------------- /download_sources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Simple shell hack to download and MD5 check source tarballs. 3 | # Copyright 2021: Luiz Antônio (takusuman). 4 | # This particular script is dual-licensed between BSD 2-Clause 5 | # or GPL3, at your preference. 6 | # n() function taken from otto-pkg's posix-alt.shi lib. 7 | # realpath() function taken from Pindorama/Copacabana version 8 | # of this script. 9 | # USAGE: ./download_sources.sh sources.list sources.md5 10 | 11 | MD5CHECK=${MD5CHECK:-YES}; 12 | SRCDIR=${SRCDIR:-src} 13 | 14 | # Workaround to the # macro in arrays 15 | # which doesn't work properly in bash 4.3 for some reason. 16 | n(){ 17 | echo ${@} | tr " " "\n" | wc -l; 18 | } 19 | 20 | realpath(){ 21 | file_basename=`basename $1` 22 | file_dirname=`dirname $1` 23 | # get the absolute directory name 24 | # example: ./sources.txt -> /usr/src/copacabana-repo/sources.txt 25 | echo "`cd "${file_dirname}"; pwd`/${file_basename}" 26 | } 27 | 28 | 29 | main(){ 30 | sources_file="`realpath ${1}`" 31 | test -n "${2}" && md5sum_file="`realpath ${2}`" 32 | test ! -e "${SRCDIR}" && mkdir "${SRCDIR}"; 33 | urls=( `cat ${sources_file} | tr "\n" " "` ); 34 | n_urls=`n ${urls[*]}`; 35 | cd "${SRCDIR}"; 36 | for (( i=0; i < ${n_urls}; i++ )){ 37 | printf 'Downloading %s\n' "$(basename ${urls[${i}]})"; 38 | curl -L "${urls[${i}]}" -O; 39 | } 40 | if `echo ${MD5CHECK} | grep -i '^y' &>/dev/null`; then 41 | md5sum -c "${md5sum_file}" \ 42 | && cd "${OLDPWD}"; 43 | fi 44 | return 0; 45 | } 46 | 47 | main "${1}" "${2}"; 48 | -------------------------------------------------------------------------------- /extra/lfs_chroot.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Check if LFS was set 4 | if [ "$1" != "" ]; then 5 | echo "[ ii ] Rootfs set at $1 " && 6 | echo "[ ii ] Chroot-ing..." && 7 | export LFS=$1 && 8 | chroot "$LFS" /usr/bin/env -i \ 9 | HOME=/root TERM="$TERM" \ 10 | PS1='(lfs chroot) \u:\w\$ ' \ 11 | PATH=/bin:/usr/bin:/sbin:/usr/sbin \ 12 | /bin/bash --login && 13 | echo "[ DONE ] LFS at $1 was chroot'ed. Exited chroot." 14 | else 15 | echo "[ STOP ] LFS not set. Please set. Usage: lfs_chroot.sh [rootfs] " 16 | fi 17 | -------------------------------------------------------------------------------- /extra/lfs_mount.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Check if LFS was set 4 | if [ "$1" != "" ]; then 5 | echo "[ ii ] rootfs set at $1 " && 6 | export LFS=$1 && 7 | mount -v --bind /dev $LFS/dev && 8 | mount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620 && 9 | mount -vt proc proc $LFS/proc && 10 | mount -vt sysfs sysfs $LFS/sys && 11 | mount -vt tmpfs tmpfs $LFS/run && 12 | if [ -h $LFS/dev/shm ]; then 13 | mkdir -pv $LFS/$(readlink $LFS/dev/shm) 14 | fi 15 | echo "[ DONE ] LFS at $1 is mounted." 16 | else 17 | echo "[ STOP ] LFS not set. Please set. Usage: lfs_mount [rootfs] " 18 | fi 19 | -------------------------------------------------------------------------------- /extra/lfs_umount.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Check if LFS was set 4 | if [ "$1" != "" ]; then 5 | echo "[ ii ] rootfs set at $1 " && 6 | export LFS=$1 && 7 | umount -v $LFS/dev/pts && 8 | umount -v $LFS/dev && 9 | umount -v $LFS/run && 10 | umount -v $LFS/proc && 11 | umount -v $LFS/sys && 12 | echo "[ DONE ] LFS at $1 is unmounted." 13 | else 14 | echo "[ STOP ] LFS not set. Please set. Usage: lfs_umount [rootfs] " 15 | fi 16 | -------------------------------------------------------------------------------- /files/__stack_chk_fail_local.c: -------------------------------------------------------------------------------- 1 | extern void __stack_chk_fail(void); 2 | void __attribute__((visibility ("hidden"))); 3 | __stack_chk_fail_local(void) { __stack_chk_fail(); } -------------------------------------------------------------------------------- /files/elfutils-void/error.h: -------------------------------------------------------------------------------- 1 | #ifndef _ERROR_H_ 2 | #define _ERROR_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | static unsigned int error_message_count = 0; 11 | 12 | static inline void error(int status, int errnum, const char* format, ...) 13 | { 14 | va_list ap; 15 | fprintf(stderr, "%s: ", program_invocation_name); 16 | va_start(ap, format); 17 | vfprintf(stderr, format, ap); 18 | va_end(ap); 19 | if (errnum) 20 | fprintf(stderr, ": %s", strerror(errnum)); 21 | fprintf(stderr, "\n"); 22 | error_message_count++; 23 | if (status) 24 | exit(status); 25 | } 26 | 27 | #endif /* _ERROR_H_ */ 28 | -------------------------------------------------------------------------------- /files/kbd-void/error.h: -------------------------------------------------------------------------------- 1 | #ifndef ERROR_H 2 | #define ERROR_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | static inline void error(int status, int errnum, const char *fmt, ...) 9 | { 10 | va_list ap; 11 | void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx }; 12 | void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx }; 13 | fflush(stdout); 14 | va_start(ap, fmt); 15 | if (status != 0) 16 | errfunc[errnum==0](status, fmt, ap); /* does not return */ 17 | warnfunc[errnum==0](fmt, ap); 18 | va_end(ap); 19 | } 20 | #endif 21 | -------------------------------------------------------------------------------- /files/musl-alpine/ldconfig: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | scan_dirs() { 3 | scanelf -qS "$@" | while read SONAME FILE; do 4 | TARGET="${FILE##*/}" 5 | LINK="${FILE%/*}/$SONAME" 6 | case "$FILE" in 7 | /lib/*|/usr/lib/*|/usr/local/lib/*) ;; 8 | *) [ -h "$LINK" -o ! -e "$LINK" ] && ln -sf "$TARGET" "$LINK" 9 | esac 10 | done 11 | return 0 12 | } 13 | # eat ldconfig options 14 | while getopts "nNvXvf:C:r:" opt; do 15 | : 16 | done 17 | shift $(( $OPTIND - 1 )) 18 | [ $# -gt 0 ] && scan_dirs "$@" 19 | -------------------------------------------------------------------------------- /files/musl-legacy-compat-void/cdefs.h: -------------------------------------------------------------------------------- 1 | #warning usage of non-standard #include is deprecated 2 | 3 | #undef __P 4 | #undef __PMT 5 | 6 | #define __P(args) args 7 | #define __PMT(args) args 8 | 9 | #define __CONCAT(x,y) x ## y 10 | #define __STRING(x) #x 11 | 12 | #ifdef __cplusplus 13 | # define __BEGIN_DECLS extern "C" { 14 | # define __END_DECLS } 15 | #else 16 | # define __BEGIN_DECLS 17 | # define __END_DECLS 18 | #endif 19 | 20 | #if defined(__GNUC__) && !defined(__cplusplus) 21 | # define __THROW __attribute__ ((__nothrow__)) 22 | # define __NTH(fct) __attribute__ ((__nothrow__)) fct 23 | #else 24 | # define __THROW 25 | # define __NTH(fct) fct 26 | #endif 27 | 28 | #define __CONCAT(x,y) x ## y 29 | #define __STRING(x) #x 30 | -------------------------------------------------------------------------------- /files/skalibs-alpine/skalibs.pc: -------------------------------------------------------------------------------- 1 | Name: skalibs 2 | Description: The skarnet.org general-purpose C library. 3 | URL: https://skarnet.org/software/skalibs/ 4 | Version: @@VERSION@@ 5 | Libs: -lskarnet 6 | -------------------------------------------------------------------------------- /files/udev-mlfs-20220325/55-mlfs.rules: -------------------------------------------------------------------------------- 1 | # /etc/udev/rules.d/55-mlfs.rules: Rule definitions for MLFS. 2 | 3 | # Core kernel devices 4 | 5 | # S6 Boot scripts cover this. 6 | ## This causes the system clock to be set as soon as /dev/rtc becomes available. 7 | ##SUBSYSTEM=="rtc", ACTION=="add", MODE="0644", RUN+="/etc/rc.d/init.d/setclock start" 8 | ##KERNEL=="rtc", ACTION=="add", MODE="0644", RUN+="/etc/rc.d/init.d/setclock start" 9 | 10 | # Comms devices 11 | 12 | KERNEL=="ippp[0-9]*", GROUP="dialout" 13 | KERNEL=="isdn[0-9]*", GROUP="dialout" 14 | KERNEL=="isdnctrl[0-9]*", GROUP="dialout" 15 | KERNEL=="dcbri[0-9]*", GROUP="dialout" 16 | -------------------------------------------------------------------------------- /files/udev-mlfs-20220325/55-mlfs.txt: -------------------------------------------------------------------------------- 1 | Purpose of rules file: 2 | 3 | Most of the rules installed by Udev itself create devices with the correct 4 | properties. This file contains rules that have not been merged upstream yet. 5 | 6 | Description of rules: 7 | 8 | By default, Udev creates device nodes with UID 0, GID 0, and permissions 0660. 9 | 10 | ISDN-related devices should be owned by the 'dialout' group, hence the following 11 | rule (and similar): 12 | 13 | KERNEL=="ippp[0-9]*", GROUP="dialout" 14 | 15 | S6 bootscripts handles this. Otherwise, create a script first to set system 16 | clock from RTC. 17 | ##The RTC-related rules cause the setclock bootscript to be run as soon as the 18 | ##RTC device has been created by Udev, meaning that times in log files, for 19 | ##example, are as accurate as possible as quickly as possible. 20 | 21 | A final word of caution: Any particular rule must be written on one line, and a 22 | comma must separate each part of the rule. 23 | -------------------------------------------------------------------------------- /files/udev-mlfs-20220325/81-cdrom.rules: -------------------------------------------------------------------------------- 1 | # /etc/udev/rules.d/81-cdrom.rules: Set CD-ROM permissions and get device capabilities 2 | 3 | ACTION=="add", SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", IMPORT{program}="cdrom_id --export $tempnode", GROUP="cdrom" 4 | -------------------------------------------------------------------------------- /files/udev-mlfs-20220325/83-cdrom-symlinks.rules: -------------------------------------------------------------------------------- 1 | # /etc/udev/rules.d/83-cdrom-symlinks.rules: Determine CD drive capability. 2 | 3 | ACTION!="add", GOTO="cd_aliases_generator_end" 4 | SUBSYSTEM!="block", GOTO="cd_aliases_generator_end" 5 | ENV{GENERATED}=="?*", GOTO="cd_aliases_generator_end" 6 | 7 | # Fail the uevent if the autogenerated rules cannot be saved 8 | ENV{ID_CDROM}=="?*", PROGRAM="/bin/grep -c ' / [^[:space:]]* rw' /proc/mounts", \ 9 | RESULT!="1", RUN+="/bin/false", GOTO="cd_aliases_generator_end" 10 | 11 | ENV{ID_CDROM}=="?*", PROGRAM="write_cd_rules", SYMLINK+="%c" 12 | 13 | LABEL="cd_aliases_generator_end" 14 | -------------------------------------------------------------------------------- /files/udev-mlfs-20220325/Makefile.mlfs: -------------------------------------------------------------------------------- 1 | # Custom systemd Makefile that installs udev rules for [M]LFS 2 | # Created by Bruce Dubbs for LFS 2014-04-02 3 | # Modified by dslm4515 for MLFS 2022-03-25 4 | 5 | # vim: tabstop=3 6 | 7 | VERSION=20220325 8 | SHELL=/bin/bash 9 | 10 | ifeq ($(V),) 11 | VB = @ 12 | else 13 | VB = 14 | endif 15 | 16 | all: 17 | @echo "Use the install target" 18 | 19 | install: 20 | @mkdir -pv $(DESTDIR)/usr/lib/udev/rules.d \ 21 | $(DESTDIR)/etc/udev/rules.d \ 22 | $(DESTDIR)/usr/share/doc/udev-$(VERSION)/mlfs 23 | 24 | # Copy rules 25 | @cp -v udev-mlfs-$(VERSION)/*.rules $(DESTDIR)/etc/udev/rules.d 26 | @cp -v udev-mlfs-$(VERSION)/*_rules \ 27 | udev-mlfs-$(VERSION)/init-net-rules.sh \ 28 | udev-mlfs-$(VERSION)/rule_generator.functions $(DESTDIR)/usr/lib/udev 29 | 30 | # Copy documentation 31 | @cp -v udev-mlfs-$(VERSION)/README $(DESTDIR)/usr/share/doc/udev-$(VERSION)/mlfs 32 | @cp -v udev-mlfs-$(VERSION)/*.txt $(DESTDIR)/usr/share/doc/udev-$(VERSION)/mlfs 33 | -------------------------------------------------------------------------------- /files/udev-mlfs-20220325/README: -------------------------------------------------------------------------------- 1 | The udev-mlfs set of files is a customization of systemd. 2 | In 2012, udev was merged with systemd and a build methodology 3 | incompatible with LFS. These files add cusom udev rules 4 | for MLFS. 5 | 6 | These files are distributed in the form of a tar file available 7 | from the LFS file mirrors. The tarball is created with: 8 | 9 | mkdir /tmp/udev-lfs-$VERSION 10 | cp -av * /tmp/udev-lfs-$VERSION 11 | tar -jcf /tmp/udev-lfs-$VERSION.tar.bz2 -C /tmp udev-lfs-$VERSION 12 | 13 | Makefile.mlfs - The MLFS Makefile. Installs udev rules for MLFS. 14 | 15 | contrib - Useful rules from debian 16 | contrib/debian 17 | contrib/debian/83-cdrom-symlinks.rules 18 | contrib/debian/write_cd_aliases 19 | contrib/debian/81-cdrom.rules 20 | 21 | 55-mlfs.rules - MLFS custom rules 22 | write_net_rules - Scripts for MLFS rules 23 | write_cd_rules 24 | rule_generator.functions 25 | 26 | 55-mlfs.txt - Documentation for MLFS installed rules 27 | 28 | ChangeLog - Log of changes to 55-mlfs-rules 29 | 30 | init-net-rules.sh - A script for establishing persistent network 31 | rules before the first MLFS boot 32 | 33 | -------------------------------------------------------------------------------- /files/udev-mlfs-20220325/contrib/debian/81-cdrom.rules: -------------------------------------------------------------------------------- 1 | # /etc/udev/rules.d/81-cdrom.rules: Set CD-ROM permissions and get device capabilities 2 | 3 | ACTION=="add", SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", IMPORT{program}="cdrom_id --export $tempnode", GROUP="cdrom" 4 | -------------------------------------------------------------------------------- /files/udev-mlfs-20220325/contrib/debian/83-cdrom-symlinks.rules: -------------------------------------------------------------------------------- 1 | # /etc/udev/rules.d/83-cdrom-symlinks.rules: Determine CD drive capability. 2 | 3 | ACTION!="add", GOTO="cd_aliases_generator_end" 4 | SUBSYSTEM!="block", GOTO="cd_aliases_generator_end" 5 | ENV{GENERATED}=="?*", GOTO="cd_aliases_generator_end" 6 | 7 | # Fail the uevent if the autogenerated rules cannot be saved 8 | ENV{ID_CDROM}=="?*", PROGRAM="/bin/grep -c ' / [^[:space:]]* rw' /proc/mounts", RESULT!="2", RUN+="/bin/false", GOTO="cd_aliases_generator_end" 9 | 10 | ENV{ID_CDROM}=="?*", PROGRAM="write_cd_aliases", SYMLINK+="%c" 11 | 12 | LABEL="cd_aliases_generator_end" 13 | -------------------------------------------------------------------------------- /files/util-linux-adelie/ttydefaults.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_TTYDEFAULTS_H_ 2 | #define _SYS_TTYDEFAULTS_H_ 3 | #define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) 4 | #define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) 5 | #define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL) 6 | #define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL) 7 | #define TTYDEF_SPEED (B9600) 8 | #define CTRL(x) (x&037) 9 | #define CEOF CTRL('d') 10 | #ifdef _POSIX_VDISABLE 11 | # define CEOL _POSIX_VDISABLE 12 | #else 13 | # define CEOL '\0' 14 | #endif 15 | #define CERASE 0177 16 | #define CINTR CTRL('c') 17 | #ifdef _POSIX_VDISABLE 18 | # define CSTATUS _POSIX_VDISABLE 19 | #else 20 | # define CSTATUS '\0' 21 | #endif 22 | #define CKILL CTRL('u') 23 | #define CMIN 1 24 | #define CQUIT 034 25 | #define CSUSP CTRL('z') 26 | #define CTIME 0 27 | #define CDSUSP CTRL('y') 28 | #define CSTART CTRL('q') 29 | #define CSTOP CTRL('s') 30 | #define CLNEXT CTRL('v') 31 | #define CDISCARD CTRL('o') 32 | #define CWERASE CTRL('w') 33 | #define CREPRINT CTRL('r') 34 | #define CEOT CEOF 35 | #define CBRK CEOL 36 | #define CRPRNT CREPRINT 37 | #define CFLUSH CDISCARD 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /files/utmps-alpine/utmps.pc: -------------------------------------------------------------------------------- 1 | Name: utmps 2 | Description: A secure implementation of the utmp mechanism. 3 | URL: https://skarnet.org/software/utmps/ 4 | Version: @@VERSION@@ 5 | Requires.private: skalibs 6 | Libs: -lutmps 7 | Cflags: -I/usr/include/utmps 8 | -------------------------------------------------------------------------------- /patches/argp-standalone-adelie/gnu89-inline.patch: -------------------------------------------------------------------------------- 1 | diff --git a/configure.ac b/configure.ac 2 | index 4658839..09f0267 100644 3 | --- a/configure.ac 4 | +++ b/configure.ac 5 | @@ -79,16 +79,10 @@ AC_CHECK_DECLS([program_invocation_name, program_invocation_short_name], 6 | 7 | # Set these flags *last*, or else the test programs won't compile 8 | if test x$GCC = xyes ; then 9 | - # Using -ggdb3 makes (some versions of) Redhat's gcc-2.96 dump core 10 | - if "$CC" --version | grep '^2\.96$' 1>/dev/null 2>&1; then 11 | - true 12 | - else 13 | - CFLAGS="$CFLAGS -ggdb3" 14 | - fi 15 | CFLAGS="$CFLAGS -Wall -W \ 16 | -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \ 17 | -Waggregate-return \ 18 | - -Wpointer-arith -Wbad-function-cast -Wnested-externs" 19 | + -Wpointer-arith -Wbad-function-cast -Wnested-externs -fgnu89-inline" 20 | fi 21 | 22 | CPPFLAGS="$CPPFLAGS -I$srcdir" 23 | -------------------------------------------------------------------------------- /patches/binutils-alpine/defang-no-split.patch: -------------------------------------------------------------------------------- 1 | From 2dad02b6d46eef438cbd14d8511487b056628a38 Mon Sep 17 00:00:00 2001 2 | From: Sergei Trofimovich 3 | Date: Mon, 26 Jul 2021 22:51:18 +0100 4 | Subject: [PATCH 1/1] texi2pod.pl: add no-op --no-split option support 5 | [PR28144] 6 | 7 | Change 2faf902da ("generate single html manual page by default") 8 | added use of --no-split option to makeinfo. binutils reuses 9 | makeinfo options for texi2pod.pl wrapper. Unsupported option 10 | led to silent manpage truncation. 11 | 12 | The change adds no-op option support. 13 | 14 | etc/ 15 | PR 28144 16 | * texi2pod.pl: Handle no-op --no-split option. 17 | 18 | (cherry picked from commit 96a7037cd8573cf065aa6b12baca68696f96d9ca) 19 | --- 20 | etc/texi2pod.pl | 2 ++ 21 | 1 file changed, 2 insertions(+) 22 | 23 | diff --git a/etc/texi2pod.pl b/etc/texi2pod.pl 24 | index 11f70d156be..dcf2b437640 100644 25 | --- a/etc/texi2pod.pl 26 | +++ b/etc/texi2pod.pl 27 | @@ -59,6 +59,8 @@ while ($_ = shift) { 28 | $flag = shift; 29 | } 30 | push (@ipath, $flag); 31 | + } elsif (/^--no-split$/) { 32 | + # ignore option for makeinfo compatibility 33 | } elsif (/^-/) { 34 | usage(); 35 | } else { 36 | -- 37 | 2.27.0 38 | 39 | -------------------------------------------------------------------------------- /patches/bzip2-clear/0002-Improve-file-access.patch: -------------------------------------------------------------------------------- 1 | From db0737d1c6954370ac9e872e0d6d30c90479e804 Mon Sep 17 00:00:00 2001 2 | From: Arjan van de Ven 3 | Date: Sat, 26 Mar 2016 19:28:57 -0700 4 | Subject: [PATCH 2/2] Improve file access 5 | 6 | 1) Don't open a file to find out if it exists. Use access(2). 7 | 2) use the "m" flag to glibc's fopen(3), to use mmap(2). 8 | --- 9 | bzip2.c | 9 +++------ 10 | 1 file changed, 3 insertions(+), 6 deletions(-) 11 | 12 | diff --git a/bzip2.c b/bzip2.c 13 | index d95d280..8156f1a 100644 14 | --- a/bzip2.c 15 | +++ b/bzip2.c 16 | @@ -939,10 +939,7 @@ void copyFileName ( Char* to, Char* from ) 17 | static 18 | Bool fileExists ( Char* name ) 19 | { 20 | - FILE *tmp = fopen ( name, "rb" ); 21 | - Bool exists = (tmp != NULL); 22 | - if (tmp != NULL) fclose ( tmp ); 23 | - return exists; 24 | + return (access(name, R_OK) == 0) ; 25 | } 26 | 27 | 28 | @@ -1425,7 +1422,7 @@ void uncompress ( Char *name ) 29 | break; 30 | 31 | case SM_F2O: 32 | - inStr = fopen ( inName, "rb" ); 33 | + inStr = fopen ( inName, "rbm" ); 34 | outStr = stdout; 35 | if ( inStr == NULL ) { 36 | fprintf ( stderr, "%s: Can't open input file %s:%s.\n", 37 | @@ -1437,7 +1434,7 @@ void uncompress ( Char *name ) 38 | break; 39 | 40 | case SM_F2F: 41 | - inStr = fopen ( inName, "rb" ); 42 | + inStr = fopen ( inName, "rbm" ); 43 | outStr = fopen_output_safely ( outName, "wb" ); 44 | if ( outStr == NULL) { 45 | fprintf ( stderr, "%s: Can't create output file %s: %s.\n", 46 | -- 47 | 2.23.0 48 | 49 | -------------------------------------------------------------------------------- /patches/coreutils-alpine/ls.patch: -------------------------------------------------------------------------------- 1 | ../src/ls.c: In function 'print_dir': 2 | 3 | ../src/ls.c:3026:24: error: 'SYS_getdents' undeclared (first use in this function); did you mean 'SYS_getdents64'? 4 | 5 | 3026 | if (syscall (SYS_getdents, dirfd (dirp), NULL, 0) == -1 6 | 7 | | ^~~~~~~~~~~~ 8 | 9 | | SYS_getdents64 10 | 11 | ../src/ls.c:3026:24: note: each undeclared identifier is reported only once for each function it appears in 12 | 13 | diff --git a/src/ls.c b/src/ls.c 14 | index 24b9832..64ecf40 100644 15 | --- a/src/ls.c 16 | +++ b/src/ls.c 17 | @@ -3018,7 +3018,7 @@ print_dir (char const *name, char const *realname, bool command_line_arg) 18 | if (errno != EOVERFLOW) 19 | break; 20 | } 21 | -#ifdef __linux__ 22 | +#if defined(__linux__) && defined(__x86_64__) 23 | else if (! found_any_entries) 24 | { 25 | /* If readdir finds no directory entries at all, not even "." or 26 | -------------------------------------------------------------------------------- /patches/coreutils-mlfs/coreutils-autoconf.patch.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dslm4515/Musl-LFS/eb647866a11fb81c419bf7cba06324f05b4dd833/patches/coreutils-mlfs/coreutils-autoconf.patch.xz -------------------------------------------------------------------------------- /patches/cpio-2.12-void/0002-Fix-signed-integer-overflow-big-block-sizes.patch: -------------------------------------------------------------------------------- 1 | From 33ff2b0de5e9bd556b64fa8e0c20dbb72c41c0fc Mon Sep 17 00:00:00 2001 2 | From: grajagandev 3 | Date: Mon, 8 Feb 2016 07:58:45 -0800 4 | Subject: [PATCH 2/4] Fix signed integer overflow - big block sizes 5 | 6 | --- 7 | src/main.c | 2 +- 8 | tests/Makefile.am | 3 ++- 9 | tests/testsuite.at | 1 + 10 | 3 files changed, 4 insertions(+), 2 deletions(-) 11 | 12 | diff --git src/main.c src/main.c 13 | index a13861f..5a30a7b 100644 14 | --- src/main.c 15 | +++ src/main.c 16 | @@ -321,7 +321,7 @@ parse_opt (int key, char *arg, struct argp_state *state) 17 | 18 | case BLOCK_SIZE_OPTION: /* --block-size */ 19 | io_block_size = atoi (arg); 20 | - if (io_block_size < 1) 21 | + if (io_block_size < 1 || io_block_size > INT_MAX/512) 22 | USAGE_ERROR ((0, 0, _("invalid block size"))); 23 | io_block_size *= 512; 24 | break; 25 | diff --git tests/Makefile.am tests/Makefile.am 26 | index 2fbee29..863f46c 100644 27 | --- tests/Makefile.am 28 | +++ tests/Makefile.am 29 | @@ -55,7 +55,8 @@ TESTSUITE_AT = \ 30 | symlink-bad-length.at\ 31 | symlink-long.at\ 32 | symlink-to-stdout.at\ 33 | - version.at 34 | + version.at\ 35 | + big-block-size.at 36 | 37 | TESTSUITE = $(srcdir)/testsuite 38 | 39 | diff --git tests/testsuite.at tests/testsuite.at 40 | index 81e205b..b11c4a0 100644 41 | --- tests/testsuite.at 42 | +++ tests/testsuite.at 43 | @@ -42,3 +42,4 @@ m4_include([setstat02.at]) 44 | m4_include([setstat03.at]) 45 | m4_include([setstat04.at]) 46 | m4_include([setstat05.at]) 47 | +m4_include([big-block-size.at]) 48 | -- 49 | 2.20.1 50 | 51 | -------------------------------------------------------------------------------- /patches/cpio-2.12-void/0004-Fix-sigfault-when-appending-to-archive.patch: -------------------------------------------------------------------------------- 1 | From ea9b0ecd469afe005137f6955b6237bcc252397b Mon Sep 17 00:00:00 2001 2 | From: Sergey Poznyakoff 3 | Date: Sat, 1 Dec 2018 11:40:02 +0200 4 | Subject: [PATCH 4/4] Fix sigfault when appending to archive 5 | 6 | Bug reported by Ross Burton. See 7 | 8 | 9 | * src/util.c: Keep static copy of the buffer pointer; always 10 | assign it to file_hdr->c_name. Use x2realloc for memory management. 11 | --- 12 | src/util.c | 17 ++++------------- 13 | 1 file changed, 4 insertions(+), 13 deletions(-) 14 | 15 | diff --git src/util.c src/util.c 16 | index 4f3c073..41916d4 100644 17 | --- src/util.c 18 | +++ src/util.c 19 | @@ -1414,22 +1414,13 @@ set_file_times (int fd, 20 | void 21 | cpio_set_c_name (struct cpio_file_stat *file_hdr, char *name) 22 | { 23 | + static char *buf = NULL; 24 | static size_t buflen = 0; 25 | size_t len = strlen (name) + 1; 26 | 27 | - if (buflen == 0) 28 | - { 29 | - buflen = len; 30 | - if (buflen < 32) 31 | - buflen = 32; 32 | - file_hdr->c_name = xmalloc (buflen); 33 | - } 34 | - else if (buflen < len) 35 | - { 36 | - buflen = len; 37 | - file_hdr->c_name = xrealloc (file_hdr->c_name, buflen); 38 | - } 39 | - 40 | + while (buflen < len) 41 | + buf = x2realloc (buf, &buflen); 42 | + file_hdr->c_name = buf; 43 | file_hdr->c_namesize = len; 44 | memmove (file_hdr->c_name, name, len); 45 | } 46 | -- 47 | 2.20.1 48 | 49 | -------------------------------------------------------------------------------- /patches/expect-5.45.3/dont-put-toolchain-in-libpath.patch: -------------------------------------------------------------------------------- 1 | Author: Jaret Cantu 2 | Date: Mon Dec 18 12:43:24 EST 2017 3 | 4 | Do not put the toolchain path TCL_BIN_DIR in the LD_LIBRARY_PATH. 5 | 6 | When crosscompiling for an x86 target, the target glibc will be 7 | used to execute the native tcl binary, which will suffer from a 8 | number of compatibility issues. 9 | 10 | Under no circumstances do we want to run any native binaries with 11 | libraries intended for the target RFS, so this is a safe change. 12 | 13 | --- expect5.45.3/Makefile.in.orig 2010-09-30 13:14:07.000000000 -0400 14 | +++ expect5.45.3/Makefile.in 2017-12-18 12:41:51.381062490 -0500 15 | @@ -166,7 +166,7 @@ TCL_LIBS = @TCL_LIBS@ 16 | 17 | EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR) 18 | TCLSH_ENV = TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` \ 19 | - @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \ 20 | + @LD_LIBRARY_PATH_VAR@="$(top_builddir):$(@LD_LIBRARY_PATH_VAR@)" \ 21 | PATH="$(EXTRA_PATH):$(PATH)" \ 22 | TCLLIBPATH="$(top_builddir)" 23 | TCLSH_PROG = @TCLSH_PROG@ 24 | -------------------------------------------------------------------------------- /patches/findutils-4.6.0-void/gnulib-freadahead.patch: -------------------------------------------------------------------------------- 1 | --- gl/lib/freadahead.c 2 | +++ gl/lib/freadahead.c 3 | @@ -30,7 +30,7 @@ extern size_t __sreadahead (FILE *); 4 | size_t 5 | freadahead (FILE *fp) 6 | { 7 | -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 8 | +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 9 | if (fp->_IO_write_ptr > fp->_IO_write_base) 10 | return 0; 11 | return (fp->_IO_read_end - fp->_IO_read_ptr) 12 | -------------------------------------------------------------------------------- /patches/findutils-4.6.0-void/gnulib-fseeko.patch: -------------------------------------------------------------------------------- 1 | --- gl/lib/fseeko.c 2 | +++ gl/lib/fseeko.c 3 | @@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence) 4 | #endif 5 | 6 | /* These tests are based on fpurge.c. */ 7 | -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 8 | +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 9 | if (fp->_IO_read_end == fp->_IO_read_ptr 10 | && fp->_IO_write_ptr == fp->_IO_write_base 11 | && fp->_IO_save_base == NULL) 12 | @@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence) 13 | return -1; 14 | } 15 | 16 | -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 17 | +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 18 | fp->_flags &= ~_IO_EOF_SEEN; 19 | fp->_offset = pos; 20 | #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ 21 | 22 | -------------------------------------------------------------------------------- /patches/findutils-4.6.0-void/gnulib-mountlist.patch: -------------------------------------------------------------------------------- 1 | --- gl/lib/mountlist.c 2 | +++ gl/lib/mountlist.c 3 | @@ -37,6 +37,12 @@ 4 | # include 5 | #endif 6 | 7 | +#if MAJOR_IN_MKDEV 8 | +# include 9 | +#elif MAJOR_IN_SYSMACROS 10 | +# include 11 | +#endif 12 | + 13 | #if defined MOUNTED_GETFSSTAT /* OSF_1 and Darwin1.3.x */ 14 | # if HAVE_SYS_UCRED_H 15 | # include /* needed on OSF V4.0 for definition of NGROUPS, 16 | -------------------------------------------------------------------------------- /patches/findutils-4.6.0-void/gnulib-stdio-impl.patch: -------------------------------------------------------------------------------- 1 | --- gl/lib/stdio-impl.h 2 | +++ gl/lib/stdio-impl.h 3 | @@ -18,6 +18,12 @@ 4 | the same implementation of stdio extension API, except that some fields 5 | have different naming conventions, or their access requires some casts. */ 6 | 7 | +/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this 8 | + problem by defining it ourselves. FIXME: Do not rely on glibc 9 | + internals. */ 10 | +#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN 11 | +# define _IO_IN_BACKUP 0x100 12 | +#endif 13 | 14 | /* BSD stdio derived implementations. */ 15 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0001-posix_memalign.patch: -------------------------------------------------------------------------------- 1 | From 0f6c64b962bb3bf75f15aec350a9d6f8997fa814 Mon Sep 17 00:00:00 2001 2 | From: Szabolcs Nagy 3 | Date: Fri, 26 Jan 2018 20:32:50 +0000 4 | Subject: [PATCH] posix_memalign 5 | 6 | --- 7 | gcc/config/i386/pmm_malloc.h | 9 +++++---- 8 | 1 file changed, 5 insertions(+), 4 deletions(-) 9 | 10 | diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h 11 | index 87344d9383f..ece428df487 100644 12 | --- a/gcc/config/i386/pmm_malloc.h 13 | +++ b/gcc/config/i386/pmm_malloc.h 14 | @@ -27,12 +27,13 @@ 15 | #include 16 | 17 | /* We can't depend on since the prototype of posix_memalign 18 | - may not be visible. */ 19 | + may not be visible and we can't pollute the namespace either. */ 20 | #ifndef __cplusplus 21 | -extern int posix_memalign (void **, size_t, size_t); 22 | +extern int _mm_posix_memalign (void **, size_t, size_t) 23 | #else 24 | -extern "C" int posix_memalign (void **, size_t, size_t) throw (); 25 | +extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw () 26 | #endif 27 | +__asm__("posix_memalign"); 28 | 29 | static __inline void * 30 | _mm_malloc (size_t __size, size_t __alignment) 31 | @@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment) 32 | return malloc (__size); 33 | if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4)) 34 | __alignment = sizeof (void *); 35 | - if (posix_memalign (&__ptr, __alignment, __size) == 0) 36 | + if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0) 37 | return __ptr; 38 | else 39 | return NULL; 40 | -- 41 | 2.31.1 42 | 43 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0003-Turn-on-Wl-z-relro-z-now-by-default.patch: -------------------------------------------------------------------------------- 1 | From ef512b8fcf9c7628267ff2dbb127aa094f6754f3 Mon Sep 17 00:00:00 2001 2 | From: Ariadne Conill 3 | Date: Fri, 21 Aug 2020 06:45:49 +0000 4 | Subject: [PATCH] Turn on -Wl,-z,relro,-z,now by default. 5 | 6 | --- 7 | gcc/doc/invoke.texi | 3 +++ 8 | gcc/gcc.c | 1 + 9 | 2 files changed, 4 insertions(+) 10 | 11 | diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi 12 | index cd31b522e42..17d371ef432 100644 13 | --- a/gcc/doc/invoke.texi 14 | +++ b/gcc/doc/invoke.texi 15 | @@ -14663,6 +14663,9 @@ For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the 16 | linker. When using the GNU linker, you can also get the same effect with 17 | @option{-Wl,-Map=output.map}. 18 | 19 | +NOTE: In Alpine Linux, for LDFLAGS, the option 20 | +@option{-Wl,-z,relro,now} is used. To disable, use @option{-Wl,-z,norelro}. 21 | + 22 | @item -u @var{symbol} 23 | @opindex u 24 | Pretend the symbol @var{symbol} is undefined, to force linking of 25 | diff --git a/gcc/gcc.c b/gcc/gcc.c 26 | index b2200c5185a..625c9ab7902 100644 27 | --- a/gcc/gcc.c 28 | +++ b/gcc/gcc.c 29 | @@ -1039,6 +1039,7 @@ proper position among the other output files. */ 30 | "%{flto|flto=*:% 3 | Date: Fri, 21 Aug 2020 06:47:43 +0000 4 | Subject: [PATCH] Enable -Wformat and -Wformat-security by default. 5 | 6 | --- 7 | gcc/c-family/c.opt | 4 ++-- 8 | 1 file changed, 2 insertions(+), 2 deletions(-) 9 | 10 | diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt 11 | index c49da99d395..93f25319005 100644 12 | --- a/gcc/c-family/c.opt 13 | +++ b/gcc/c-family/c.opt 14 | @@ -599,7 +599,7 @@ Warn about function calls with format strings that write past the end 15 | of the destination region. Same as -Wformat-overflow=1. 16 | 17 | Wformat-security 18 | -C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) 19 | +C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) 20 | Warn about possible security problems with format functions. 21 | 22 | Wformat-signedness 23 | @@ -620,7 +620,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++ 24 | Warn about zero-length formats. 25 | 26 | Wformat= 27 | -C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2) 28 | +C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2) 29 | Warn about printf/scanf/strftime/strfmon format string anomalies. 30 | 31 | Wformat-overflow= 32 | -- 33 | 2.31.1 34 | 35 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0007-Enable-Wtrampolines-by-default.patch: -------------------------------------------------------------------------------- 1 | From 5679adc04a200e3a1a8dd77466eb79d03da8bf8a Mon Sep 17 00:00:00 2001 2 | From: Ariadne Conill 3 | Date: Fri, 21 Aug 2020 06:48:24 +0000 4 | Subject: [PATCH] Enable -Wtrampolines by default. 5 | 6 | --- 7 | gcc/common.opt | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/gcc/common.opt b/gcc/common.opt 11 | index ca942863064..0a0ab6195ee 100644 12 | --- a/gcc/common.opt 13 | +++ b/gcc/common.opt 14 | @@ -774,7 +774,7 @@ Common Var(warn_system_headers) Warning 15 | Do not suppress warnings from system headers. 16 | 17 | Wtrampolines 18 | -Common Var(warn_trampolines) Warning 19 | +Common Var(warn_trampolines) Init(1) Warning 20 | Warn whenever a trampoline is generated. 21 | 22 | Wtype-limits 23 | -- 24 | 2.31.1 25 | 26 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch: -------------------------------------------------------------------------------- 1 | From 953779008f2caa78c55f80c2d6096bf627080016 Mon Sep 17 00:00:00 2001 2 | From: Ariadne Conill 3 | Date: Fri, 21 Aug 2020 06:52:07 +0000 4 | Subject: [PATCH] Don't declare asprintf if defined as a macro. 5 | 6 | --- 7 | include/libiberty.h | 3 +++ 8 | 1 file changed, 3 insertions(+) 9 | 10 | diff --git a/include/libiberty.h b/include/libiberty.h 11 | index 141cb886a85..fa0e78eb62f 100644 12 | --- a/include/libiberty.h 13 | +++ b/include/libiberty.h 14 | @@ -645,8 +645,11 @@ extern int pwait (int, int *, int); 15 | /* Like sprintf but provides a pointer to malloc'd storage, which must 16 | be freed by the caller. */ 17 | 18 | +/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */ 19 | +#ifndef asprintf 20 | extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2; 21 | #endif 22 | +#endif 23 | 24 | /* Like asprintf but allocates memory without fail. This works like 25 | xmalloc. */ 26 | -- 27 | 2.31.1 28 | 29 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0011-libiberty-copy-PIC-objects-during-build-process.patch: -------------------------------------------------------------------------------- 1 | From b43185f44ed438267db101fbe41361001c4e8a94 Mon Sep 17 00:00:00 2001 2 | From: Ariadne Conill 3 | Date: Fri, 21 Aug 2020 06:53:00 +0000 4 | Subject: [PATCH] libiberty: copy PIC objects during build process 5 | 6 | --- 7 | libiberty/Makefile.in | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in 11 | index d6b302e02fd..fd39928546f 100644 12 | --- a/libiberty/Makefile.in 13 | +++ b/libiberty/Makefile.in 14 | @@ -263,6 +263,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) 15 | $(AR) $(AR_FLAGS) $(TARGETLIB) \ 16 | $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ 17 | $(RANLIB) $(TARGETLIB); \ 18 | + cp $(TARGETLIB) ../ ; \ 19 | cd ..; \ 20 | else true; fi 21 | 22 | -- 23 | 2.31.1 24 | 25 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0012-libitm-disable-FORTIFY.patch: -------------------------------------------------------------------------------- 1 | From 10f38bef9af2e3d6a32253ca18d5ae0123e25e1b Mon Sep 17 00:00:00 2001 2 | From: Ariadne Conill 3 | Date: Fri, 21 Aug 2020 06:53:36 +0000 4 | Subject: [PATCH] libitm: disable FORTIFY 5 | 6 | --- 7 | libitm/configure.tgt | 10 ++++++++++ 8 | 1 file changed, 10 insertions(+) 9 | 10 | diff --git a/libitm/configure.tgt b/libitm/configure.tgt 11 | index d1beb5c9ec8..c2b50b95c01 100644 12 | --- a/libitm/configure.tgt 13 | +++ b/libitm/configure.tgt 14 | @@ -47,6 +47,16 @@ if test "$gcc_cv_have_tls" = yes ; then 15 | esac 16 | fi 17 | 18 | +# FIXME: error: inlining failed in call to always_inline 19 | +# ‘int vfprintf(FILE*, const char*, __va_list_tag*)’ 20 | +# : function body can be overwritten at link time 21 | +# Disable Fortify in libitm for now. #508852 22 | +case "${target}" in 23 | + *-*-linux*) 24 | + XCFLAGS="${XCFLAGS} -U_FORTIFY_SOURCE" 25 | + ;; 26 | +esac 27 | + 28 | # Map the target cpu to an ARCH sub-directory. At the same time, 29 | # work out any special compilation flags as necessary. 30 | case "${target_cpu}" in 31 | -- 32 | 2.31.1 33 | 34 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch: -------------------------------------------------------------------------------- 1 | From c5ee6bb497f640877be668428292487eb026d79e Mon Sep 17 00:00:00 2001 2 | From: Ariadne Conill 3 | Date: Fri, 21 Aug 2020 06:57:09 +0000 4 | Subject: [PATCH] libffi: use __linux__ instead of __gnu_linux__ for musl 5 | 6 | --- 7 | libffi/src/closures.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/libffi/src/closures.c b/libffi/src/closures.c 11 | index 721ff00ea43..22a699c6340 100644 12 | --- a/libffi/src/closures.c 13 | +++ b/libffi/src/closures.c 14 | @@ -34,7 +34,7 @@ 15 | #include 16 | 17 | #if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE 18 | -# if __gnu_linux__ && !defined(__ANDROID__) 19 | +# if __linux__ && !defined(__ANDROID__) 20 | /* This macro indicates it may be forbidden to map anonymous memory 21 | with both write and execute permission. Code compiled when this 22 | option is defined will attempt to map such pages once, but if it 23 | -- 24 | 2.31.1 25 | 26 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch: -------------------------------------------------------------------------------- 1 | From 76c7eb27b9dfe96f2f1db4fa6f29ce28715ad2a4 Mon Sep 17 00:00:00 2001 2 | From: Ariadne Conill 3 | Date: Fri, 21 Aug 2020 06:58:22 +0000 4 | Subject: [PATCH] dlang: fix fcntl on mips, add libucontext dep 5 | 6 | --- 7 | libphobos/configure.tgt | 1 + 8 | libphobos/libdruntime/core/sys/posix/fcntl.d | 15 +++++++++++++++ 9 | 2 files changed, 16 insertions(+) 10 | 11 | diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt 12 | index 94e42bf5509..73f2e4b7f01 100644 13 | --- a/libphobos/configure.tgt 14 | +++ b/libphobos/configure.tgt 15 | @@ -35,6 +35,7 @@ case "${target}" in 16 | ;; 17 | mips*-*-linux*) 18 | LIBPHOBOS_SUPPORTED=yes 19 | + LIBDRUNTIME_NEEDS_UCONTEXT=yes 20 | ;; 21 | power*-*-linux*) 22 | LIBPHOBOS_SUPPORTED=yes 23 | diff --git a/libphobos/libdruntime/core/sys/posix/fcntl.d b/libphobos/libdruntime/core/sys/posix/fcntl.d 24 | index 9febcff849b..cb34e2108bd 100644 25 | --- a/libphobos/libdruntime/core/sys/posix/fcntl.d 26 | +++ b/libphobos/libdruntime/core/sys/posix/fcntl.d 27 | @@ -870,6 +870,21 @@ else version (CRuntime_Musl) 28 | F_SETLKW = 7, 29 | } 30 | } 31 | + else version (MIPS_Any) 32 | + { 33 | + enum 34 | + { 35 | + O_DIRECTORY = 0x010000, // octal 0200000 36 | + O_NOFOLLOW = 0x020000, // octal 0400000 37 | + O_DIRECT = 0x008000, // octal 0100000 38 | + O_LARGEFILE = 0x002000, // octal 0020000 39 | + O_TMPFILE = 0x410000, // octal 020200000 40 | + 41 | + F_GETLK = 33, 42 | + F_SETLK = 34, 43 | + F_SETLKW = 35, 44 | + } 45 | + } 46 | else 47 | static assert(0, "Platform not supported"); 48 | 49 | -- 50 | 2.31.1 51 | 52 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0018-ada-fix-shared-linking.patch: -------------------------------------------------------------------------------- 1 | From 95fee2cfb1a6a32b7e671861b58ee93978ba16b8 Mon Sep 17 00:00:00 2001 2 | From: Ariadne Conill 3 | Date: Fri, 21 Aug 2020 06:59:16 +0000 4 | Subject: [PATCH] ada: fix shared linking 5 | 6 | --- 7 | gcc/ada/link.c | 12 ++++++------ 8 | 1 file changed, 6 insertions(+), 6 deletions(-) 9 | 10 | diff --git a/gcc/ada/link.c b/gcc/ada/link.c 11 | index 02c413a412f..f0e52a87d6e 100644 12 | --- a/gcc/ada/link.c 13 | +++ b/gcc/ada/link.c 14 | @@ -107,9 +107,9 @@ const char *__gnat_default_libgcc_subdir = "lib"; 15 | || defined (__NetBSD__) || defined (__OpenBSD__) \ 16 | || defined (__QNX__) 17 | const char *__gnat_object_file_option = "-Wl,@"; 18 | -const char *__gnat_run_path_option = "-Wl,-rpath,"; 19 | -char __gnat_shared_libgnat_default = STATIC; 20 | -char __gnat_shared_libgcc_default = STATIC; 21 | +const char *__gnat_run_path_option = ""; 22 | +char __gnat_shared_libgnat_default = SHARED; 23 | +char __gnat_shared_libgcc_default = SHARED; 24 | int __gnat_link_max = 8192; 25 | unsigned char __gnat_objlist_file_supported = 1; 26 | const char *__gnat_object_library_extension = ".a"; 27 | @@ -129,9 +129,9 @@ const char *__gnat_default_libgcc_subdir = "lib"; 28 | 29 | #elif defined (__linux__) || defined (__GLIBC__) 30 | const char *__gnat_object_file_option = "-Wl,@"; 31 | -const char *__gnat_run_path_option = "-Wl,-rpath,"; 32 | -char __gnat_shared_libgnat_default = STATIC; 33 | -char __gnat_shared_libgcc_default = STATIC; 34 | +const char *__gnat_run_path_option = ""; 35 | +char __gnat_shared_libgnat_default = SHARED; 36 | +char __gnat_shared_libgcc_default = SHARED; 37 | int __gnat_link_max = 8192; 38 | unsigned char __gnat_objlist_file_supported = 1; 39 | const char *__gnat_object_library_extension = ".a"; 40 | -- 41 | 2.31.1 42 | 43 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch: -------------------------------------------------------------------------------- 1 | From aa0311c59892d7fbc4ffa9e2f0520391521cc4dd Mon Sep 17 00:00:00 2001 2 | From: Ariadne Conill 3 | Date: Fri, 21 Aug 2020 06:59:43 +0000 4 | Subject: [PATCH] build: fix CXXFLAGS_FOR_BUILD passing 5 | 6 | --- 7 | Makefile.in | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/Makefile.in b/Makefile.in 11 | index 36e369df6e7..63627db68cf 100644 12 | --- a/Makefile.in 13 | +++ b/Makefile.in 14 | @@ -170,6 +170,7 @@ BUILD_EXPORTS = \ 15 | # built for the build system to override those in BASE_FLAGS_TO_PASS. 16 | EXTRA_BUILD_FLAGS = \ 17 | CFLAGS="$(CFLAGS_FOR_BUILD)" \ 18 | + CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \ 19 | LDFLAGS="$(LDFLAGS_FOR_BUILD)" 20 | 21 | # This is the list of directories to built for the host system. 22 | -- 23 | 2.31.1 24 | 25 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0020-add-fortify-headers-paths.patch: -------------------------------------------------------------------------------- 1 | From 39e86416709d3d34f46da7cd7b8a3e5a8f0ff7cd Mon Sep 17 00:00:00 2001 2 | From: Ariadne Conill 3 | Date: Fri, 21 Aug 2020 07:01:06 +0000 4 | Subject: [PATCH] add fortify-headers paths 5 | 6 | --- 7 | gcc/config/linux.h | 2 ++ 8 | 1 file changed, 2 insertions(+) 9 | 10 | diff --git a/gcc/config/linux.h b/gcc/config/linux.h 11 | index 95654bcdb5a..d88df8f154a 100644 12 | --- a/gcc/config/linux.h 13 | +++ b/gcc/config/linux.h 14 | @@ -167,6 +167,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 15 | 16 | #ifdef NATIVE_SYSTEM_HEADER_DIR 17 | #define INCLUDE_DEFAULTS_MUSL_NATIVE \ 18 | + { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \ 19 | + { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \ 20 | { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ 21 | { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, 22 | #else 23 | -- 24 | 2.31.1 25 | 26 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0021-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch: -------------------------------------------------------------------------------- 1 | From c6b54651688cf062ae48ca3402d6d2e08b70ceed Mon Sep 17 00:00:00 2001 2 | From: =?UTF-8?q?Timo=20Ter=C3=A4s?= 3 | Date: Fri, 21 Aug 2020 07:03:00 +0000 4 | Subject: [PATCH] Alpine musl package provides libssp_nonshared.a. We link to 5 | it unconditionally, as otherwise we get link failures if some objects are 6 | -fstack-protector built and final link happens with -fno-stack-protector. 7 | This seems to be the common case when bootstrapping gcc, the piepatches do 8 | not seem to fully fix the crosstoolchain and bootstrap sequence wrt. 9 | stack-protector flag usage. 10 | 11 | --- 12 | gcc/gcc.c | 3 +-- 13 | 1 file changed, 1 insertion(+), 2 deletions(-) 14 | 15 | diff --git a/gcc/gcc.c b/gcc/gcc.c 16 | index daeb4d0c8ea..6920bec0fa0 100644 17 | --- a/gcc/gcc.c 18 | +++ b/gcc/gcc.c 19 | @@ -894,8 +894,7 @@ proper position among the other output files. */ 20 | 21 | #ifndef LINK_SSP_SPEC 22 | #ifdef TARGET_LIBC_PROVIDES_SSP 23 | -#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ 24 | - "|fstack-protector-strong|fstack-protector-explicit:}" 25 | +#define LINK_SSP_SPEC "-lssp_nonshared" 26 | #else 27 | #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ 28 | "|fstack-protector-strong|fstack-protector-explicit" \ 29 | -- 30 | 2.31.1 31 | 32 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0025-always-build-libgcc_eh.a.patch: -------------------------------------------------------------------------------- 1 | From 00917df4274ea2fb33b08c963a97cf1b28f59dd3 Mon Sep 17 00:00:00 2001 2 | From: Ariadne Conill 3 | Date: Fri, 21 Aug 2020 07:05:41 +0000 4 | Subject: [PATCH] always build libgcc_eh.a 5 | 6 | highly inspired by: 7 | http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch 8 | --- 9 | libgcc/Makefile.in | 11 ++++++----- 10 | 1 file changed, 6 insertions(+), 5 deletions(-) 11 | 12 | diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in 13 | index 851e7657d07..99ec513a1a6 100644 14 | --- a/libgcc/Makefile.in 15 | +++ b/libgcc/Makefile.in 16 | @@ -956,8 +956,9 @@ ifneq ($(LIBUNWIND),) 17 | all: libunwind.a 18 | endif 19 | 20 | +all: libgcc_eh.a 21 | ifeq ($(enable_shared),yes) 22 | -all: libgcc_eh.a libgcc_s$(SHLIB_EXT) 23 | +all: libgcc_s$(SHLIB_EXT) 24 | ifneq ($(LIBUNWIND),) 25 | all: libunwind$(SHLIB_EXT) 26 | libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT) 27 | @@ -1159,10 +1160,6 @@ install-libunwind: 28 | install-shared: 29 | $(mkinstalldirs) $(DESTDIR)$(inst_libdir) 30 | 31 | - $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/ 32 | - chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a 33 | - $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a 34 | - 35 | $(subst @multilib_dir@,$(MULTIDIR),$(subst \ 36 | @shlib_base_name@,libgcc_s,$(subst \ 37 | @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL)))) 38 | @@ -1179,6 +1176,10 @@ ifeq ($(enable_gcov),yes) 39 | $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a 40 | endif 41 | 42 | + $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/ 43 | + chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a 44 | + $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a 45 | + 46 | parts="$(INSTALL_PARTS)"; \ 47 | for file in $$parts; do \ 48 | rm -f $(DESTDIR)$(inst_libdir)/$$file; \ 49 | -- 50 | 2.31.1 51 | 52 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0029-gcc-go-Don-t-include-sys-user.h.patch: -------------------------------------------------------------------------------- 1 | From 40322de36043aaa3cbb98d7f01037f53fc1b5a98 Mon Sep 17 00:00:00 2001 2 | From: "A. Wilcox" 3 | Date: Sun, 30 Aug 2020 17:58:21 +0200 4 | Subject: [PATCH] gcc-go: Don't include sys/user.h 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | Taken from Adélie Linux. 10 | --- 11 | libgo/sysinfo.c | 3 --- 12 | 1 file changed, 3 deletions(-) 13 | 14 | diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c 15 | index 0692fd41eb7..c8d987358d9 100644 16 | --- a/libgo/sysinfo.c 17 | +++ b/libgo/sysinfo.c 18 | @@ -73,9 +73,6 @@ 19 | #include 20 | #include 21 | #include 22 | -#if defined(HAVE_SYS_USER_H) 23 | -#include 24 | -#endif 25 | #if defined(HAVE_SYS_UTSNAME_H) 26 | #include 27 | #endif 28 | -- 29 | 2.31.1 30 | 31 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0030-gcc-go-Fix-ucontext_t-on-PPC64.patch: -------------------------------------------------------------------------------- 1 | From f1503cf97b5a5c6f9466145f5eb1ed3b5f200119 Mon Sep 17 00:00:00 2001 2 | From: "A. Wilcox" 3 | Date: Sun, 30 Aug 2020 17:59:22 +0200 4 | Subject: [PATCH] gcc-go: Fix ucontext_t on PPC64 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | Taken from Adélie Linux. 10 | --- 11 | libgo/runtime/go-signal.c | 2 +- 12 | 1 file changed, 1 insertion(+), 1 deletion(-) 13 | 14 | diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c 15 | index b429fdb2403..fd1c885f043 100644 16 | --- a/libgo/runtime/go-signal.c 17 | +++ b/libgo/runtime/go-signal.c 18 | @@ -224,7 +224,7 @@ getSiginfo(siginfo_t *info, void *context __attribute__((unused))) 19 | #elif defined(__alpha__) && defined(__linux__) 20 | ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc; 21 | #elif defined(__PPC__) && defined(__linux__) 22 | - ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip; 23 | + ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gp_regs[32]; 24 | #elif defined(__PPC__) && defined(_AIX) 25 | ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar; 26 | #elif defined(__aarch64__) && defined(__linux__) 27 | -- 28 | 2.31.1 29 | 30 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0032-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch: -------------------------------------------------------------------------------- 1 | From 3be2284d92c560204e9eddb20db56d57fe584360 Mon Sep 17 00:00:00 2001 2 | From: "A. Wilcox" 3 | Date: Sun, 30 Aug 2020 18:01:03 +0200 4 | Subject: [PATCH] gcc-go: Use int64 type as offset argument for mmap 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | Taken from Adélie Linux. 10 | --- 11 | libgo/go/runtime/mem_gccgo.go | 4 ++-- 12 | 1 file changed, 2 insertions(+), 2 deletions(-) 13 | 14 | diff --git a/libgo/go/runtime/mem_gccgo.go b/libgo/go/runtime/mem_gccgo.go 15 | index ba38ebaa9ab..3c9e5ce9461 100644 16 | --- a/libgo/go/runtime/mem_gccgo.go 17 | +++ b/libgo/go/runtime/mem_gccgo.go 18 | @@ -15,7 +15,7 @@ import ( 19 | //go:linkname sysFree 20 | 21 | //extern mmap 22 | -func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) unsafe.Pointer 23 | +func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off int64) unsafe.Pointer 24 | 25 | //extern munmap 26 | func munmap(addr unsafe.Pointer, length uintptr) int32 27 | @@ -37,7 +37,7 @@ func init() { 28 | } 29 | } 30 | 31 | -func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (unsafe.Pointer, int) { 32 | +func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off int64) (unsafe.Pointer, int) { 33 | p := sysMmap(addr, n, prot, flags, fd, off) 34 | if uintptr(p) == _MAP_FAILED { 35 | return nil, errno() 36 | -- 37 | 2.31.1 38 | 39 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0033-gcc-go-Fix-st_-a-m-c-tim-fields-in-generated-sysinfo.patch: -------------------------------------------------------------------------------- 1 | From: "A. Wilcox" 2 | From: Olsken (updated patches) 3 | Date: Sat, 21 Aug 2021 08:51:52 +0000 4 | Subject: [PATCH] gcc-go: Fix st_{a,m,c}tim fields in generated sysinfo.go 5 | 6 | There are more than one st_{a,m,c}tim fields in struct stat on time64 machines. 7 | 8 | Run the Go-isation on all of them. 9 | 10 | Taken from Adélie Linux. 11 | 12 | diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh 13 | index 0c52ea5d7..6fef104cc 100755 14 | --- a/libgo/mksysinfo.sh 15 | +++ b/libgo/mksysinfo.sh 16 | @@ -510,7 +510,7 @@ fi 17 | 18 | # For historical reasons Go uses the suffix "timespec" instead of "tim" for 19 | # stat_t's time fields on NetBSD. 20 | -st_times='-e s/st_atim/Atim/ -e s/st_mtim/Mtim/ -e s/st_ctim/Ctim/' 21 | +st_times='-e s/st_atim/Atim/g -e s/st_mtim/Mtim/g -e s/st_ctim/Ctim/g' 22 | if test "${GOOS}" = "netbsd"; then 23 | st_times='-e s/st_atim/Atimespec/ -e s/st_mtim/Mtimespec/ -e s/st_ctim/Ctimespec/' 24 | fi 25 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0034-gcc-go-signal-34-is-special-on-musl-libc.patch: -------------------------------------------------------------------------------- 1 | From dd1465b56f76ada5c7383ebd98ef02311a3b907c Mon Sep 17 00:00:00 2001 2 | From: "A. Wilcox" 3 | Date: Sun, 30 Aug 2020 18:03:03 +0200 4 | Subject: [PATCH] gcc-go: signal 34 is special on musl libc 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | Taken from Adélie Linux. 10 | --- 11 | libgo/go/runtime/signal_gccgo.go | 2 +- 12 | 1 file changed, 1 insertion(+), 1 deletion(-) 13 | 14 | diff --git a/libgo/go/runtime/signal_gccgo.go b/libgo/go/runtime/signal_gccgo.go 15 | index c555712a03c..9e228580d37 100644 16 | --- a/libgo/go/runtime/signal_gccgo.go 17 | +++ b/libgo/go/runtime/signal_gccgo.go 18 | @@ -106,7 +106,7 @@ func getsig(i uint32) uintptr { 19 | if sigaction(i, nil, &sa) < 0 { 20 | // On GNU/Linux glibc rejects attempts to call 21 | // sigaction with signal 32 (SIGCANCEL) or 33 (SIGSETXID). 22 | - if GOOS == "linux" && (i == 32 || i == 33) { 23 | + if GOOS == "linux" && (i == 32 || i == 33 || i == 34) { 24 | return _SIG_DFL 25 | } 26 | throw("sigaction read failure") 27 | -- 28 | 2.31.1 29 | 30 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0035-gcc-go-Prefer-_off_t-over-_off64_t.patch: -------------------------------------------------------------------------------- 1 | From 382d4516db8a7c183e9d7b5ec16a9bc175523ac9 Mon Sep 17 00:00:00 2001 2 | From: =?UTF-8?q?S=C3=B6ren=20Tempel?= 3 | Date: Sun, 30 Aug 2020 19:26:53 +0200 4 | Subject: [PATCH] gcc-go: Prefer _off_t over _off64_t 5 | 6 | musl does not seem to have _off64_t. 7 | --- 8 | libgo/mksysinfo.sh | 6 +----- 9 | 1 file changed, 1 insertion(+), 5 deletions(-) 10 | 11 | diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh 12 | index 972e2c379bc..8d6da15f983 100755 13 | --- a/libgo/mksysinfo.sh 14 | +++ b/libgo/mksysinfo.sh 15 | @@ -379,11 +379,7 @@ fi 16 | # Some basic types. 17 | echo 'type Size_t _size_t' >> ${OUT} 18 | echo "type Ssize_t _ssize_t" >> ${OUT} 19 | -if grep '^const _HAVE_OFF64_T = ' gen-sysinfo.go > /dev/null 2>&1; then 20 | - echo "type Offset_t _off64_t" >> ${OUT} 21 | -else 22 | - echo "type Offset_t _off_t" >> ${OUT} 23 | -fi 24 | +echo "type Offset_t _off_t" >> ${OUT} 25 | echo "type Mode_t _mode_t" >> ${OUT} 26 | echo "type Pid_t _pid_t" >> ${OUT} 27 | echo "type Uid_t _uid_t" >> ${OUT} 28 | -- 29 | 2.31.1 30 | 31 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0036-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c.patch: -------------------------------------------------------------------------------- 1 | From 79d8ab42aefb1d3c5f794f51df643ab040c30e30 Mon Sep 17 00:00:00 2001 2 | From: =?UTF-8?q?S=C3=B6ren=20Tempel?= 3 | Date: Sun, 30 Aug 2020 19:27:51 +0200 4 | Subject: [PATCH] gcc-go: undef SETCONTEXT_CLOBBERS_TLS in proc.c 5 | 6 | --- 7 | libgo/runtime/proc.c | 4 ++++ 8 | 1 file changed, 4 insertions(+) 9 | 10 | diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c 11 | index 6f7d2e27996..5afd7902497 100644 12 | --- a/libgo/runtime/proc.c 13 | +++ b/libgo/runtime/proc.c 14 | @@ -66,6 +66,10 @@ static void gscanstack(G*); 15 | 16 | __thread G *g __asm__(GOSYM_PREFIX "runtime.g"); 17 | 18 | +/* libucontext does not seem to support tlsbase, undef the macro 19 | + * here to make sure we define initcontext and fixcontext as dummies. */ 20 | +#undef SETCONTEXT_CLOBBERS_TLS 21 | + 22 | #ifndef SETCONTEXT_CLOBBERS_TLS 23 | 24 | static inline void 25 | -- 26 | 2.31.1 27 | 28 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0037-gcc-go-link-to-libucontext.patch: -------------------------------------------------------------------------------- 1 | From d42de24395e4f07cf6412896d4cd8c7f83a9b875 Mon Sep 17 00:00:00 2001 2 | From: "A. Wilcox" 3 | Date: Mon, 31 Aug 2020 08:59:40 +0200 4 | Subject: [PATCH] gcc-go: link to libucontext 5 | 6 | --- 7 | Makefile.in | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/Makefile.in b/Makefile.in 11 | index 63627db68cf..c7f1f84d683 100644 12 | --- a/Makefile.in 13 | +++ b/Makefile.in 14 | @@ -48823,7 +48823,7 @@ configure-target-libgo: 15 | esac; \ 16 | module_srcdir=libgo; \ 17 | rm -f no-such-file || : ; \ 18 | - CONFIG_SITE=no-such-file $(SHELL) \ 19 | + CONFIG_SITE=no-such-file LIBS="-lucontext $$LIBS" $(SHELL) \ 20 | $$s/$$module_srcdir/configure \ 21 | --srcdir=$${topdir}/$$module_srcdir \ 22 | $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \ 23 | -- 24 | 2.31.1 25 | 26 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0038-gcc-go-Disable-printing-of-unaccessible-ppc64-struct.patch: -------------------------------------------------------------------------------- 1 | From 570cd2b596daf12e8dfe1a444fe405a7c26fc2bc Mon Sep 17 00:00:00 2001 2 | From: =?UTF-8?q?S=C3=B6ren=20Tempel?= 3 | Date: Mon, 31 Aug 2020 20:26:56 +0200 4 | Subject: [PATCH] gcc-go: Disable printing of unaccessible ppc64 struct members 5 | 6 | These struct members do not seem to exist on musl. 7 | --- 8 | libgo/runtime/go-signal.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c 12 | index fd1c885f043..e845e453332 100644 13 | --- a/libgo/runtime/go-signal.c 14 | +++ b/libgo/runtime/go-signal.c 15 | @@ -333,7 +333,7 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u 16 | runtime_printf("sp %X\n", m->sc_regs[30]); 17 | runtime_printf("pc %X\n", m->sc_pc); 18 | } 19 | -#elif defined(__PPC__) && defined(__LITTLE_ENDIAN__) && defined(__linux__) 20 | +#elif defined(__PPC__) && defined(__LITTLE_ENDIAN__) && defined(__GLIBC__) 21 | { 22 | mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext; 23 | int i; 24 | -- 25 | 2.31.1 26 | 27 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0042-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch: -------------------------------------------------------------------------------- 1 | From: Alpine Linux community 2 | From: Olsken (updated patches) 3 | Date: Sat, 21 Aug 2021 08:51:52 +0000 4 | 5 | diff --git a/gcc/gcc.c b/gcc/gcc.c 6 | index bc1bd1686..b5c83977f 100644 7 | --- a/gcc/gcc.c 8 | +++ b/gcc/gcc.c 9 | @@ -1005,6 +1005,12 @@ proper position among the other output files. */ 10 | #define NO_SSP_SPEC "" 11 | #endif 12 | 13 | +#ifdef ENABLE_DEFAULT_SSP 14 | +#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} " 15 | +#else 16 | +#define NO_SSP_SPEC "" 17 | +#endif 18 | + 19 | #ifndef LINK_SSP_SPEC 20 | #ifdef TARGET_LIBC_PROVIDES_SSP 21 | #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ 22 | -------------------------------------------------------------------------------- /patches/gcc-alpine/0043-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch: -------------------------------------------------------------------------------- 1 | From: Alpine Linux community 2 | From: Olsken (updated patches) 3 | Date: Sat, 21 Aug 2021 08:51:52 +0000 4 | 5 | diff --git a/gcc/config.in b/gcc/config.in 6 | index d0287d4cc..8c10816c4 100644 7 | --- a/gcc/config.in 8 | +++ b/gcc/config.in 9 | @@ -112,6 +112,12 @@ 10 | #endif 11 | 12 | 13 | +/* Define if libatomic should always be linked. */ 14 | +#ifndef USED_FOR_TARGET 15 | +#undef ENABLE_AUTOLINK_LIBATOMIC 16 | +#endif 17 | + 18 | + 19 | /* Define to 1 to specify that we are using the BID decimal floating point 20 | format instead of DPD */ 21 | #ifndef USED_FOR_TARGET 22 | -------------------------------------------------------------------------------- /patches/gcc-alpine/apply_patches_ct.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | for p in 0001-posix_memalign 0002-gcc-poison-system-directories \ 4 | 0003-Turn-on-Wl-z-relro-z-now-by-default \ 5 | 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O \ 6 | 0006-Enable-Wformat-and-Wformat-security-by-default \ 7 | 0007-Enable-Wtrampolines-by-default \ 8 | 0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during \ 9 | 0010-Don-t-declare-asprintf-if-defined-as-a-macro \ 10 | 0011-libiberty-copy-PIC-objects-during-build-process \ 11 | 0012-libitm-disable-FORTIFY \ 12 | 0013-libgcc_s \ 13 | 0014-nopie \ 14 | 0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu \ 15 | 0016-dlang-update-zlib-binding \ 16 | 0017-dlang-fix-fcntl-on-mips-add-libucontext-dep \ 17 | 0018-ada-fix-shared-linking \ 18 | 0019-build-fix-CXXFLAGS_FOR_BUILD-passing \ 19 | 0020-add-fortify-headers-paths \ 20 | 0023-Pure-64-bit-MIPS \ 21 | 0024-use-pure-64-bit-configuration-where-appropriate \ 22 | 0025-always-build-libgcc_eh.a \ 23 | 0027-ada-musl-support-fixes \ 24 | 0028-gcc-go-Use-_off_t-type-instead-of-_loff_t \ 25 | 0029-gcc-go-Don-t-include-sys-user.h \ 26 | 0030-gcc-go-Fix-ucontext_t-on-PPC64 \ 27 | 0031-gcc-go-Fix-handling-of-signal-34-on-musl \ 28 | 0032-gcc-go-Use-int64-type-as-offset-argument-for-mmap \ 29 | 0034-gcc-go-signal-34-is-special-on-musl-libc \ 30 | 0035-gcc-go-Prefer-_off_t-over-_off64_t \ 31 | 0036-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c \ 32 | 0037-gcc-go-link-to-libucontext \ 33 | 0038-gcc-go-Disable-printing-of-unaccessible-ppc64-struct \ 34 | 0041-Use-generic-errstr.go-implementation-on-musl \ 35 | 0042-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand \ 36 | 0043-configure-Add-enable-autolink-libatomic-use-in-LINK_ \ 37 | 0022-DP-Use-push-state-pop-state-for-gold-as-well-when-li 38 | do 39 | patch -Np1 -i ../patches/gcc-alpine/$p.patch 40 | done 41 | -------------------------------------------------------------------------------- /patches/gcc-mlfs-11.2.0/fix_fenv_header.patch: -------------------------------------------------------------------------------- 1 | --- gcc-11.2.0.orig/libstdc++-v3/include/c_global/cfenv 2021-07-28 01:55:09.292315320 -0500 2 | +++ gcc-11.2.0/libstdc++-v3/include/c_global/cfenv 2021-08-07 10:17:27.945057906 -0500 3 | @@ -37,9 +37,14 @@ 4 | 5 | #include 6 | 7 | -#if _GLIBCXX_HAVE_FENV_H 8 | -# include 9 | -#endif 10 | +//#if _GLIBCXX_HAVE_FENV_H 11 | +//# include 12 | +//#endif 13 | +// Need to ensure this finds the C library's not a libstdc++ 14 | +// wrapper that might already be installed later in the include search path. 15 | +#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS 16 | +# include_next 17 | +#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS 18 | 19 | #ifdef _GLIBCXX_USE_C99_FENV_TR1 20 | 21 | --- gcc-11.2.0.orig/libstdc++-v3/include/c_compatibility/fenv.h 2021-07-28 01:55:09.292315320 -0500 22 | +++ gcc-11.2.0/libstdc++-v3/include/c_compatibility/fenv.h 2021-08-07 10:15:08.542063961 -0500 23 | @@ -25,6 +25,9 @@ 24 | /** @file fenv.h 25 | * This is a Standard C++ Library header. 26 | */ 27 | +#if !defined __cplusplus || defined _GLIBCXX_INCLUDE_NEXT_C_HEADERS 28 | +# include_next 29 | +#else 30 | 31 | #ifndef _GLIBCXX_FENV_H 32 | #define _GLIBCXX_FENV_H 1 33 | -------------------------------------------------------------------------------- /patches/gcc-mlfs-11.2.0/fix_fenv_header_1.patch: -------------------------------------------------------------------------------- 1 | --- gcc-11.2.0.orig/libstdc++-v3/include/c_global/cfenv 2021-07-28 01:55:09.292315320 -0500 2 | +++ gcc-11.2.0/libstdc++-v3/include/c_global/cfenv 2021-08-07 10:17:27.945057906 -0500 3 | @@ -37,9 +37,14 @@ 4 | 5 | #include 6 | 7 | -#if _GLIBCXX_HAVE_FENV_H 8 | -# include 9 | -#endif 10 | +//#if _GLIBCXX_HAVE_FENV_H 11 | +//# include 12 | +//#endif 13 | +// Need to ensure this finds the C library's not a libstdc++ 14 | +// wrapper that might already be installed later in the include search path. 15 | +#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS 16 | +# include_next 17 | +#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS 18 | 19 | #ifdef _GLIBCXX_USE_C99_FENV_TR1 20 | 21 | -------------------------------------------------------------------------------- /patches/gcc-mlfs-11.2.0/fix_fenv_header_2.patch: -------------------------------------------------------------------------------- 1 | --- gcc-11.2.0.orig/libstdc++-v3/include/c_compatibility/fenv.h 2021-07-28 01:55:09.292315320 -0500 2 | +++ gcc-11.2.0/libstdc++-v3/include/c_compatibility/fenv.h 2021-08-07 10:15:08.542063961 -0500 3 | @@ -25,6 +25,9 @@ 4 | /** @file fenv.h 5 | * This is a Standard C++ Library header. 6 | */ 7 | +#if !defined __cplusplus || defined _GLIBCXX_INCLUDE_NEXT_C_HEADERS 8 | +# include_next 9 | +#else 10 | 11 | #ifndef _GLIBCXX_FENV_H 12 | #define _GLIBCXX_FENV_H 1 13 | -------------------------------------------------------------------------------- /patches/gettext-tiny-alpine/flip-macro-logic.patch: -------------------------------------------------------------------------------- 1 | --- gettext-tiny-0.2.0/include/libintl.h.old 2017-08-02 06:14:20.000000000 -0500 2 | +++ gettext-tiny-0.2.0/include/libintl.h 2018-06-15 02:31:14.241446687 -0500 3 | @@ -34,14 +34,14 @@ 4 | #undef gettext_noop 5 | #define gettext_noop(X) X 6 | 7 | -#ifndef LIBINTL_NO_MACROS 8 | +#ifdef LIBINTL_MACROS 9 | /* if these macros are defined, configure checks will detect libintl as 10 | * built into the libc because test programs will work without -lintl. 11 | * for example: 12 | * checking for ngettext in libc ... yes 13 | * the consequence is that -lintl will not be added to the LDFLAGS. 14 | - * so if for some reason you want that libintl.a gets linked, 15 | - * add -DLIBINTL_NO_MACROS=1 to your CPPFLAGS. */ 16 | + * so if for some reason you dont want that libintl.a gets linked, 17 | + * add -DLIBINTL_MACROS=1 to your CPPFLAGS. */ 18 | 19 | #define gettext(X) ((char*) (X)) 20 | #define dgettext(dom, X) ((void)(dom), (char*) (X)) 21 | -------------------------------------------------------------------------------- /patches/gettext-tiny-alpine/line-length.patch: -------------------------------------------------------------------------------- 1 | https://github.com/sabotage-linux/gettext-tiny/issues/50 2 | 3 | We're losing the battle of the bulge; someone really should make this use malloc. 4 | 5 | --- gettext-tiny-0.3.1_git20191130/src/msgfmt.c.old 2020-01-14 08:03:11.000000000 +0000 6 | +++ gettext-tiny-0.3.1_git20191130/src/msgfmt.c 2020-01-21 18:58:28.257709860 +0000 7 | @@ -160,7 +160,7 @@ 8 | 9 | int process(FILE *in, FILE *out, bool strict) { 10 | struct mo_hdr mohdr = def_hdr; 11 | - char line[8192]; char *lp; 12 | + char line[12288]; char *lp; 13 | size_t off, i; 14 | enum po_error t; 15 | char convbuf[32768]; 16 | -------------------------------------------------------------------------------- /patches/gettext-tiny-alpine/respect-cflags.patch: -------------------------------------------------------------------------------- 1 | --- gettext-tiny-0.2.0/Makefile.old 2017-08-02 06:14:20.000000000 -0500 2 | +++ gettext-tiny-0.2.0/Makefile 2018-06-16 21:21:57.148735892 -0500 3 | @@ -32,7 +32,7 @@ 4 | ALL_M4S=$(sort $(wildcard m4/*.m4)) 5 | ALL_DATA=$(sort $(wildcard data/*)) 6 | 7 | -CFLAGS=-O0 -fPIC 8 | +CFLAGS ?= -O0 -fPIC 9 | 10 | AR ?= $(CROSS_COMPILE)ar 11 | RANLIB ?= $(CROSS_COMPILE)ranlib 12 | -------------------------------------------------------------------------------- /patches/grub-alpine/fix-gcc-no-pie-specs.patch: -------------------------------------------------------------------------------- 1 | --- ./configure.ac.orig 2 | +++ ./configure.ac 3 | @@ -1100,7 +1100,7 @@ 4 | if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then 5 | efiemu_excuse="no suitable link format for efiemu64 found" 6 | else 7 | - EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format" 8 | + EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format -no-pie" 9 | fi 10 | fi 11 | if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then 12 | -------------------------------------------------------------------------------- /patches/grub-alpine/lang-C.UTF-8.patch: -------------------------------------------------------------------------------- 1 | diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in 2 | index 93a9023..130abd4 100644 3 | --- a/util/grub.d/00_header.in 4 | +++ b/util/grub.d/00_header.in 5 | @@ -191,7 +191,7 @@ EOF 6 | EOF 7 | 8 | # Gettext variables and module 9 | -if [ "x${LANG}" != "xC" ] && [ "x${LANG}" != "x" ]; then 10 | +if [ "x${LANG%.UTF-8}" != "xC" ] && [ "x${LANG}" != "x" ]; then 11 | cat << EOF 12 | set locale_dir=\$prefix/locale 13 | set lang=${grub_lang} 14 | -------------------------------------------------------------------------------- /patches/inetutils-mlfs/logwtmp.patch: -------------------------------------------------------------------------------- 1 | diff -uNr inetutils-1.9.4.orig/libinetutils/logwtmpko.c inetutils-1.9.4/libinetutils/logwtmpko.c 2 | --- inetutils-1.9.4.orig/libinetutils/logwtmpko.c 2015-03-31 15:40:48.000000000 +0000 3 | +++ inetutils-1.9.4/libinetutils/logwtmpko.c 2020-10-30 23:49:16.601844196 +0000 4 | @@ -32,7 +32,7 @@ 5 | */ 6 | #if defined HAVE_UPDWTMPX && !defined HAVE_LOGWTMP 7 | void 8 | -logwtmp (char *line, char *name, char *host) 9 | +logwtmp (char const *line, char const *name, const char *host) 10 | { 11 | struct utmpx ut; 12 | struct timeval tv; 13 | -------------------------------------------------------------------------------- /patches/kernel/include-uapi-linux-swab-Fix-potentially-missing-__always_inline.patch: -------------------------------------------------------------------------------- 1 | --- linux-5.12.10.orig/include/uapi/linux/swab.h 2021-06-10 11:41:49.000000000 +0000 2 | +++ linux-5.12.10/include/uapi/linux/swab.h 2021-06-18 19:32:55.629671643 +0000 3 | @@ -3,7 +3,8 @@ 4 | #define _UAPI_LINUX_SWAB_H 5 | 6 | #include 7 | -#include 8 | + 9 | +#include 10 | #include 11 | #include 12 | 13 | -------------------------------------------------------------------------------- /patches/m4-alpine/musl-realpath.patch: -------------------------------------------------------------------------------- 1 | https://gitlab.alpinelinux.org/alpine/aports/-/issues/12295 2 | 3 | ---- 4 | test-canonicalize.c:339: assertion 'strcmp (result1, "/") == 0' failed 5 | Aborted (core dumped) 6 | FAIL test-canonicalize (exit status: 134) 7 | ---- 8 | 9 | diff --git a/tests/test-canonicalize-lgpl.c b/tests/test-canonicalize-lgpl.c 10 | index ff82981..17842e8 100644 11 | --- a/tests/test-canonicalize-lgpl.c 12 | +++ b/tests/test-canonicalize-lgpl.c 13 | @@ -196,8 +196,8 @@ main (void) 14 | #ifndef __MVS__ 15 | if (SAME_INODE (st1, st2)) 16 | { 17 | - ASSERT (strcmp (result1, "/") == 0); 18 | - ASSERT (strcmp (result2, "/") == 0); 19 | + ASSERT (strcmp (result1, "/") == 0 || strcmp (result1, "//") == 0); 20 | + ASSERT (strcmp (result2, "/") == 0 || strcmp (result2, "//") == 0); 21 | } 22 | else 23 | #endif 24 | -------------------------------------------------------------------------------- /patches/musl-alpine/0001-riscv64-define-ELF_NFPREG.patch: -------------------------------------------------------------------------------- 1 | From e5d2823631bbfebacf48e1a34ed28f28d7cb2570 Mon Sep 17 00:00:00 2001 2 | From: Khem Raj 3 | Date: Mon, 11 Jan 2021 09:40:33 -0800 4 | Subject: [PATCH] riscv64: define ELF_NFPREG 5 | 6 | ELF_NFPREG is used by some userspace applications like gdb 7 | --- 8 | arch/riscv64/bits/user.h | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h 12 | index 2da743ea..0d37de0b 100644 13 | --- a/arch/riscv64/bits/user.h 14 | +++ b/arch/riscv64/bits/user.h 15 | @@ -1,5 +1,6 @@ 16 | #include 17 | 18 | #define ELF_NGREG 32 19 | +#define ELF_NFPREG 33 20 | typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG]; 21 | typedef union __riscv_mc_fp_state elf_fpregset_t; 22 | -- 23 | 2.30.1 24 | 25 | -------------------------------------------------------------------------------- /patches/musl-alpine/handle-aux-at_base.patch: -------------------------------------------------------------------------------- 1 | This is required to make the gcompat ELF interpreter stub work with some 2 | packed binaries. 3 | 4 | diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c 5 | index b125eb1..616c6a6 100644 6 | --- a/src/env/__init_tls.c 7 | +++ b/src/env/__init_tls.c 8 | @@ -66,8 +66,10 @@ void *__copy_tls(unsigned char *mem) 9 | } 10 | 11 | #if ULONG_MAX == 0xffffffff 12 | +typedef Elf32_Ehdr Ehdr; 13 | typedef Elf32_Phdr Phdr; 14 | #else 15 | +typedef Elf64_Ehdr Ehdr; 16 | typedef Elf64_Phdr Phdr; 17 | #endif 18 | 19 | @@ -77,15 +79,23 @@ extern const size_t _DYNAMIC[]; 20 | static void static_init_tls(size_t *aux) 21 | { 22 | unsigned char *p; 23 | - size_t n; 24 | + size_t n, e; 25 | Phdr *phdr, *tls_phdr=0; 26 | size_t base = 0; 27 | void *mem; 28 | 29 | - for (p=(void *)aux[AT_PHDR],n=aux[AT_PHNUM]; n; n--,p+=aux[AT_PHENT]) { 30 | + if (aux[AT_BASE]) { 31 | + Ehdr *ehdr = (void *)aux[AT_BASE]; 32 | + p = (unsigned char *)aux[AT_BASE] + ehdr->e_phoff; 33 | + n = ehdr->e_phnum; 34 | + e = ehdr->e_phentsize; 35 | + } else { 36 | + p = (void *)aux[AT_PHDR]; 37 | + n = aux[AT_PHNUM]; 38 | + e = aux[AT_PHENT]; 39 | + } 40 | + for (; n; n--, p+=e) { 41 | phdr = (void *)p; 42 | - if (phdr->p_type == PT_PHDR) 43 | - base = aux[AT_PHDR] - phdr->p_vaddr; 44 | if (phdr->p_type == PT_DYNAMIC && _DYNAMIC) 45 | base = (size_t)_DYNAMIC - phdr->p_vaddr; 46 | if (phdr->p_type == PT_TLS) 47 | -------------------------------------------------------------------------------- /patches/musl-alpine/syscall-cp-epoll.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/linux/epoll.c b/src/linux/epoll.c 2 | index deff5b10..93baa814 100644 3 | --- a/src/linux/epoll.c 4 | +++ b/src/linux/epoll.c 5 | @@ -24,9 +24,9 @@ int epoll_ctl(int fd, int op, int fd2, struct epoll_event *ev) 6 | 7 | int epoll_pwait(int fd, struct epoll_event *ev, int cnt, int to, const sigset_t *sigs) 8 | { 9 | - int r = __syscall(SYS_epoll_pwait, fd, ev, cnt, to, sigs, _NSIG/8); 10 | + int r = __syscall_cp(SYS_epoll_pwait, fd, ev, cnt, to, sigs, _NSIG/8); 11 | #ifdef SYS_epoll_wait 12 | - if (r==-ENOSYS && !sigs) r = __syscall(SYS_epoll_wait, fd, ev, cnt, to); 13 | + if (r==-ENOSYS && !sigs) r = __syscall_cp(SYS_epoll_wait, fd, ev, cnt, to); 14 | #endif 15 | return __syscall_ret(r); 16 | } 17 | -------------------------------------------------------------------------------- /patches/musl-mlfs/fix-utmp-wtmp-paths.patch: -------------------------------------------------------------------------------- 1 | diff -uNr musl-1.2.2.orig/include/paths.h musl-1.2.2/include/paths.h 2 | --- musl-1.2.2.orig/include/paths.h 2021-01-14 20:26:00.000000000 -0600 3 | +++ musl-1.2.2/include/paths.h 2021-08-26 16:39:31.355618388 -0500 4 | @@ -18,9 +18,9 @@ 5 | #define _PATH_SHADOW "/etc/shadow" 6 | #define _PATH_SHELLS "/etc/shells" 7 | #define _PATH_TTY "/dev/tty" 8 | -#define _PATH_UTMP "/dev/null/utmp" 9 | +#define _PATH_UTMP "/run/utmps/utmp" 10 | #define _PATH_VI "/usr/bin/vi" 11 | -#define _PATH_WTMP "/dev/null/wtmp" 12 | +#define _PATH_WTMP "/var/log/wtmp" 13 | 14 | #define _PATH_DEV "/dev/" 15 | #define _PATH_TMP "/tmp/" 16 | diff -uNr musl-1.2.2.orig/include/utmp.h musl-1.2.2/include/utmp.h 17 | --- musl-1.2.2.orig/include/utmp.h 2021-01-14 20:26:00.000000000 -0600 18 | +++ musl-1.2.2/include/utmp.h 2021-08-26 16:37:11.567365982 -0500 19 | @@ -37,8 +37,8 @@ 20 | 21 | int login_tty(int); 22 | 23 | -#define _PATH_UTMP "/dev/null/utmp" 24 | -#define _PATH_WTMP "/dev/null/wtmp" 25 | +#define _PATH_UTMP "/run/utmps/utmp" 26 | +#define _PATH_WTMP "/var/log/wtmp" 27 | 28 | #define UTMP_FILE _PATH_UTMP 29 | #define WTMP_FILE _PATH_WTMP 30 | -------------------------------------------------------------------------------- /patches/musl-mlfs/i686-fix-rounding.patch: -------------------------------------------------------------------------------- 1 | diff -uNr musl-1.1.23.orig/src/math/round.c musl-1.1.23/src/math/round.c 2 | --- musl-1.1.23.orig/src/math/round.c 2019-07-16 14:30:39.000000000 -0500 3 | +++ musl-1.1.23/src/math/round.c 2019-09-07 14:26:53.555422685 -0500 4 | @@ -22,7 +22,7 @@ 5 | FORCE_EVAL(x + toint); 6 | return 0*u.f; 7 | } 8 | - y = x + toint - toint - x; 9 | + y = (double)(x + 0x1p52) - 0x1p52 - x; 10 | if (y > 0.5) 11 | y = y + x - 1; 12 | else if (y <= -0.5) 13 | -------------------------------------------------------------------------------- /patches/perl-alpine/musl-locale.patch: -------------------------------------------------------------------------------- 1 | diff --git a/locale.c b/locale.c 2 | index 7653340..7243cb1 100644 3 | --- a/locale.c 4 | +++ b/locale.c 5 | @@ -581,6 +581,10 @@ S_emulate_setlocale(const int category, 6 | 7 | return (char *) querylocale(mask, cur_obj); 8 | 9 | +# elif defined(_NL_LOCALE_NAME) 10 | + 11 | + return (char *) nl_langinfo_l(_NL_LOCALE_NAME(category), cur_obj); 12 | + 13 | # else 14 | 15 | /* If this assert fails, adjust the size of curlocales in intrpvar.h */ 16 | @@ -737,7 +741,7 @@ S_emulate_setlocale(const int category, 17 | 18 | /* Here, we are switching locales. */ 19 | 20 | -# ifndef HAS_QUERYLOCALE 21 | +# if !defined(HAS_QUERYLOCALE) && !defined(_NL_LOCALE_NAME) 22 | 23 | if (strEQ(locale, "")) { 24 | 25 | @@ -1094,6 +1098,12 @@ S_emulate_setlocale(const int category, 26 | locale = querylocale(mask, new_obj); 27 | } 28 | 29 | +# elif defined(_NL_LOCALE_NAME) 30 | + 31 | + if (strEQ(locale, "")) { 32 | + locale = nl_langinfo_l(_NL_LOCALE_NAME(category), new_obj); 33 | + } 34 | + 35 | # else 36 | 37 | /* Here, 'locale' is the return value */ 38 | -------------------------------------------------------------------------------- /patches/perl-alpine/musl-stack-size.patch: -------------------------------------------------------------------------------- 1 | Tests fails on s390x due to low thread stack size 2 | upstream report: https://github.com/Perl/perl5/issues/18160 3 | 4 | diff --git a/t/thread_it.pl b/t/thread_it.pl 5 | index f38a580..e8c450a 100644 6 | --- a/t/thread_it.pl 7 | +++ b/t/thread_it.pl 8 | @@ -36,7 +36,7 @@ my $curr = threads->create({ 9 | stack_size => $^O eq 'hpux' ? 524288 : 10 | $^O eq 'darwin' ? 2000000: 11 | $^O eq 'VMS' ? 150000 : 12 | - $^O eq 'aix' ? 1500000 : 0, 13 | + $^O eq 'aix' ? 1500000 : 256*1024, 14 | }, sub { 15 | run_tests(); 16 | return defined &curr_test ? curr_test() : () 17 | -------------------------------------------------------------------------------- /patches/posixtz-adelie/0001-posixtz-fix-up-lseek.patch: -------------------------------------------------------------------------------- 1 | From 5c4cd3cee03428636e8d7cc4ed644389a4d598b3 Mon Sep 17 00:00:00 2001 2 | From: William Pitcock 3 | Date: Thu, 28 Apr 2011 02:56:42 -0500 4 | Subject: [PATCH] posixtz: ensure the file offset we pass to lseek is off_t 5 | 6 | on 32-bit systems, sizeof(off_t) is 4, on 64-bit sizeof(off_t) is 8 7 | causing a word masking issue. 8 | --- 9 | posixtz.c | 2 +- 10 | 1 files changed, 1 insertions(+), 1 deletions(-) 11 | 12 | diff --git a/posixtz.c b/posixtz.c 13 | index cddcb3e..972ca31 100644 14 | --- a/posixtz-0.5/posixtz.c 15 | +++ b/posixtz-0.5/posixtz.c 16 | @@ -36,7 +36,7 @@ char *posix_tz(const char *filename) 17 | if (r != TZ_BUFLEN 18 | || strncmp(buf, "TZif", 4) != 0 19 | || (unsigned char)buf[4] < 2 20 | - || lseek(fd, -TZ_BUFLEN, SEEK_END) < 0 21 | + || lseek(fd, (off_t) -TZ_BUFLEN, SEEK_END) < 0 22 | ) 23 | goto ERROR; 24 | 25 | -- 26 | 1.7.4.5 27 | 28 | -------------------------------------------------------------------------------- /patches/procps-mlfs/use_utmpx.patch: -------------------------------------------------------------------------------- 1 | diff -uNr procps-3.3.17.orig/proc/whattime.c procps-3.3.17/proc/whattime.c 2 | --- procps-3.3.17.orig/proc/whattime.c 2021-02-09 04:11:25.000000000 -0600 3 | +++ procps-3.3.17/proc/whattime.c 2021-03-19 13:40:17.910049032 -0500 4 | @@ -33,7 +33,7 @@ 5 | #include 6 | #include 7 | #include 8 | -#include 9 | +#include 10 | #include 11 | #include "whattime.h" 12 | #include "sysinfo.h" 13 | @@ -42,7 +42,7 @@ 14 | static double av[3]; 15 | 16 | char *sprint_uptime(int human_readable) { 17 | - struct utmp *utmpstruct; 18 | + struct utmpx *utmpstruct; 19 | int upminutes, uphours, updays, upweeks, upyears, updecades; 20 | int pos; 21 | int comma; 22 | @@ -98,13 +98,13 @@ 23 | /* count the number of users */ 24 | 25 | numuser = 0; 26 | - setutent(); 27 | - while ((utmpstruct = getutent())) { 28 | + setutxent(); 29 | + while ((utmpstruct = getutxent())) { 30 | if ((utmpstruct->ut_type == USER_PROCESS) && 31 | (utmpstruct->ut_name[0] != '\0')) 32 | numuser++; 33 | } 34 | - endutent(); 35 | + endutxent(); 36 | 37 | pos += sprintf(buf + pos, "%2d user%s, ", numuser, numuser == 1 ? "" : "s"); 38 | 39 | -------------------------------------------------------------------------------- /patches/python3-void/musl-find_library.patch: -------------------------------------------------------------------------------- 1 | --- Lib/ctypes/util.py.orig 2 | +++ Lib/ctypes/util.py 3 | @@ -204,6 +204,41 @@ 4 | def find_library(name, is64 = False): 5 | return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name)) 6 | 7 | + elif True: 8 | + 9 | + # Patched for Alpine Linux / musl - search manually system paths 10 | + def _is_elf(filepath): 11 | + try: 12 | + with open(filepath, 'rb') as fh: 13 | + return fh.read(4) == b'\x7fELF' 14 | + except: 15 | + return False 16 | + 17 | + def find_library(name): 18 | + from glob import glob 19 | + # absolute name? 20 | + if os.path.isabs(name): 21 | + return name 22 | + # special case for libm, libcrypt and libpthread and musl 23 | + if name in ['m', 'crypt', 'pthread']: 24 | + name = 'c' 25 | + elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']: 26 | + name = 'libc.so' 27 | + # search in standard locations (musl order) 28 | + paths = ['/lib', '/usr/local/lib', '/usr/lib'] 29 | + if 'LD_LIBRARY_PATH' in os.environ: 30 | + paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths 31 | + for d in paths: 32 | + f = os.path.join(d, name) 33 | + if _is_elf(f): 34 | + return os.path.basename(f) 35 | + 36 | + prefix = os.path.join(d, 'lib'+name) 37 | + for suffix in ['.so', '.so.*']: 38 | + for f in glob('{0}{1}'.format(prefix, suffix)): 39 | + if _is_elf(f): 40 | + return os.path.basename(f) 41 | + 42 | else: 43 | 44 | def _findSoname_ldconfig(name): 45 | -------------------------------------------------------------------------------- /patches/python3-void/tweak-MULTIARCH-for-powerpc-linux-musl.patch: -------------------------------------------------------------------------------- 1 | --- configure 2 | +++ configure 3 | @@ -5205,6 +5205,10 @@ 4 | 5 | MULTIARCH=$($CC --print-multiarch 2>/dev/null) 6 | 7 | +if test x$MULTIARCH = xpowerpc-linux-musl 8 | +then 9 | + MULTIARCH="powerpc-linux-gnu" 10 | +fi 11 | 12 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the platform triplet based on compiler characteristics" >&5 13 | $as_echo_n "checking for the platform triplet based on compiler characteristics... " >&6; } 14 | -------------------------------------------------------------------------------- /patches/util-linux-mlfs/use-tiparm-when-compiling-with-netbsd_curses.patch: -------------------------------------------------------------------------------- 1 | --- util-linux-2.37.2.orig/text-utils/more.c 2021-08-16 05:57:48.692807016 -0500 2 | +++ util-linux-2.37.2/text-utils/more.c 2021-12-31 19:18:20.162108917 -0600 3 | @@ -1990,7 +1990,7 @@ 4 | if (cursor_addr == NULL || *cursor_addr == '\0') { 5 | cursor_addr = tigetstr(TERM_CURSOR_ADDRESS); 6 | if (cursor_addr) 7 | - cursor_addr = tparm(cursor_addr, 0, 0); 8 | + cursor_addr = tiparm(cursor_addr, 0, 0); 9 | } 10 | if (cursor_addr) 11 | ctl->go_home = xstrdup(cursor_addr); 12 | -------------------------------------------------------------------------------- /patches/util-linux-void/fix-musl.patch: -------------------------------------------------------------------------------- 1 | Define __SWORD_TYPE for musl. 2 | 3 | --- sys-utils/switch_root.c.orig 2014-09-20 21:33:27.551345526 +0200 4 | +++ sys-utils/switch_root.c 2014-09-20 21:34:17.958584374 +0200 5 | @@ -47,6 +47,15 @@ 6 | #define MNT_DETACH 0x00000002 /* Just detach from the tree */ 7 | #endif 8 | 9 | +#ifndef __SWORD_TYPE 10 | +# if __WORDSIZE == 32 /* System word size */ 11 | +# define __SWORD_TYPE int 12 | +# else /* __WORDSIZE == 64 */ 13 | +# define __SWORD_TYPE long int 14 | +# endif 15 | +#endif 16 | + 17 | + 18 | /* remove all files/directories below dirName -- don't cross mountpoints */ 19 | static int recursiveRemove(int fd) 20 | { 21 | -------------------------------------------------------------------------------- /patches/zlib-ng-mlfs/configure-fix-interpreter.patch: -------------------------------------------------------------------------------- 1 | --- zlib-ng-2.0.5.orig/configure 2021-06-25 12:35:43.000000000 -0500 2 | +++ zlib-ng-2.0.5/configure 2021-07-08 08:02:54.409181459 -0500 3 | @@ -1,4 +1,4 @@ 4 | -#!/usr/bin/env bash 5 | +#!/bin/bash 6 | # configure script for zlib. 7 | # 8 | # Normally configure builds both a static and a shared library. 9 | --------------------------------------------------------------------------------