├── .gitignore ├── DOCUMENTATION.md ├── LICENSE ├── README.md ├── check ├── meson ├── meson.cross.aarch64 ├── meson.cross.armv4t ├── meson.cross.armv5te ├── meson.cross.armv6 ├── meson.cross.armv6kz ├── meson.cross.armv7 ├── meson.cross.i486 ├── meson.cross.i586 ├── meson.cross.i686 ├── meson.cross.m68k ├── meson.cross.microblaze ├── meson.cross.microblazeel ├── meson.cross.mips64 ├── meson.cross.mips64el ├── meson.cross.mipsisa64r6 ├── meson.cross.mipsisa64r6el ├── meson.cross.or1k ├── meson.cross.powerpc ├── meson.cross.powerpc64 ├── meson.cross.powerpc64le ├── meson.cross.powerpcle ├── meson.cross.riscv64 ├── meson.cross.s390x ├── meson.cross.sh2 ├── meson.cross.sh2-fdpic ├── meson.cross.sh2eb ├── meson.cross.sh2eb-fdpic ├── meson.cross.sh4 ├── meson.cross.sh4eb ├── meson.cross.x86-64 └── mussel-meson ├── mussel └── patches ├── gcc └── glaucus │ ├── 0001-pure64-for-aarch64.patch │ ├── 0001-pure64-for-mips64.patch │ ├── 0001-pure64-for-powerpc64.patch │ ├── 0001-pure64-for-riscv64.patch │ ├── 0001-pure64-for-s390x.patch │ └── 0001-pure64-for-x86-64.patch └── musl └── upstream └── CVE-2025-26519.patch /.gitignore: -------------------------------------------------------------------------------- 1 | # ----- Files ----- # 2 | log.txt 3 | 4 | # ----- Directories ----- # 5 | builds/ 6 | sources/ 7 | sysroot/ 8 | toolchain/ 9 | -------------------------------------------------------------------------------- /DOCUMENTATION.md: -------------------------------------------------------------------------------- 1 | # `mussel` Documentation 2 | 3 | ## Table of Contents 4 | - [i. Package URLs](#i-package-urls) 5 | - [ii. Development Directories](#ii-development-directories) 6 | - [iii. Available Architectures](#iii-available-architectures) 7 | - [iv. PATH](#iv-path) 8 | - [v. `mussel` Flags](#v-mussel-flags) 9 | - [v.i `or1k`](#vi-or1k) 10 | - [v.ii `s390x`](#vii-s390x) 11 | - [vi. `make` Flags](#vi-make-flags) 12 | - [vii. Print Variables to mussel Log File](#vii-print-variables-to-mussel-log-file) 13 | - [viii. Patch Packages](#viii-patch-packages) 14 | 15 | - [1. Step 1: `musl` headers](#1-step-1-musl-headers) 16 | - [2. Step 2: `cross-binutils`](#2-step-2-cross-binutils) 17 | - [3. Step 3: `cross-gcc` (compiler)](#3-step-3-cross-gcc-compiler) 18 | - [4. Step 4: `musl`](#4-step-4-musl) 19 | - [5. Step 5: `cross-gcc` (`libgcc-shared`)](#5-step-5-cross-gcc-libgcc-shared) 20 | - [6. [**Optional** C++ Support] Step 6: `cross-gcc` (`libstdc++-v3`)](#6-optional-c-support-step-6-cross-gcc-libstdc-v3) 21 | - [7. [**Optional** OpenMP Support] Step 7: `cross-gcc` (`libgomp`)](#7-optional-openmp-support-step-7-cross-gcc-libgomp) 22 | - [8. [**Optional** Quadruple-precision Support] Step 8: `cross-gcc` (`libquadmath`)](#8-optional-quadruple-precision-support-step-8-cross-gcc-libquadmath) 23 | - [9. [**Optional** Fortran Support] Step 9: `cross-gcc` (`libgfortran`)](#9-optional-fortran-support-step-9-cross-gcc-libgfortran) 24 | - [10. [**Optional** Linux Headers Support] Step 10: `linux` headers](#10-optional-linux-headers-support-step-11-linux-headers) 25 | - [11. [**Optional** `pkg-config` Support] Step 11: `pkgconf`](#11-optional-pkg-config-support-step-11-pkgconf) 26 | 27 | ## i. Package URLs 28 | The usage of ftpmirror for GNU packages is preferred. 29 | 30 | We also try to use the smallest tarballs available from upstream (in order of 31 | preference): 32 | 33 | - zst 34 | - lz 35 | - xz 36 | - bzip2 37 | - gz 38 | 39 | ## ii. Development Directories 40 | Please don't change `$MSYSROOT` to `$CURDIR/toolchain/$XTARGET` like CLFS and 41 | other implementations do because it'll break here (even if `binutils` insists on 42 | installing stuff to that directory). 43 | 44 | ## iii. Available Architectures 45 | All architectures require a static libgcc (aka `libgcc-static`) to be built 46 | before `musl`. 47 | 48 | `libgcc-static` won't be linked against any C library, and will suffice to to 49 | build `musl` for these architectures. 50 | 51 | All listed archs were tested and are fully working! 52 | 53 | - aarch64 54 | - armv4t 55 | - armv5te 56 | - armv6 57 | - armv6kz (Raspberry Pi 1 Models A, B, B+, the Compute Module, and the 58 | Raspberry Pi Zero) 59 | - armv7 60 | - i486 61 | - i586 62 | - i686 63 | - m68k 64 | - microblaze 65 | - microblazeel 66 | - mips 67 | - mipsel 68 | - mips64 69 | - mips64el 70 | - mipsisa64r6 71 | - mipsisa64r6el 72 | - or1k 73 | - powerpc 74 | - powerpcle 75 | - powerpc64 76 | - powerpc64le 77 | - riscv64 78 | - s390x 79 | - sh2 80 | - sh2be 81 | - sh2-fdpic 82 | - sh2be-fdpic 83 | - sh4 84 | - sh4be 85 | - x86-64 86 | 87 | ## iv. PATH 88 | We start by using the tools available on the host system. We then switch to ours 89 | when they're available. 90 | 91 | ## v. mussel Flags 92 | The `--parallel` flag will use all available cores on the host system. 93 | 94 | It's also common to see `--enable-secureplt` added to `cross-gcc` arguments 95 | when the target is `powerpc*`, but that's only the case to get `musl` to support 96 | 32-bit `powerpc` (as instructed by `musl`'s wiki, along with 97 | `--with-long-double-64`, which was replaced by `--without-long-double-128` in 98 | recent `gcc` versions). For 64-bit `powerpc` like `powerpc64` and `powerpc64le`, 99 | there's no need to explicitly specify it (This needs more investigation, but it 100 | works fine without it). 101 | 102 | `XARCH` is the arch that we are supporting and the user chooses 103 | 104 | `LARCH` is the arch that is supported by the `linux` kernel (found in 105 | `$SRCDIR/linux/linux-$linux_ver/arch/`) 106 | 107 | `MARCH` is the arch that is supported by `musl` (found in 108 | `$SRCDIR/musl/musl-$musl_ver/arch/`) 109 | 110 | `XTARGET` is the final target triplet 111 | 112 | ### v.i `or1k` 113 | There's no such option as `--with-float=hard` for this arch. 114 | 115 | ### v.ii `s390x` 116 | `--enable-decimal-float` is the default on z9-ec and higher (e.g. z196). 117 | 118 | ## vi. `make` Flags 119 | The flags being used with `make` ensure that no documentation is being built, 120 | and it prevents `binutils` from requiring `texinfo` (`binutils` looks for 121 | `makeinfo`, and it fails if it doesn't find it, and the build stops). 122 | 123 | Also please don't use `MAKEINFO=false` (which is what `musl-cross-make` does), 124 | because `binutils` will still fail. 125 | 126 | ## vii. Print Variables to mussel Log File 127 | This is important as debugging will be easier knowing what the environmental 128 | variables are, and instead of assuming, the system can tell us by printing each 129 | of them to the log file. 130 | 131 | ## viii. Patch Packages 132 | Currently only `gcc` is being patched to provide pure 64-bit support for 64-bit 133 | architectures (this means that `/lib/` will be used instead of `/lib64/`, and 134 | `/lib32/` will be used instead of `/lib/`). 135 | 136 | ## 1. Step 1: `musl` headers 137 | We only want the headers to configure `gcc`... Also with `musl` installs, you 138 | almost always should use a `DESTDIR` (this should be the equivalent of setting 139 | `--with-sysroot` when configuring `gcc` and `binutils`. 140 | 141 | We also need to pass `ARCH=$MARCH` and `prefix=/usr` since we haven't 142 | configured `musl` yet, to get the right versions of `musl` headers for the 143 | target architecture. 144 | 145 | ## 2. Step 2: `cross-binutils` 146 | Unlike `musl`, `--prefix` for GNU stuff means where we expect them to be 147 | installed, so specifying it will save you the need to add a `DESTDIR` when 148 | installing `cross-binutils`. 149 | 150 | The `--target` specifies that we're cross compiling, and `binutils` tools will 151 | be prefixed by the value provided to it. There's no need to specify `--build` 152 | and `--host` as `config.guess` and `config.sub` are now smart enough to figure 153 | them in **ALMOST** all GNU packages (yup, I'm looking at you `gcc`...). 154 | 155 | The use of `--disable-werror` is a necessity now, as the build will fail 156 | without it, or it may throw implicit-fallthrough warnings, among others 157 | (thanks to Aurelian). 158 | 159 | Notice how we specify a `--with-sysroot` here to tell `binutils` to consider 160 | the passed value as the root directory of our target system in which it'll 161 | search for target headers and libraries. 162 | 163 | ## 3. Step 3: `cross-gcc` (compiler) 164 | We manually track GCC's prerequisites instead of relying on 165 | `contrib/download_prerequisites` in `gcc`'s source tree. 166 | 167 | Again, what's mentioned in `cross-binutils` applies here. 168 | 169 | C++ language support is needed to successfully build `gcc`, since `gcc` has 170 | big chunks of its source code written in C++. 171 | 172 | LTO is not a default language, but is built by default because `--enable-lto` 173 | is enabled by default. 174 | 175 | If you want to use `zstd` as a backend for LTO, just add `--with-zstd` below 176 | and make sure you have `zstd` (or `zstd-devel` or whatever it's called) 177 | installed on your host. 178 | 179 | Notice how we're not optimizing `libgcc-static` by passing `-O0` to both the 180 | `CFLAGS` and `CXXFLAGS` as we're only using `libgcc-static` to build `musl`, 181 | then we rebuild it later on as a full `libgcc-shared`. 182 | 183 | ## 4. Step 4: `musl` 184 | We need a separate build directory for `musl` now that we have our `cross-gcc` 185 | ready. Using the same directory as `musl` headers without reconfiguring `musl` 186 | would break the ABI. 187 | 188 | `musl` can be configured with a nonexistent `libgcc-static` (which is what 189 | `musl-cross-make` does), but we're able to build `libgcc.a` before `musl` so 190 | it's considered existent here. (We can configure `musl` with a nonexistent 191 | `libgcc.a` then go back to `$BLDDIR/cross-gcc` and build `libgcc.a`, then come 192 | back to `$BLDDIR/musl` and build `musl` (which again is what `musl-cross-make` 193 | does), but that's a lot of jumping, and we end up rebuilding `libgcc` later on 194 | as a shared version to be able to compile the rest of `gcc` libs, so why confuse 195 | ourselves...). 196 | 197 | We can specify `install-libs install-tools` instead of `install` (since we 198 | already have the headers installed (with `install-headers above`)), but 199 | apparently the `install` target automatically skips the headers if it found them 200 | already installed. 201 | 202 | Almost all implementations of `musl` based toolchains change the symlink 203 | between LDSO and the libc.so because it'll be wrong almost always... 204 | 205 | ## 5. Step 5: `cross-gcc` (`libgcc-shared`) 206 | After building `musl`, we need to rebuild `libgcc` but this time as 207 | `libgcc-shared` to be able to build the following `gcc` libs (`libstdc++-v3` and 208 | `libgomp` which would complain about a missing `-lgcc_s` and would error out 209 | with `C compiler doesn't work`...). 210 | 211 | We need to run `make distclean` and not just `make clean` to make sure the 212 | leftovers from the building of `libgcc-static` are gone so we can build 213 | `libgcc-shared` without having to restart the entire build just to build 214 | `libgcc-shared`! 215 | 216 | We specify `enable_shared=yes` here which may not be needed but is highly 217 | recommended to ensure that this step results in a shared version of `libgcc`. 218 | 219 | ## 6. [**Optional** C++ Support] Step 6: `cross-gcc` (`libstdc++-v3`) 220 | It's a good idea to leave the support for C++ enabled as many programs require 221 | it (e.g. `gcc`). 222 | 223 | ## 7. [**Optional** OpenMP Support] Step 7: `cross-gcc` (`libgomp`) 224 | If you're planning on targeting a machine with two or more cores, then it might 225 | be a good idea to enable support for OpenMP optimizations as well (beware as 226 | some packages may fail to build with OpenMP enabled e.g. `grub`). 227 | 228 | ## 8. [**Optional** Quadruple-precision Support] Step 8: `cross-gcc` (`libquadmath`) 229 | If you're building a toolchain with Fortran support (or otherwise need or want 230 | support for quadruple-precision floating point arithmetic), you will want to 231 | enable support for libquadmath. This is enabled when building for Fortran 232 | by default. 233 | 234 | ## 9. [**Optional** Fortran Support] Step 9: `cross-gcc` (`libgfortran`) 235 | If you're building Fortran support, `mussel` will build gcc's implementation of 236 | Fortran's standard library. 237 | 238 | ## 10. [**Optional** Linux Headers Support] Step 10: linux headers 239 | If you're planning on targeting a Linux system then it's a good idea to include 240 | support for Linux kernel headers as several packages require them. 241 | 242 | We first perform a `mrproper` to ensure that our kernel source tree is clean. 243 | 244 | We won't be polluting our kernel source tree which is why we're specifying 245 | `O=$BLDDIR/linux` (which I believe may or may not be used since we're 246 | only installing the kernel header files and not actually building anything, but 247 | just to be safe...). 248 | 249 | The `headers_install` target requires `rsync` to be available (this is the 250 | default as of `5.3`, it also performs additional cleaning on `*.cmd` files which 251 | may require manual cleaning if we're manually copying the headers (in the case 252 | of `rsync` not being available, which isn't recommended)). 253 | 254 | ## 11. [**Optional** `pkg-config` Support] Step 11: `pkgconf` 255 | As of `gcc` 10, the flag `-fno-common` is now enabled by default, which in 256 | most cases is a good thing because it helps in performance but for `pkgconf` it 257 | will result in breakage which is why we're passing `-fcommon` instead. 258 | 259 | Since we're building our own `pkgconf` it should be able to run on where the 260 | toolchain will be hosted, and it will be built on the same machine that we used 261 | to build our toolchain, this makes `--build` equal to `--host` equal to the 262 | machine we're building everything on. There's no need to set `--target` because 263 | `pkgconf` doesn't produce binaries or executables that can be run on a given 264 | target, hence the option is irrelevant here. You might also notice that since 265 | `--build` is equal to `--host` (which is mostly `x86_64-pc-linux-gnu`) then why 266 | aren't we using the host's `pkg-config` or `pkgconf` in the first place (since 267 | both ours and the host's will be compiled using the same toolchain installed on 268 | the host system), and we already answered that in the `README.md` file (we can 269 | make use of the host's `pkg-config` or `pkgconf` by setting 3-5 environment 270 | variables that point to where we're storing our relevant `.pc` files). The only 271 | advantage we have when building our own `pkg-config` or `pkgconf` is that we can 272 | configure these options at compile time instead of relying on environment 273 | variables, and that's pretty much about it... 274 | 275 | It's also a good idea to symlink `pkg-config` to `pkgconf`. 276 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2020-2025, Firas Khana 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # `mussel` 2 | `mussel` is the shortest and fastest script available today to build working cross 3 | compilers that target `musl` libc 4 | 5 | ## Features 6 | 1. **Up-to-date**: uses latest available upstream sources for packages 7 | 2. **Fast**: probably the fastest script around to build a cross compiler 8 | targeting `musl` libc, and runs fully under `dash` 9 | 3. **Short**: has the least amount of steps ([see 10 | below](#how-is-mussel-doing-it)) required 11 | to build a cross compiler targeting musl libc (even less than 12 | [musl-cross-make](https://github.com/richfelker/musl-cross-make)) 13 | 4. **Small**: all installation steps use `install-strip` where applicable 14 | 5. **Simple**: easy to read, modify and extend 15 | 6. **POSIX Compliant**: the entire script is POSIX compliant 16 | 7. **Well Documented**: the script comes with a 17 | [`DOCUMENTATION.md`](DOCUMENTATION.md) 18 | file that includes state of the art information explaining what is being done 19 | and why 20 | 21 | ## Requirements: 22 | To confirm you have all required packages, please execute `./check` 23 | 24 | ## Usage 25 | ### Building a Cross Compiler 26 | ```Shell 27 | ./mussel (arch) (flags) 28 | ``` 29 | 30 | **(arch)**: See [**Supported 31 | Architectures**](#supported-architectures) 32 | below 33 | 34 | **(flags)**: 35 | ```Console 36 | f | -f | --enable-fortran Enable optional Fortran support 37 | k | -k | --enable-pkg-config Enable optional pkg-config support 38 | l | -l | --enable-linux-headers Enable optional Linux Headers support 39 | o | -o | --enable-openmp Enable optional OpenMP support 40 | p | -p | --parallel Use all available cores on the host system 41 | q | -q | --enable-quadmath Enable optional libquadmath support (default for Fortran) 42 | s | -s | --min-size Optimize for minimum size 43 | x | -x | --disable-cxx Disable optional C++ support 44 | g | -g | --disable-isl Disable isl Library support (Graphite loop optimisations) 45 | T | -T | --custom-vendor Sets a custom vendor for tuple, requires architecture to be set before 46 | ``` 47 | 48 | ### Other Commands 49 | ```Shell 50 | ./mussel (command) 51 | ``` 52 | 53 | **(command)**: 54 | ```Shell 55 | c | -c | --clean Clean mussel's build environment 56 | h | -h | --help Display this help message 57 | ``` 58 | 59 | Sources will be preserved 60 | 61 | ## Supported Architectures 62 | - aarch64 63 | - armv4t 64 | - armv5te 65 | - armv6 66 | - armv6kz (Raspberry Pi 1 Models A, B, B+, the Compute Module, and the Raspberry 67 | Pi Zero) 68 | - armv7 69 | - i486 70 | - i586 71 | - i686 72 | - m68k 73 | - microblaze 74 | - microblazeel 75 | - mips 76 | - mipsel 77 | - mips64 78 | - mips64el 79 | - mipsisa64r6 80 | - mipsisa64r6el 81 | - or1k 82 | - powerpc 83 | - powerpcle 84 | - powerpc64 85 | - powerpc64le 86 | - riscv64 87 | - s390x 88 | - sh2 89 | - sh2be 90 | - sh2-fdpic 91 | - sh2be-fdpic 92 | - sh4 93 | - sh4be 94 | - x86-64 95 | 96 | ## Packages 97 | 1. `binutils`: 2.44 98 | 2. `gcc`: 14.2.0 99 | 3. `gmp`: 6.3.0 100 | 4. `isl`: 0.27 101 | 5. `linux`: 6.13.7 (**Optional** Linux Headers Support) (**Disabled** by default) 102 | 6. `mpc`: 1.3.1 103 | 7. `mpfr`: 4.2.2 104 | 8. `musl`: 1.2.5 105 | 9. `pkgconf`: 2.4.3 (**Optional** `pkg-config` Support) (**Disabled** by default) 106 | 107 | ## How Is `mussel` Doing It? 108 | 1. Install `musl` headers 109 | 2. Configure, build and install cross `binutils` 110 | 3. Configure, build and install cross `gcc` (with `libgcc-static`) 111 | 4. Configure, build and install `musl` 112 | 5. Build, and install `libgcc-shared` 113 | 114 | ## **Optional** Steps 115 | - Build and install `libstdc++-v3` (**Optional** C++ Support) (**Enabled** by default) 116 | - Build and install `libgomp` (**Optional** OpenMP Support) (**Disabled** by default) 117 | - Build and install `libquadmath` (**Optional** Quadruple-precision Support) 118 | (**Disabled** by default, **Enabled** for Fortran) 119 | - Build and install `libgfortran` (**Optional** Fortran Support) (**Disabled** by default) 120 | - Install `linux-headers` (**Optional** Linux Headers Support) (**Disabled** by default) 121 | - Configure, build and install `pkgconf` (**Optional** `pkg-config` Support) 122 | (**Disabled** by default) 123 | 124 | ### Using `mussel` With Host's `pkg-config` or `pkgconf` 125 | The reason we included `pkgconf` with `mussel` as an **optional** step is 126 | because we can easily configure the host's `pkg-config` or `pkgconf` to work 127 | with `mussel` without having to build our own version of `pkg-config` or 128 | `pkgconf`. 129 | 130 | Here are the five magical environment variables that we need to set to configure 131 | the host's `pkg-config` or `pkgconf` to work with `mussel`: 132 | 133 | ```Shell 134 | export PKG_CONFIG_PATH=$MSYSROOT/usr/lib/pkgconfig:$MSYSROOT/usr/share/pkgconfig 135 | export PKG_CONFIG_LIBDIR=$MSYSROOT/usr/lib/pkgconfig:$MSYSROOT/usr/share/pkgconfig 136 | export PKG_CONFIG_SYSROOT_DIR=$MSYSROOT 137 | 138 | export PKG_CONFIG_SYSTEM_INCLUDE_PATH=$MSYSROOT/usr/include 139 | export PKG_CONFIG_SYSTEM_LIBRARY_PATH=$MSYSROOT/usr/lib 140 | ``` 141 | 142 | The last two I believe are `pkgconf` specific but setting them won't do any harm. 143 | 144 | ### Using `mussel` With Host's `meson` 145 | `mussel` now provides cross-compilation configuration files for `meson` that 146 | support all listed architectures, and a wrapper around host's `meson` 147 | (`mussel-meson`) in an effort to make dealing with `meson` a bit easier. 148 | 149 | ## Projects Using `mussel` 150 | - [CMLFS](https://github.com/dslm4515/CMLFS) 151 | - [Copacabana Linux](http://copacabana.pindorama.net.br) 152 | - [glaucus](https://glaucuslinux.org/) 153 | - [Hanh Linux](https://hanh-linux.github.io/) 154 | - [qLinux](https://qlinux.qware.org/doku.php) 155 | - [Raptix](https://github.com/dslm4515/Raptix) 156 | - [Spider Linux](https://github.com/spider-linux/spiderlinux) 157 | - [Tin Can Linux](https://tincan-linux.github.io/) 158 | - [Yeti OS](https://github.com/avs-origami/yeti) 159 | 160 | ## Credits and Inspiration 161 | `mussel` is possible thanks to the awesome work done by Aurelian, Rich 162 | Felker, [qword](https://github.com/qword-os), [The Managarm Project]( 163 | https://github.com/managarm), [glaucus](https://glaucuslinux.org/) and 164 | [musl-cross-make]( https://github.com/richfelker/musl-cross-make) 165 | 166 | ## Author 167 | Firas Khana (firasuke) <[firasuke@glaucuslinux.org]( 168 | mailto:firasuke@glaucuslinux.org)> 169 | 170 | ## Contributors 171 | - Alexander Barris (AwlsomeAlex) <[alex@awlsome.com](mailto:alex@awlsome.com)> 172 | - Andrew Blue <[andy@antareslinux.org](mailto:andy@antareslinux.org)> 173 | - ayb <[ayb@3hg.fr](mailto:ayb@3hg.fr)> 174 | - Luiz Antônio Rangel at Pindorama (takusuman) <[luiz.antonio.rangel@outlook.com.br](luiz.antonio.rangel@outlook.com.br)> 175 | - Rida Antoinette (vibrantrida) <[vibrantsmug@gmail.com](vibrantsmug@gmail.com)> 176 | 177 | ## License 178 | `mussel` is licensed under the Internet Systems Consortium (ISC) license 179 | 180 | ## Dedication 181 | `mussel` is dedicated to all those that believe setting up a cross compiler 182 | targeting musl libc is a complicated process. 183 | 184 | ## Community 185 | - [Reddit](https://reddit.com/r/distrodev) 186 | 187 | ## Mirrors 188 | - [Codeberg](https://codeberg.org/firasuke/mussel) 189 | - [GitHub](https://github.com/firasuke/mussel) 190 | - [SourceHut](https://git.sr.ht/~firasuke/mussel) 191 | -------------------------------------------------------------------------------- /check: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # Copyright © 2018-2025 Firas Khana 4 | # Distributed under the terms of the ISC License 5 | 6 | # Contributors: 7 | # * Luiz Antônio Rangel at Pindorama (takusuman) 8 | 9 | # Boilerplate that checks if it's GNU, Heirloom 10 | # or just desist and print the current POSIX 11 | # standard of the system. 12 | GNUorNonGNU() { 13 | cmd=$1 14 | heirloom_ver="$(getconf HEIRLOOM_TOOLCHEST_VERSION 2>/dev/null || 15 | printf 'err')" 16 | posix_ver=$(getconf _POSIX_VERSION) 17 | case "$($cmd --version 2>/dev/null || printf 'err')" in 18 | err) case "$heirloom_ver" in 19 | 'err') 20 | if (command -v "$cmd" 2>&1 >/dev/null); then 21 | printf 'POSIX version: %d\n' \ 22 | $posix_ver 23 | else 24 | printf 'Not found.\n' 25 | return 1 26 | fi 27 | ;; 28 | *) 29 | if [ $heirloom_ver -gt 070715 ]; then 30 | NG="(New Generation)" 31 | fi 32 | printf 'Heirloom Toolchest%srel. %d\n' \ 33 | " $NG " $heirloom_ver 34 | ;; 35 | esac ;; 36 | *) $cmd --version 2>&1 | sed 1q | cut -d' ' -f4 ;; 37 | esac 38 | } 39 | 40 | if command -v b3sum 2>&1 >/dev/null; then 41 | printf 'b3sum :: ' 42 | b3sum --version | cut -d' ' -f2 43 | elif command -v sha256sum 2>&1 >/dev/null; then 44 | printf 'sha256sum :: ' 45 | sha256sum --version | sed 1q | cut -d' ' -f2- 46 | elif command -v openssl 2>&1 >/dev/null; then 47 | printf 'sha256sum (Open/LibreSSL) :: ' 48 | openssl version 49 | fi 50 | 51 | printf 'bash :: ' 52 | bash --version | sed 1q | cut -d' ' -f4 53 | 54 | printf 'bc :: ' 55 | { (command -v bc 2>&1 >/dev/null) && ( (bc --version || 56 | getconf HEIRLOOM_TOOLCHEST_VERSION || 57 | getconf _POSIX_VERSION) | sed 1q | cut -d' ' -f2) 2>/dev/null; } || 58 | printf 'Not found.\n' 59 | 60 | printf 'binutils :: ' 61 | ld --version | sed 1q | cut -d' ' -f5 62 | 63 | printf 'bison :: ' 64 | bison --version | sed 1q | cut -d' ' -f4 65 | 66 | printf 'bzip2 :: ' 67 | bzip2 --version 2>&1 &1 | grep 'musl' 2>&1 >/dev/null); then 91 | printf 'musl libc :: ' 92 | ldd --version 2>&1 | sed -n 2p | cut -d' ' -f2 93 | elif $(ldd --version 2>&1 | grep 'GNU' 2>&1 >/dev/null); then 94 | printf 'glibc :: ' 95 | ldd --version 2>&1 | sed 1q | cut -d' ' -f4 96 | fi 97 | 98 | printf 'grep :: ' 99 | GNUorNonGNU 'grep' 100 | 101 | printf 'gzip :: ' 102 | gzip --version | sed 1q | cut -d' ' -f2 103 | 104 | printf 'libzstd :: ' 105 | (printf '#include \nZSTD_VERSION_STRING' | 106 | (gcc -E -P - 2>/dev/null || echo 'libzstd not found.') | tail -n1) 107 | 108 | printf 'linux :: ' 109 | uname -r 110 | 111 | printf 'm4 :: ' 112 | m4 --version | sed 1q | cut -d' ' -f4 113 | 114 | printf 'make :: ' 115 | make --version | sed 1q | cut -d' ' -f3 116 | 117 | printf 'patch :: ' 118 | patch --version | sed 1q | cut -d' ' -f3 119 | 120 | printf 'perl :: ' 121 | perl -V:version | cut -d"'" -f2 122 | 123 | printf 'sed :: ' 124 | GNUorNonGNU 'sed' 125 | 126 | printf 'tar :: ' 127 | ( (tar --version || 128 | # Important: Heirloom tar(1) is broken for 129 | # the modern world since its conception. 130 | getconf HEIRLOOM_TOOLCHEST_VERSION || 131 | getconf _POSIX_VERSION) | sed 1q | cut -d' ' -f4) 2>/dev/null 132 | 133 | printf 'texinfo :: ' 134 | makeinfo --version | sed 1q | cut -d' ' -f4 135 | 136 | printf 'xz :: ' 137 | xz --version | sed 1q | cut -d' ' -f4 138 | -------------------------------------------------------------------------------- /meson/meson.cross.aarch64: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'aarch64-linux-musl-gcc-ar' 3 | as = 'aarch64-linux-musl-as' 4 | c = 'aarch64-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'aarch64-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'aarch64-linux-musl-ld.bfd' 9 | nm = 'aarch64-linux-musl-gcc-nm' 10 | objcopy = 'aarch64-linux-musl-objcopy' 11 | objdump = 'aarch64-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'aarch64-linux-musl-gcc-ranlib' 14 | readelf = 'aarch64-linux-musl-readelf' 15 | size = 'aarch64-linux-musl-size' 16 | strings = 'aarch64-linux-musl-strings' 17 | strip = 'aarch64-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'armv8-a' 21 | cpu_family = 'aarch64' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.armv4t: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'armv4t-linux-musleabihf-gcc-ar' 3 | as = 'armv4t-linux-musleabihf-as' 4 | c = 'armv4t-linux-musleabihf-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'armv4t-linux-musleabihf-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'armv4t-linux-musleabihf-ld.bfd' 9 | nm = 'armv4t-linux-musleabihf-gcc-nm' 10 | objcopy = 'armv4t-linux-musleabihf-objcopy' 11 | objdump = 'armv4t-linux-musleabihf-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'armv4t-linux-musleabihf-gcc-ranlib' 14 | readelf = 'armv4t-linux-musleabihf-readelf' 15 | size = 'armv4t-linux-musleabihf-size' 16 | strings = 'armv4t-linux-musleabihf-strings' 17 | strip = 'armv4t-linux-musleabihf-strip' 18 | 19 | [host_machine] 20 | cpu = 'armv4t' 21 | cpu_family = 'arm' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.armv5te: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'armv5te-linux-musleabihf-gcc-ar' 3 | as = 'armv5te-linux-musleabihf-as' 4 | c = 'armv5te-linux-musleabihf-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'armv5te-linux-musleabihf-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'armv5te-linux-musleabihf-ld.bfd' 9 | nm = 'armv5te-linux-musleabihf-gcc-nm' 10 | objcopy = 'armv5te-linux-musleabihf-objcopy' 11 | objdump = 'armv5te-linux-musleabihf-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'armv5te-linux-musleabihf-gcc-ranlib' 14 | readelf = 'armv5te-linux-musleabihf-readelf' 15 | size = 'armv5te-linux-musleabihf-size' 16 | strings = 'armv5te-linux-musleabihf-strings' 17 | strip = 'armv5te-linux-musleabihf-strip' 18 | 19 | [host_machine] 20 | cpu = 'armv5te' 21 | cpu_family = 'arm' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.armv6: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'armv6-linux-musleabihf-gcc-ar' 3 | as = 'armv6-linux-musleabihf-as' 4 | c = 'armv6-linux-musleabihf-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'armv6-linux-musleabihf-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'armv6-linux-musleabihf-ld.bfd' 9 | nm = 'armv6-linux-musleabihf-gcc-nm' 10 | objcopy = 'armv6-linux-musleabihf-objcopy' 11 | objdump = 'armv6-linux-musleabihf-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'armv6-linux-musleabihf-gcc-ranlib' 14 | readelf = 'armv6-linux-musleabihf-readelf' 15 | size = 'armv6-linux-musleabihf-size' 16 | strings = 'armv6-linux-musleabihf-strings' 17 | strip = 'armv6-linux-musleabihf-strip' 18 | 19 | [host_machine] 20 | cpu = 'armv6' 21 | cpu_family = 'arm' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.armv6kz: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'armv6kz-linux-musleabihf-gcc-ar' 3 | as = 'armv6kz-linux-musleabihf-as' 4 | c = 'armv6kz-linux-musleabihf-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'armv6kz-linux-musleabihf-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'armv6kz-linux-musleabihf-ld.bfd' 9 | nm = 'armv6kz-linux-musleabihf-gcc-nm' 10 | objcopy = 'armv6kz-linux-musleabihf-objcopy' 11 | objdump = 'armv6kz-linux-musleabihf-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'armv6kz-linux-musleabihf-gcc-ranlib' 14 | readelf = 'armv6kz-linux-musleabihf-readelf' 15 | size = 'armv6kz-linux-musleabihf-size' 16 | strings = 'armv6kz-linux-musleabihf-strings' 17 | strip = 'armv6kz-linux-musleabihf-strip' 18 | 19 | [host_machine] 20 | cpu = 'armv6kz' 21 | cpu_family = 'arm' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.armv7: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'armv7-linux-musleabihf-gcc-ar' 3 | as = 'armv7-linux-musleabihf-as' 4 | c = 'armv7-linux-musleabihf-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'armv7-linux-musleabihf-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'armv7-linux-musleabihf-ld.bfd' 9 | nm = 'armv7-linux-musleabihf-gcc-nm' 10 | objcopy = 'armv7-linux-musleabihf-objcopy' 11 | objdump = 'armv7-linux-musleabihf-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'armv7-linux-musleabihf-gcc-ranlib' 14 | readelf = 'armv7-linux-musleabihf-readelf' 15 | size = 'armv7-linux-musleabihf-size' 16 | strings = 'armv7-linux-musleabihf-strings' 17 | strip = 'armv7-linux-musleabihf-strip' 18 | 19 | [host_machine] 20 | cpu = 'armv7' 21 | cpu_family = 'arm' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.i486: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'i486-linux-musl-gcc-ar' 3 | as = 'i486-linux-musl-as' 4 | c = 'i486-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'i486-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'i486-linux-musl-ld.bfd' 9 | nm = 'i486-linux-musl-gcc-nm' 10 | objcopy = 'i486-linux-musl-objcopy' 11 | objdump = 'i486-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'i486-linux-musl-gcc-ranlib' 14 | readelf = 'i486-linux-musl-readelf' 15 | size = 'i486-linux-musl-size' 16 | strings = 'i486-linux-musl-strings' 17 | strip = 'i486-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'i486' 21 | cpu_family = 'x86' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.i586: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'i586-linux-musl-gcc-ar' 3 | as = 'i586-linux-musl-as' 4 | c = 'i586-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'i586-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'i586-linux-musl-ld.bfd' 9 | nm = 'i586-linux-musl-gcc-nm' 10 | objcopy = 'i586-linux-musl-objcopy' 11 | objdump = 'i586-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'i586-linux-musl-gcc-ranlib' 14 | readelf = 'i586-linux-musl-readelf' 15 | size = 'i586-linux-musl-size' 16 | strings = 'i586-linux-musl-strings' 17 | strip = 'i586-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'i586' 21 | cpu_family = 'x86' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.i686: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'i686-linux-musl-gcc-ar' 3 | as = 'i686-linux-musl-as' 4 | c = 'i686-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'i686-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'i686-linux-musl-ld.bfd' 9 | nm = 'i686-linux-musl-gcc-nm' 10 | objcopy = 'i686-linux-musl-objcopy' 11 | objdump = 'i686-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'i686-linux-musl-gcc-ranlib' 14 | readelf = 'i686-linux-musl-readelf' 15 | size = 'i686-linux-musl-size' 16 | strings = 'i686-linux-musl-strings' 17 | strip = 'i686-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'i686' 21 | cpu_family = 'x86' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.m68k: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'm68k-linux-musl-gcc-ar' 3 | as = 'm68k-linux-musl-as' 4 | c = 'm68k-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'm68k-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'm68k-linux-musl-ld.bfd' 9 | nm = 'm68k-linux-musl-gcc-nm' 10 | objcopy = 'm68k-linux-musl-objcopy' 11 | objdump = 'm68k-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'm68k-linux-musl-gcc-ranlib' 14 | readelf = 'm68k-linux-musl-readelf' 15 | size = 'm68k-linux-musl-size' 16 | strings = 'm68k-linux-musl-strings' 17 | strip = 'm68k-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'm68k' 21 | cpu_family = 'm68k' 22 | endian = 'big' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.microblaze: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'microblaze-linux-musl-gcc-ar' 3 | as = 'microblaze-linux-musl-as' 4 | c = 'microblaze-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'microblaze-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'microblaze-linux-musl-ld.bfd' 9 | nm = 'microblaze-linux-musl-gcc-nm' 10 | objcopy = 'microblaze-linux-musl-objcopy' 11 | objdump = 'microblaze-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'microblaze-linux-musl-gcc-ranlib' 14 | readelf = 'microblaze-linux-musl-readelf' 15 | size = 'microblaze-linux-musl-size' 16 | strings = 'microblaze-linux-musl-strings' 17 | strip = 'microblaze-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'microblaze' 21 | cpu_family = 'microblaze' 22 | endian = 'big' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.microblazeel: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'microblazeel-linux-musl-gcc-ar' 3 | as = 'microblazeel-linux-musl-as' 4 | c = 'microblazeel-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'microblazeel-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'microblazeel-linux-musl-ld.bfd' 9 | nm = 'microblazeel-linux-musl-gcc-nm' 10 | objcopy = 'microblazeel-linux-musl-objcopy' 11 | objdump = 'microblazeel-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'microblazeel-linux-musl-gcc-ranlib' 14 | readelf = 'microblazeel-linux-musl-readelf' 15 | size = 'microblazeel-linux-musl-size' 16 | strings = 'microblazeel-linux-musl-strings' 17 | strip = 'microblazeel-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'microblaze' 21 | cpu_family = 'microblaze' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.mips64: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'mips64-linux-musl-gcc-ar' 3 | as = 'mips64-linux-musl-as' 4 | c = 'mips64-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'mips64-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'mips64-linux-musl-ld.bfd' 9 | nm = 'mips64-linux-musl-gcc-nm' 10 | objcopy = 'mips64-linux-musl-objcopy' 11 | objdump = 'mips64-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'mips64-linux-musl-gcc-ranlib' 14 | readelf = 'mips64-linux-musl-readelf' 15 | size = 'mips64-linux-musl-size' 16 | strings = 'mips64-linux-musl-strings' 17 | strip = 'mips64-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'mips64' 21 | cpu_family = 'mips64' 22 | endian = 'big' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.mips64el: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'mips64el-linux-musl-gcc-ar' 3 | as = 'mips64el-linux-musl-as' 4 | c = 'mips64el-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'mips64el-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'mips64el-linux-musl-ld.bfd' 9 | nm = 'mips64el-linux-musl-gcc-nm' 10 | objcopy = 'mips64el-linux-musl-objcopy' 11 | objdump = 'mips64el-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'mips64el-linux-musl-gcc-ranlib' 14 | readelf = 'mips64el-linux-musl-readelf' 15 | size = 'mips64el-linux-musl-size' 16 | strings = 'mips64el-linux-musl-strings' 17 | strip = 'mips64el-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'mips64el' 21 | cpu_family = 'mips64' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.mipsisa64r6: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'mipsisa64r6-linux-musl-gcc-ar' 3 | as = 'mipsisa64r6-linux-musl-as' 4 | c = 'mipsisa64r6-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'mipsisa64r6-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'mipsisa64r6-linux-musl-ld.bfd' 9 | nm = 'mipsisa64r6-linux-musl-gcc-nm' 10 | objcopy = 'mipsisa64r6-linux-musl-objcopy' 11 | objdump = 'mipsisa64r6-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'mipsisa64r6-linux-musl-gcc-ranlib' 14 | readelf = 'mipsisa64r6-linux-musl-readelf' 15 | size = 'mipsisa64r6-linux-musl-size' 16 | strings = 'mipsisa64r6-linux-musl-strings' 17 | strip = 'mipsisa64r6-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'mips64r6' 21 | cpu_family = 'mips64' 22 | endian = 'big' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.mipsisa64r6el: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'mipsisa64r6el-linux-musl-gcc-ar' 3 | as = 'mipsisa64r6el-linux-musl-as' 4 | c = 'mipsisa64r6el-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'mipsisa64r6el-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'mipsisa64r6el-linux-musl-ld.bfd' 9 | nm = 'mipsisa64r6el-linux-musl-gcc-nm' 10 | objcopy = 'mipsisa64r6el-linux-musl-objcopy' 11 | objdump = 'mipsisa64r6el-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'mipsisa64r6el-linux-musl-gcc-ranlib' 14 | readelf = 'mipsisa64r6el-linux-musl-readelf' 15 | size = 'mipsisa64r6el-linux-musl-size' 16 | strings = 'mipsisa64r6el-linux-musl-strings' 17 | strip = 'mipsisa64r6el-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'mips64r6el' 21 | cpu_family = 'mips64' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.or1k: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'or1k-linux-musl-gcc-ar' 3 | as = 'or1k-linux-musl-as' 4 | c = 'or1k-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'or1k-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'or1k-linux-musl-ld.bfd' 9 | nm = 'or1k-linux-musl-gcc-nm' 10 | objcopy = 'or1k-linux-musl-objcopy' 11 | objdump = 'or1k-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'or1k-linux-musl-gcc-ranlib' 14 | readelf = 'or1k-linux-musl-readelf' 15 | size = 'or1k-linux-musl-size' 16 | strings = 'or1k-linux-musl-strings' 17 | strip = 'or1k-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'openrisc' 21 | cpu_family = 'openrisc' 22 | endian = 'big' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.powerpc: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'powerpc-linux-musl-gcc-ar' 3 | as = 'powerpc-linux-musl-as' 4 | c = 'powerpc-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'powerpc-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'powerpc-linux-musl-ld.bfd' 9 | nm = 'powerpc-linux-musl-gcc-nm' 10 | objcopy = 'powerpc-linux-musl-objcopy' 11 | objdump = 'powerpc-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'powerpc-linux-musl-gcc-ranlib' 14 | readelf = 'powerpc-linux-musl-readelf' 15 | size = 'powerpc-linux-musl-size' 16 | strings = 'powerpc-linux-musl-strings' 17 | strip = 'powerpc-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'ppc' 21 | cpu_family = 'ppc' 22 | endian = 'big' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.powerpc64: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'powerpc64-linux-musl-gcc-ar' 3 | as = 'powerpc64-linux-musl-as' 4 | c = 'powerpc64-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'powerpc64-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'powerpc64-linux-musl-ld.bfd' 9 | nm = 'powerpc64-linux-musl-gcc-nm' 10 | objcopy = 'powerpc64-linux-musl-objcopy' 11 | objdump = 'powerpc64-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'powerpc64-linux-musl-gcc-ranlib' 14 | readelf = 'powerpc64-linux-musl-readelf' 15 | size = 'powerpc64-linux-musl-size' 16 | strings = 'powerpc64-linux-musl-strings' 17 | strip = 'powerpc64-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'ppc64' 21 | cpu_family = 'ppc64' 22 | endian = 'big' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.powerpc64le: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'powerpc64le-linux-musl-gcc-ar' 3 | as = 'powerpc64le-linux-musl-as' 4 | c = 'powerpc64le-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'powerpc64le-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'powerpc64le-linux-musl-ld.bfd' 9 | nm = 'powerpc64le-linux-musl-gcc-nm' 10 | objcopy = 'powerpc64le-linux-musl-objcopy' 11 | objdump = 'powerpc64le-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'powerpc64le-linux-musl-gcc-ranlib' 14 | readelf = 'powerpc64le-linux-musl-readelf' 15 | size = 'powerpc64le-linux-musl-size' 16 | strings = 'powerpc64le-linux-musl-strings' 17 | strip = 'powerpc64le-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'ppc64le' 21 | cpu_family = 'ppc64' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.powerpcle: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'powerpcle-linux-musl-gcc-ar' 3 | as = 'powerpcle-linux-musl-as' 4 | c = 'powerpcle-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'powerpcle-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'powerpcle-linux-musl-ld.bfd' 9 | nm = 'powerpcle-linux-musl-gcc-nm' 10 | objcopy = 'powerpcle-linux-musl-objcopy' 11 | objdump = 'powerpcle-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'powerpcle-linux-musl-gcc-ranlib' 14 | readelf = 'powerpcle-linux-musl-readelf' 15 | size = 'powerpcle-linux-musl-size' 16 | strings = 'powerpcle-linux-musl-strings' 17 | strip = 'powerpcle-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'ppcle' 21 | cpu_family = 'ppc' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.riscv64: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'riscv64-linux-musl-gcc-ar' 3 | as = 'riscv64-linux-musl-as' 4 | c = 'riscv64-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'riscv64-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'riscv64-linux-musl-ld.bfd' 9 | nm = 'riscv64-linux-musl-gcc-nm' 10 | objcopy = 'riscv64-linux-musl-objcopy' 11 | objdump = 'riscv64-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'riscv64-linux-musl-gcc-ranlib' 14 | readelf = 'riscv64-linux-musl-readelf' 15 | size = 'riscv64-linux-musl-size' 16 | strings = 'riscv64-linux-musl-strings' 17 | strip = 'riscv64-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'rv64gc' 21 | cpu_family = 'riscv64' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.s390x: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 's390x-linux-musl-gcc-ar' 3 | as = 's390x-linux-musl-as' 4 | c = 's390x-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 's390x-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 's390x-linux-musl-ld.bfd' 9 | nm = 's390x-linux-musl-gcc-nm' 10 | objcopy = 's390x-linux-musl-objcopy' 11 | objdump = 's390x-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 's390x-linux-musl-gcc-ranlib' 14 | readelf = 's390x-linux-musl-readelf' 15 | size = 's390x-linux-musl-size' 16 | strings = 's390x-linux-musl-strings' 17 | strip = 's390x-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 's390x' 21 | cpu_family = 's390x' 22 | endian = 'big' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.sh2: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'sh2-linux-musl-gcc-ar' 3 | as = 'sh2-linux-musl-as' 4 | c = 'sh2-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'sh2-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'sh2-linux-musl-ld.bfd' 9 | nm = 'sh2-linux-musl-gcc-nm' 10 | objcopy = 'sh2-linux-musl-objcopy' 11 | objdump = 'sh2-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'sh2-linux-musl-gcc-ranlib' 14 | readelf = 'sh2-linux-musl-readelf' 15 | size = 'sh2-linux-musl-size' 16 | strings = 'sh2-linux-musl-strings' 17 | strip = 'sh2-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'sh2' 21 | cpu_family = 'sh' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.sh2-fdpic: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'sh2-linux-muslfdpic-gcc-ar' 3 | as = 'sh2-linux-muslfdpic-as' 4 | c = 'sh2-linux-muslfdpic-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'sh2-linux-muslfdpic-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'sh2-linux-muslfdpic-ld.bfd' 9 | nm = 'sh2-linux-muslfdpic-gcc-nm' 10 | objcopy = 'sh2-linux-muslfdpic-objcopy' 11 | objdump = 'sh2-linux-muslfdpic-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'sh2-linux-muslfdpic-gcc-ranlib' 14 | readelf = 'sh2-linux-muslfdpic-readelf' 15 | size = 'sh2-linux-muslfdpic-size' 16 | strings = 'sh2-linux-muslfdpic-strings' 17 | strip = 'sh2-linux-muslfdpic-strip' 18 | 19 | [host_machine] 20 | cpu = 'sh2' 21 | cpu_family = 'sh' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.sh2eb: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'sh2eb-linux-musl-gcc-ar' 3 | as = 'sh2eb-linux-musl-as' 4 | c = 'sh2eb-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'sh2eb-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'sh2eb-linux-musl-ld.bfd' 9 | nm = 'sh2eb-linux-musl-gcc-nm' 10 | objcopy = 'sh2eb-linux-musl-objcopy' 11 | objdump = 'sh2eb-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'sh2eb-linux-musl-gcc-ranlib' 14 | readelf = 'sh2eb-linux-musl-readelf' 15 | size = 'sh2eb-linux-musl-size' 16 | strings = 'sh2eb-linux-musl-strings' 17 | strip = 'sh2eb-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'sh2eb' 21 | cpu_family = 'sh' 22 | endian = 'big' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.sh2eb-fdpic: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'sh2eb-linux-muslfdpic-gcc-ar' 3 | as = 'sh2eb-linux-muslfdpic-as' 4 | c = 'sh2eb-linux-muslfdpic-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'sh2eb-linux-muslfdpic-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'sh2eb-linux-muslfdpic-ld.bfd' 9 | nm = 'sh2eb-linux-muslfdpic-gcc-nm' 10 | objcopy = 'sh2eb-linux-muslfdpic-objcopy' 11 | objdump = 'sh2eb-linux-muslfdpic-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'sh2eb-linux-muslfdpic-gcc-ranlib' 14 | readelf = 'sh2eb-linux-muslfdpic-readelf' 15 | size = 'sh2eb-linux-muslfdpic-size' 16 | strings = 'sh2eb-linux-muslfdpic-strings' 17 | strip = 'sh2eb-linux-muslfdpic-strip' 18 | 19 | [host_machine] 20 | cpu = 'sh2eb' 21 | cpu_family = 'sh' 22 | endian = 'big' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.sh4: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'sh4-linux-musl-gcc-ar' 3 | as = 'sh4-linux-musl-as' 4 | c = 'sh4-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'sh4-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'sh4-linux-musl-ld.bfd' 9 | nm = 'sh4-linux-musl-gcc-nm' 10 | objcopy = 'sh4-linux-musl-objcopy' 11 | objdump = 'sh4-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'sh4-linux-musl-gcc-ranlib' 14 | readelf = 'sh4-linux-musl-readelf' 15 | size = 'sh4-linux-musl-size' 16 | strings = 'sh4-linux-musl-strings' 17 | strip = 'sh4-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'sh4' 21 | cpu_family = 'sh' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.sh4eb: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'sh4eb-linux-musl-gcc-ar' 3 | as = 'sh4eb-linux-musl-as' 4 | c = 'sh4eb-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'sh4eb-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'sh4eb-linux-musl-ld.bfd' 9 | nm = 'sh4eb-linux-musl-gcc-nm' 10 | objcopy = 'sh4eb-linux-musl-objcopy' 11 | objdump = 'sh4eb-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'sh4eb-linux-musl-gcc-ranlib' 14 | readelf = 'sh4eb-linux-musl-readelf' 15 | size = 'sh4eb-linux-musl-size' 16 | strings = 'sh4eb-linux-musl-strings' 17 | strip = 'sh4eb-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'sh4eb' 21 | cpu_family = 'sh' 22 | endian = 'big' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/meson.cross.x86-64: -------------------------------------------------------------------------------- 1 | [binaries] 2 | ar = 'x86_64-linux-musl-gcc-ar' 3 | as = 'x86_64-linux-musl-as' 4 | c = 'x86_64-linux-musl-gcc' 5 | c_ld = 'bfd' 6 | cpp = 'x86_64-linux-musl-g++' 7 | cpp_ld = 'bfd' 8 | ld = 'x86_64-linux-musl-ld.bfd' 9 | nm = 'x86_64-linux-musl-gcc-nm' 10 | objcopy = 'x86_64-linux-musl-objcopy' 11 | objdump = 'x86_64-linux-musl-objdump' 12 | pkg-config = 'pkgconf' 13 | ranlib = 'x86_64-linux-musl-gcc-ranlib' 14 | readelf = 'x86_64-linux-musl-readelf' 15 | size = 'x86_64-linux-musl-size' 16 | strings = 'x86_64-linux-musl-strings' 17 | strip = 'x86_64-linux-musl-strip' 18 | 19 | [host_machine] 20 | cpu = 'x86_64' 21 | cpu_family = 'x86_64' 22 | endian = 'little' 23 | system = 'linux' 24 | -------------------------------------------------------------------------------- /meson/mussel-meson: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright © 2018-2025 Firas Khana 4 | # Distributed under the terms of the ISC License 5 | 6 | exec meson setup \ 7 | -Dprefix=/usr \ 8 | -Dlibexecdir=lib \ 9 | -Dsbindir=bin \ 10 | -Dbuildtype=release \ 11 | -Ddefault_library=shared \ 12 | -Dstdsplit=true \ 13 | -Dstrip=true \ 14 | -Dwrap_mode=nodownload \ 15 | -Db_lto=true \ 16 | -Db_lto_mode=thin \ 17 | -Db_pie=true \ 18 | --cross-file meson.cross.$XARCH \ 19 | "$@" 20 | -------------------------------------------------------------------------------- /mussel: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright © 2020-2025 Firas Khana 4 | # Distributed under the terms of the ISC License 5 | 6 | # Contributors: 7 | # * Alexander Barris (AwlsomeAlex) 8 | # * Andrew Blue 9 | # * ayb 10 | # * Luiz Antônio Rangel at Pindorama (takusuman) 11 | 12 | set -e 13 | # trap at line 658 14 | umask 022 15 | 16 | alias printf="printf --" 17 | 18 | #---------------------------------------# 19 | # ------------- Variables ------------- # 20 | #---------------------------------------# 21 | 22 | progname=$0 23 | 24 | # ----- Optional ----- # 25 | ISL_SUPPORT=yes 26 | CXX_SUPPORT=yes 27 | FORTRAN_SUPPORT=no 28 | LINUX_HEADERS_SUPPORT=no 29 | OPENMP_SUPPORT=no 30 | PARALLEL_SUPPORT=no 31 | PKG_CONFIG_SUPPORT=no 32 | QUADMATH_SUPPORT=no 33 | CUSTOM_VENDOR='(none)' 34 | 35 | # ----- Colors ----- # 36 | REDC='\033[1;31m' 37 | GREENC='\033[1;32m' 38 | YELLOWC='\033[1;33m' 39 | BLUEC='\033[1;34m' 40 | NORMALC='\033[0m' 41 | 42 | # ----- Package Versions ----- # 43 | binutils_ver=2.44 44 | gcc_ver=14.2.0 45 | gmp_ver=6.3.0 46 | isl_ver=0.27 47 | linux_ver=6.13.7 48 | mpc_ver=1.3.1 49 | mpfr_ver=4.2.2 50 | musl_ver=1.2.5 51 | pkgconf_ver=2.4.3 52 | 53 | # ----- Package URLs ----- # 54 | binutils_url=https://ftpmirror.gnu.org/binutils/binutils-$binutils_ver.tar.xz 55 | gcc_url=https://ftpmirror.gnu.org/gcc/gcc-$gcc_ver/gcc-$gcc_ver.tar.xz 56 | gmp_url=https://ftpmirror.gnu.org/gmp/gmp-$gmp_ver.tar.xz 57 | isl_url=https://libisl.sourceforge.io/isl-$isl_ver.tar.xz 58 | linux_url=https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-$linux_ver.tar.xz 59 | mpc_url=https://ftpmirror.gnu.org/mpc/mpc-$mpc_ver.tar.gz 60 | mpfr_url=https://ftpmirror.gnu.org/mpfr/mpfr-$mpfr_ver.tar.xz 61 | musl_url=https://musl.libc.org/releases/musl-$musl_ver.tar.gz 62 | pkgconf_url=https://distfiles.ariadne.space/pkgconf/pkgconf-$pkgconf_ver.tar.xz 63 | 64 | # Generic function to decide a command to be used. 65 | decide_cmd() { 66 | for ccmd; do 67 | if (command -v $ccmd 1>&2 2>/dev/null); then 68 | # Return the decided command. 69 | printf '%s' "$ccmd" 70 | break 71 | else 72 | continue 73 | fi 74 | done 75 | return 0 76 | } 77 | 78 | # Decide which checksum command to use. 79 | if [ -z "$checksum_command" ]; then 80 | checksum_command="$(decide_cmd b3sum openssl sha256sum)" 81 | fi 82 | 83 | # checksums 84 | if [ "$checksum_command" = "b3sum" ]; then 85 | # ----- Package Checksums (b3sum) ----- # 86 | binutils_sum=85610ffef19cc45319ad23df13b1d8aaea394c42d9870aeb6b4dddcc4526be32 87 | gcc_sum=ffee29313fd417420454d985b6740be3755e6465e14173c420c02e3719a51539 88 | gmp_sum=fffe4996713928ae19331c8ef39129e46d3bf5b7182820656fd4639435cd83a4 89 | isl_sum=a419cf24561a34f81ec46d251b25d5aaccedbbf87ed2b96f3f0fb17a79a8c913 90 | linux_sum=9dda6ad3b457821eaafb890a1f9bbd179b9be33cadff7a6fd62befac7f794d2f 91 | mpc_sum=86d083c43c08e98d4470c006a01e0df727c8ff56ddd2956b170566ba8c9a46de 92 | mpfr_sum=11d59d061ef8db588650bc7dc5172594a6e5aad013994801c6f63011a62b191d 93 | musl_sum=63f96e526d3a73fddff8fcb9ee5c1dcbfdac8405db7d7537c3d1c8fffd5e6947 94 | pkgconf_sum=88a2b13f76c636d2d836eef7db1a9e4b40773f7f5f836e1bce46fceabca09aab 95 | elif [ "$checksum_command" = "sha256sum" ] || [ "$checksum_command" = "openssl" ]; then 96 | # ----- Package Checksums (sha256sum) ----- # 97 | binutils_sum=ce2017e059d63e67ddb9240e9d4ec49c2893605035cd60e92ad53177f4377237 98 | gcc_sum=a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9 99 | gmp_sum=a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898 100 | isl_sum=6d8babb59e7b672e8cb7870e874f3f7b813b6e00e6af3f8b04f7579965643d5c 101 | linux_sum=3a39b62038b7ac2f43d26a1f84b4283e197804e1e817ad637e9a3d874c47801d 102 | mpc_sum=ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8 103 | mpfr_sum=b67ba0383ef7e8a8563734e2e889ef5ec3c3b898a01d00fa0a6869ad81c6ce01 104 | musl_sum=a9a118bbe84d8764da0ea0d28b3ab3fae8477fc7e4085d90102b8596fc7c75e4 105 | pkgconf_sum=51203d99ed573fa7344bf07ca626f10c7cc094e0846ac4aa0023bd0c83c25a41 106 | fi 107 | 108 | # ----- Check sha256 hash using openssl ----- # 109 | # For a simple formality, I must say this code comes from Copacabana's 110 | # build-system cmd/sha256sum.ksh implementation, but was heavly modified 111 | # for POSIX shell compliance and for fitting this script. 112 | osslchecksum() { 113 | err=0 114 | # If it's not passed via $1, read it from standard input using cat(1). 115 | hash_line="${1:-$(cat)}" 116 | # Split the line in two using the good ol' POSIX "regex", then use the 117 | # file name for recreating the hash using OpenSSL's shell/command line 118 | # API and treating its output with [n]awk(1). 119 | _file_to_check="${hash_line#* }" 120 | # And that's some POSIX "macumba" for getting around leading spaces 121 | # before the file name. Anyway. 122 | file_to_check="${_file_to_check#${_file_to_check%%[![:space:]]*}}" 123 | alleged_hash="${hash_line%% *}" 124 | actual_hash_line="$(openssl dgst -sha256 "$file_to_check" | 125 | awk '{ split($0, digest, "= "); 126 | sub(/.*[(]/, "", digest[1]); 127 | sub(/[)].*/, "", digest[1]); 128 | printf("%s %s\n", digest[2], digest[1]); }')" 129 | actual_fname="${actual_hash_line#* }" 130 | actual_hash="${actual_hash_line%% *}" 131 | if [ "x$alleged_hash" != "x$actual_hash" ]; then 132 | # "They said I came back Google Go-nized..." 133 | err=1 134 | fi 135 | unset hash_line _file_to_check file_to_check alleged_hash \ 136 | actual_hash_line actual_fname actual_hash 137 | return $err 138 | } 139 | 140 | # ----- Checksum utility alias ----- # 141 | # First of all, alias the command to be used with a generic 142 | # boilerplate function. 143 | # Since the shell, in any POSIX-compliant implementation, maintains 144 | # function declarations in a stack different from variables, we can 145 | # use 'checksum_command' as the identifier for both the variable 146 | # that contains the type of hash check mechanism and the boilerplate 147 | # function. 148 | case "$checksum_command" in 149 | # check the hash with b3sum 150 | 'b3sum') checksum_command() { b3sum -c; } ;; 151 | # check the hash with sha256sum 152 | 'sha256sum') checksum_command() { sha256sum -c; } ;; 153 | # check the hash with openssl 154 | 'openssl') checksum_command() { osslchecksum; } ;; 155 | esac 156 | checksum() { 157 | unset chksumna 158 | if [ -z "$1" ]; then 159 | # Is it true because we're not sure? 160 | export chksumna=true 161 | return 0 162 | fi 163 | printf '%s %s' $1 "$2" | checksum_command 164 | return $? 165 | } 166 | 167 | # Stone-portable way to get the processor number of cores on 168 | # UNIX-compatible systems, although we may only be using this on Linux. 169 | getnproc() { 170 | ( 171 | getconf _NPROCESSORS_ONLN || 172 | ([ "$(uname -s)" = 'Linux' ] && printf '%d' $(grep -c 'processor' /proc/cpuinfo)) || 173 | nproc || 174 | printf '%d' 1 175 | ) 2>/dev/null 176 | } 177 | 178 | # Decide which download command to use. 179 | if [ -z "$download_command" ]; then 180 | download_command="$(decide_cmd aria2c curl lynx w3m wget)" 181 | fi 182 | 183 | # If $download_command is still unset, we can't continue. 184 | if [ -z "$download_command" ]; then 185 | printf '%b!!%b There'\''s no URL transfer utility installed at this system (searched at %s).\n' \ 186 | "$REDC" "$NORMALC" "$PATH" 187 | printf '%b!.%b Go and get one of those, it'\''s free, gratis, buckshee:\n%s\n%s\n%s\n%s\n%s\n' \ 188 | "$YELLOWC" "$NORMALC" \ 189 | 'https://aria2.github.io' 'https://curl.se' \ 190 | 'https://lynx.invisible-island.net' 'https://w3m.sourceforge.net' \ 191 | 'https://www.gnu.org/software/wget/ (C'\''mon, it'\''s better than nothing)' 192 | exit 1 193 | fi 194 | 195 | # ----- URL transfer utility alias ----- # 196 | nettransfer() { 197 | url="$1" 198 | fname="${url##*/}" 199 | col=28 200 | 201 | # Moved to its own function for redundancy. 202 | nproc="$(getnproc)" 203 | 204 | [ "$download_command" = "aria2c" ] && { 205 | aria2c -o "$fname" -j $nproc -s $nproc --download-result=hide "$url" 206 | } 207 | # cURL, but with a progress bar and the file name. 208 | # Order and progress. 209 | [ "$download_command" = "curl" ] && { 210 | printf ' %-*s%s' $col "" "$fname" 1>&2 211 | COLUMNS=$col curl -o "$fname" -L -# "$url" 212 | } 213 | # A tribute for slackpkg folks 214 | [ "$download_command" = "lynx" ] && { 215 | printf '%b!.%b Using Lynx, there will be no progress bar or any indicator here.\n' "$YELLOWC" "$NORMALC" 216 | (lynx -source "$url") >"$fname" 217 | } 218 | [ "$download_command" = "w3m" ] && { 219 | printf '%b!.%b Using w3m, there will be no progress bar or any indicator here.\n' "$YELLOWC" "$NORMALC" 220 | (w3m -dump_source "$url") >"$fname" 221 | } 222 | [ "$download_command" = "wget" ] && { 223 | wget -q --show-progress "$url" 224 | } 225 | 226 | unset fname nproc url 227 | } 228 | 229 | # ----- Print help for command line arguments ----- # 230 | help() { 231 | printf 'Run '\''%s -h'\'' for help.\n' $progname 232 | exit 1 233 | } 234 | 235 | # ----- Development Directories ----- # 236 | CURDIR="$PWD" 237 | SRCDIR="$CURDIR/sources" 238 | BLDDIR="$CURDIR/builds" 239 | PCHDIR="$CURDIR/patches" 240 | 241 | MPREFIX="$CURDIR/toolchain" 242 | MSYSROOT="$CURDIR/toolchain" 243 | 244 | # ----- mussel Log File ---- # 245 | MLOG="$CURDIR/log.txt" 246 | 247 | # ----- PATH ----- # 248 | PATH=$MPREFIX/bin:/usr/bin:/bin 249 | 250 | # ----- Compiler Flags ----- # 251 | CFLAGS=-O2 252 | CXXFLAGS=-O2 253 | 254 | # ----- mussel Flags ----- # 255 | while [ $# -gt 0 ]; do 256 | case $1 in 257 | aarch64 | arm64 | armv8-a) 258 | XARCH=aarch64 259 | LARCH=arm64 260 | MARCH=$XARCH 261 | XGCCARGS="--with-arch=armv8-a --with-abi=lp64 --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419" 262 | XPURE64=$XARCH 263 | XTARGET=$XARCH-linux-musl 264 | ;; 265 | armv4 | armv4t) 266 | XARCH=armv4t 267 | LARCH=arm 268 | MARCH=$LARCH 269 | XGCCARGS="--with-arch=armv4t --with-float=soft" 270 | XPURE64="" 271 | XTARGET=$XARCH-linux-musleabi 272 | ;; 273 | armv5 | armv5te) 274 | XARCH=armv5te 275 | LARCH=arm 276 | MARCH=$LARCH 277 | XGCCARGS="--with-arch=armv5te --with-float=soft" 278 | XPURE64="" 279 | XTARGET=$XARCH-linux-musleabi 280 | ;; 281 | armv6) 282 | XARCH=armv6 283 | LARCH=arm 284 | MARCH=$LARCH 285 | XGCCARGS="--with-arch=$XARCH --with-fpu=vfp --with-float=hard" 286 | XPURE64="" 287 | XTARGET=$XARCH-linux-musleabihf 288 | ;; 289 | arm | armv6kz | armv6zk | bcm2835) 290 | XARCH=armv6kz 291 | LARCH=arm 292 | MARCH=$LARCH 293 | XGCCARGS="--with-arch=$XARCH --with-tune=arm1176jzf-s --with-abi=aapcs-linux --with-fpu=vfpv2 --with-float=hard" 294 | XPURE64="" 295 | XTARGET=$XARCH-linux-musleabihf 296 | ;; 297 | armv7 | armv7-a) 298 | XARCH=armv7-a 299 | LARCH=arm 300 | MARCH=$LARCH 301 | XGCCARGS="--with-arch=$XARCH --with-fpu=vfpv3 --with-float=hard" 302 | XPURE64="" 303 | XTARGET=$LARCH-linux-musleabihf 304 | ;; 305 | i486) 306 | XARCH=$1 307 | LARCH=i386 308 | MARCH=$LARCH 309 | XGCCARGS="--with-arch=$1 --with-tune=generic" 310 | XPURE64="" 311 | XTARGET=$1-linux-musl 312 | ;; 313 | i586) 314 | XARCH=$1 315 | LARCH=i386 316 | MARCH=$LARCH 317 | XGCCARGS="--with-arch=$1 --with-tune=generic" 318 | XPURE64="" 319 | XTARGET=$1-linux-musl 320 | ;; 321 | i386 | i686 | x86) 322 | XARCH=i686 323 | LARCH=i386 324 | MARCH=$LARCH 325 | XGCCARGS="--with-arch=$XARCH --with-tune=generic" 326 | XPURE64="" 327 | XTARGET=$XARCH-linux-musl 328 | ;; 329 | m68k | 68000 | motorola) 330 | XARCH=m68k 331 | LARCH=$XARCH 332 | MARCH=$XARCH 333 | XGCCARGS="" 334 | XPURE64="" 335 | XTARGET=$XARCH-linux-musl 336 | ;; 337 | mblaze | microblaze | microblazebe | microblazeeb) 338 | XARCH=microblaze 339 | LARCH=$XARCH 340 | MARCH=$XARCH 341 | XGCCARGS="--with-endian=big" 342 | XPURE64="" 343 | XTARGET=$XARCH-linux-musl 344 | ;; 345 | microblazeel | microblazele) 346 | XARCH=microblazeel 347 | LARCH=microblaze 348 | MARCH=$LARCH 349 | XGCCARGS="--with-endian=little" 350 | XPURE64="" 351 | XTARGET=$XARCH-linux-musl 352 | ;; 353 | mips | mips32 | mips32r2) 354 | XARCH=$1 355 | LARCH=mips 356 | MARCH=${LARCH} 357 | XGCCARGS="--with-endian=big --with-arch=mips32r2 --with-abi=32 --with-float=soft" 358 | XPURE64="" 359 | XTARGET=$1-linux-musl 360 | ;; 361 | mipsel | mips32el | mips32r2el) 362 | XARCH=$1 363 | LARCH=mips 364 | MARCH=${LARCH} 365 | XGCCARGS="--with-endian=little --with-arch=mips32r2 --with-abi=32 --with-float=soft" 366 | XPURE64="" 367 | XTARGET=$1-linux-musl 368 | ;; 369 | mips64 | mips64be | mips64eb | mips64r2) 370 | XARCH=mips64 371 | LARCH=mips 372 | MARCH=$XARCH 373 | XGCCARGS="--with-endian=big --with-arch=${XARCH}r2 --with-abi=64 --with-float=hard" 374 | XPURE64=$XARCH 375 | XTARGET=$XARCH-linux-musl 376 | ;; 377 | loongson | loongson3 | mips64el | mips64le | mips64elr2 | mips64r2el) 378 | XARCH=mips64el 379 | LARCH=mips 380 | MARCH=${LARCH}64 381 | XGCCARGS="--with-endian=little --with-arch=${MARCH}r2 --with-abi=64 --with-float=hard" 382 | XPURE64=$MARCH 383 | XTARGET=$XARCH-linux-musl 384 | ;; 385 | mips64r6 | mipsisa64r6) 386 | XARCH=mipsisa64r6 387 | LARCH=mips 388 | MARCH=${LARCH}64 389 | XGCCARGS="--with-endian=big --with-arch=${MARCH}r6 --with-abi=64 --with-float=hard --with-nan=2008" 390 | XPURE64=$MARCH 391 | XTARGET=$XARCH-linux-musl 392 | ;; 393 | mips64r6el | mips64r6le | mipsisa64r6el) 394 | XARCH=mipsisa64r6el 395 | LARCH=mips 396 | MARCH=${LARCH}64 397 | XGCCARGS="--with-endian=little --with-arch=${MARCH}r6 --with-abi=64 --with-float=hard --with-nan=2008" 398 | XPURE64=$MARCH 399 | XTARGET=$XARCH-linux-musl 400 | ;; 401 | openrisc | or1k | or1ksim) 402 | XARCH=or1k 403 | LARCH=openrisc 404 | MARCH=$XARCH 405 | XGCCARGS="" 406 | XPURE64="" 407 | XTARGET=$XARCH-linux-musl 408 | ;; 409 | pmac32 | powerpc | ppc) 410 | XARCH=powerpc 411 | LARCH=$XARCH 412 | MARCH=$XARCH 413 | XGCCARGS="--with-cpu=$XARCH --enable-secureplt --without-long-double-128" 414 | XPURE64="" 415 | XTARGET=$XARCH-linux-musl 416 | ;; 417 | powerpcle | powerpcel | ppcle | ppcel) 418 | XARCH=powerpcle 419 | LARCH=poweroc 420 | MARCH=powerpc 421 | XGCCARGS="--with-cpu=$LARCH --enable-secureplt --without-long-double-128 --with-endian=little" 422 | XPURE64="" 423 | XTARGET=$XARCH-linux-musl 424 | ;; 425 | g5 | powerpc64 | powerpc64be | powerpc64eb | ppc64 | ppc64be | ppc64eb) 426 | XARCH=powerpc64 427 | LARCH=powerpc 428 | MARCH=$XARCH 429 | XGCCARGS="--with-cpu=$XARCH --with-abi=elfv2" 430 | XPURE64=$XARCH 431 | XTARGET=$XARCH-linux-musl 432 | ;; 433 | powernv | powerpc64le | ppc64le) 434 | XARCH=powerpc64le 435 | LARCH=powerpc 436 | MARCH=${LARCH}64 437 | XGCCARGS="--with-cpu=$XARCH --enable-secureplt --without-long-double-128 --with-abi=elfv2" 438 | XPURE64=$MARCH 439 | XTARGET=$XARCH-linux-musl 440 | ;; 441 | riscv | riscv64 | rv64gc | sifive) 442 | XARCH=riscv64 443 | LARCH=riscv 444 | MARCH=$XARCH 445 | XGCCARGS="--with-cpu=sifive-u74 --with-arch=rv64gc --with-tune=sifive-7-series --with-abi=lp64d" 446 | XPURE64=$XARCH 447 | XTARGET=$XARCH-linux-musl 448 | ;; 449 | s390 | s390x | z15 | z196) 450 | XARCH=s390x 451 | LARCH=s390 452 | MARCH=$XARCH 453 | XGCCARGS="--with-arch=z196 --with-tune=z15 --with-long-double-128" 454 | XPURE64=$XARCH 455 | XTARGET=$XARCH-linux-musl 456 | ;; 457 | sh2 | superh | sh2le | sh2el) 458 | XARCH=sh2 459 | LARCH=sh 460 | MARCH=$LARCH 461 | XGCCARGS="" 462 | XPURE64="" 463 | XTARGET=$XARCH-linux-musl 464 | ;; 465 | sh2-fdpic | superh-fdpic | sh2le-fdpic | sh2el-fdpic) 466 | XARCH=sh2-fdpic 467 | LARCH=sh 468 | MARCH=$LARCH 469 | XGCCARGS="" 470 | XPURE64="--enable-fdpic" 471 | XTARGET=sh2-linux-muslfdpic 472 | ;; 473 | sh2be | sh2eb) 474 | XARCH=sh2eb 475 | LARCH=sh 476 | MARCH=$LARCH 477 | XGCCARGS="--with-endian=big" 478 | XPURE64="" 479 | XTARGET=$XARCH-linux-musl 480 | ;; 481 | sh2be-fdpic | sh2eb-fdpic) 482 | XARCH=sh2eb-fdpic 483 | LARCH=sh 484 | MARCH=$LARCH 485 | XGCCARGS="--enable-fdpic --with-endian=big" 486 | XPURE64="" 487 | XTARGET=sh2eb-linux-muslfdpic 488 | ;; 489 | sh4 | superh4 | sh4le | sh4el) 490 | XARCH=sh4 491 | LARCH=sh 492 | MARCH=$LARCH 493 | XGCCARGS="" 494 | XPURE64="" 495 | XTARGET=$XARCH-linux-musl 496 | ;; 497 | sh4be-fdpic | sh4eb-fdpic) 498 | XARCH=sh4eb 499 | LARCH=sh 500 | MARCH=$LARCH 501 | XGCCARGS="--with-endian=big" 502 | XPURE64="" 503 | XTARGET=$XARCH-linux-muslfdpic 504 | ;; 505 | amd64 | x86-64 | x86_64) 506 | XARCH=x86-64 507 | LARCH=x86_64 508 | MARCH=$LARCH 509 | XGCCARGS="--with-arch=$XARCH --with-tune=generic" 510 | XPURE64=$XARCH 511 | XTARGET=$LARCH-linux-musl 512 | ;; 513 | c | -c | --clean) 514 | printf "${BLUEC}..${NORMALC} Cleaning mussel...\n" 515 | rm -fr "$BLDDIR" 516 | rm -fr "$MPREFIX" 517 | rm -fr "$MSYSROOT" 518 | rm -f "$MLOG" 519 | printf "${GREENC}=>${NORMALC} mussel cleaned.\n" 520 | exit 521 | ;; 522 | h | -h | --help) 523 | printf 'Copyright © 2020-2025 Firas Khana\n' 524 | printf 'Distributed under the terms of the ISC License\n' 525 | printf '\n' 526 | printf 'mussel - The fastest musl libc cross compiler generator\n' 527 | printf '\n' 528 | printf "Usage: $0: (architecture) (flags)\n" 529 | printf "Usage: $0: (command)\n" 530 | printf '\n' 531 | printf 'Supported Architectures:\n' 532 | printf '\t+ aarch64\n' 533 | printf '\t+ armv4t\n' 534 | printf '\t+ armv5te\n' 535 | printf '\t+ armv6\n' 536 | printf '\t+ armv6kz (Raspberry Pi 1 Models A, B, B+, the Compute Module,' 537 | printf '\n\t and the Raspberry Pi Zero)\n' 538 | printf '\t+ armv7\n' 539 | printf '\t+ i486\n' 540 | printf '\t+ i586\n' 541 | printf '\t+ i686\n' 542 | printf '\t+ m68k\n' 543 | printf '\t+ microblaze\n' 544 | printf '\t+ microblazeel\n' 545 | printf '\t+ mips\n' 546 | printf '\t+ mipsel\n' 547 | printf '\t+ mips64\n' 548 | printf '\t+ mips64el\n' 549 | printf '\t+ mipsisa64r6\n' 550 | printf '\t+ mipsisa64r6el\n' 551 | printf '\t+ or1k\n' 552 | printf '\t+ powerpc\n' 553 | printf '\t+ powerpcle\n' 554 | printf '\t+ powerpc64\n' 555 | printf '\t+ powerpc64le\n' 556 | printf '\t+ riscv64\n' 557 | printf '\t+ s390x\n' 558 | printf '\t+ sh2\n' 559 | printf '\t+ sh2be\n' 560 | printf '\t+ sh2-fdpic\n' 561 | printf '\t+ sh2be-fdpic\n' 562 | printf '\t+ sh4\n' 563 | printf '\t+ sh4be\n' 564 | printf '\t+ x86-64\n' 565 | printf '\n' 566 | printf 'Flags:\n' 567 | printf '\tf | -f | --enable-fortran \tEnable optional Fortran support\n' 568 | printf '\tk | -k | --enable-pkg-config \tEnable optional pkg-config support\n' 569 | printf '\tl | -l | --enable-linux-headers\tEnable optional Linux Headers support\n' 570 | printf '\to | -o | --enable-openmp \tEnable optional OpenMP support\n' 571 | printf '\tp | -p | --parallel \tUse all available cores on the host system\n' 572 | printf '\tq | -q | --enable-quadmath \tEnable optional Quadruple-precision support\n' 573 | printf '\ts | -s | --min-size \tOptimize for minimum size.\n' 574 | printf '\tx | -x | --disable-cxx \tDisable optional C++ support\n' 575 | printf '\tg | -g | --disable-isl \tDisable isl Library support (Graphite loop optimisations)\n' 576 | printf '\tT | -T | --custom-vendor \tSets a custom vendor for tuple, requires architecture to be set before\n' 577 | printf '\n' 578 | printf 'Commands:\n' 579 | printf "\tc | -c | --clean \tClean mussel's build environment\n" 580 | printf '\th | -h | --help \tDisplay this help message\n' 581 | printf '\n' 582 | printf 'No penguins were harmed in the making of this script!\n' 583 | exit 584 | ;; 585 | f | -f | --enable-fortran) 586 | QUADMATH_SUPPORT=yes 587 | FORTRAN_SUPPORT=yes 588 | ;; 589 | k | -k | --enable-pkg-config) 590 | PKG_CONFIG_SUPPORT=yes 591 | ;; 592 | l | -l | --enable-linux-headers) 593 | LINUX_HEADERS_SUPPORT=yes 594 | ;; 595 | o | -o | --enable-openmp) 596 | OPENMP_SUPPORT=yes 597 | ;; 598 | p | -p | --parallel) 599 | PARALLEL_SUPPORT=yes 600 | ;; 601 | q | -q | --enable-quadmath) 602 | QUADMATH_SUPPORT=yes 603 | ;; 604 | s | -s | --min-size) 605 | CFLAGS=-Os 606 | CXXFLAGS=-Os 607 | ;; 608 | x | -x | --disable-cxx) 609 | CXX_SUPPORT=no 610 | ;; 611 | g | -g | --disable-isl) 612 | ISL_SUPPORT=no 613 | ;; 614 | T | -T | --custom-vendor) 615 | # Have the user defined the default tuple first? 616 | if [ -z $XTARGET ]; then 617 | printf '%b!!%b '\''%s'\'' requires that the target architecture is already specified.\n' \ 618 | "$REDC" "$NORMALC" $1 619 | help 620 | fi 621 | # Set the vendor as the next argument to this flag. 622 | shift 623 | CUSTOM_VENDOR="$1" 624 | # This mechanism basically cuts the string whenever there is a space. 625 | # If it still equals the original, then it hasn't any spaces. 626 | # The same happens for the '-' character. 627 | if [ "x$CUSTOM_VENDOR" != "x${CUSTOM_VENDOR% *}" ] || 628 | ([ "x$CUSTOM_VENDOR" != "x${CUSTOM_VENDOR#-}" ] || 629 | [ "x$CUSTOM_VENDOR" != "x${CUSTOM_VENDOR%-}" ]); then 630 | printf '%b!!%b Illegal vendor '\''%s'\'': %s.\n' \ 631 | "$REDC" "$NORMALC" "$CUSTOM_VENDOR" \ 632 | 'no spaces nor strings starting and/or terminated with '\''-'\'' are permitted' 633 | help 634 | fi 635 | OLD_XTARGET=$XTARGET 636 | # Cut the architecture out. 637 | _XARCH=${OLD_XTARGET%%-*} 638 | # And then the remainder whose name I don't know to specify. 639 | _XTARGET_REMAINDER=${OLD_XTARGET#*-} 640 | # So we can now build the new XTARGET. 641 | XTARGET="${_XARCH}-$CUSTOM_VENDOR-$_XTARGET_REMAINDER" 642 | unset OLD_XTARGET _XARCH _XTARGET_REMAINDER 643 | ;; 644 | *) 645 | printf "${REDC}!!${NORMALC} Unknown architecture or flag: $1\n" 646 | help 647 | ;; 648 | esac 649 | 650 | shift 651 | done 652 | 653 | if [ -z $XARCH ]; then 654 | printf "${REDC}!!${NORMALC} No Architecture Specified!\n" 655 | help 656 | fi 657 | 658 | # ----- Make Flags ----- # 659 | MAKE_CMD="make INFO_DEPS= infodir= ac_cv_prog_lex_root=lex.yy MAKEINFO=true" 660 | if [ $PARALLEL_SUPPORT = yes ]; then 661 | JOBS=$(getnproc) 662 | MAKE="$MAKE_CMD -j$JOBS" 663 | else 664 | MAKE="$MAKE_CMD" 665 | fi 666 | 667 | ################################################ 668 | # !!!!! DON'T CHANGE ANYTHING UNDER HERE !!!!! # 669 | # !!!!! UNLESS YOU KNOW WHAT YOURE DOING !!!!! # 670 | ################################################ 671 | 672 | #---------------------------------# 673 | # ---------- Functions ---------- # 674 | #---------------------------------# 675 | 676 | # ----- mpackage(): Preparation Function ----- # 677 | mpackage() { 678 | cd "$SRCDIR" 679 | 680 | if [ ! -d "$1" ]; then 681 | mkdir "$1" 682 | else 683 | printf "${YELLOWC}!.${NORMALC} $1 source directory already exists, skipping...\n" 684 | fi 685 | 686 | cd "$1" 687 | 688 | HOLDER="${2##*/}" 689 | 690 | if [ ! -f "$HOLDER" ]; then 691 | printf "${BLUEC}..${NORMALC} Fetching ""$HOLDER""...\n" 692 | nettransfer "$2" 693 | else 694 | printf "${YELLOWC}!.${NORMALC} ""$HOLDER"" already exists, skipping...\n" 695 | fi 696 | 697 | printf "${BLUEC}..${NORMALC} Verifying ""$HOLDER""...\n" 698 | checksum "$3" "$HOLDER" 699 | if [ $? != 0 ]; then 700 | printf "${YELLOWC}!.${NORMALC} ""$HOLDER"" is corrupted, redownloading...\n" && 701 | rm "$HOLDER" && 702 | nettransfer "$2" 703 | else 704 | [ "x$chksumna" = 'xtrue' ] && 705 | printf 'mpackage: Not verifying '\''%s'\'': checksum hash not available.\n' \ 706 | "$HOLDER" >>"$MLOG" 707 | fi 708 | 709 | rm -fr "$1-$4" 710 | printf "${BLUEC}..${NORMALC} Unpacking $HOLDER...\n" 711 | tar xf "$HOLDER" -C . 712 | 713 | printf "${GREENC}=>${NORMALC} $HOLDER prepared.\n\n" 714 | printf "${HOLDER}: Ok\n" >>"$MLOG" 715 | } 716 | 717 | # ----- mpatch(): Patching ----- # 718 | mpatch() { 719 | printf "${BLUEC}..${NORMALC} Applying ${4}.patch from $5 for ${2}...\n" 720 | 721 | cd "$SRCDIR/$2/$2-$3" 722 | patch -p"$1" -i "$PCHDIR/$2/$5/${4}.patch" >>"$MLOG" 2>&1 723 | printf "${GREENC}=>${NORMALC} $2 patched with ${4}!\n" 724 | } 725 | 726 | # ----- mclean(): Clean Directory ----- # 727 | mclean() { 728 | if [ -d "$CURDIR/$1" ]; then 729 | printf "${BLUEC}..${NORMALC} Cleaning $1 directory...\n" 730 | rm -fr "$CURDIR/$1" 731 | mkdir "$CURDIR/$1" 732 | printf "${GREENC}=>${NORMALC} $1 cleaned.\n" 733 | printf "Cleaned $1.\n" >>"$MLOG" 734 | fi 735 | } 736 | 737 | # ----- fail(): To be called by trap ----- # 738 | fail() { 739 | logfile="$1" 740 | # Check if it's properly done and if isn't a vulgar 741 | # error such as an flag erroneusly informed. 742 | if ! (grep '^End Time: .*$' "$logfile") && 743 | [ -n "$XARCH" ]; then 744 | printf '%b!!%b Build failed!\n%b!.%b Last lines of the log file (%s):\n' \ 745 | "$REDC" "$NORMALC" "$YELLOWC" "$NORMALC" "$logfile" 746 | tail "$logfile" 747 | fi 748 | } 749 | trap 'fail "$MLOG"' EXIT 750 | 751 | #--------------------------------------# 752 | # ---------- Execution Area ---------- # 753 | #--------------------------------------# 754 | 755 | printf '\n' 756 | printf '+======================================================+\n' 757 | printf '| mussel - The fastest musl libc Toolchain Generator |\n' 758 | printf '+------------------------------------------------------+\n' 759 | printf '| Copyright © 2018-2025 Firas Khana |\n' 760 | printf '| Distributed under the terms of the ISC License |\n' 761 | printf '+======================================================+\n' 762 | printf '\n' 763 | printf "Target Architecture: $XARCH\n\n" 764 | printf "Optional isl Library Support: $ISL_SUPPORT\n" 765 | printf "Optional C++ Support: $CXX_SUPPORT\n" 766 | printf "Optional Fortran Support: $FORTRAN_SUPPORT\n" 767 | printf "Optional Linux Headers Support: $LINUX_HEADERS_SUPPORT\n" 768 | printf "Optional OpenMP Support: $OPENMP_SUPPORT\n" 769 | printf "Optional Parallel Support: $PARALLEL_SUPPORT\n" 770 | printf "Optional pkg-config Support: $PKG_CONFIG_SUPPORT\n" 771 | printf "Optional Quadmath Support: $QUADMATH_SUPPORT\n" 772 | printf "Optional custom vendor: '$CUSTOM_VENDOR'\n\n" 773 | 774 | [ ! -d "$SRCDIR" ] && printf "${BLUEC}..${NORMALC} Creating the sources directory...\n" && mkdir "$SRCDIR" 775 | [ ! -d "$BLDDIR" ] && printf "${BLUEC}..${NORMALC} Creating the builds directory...\n" && mkdir "$BLDDIR" 776 | [ ! -d "$PCHDIR" ] && printf "${BLUEC}..${NORMALC} Creating the patches directory...\n" && mkdir "$PCHDIR" 777 | printf '\n' 778 | rm -f "$MLOG" 779 | 780 | # ----- Print Variables to mussel Log File ----- # 781 | printf 'mussel Log File\n\n' >>"$MLOG" 782 | printf "ISL_SUPPORT: $ISL_SUPPORT\nCXX_SUPPORT: $CXX_SUPPORT\nFORTRAN_SUPPORT: $FORTRAN_SUPPORT\nLINUX_HEADERS_SUPPORT: $LINUX_HEADERS_SUPPORT\nOPENMP_SUPPORT: $OPENMP_SUPPORT\nPARALLEL_SUPPORT: $PARALLEL_SUPPORT\nPKG_CONFIG_SUPPORT: $PKG_CONFIG_SUPPORT\nQUADMATH_SUPPORT: $QUADMATH_SUPPORT\n\n" >>"$MLOG" 783 | printf "XARCH: $XARCH\nLARCH: $LARCH\nMARCH: $MARCH\nXTARGET: $XTARGET\nCUSTOM_VENDOR: $CUSTOM_VENDOR\n" >>"$MLOG" 784 | printf "XGCCARGS: \"$XGCCARGS\"\n\n" >>"$MLOG" 785 | printf "CFLAGS: \"$CFLAGS\"\nCXXFLAGS: \"$CXXFLAGS\"\n\n" >>"$MLOG" 786 | printf "PATH: \"$PATH\"\nMAKE: \"$MAKE\"\n\n" >>"$MLOG" 787 | printf "Host Kernel: \"$(uname -a)\"\nHost Info:\n$(cat /etc/*release)\n" >>"$MLOG" 788 | printf "\nStart Time: $(date)\n\n" >>"$MLOG" 789 | 790 | # if defined, c++ lang support is built in gcc 791 | [ $CXX_SUPPORT = "yes" ] && ENABLE_CXX_YES="abcd" 792 | 793 | # if defined, fortran lang support is built in gcc 794 | [ $FORTRAN_SUPPORT = "yes" ] && ENABLE_FORTRAN_YES="abcd" 795 | 796 | # ----- Prepare Packages ----- # 797 | printf "-----\nprepare\n-----\n\n" >>"$MLOG" 798 | mpackage binutils "$binutils_url" "$binutils_sum" $binutils_ver 799 | mpackage gcc "$gcc_url" "$gcc_sum" $gcc_ver 800 | mpackage gmp "$gmp_url" "$gmp_sum" $gmp_ver 801 | [ $ISL_SUPPORT = "yes" ] && mpackage isl "$isl_url" "$isl_sum" $isl_ver 802 | 803 | [ $LINUX_HEADERS_SUPPORT = yes ] && mpackage linux "$linux_url" "$linux_sum" $linux_ver 804 | 805 | mpackage mpc "$mpc_url" "$mpc_sum" $mpc_ver 806 | mpackage mpfr "$mpfr_url" "$mpfr_sum" $mpfr_ver 807 | mpackage musl "$musl_url" "$musl_sum" $musl_ver 808 | 809 | [ $PKG_CONFIG_SUPPORT = yes ] && mpackage pkgconf "$pkgconf_url" "$pkgconf_sum" $pkgconf_ver 810 | 811 | # ----- Patch Packages ----- # 812 | if [ ! -z $XPURE64 ]; then 813 | printf "\n-----\npatch\n-----\n\n" >>"$MLOG" 814 | mpatch 0 gcc $gcc_ver "0001-pure64-for-$XPURE64" glaucus 815 | mpatch 1 musl $musl_ver "CVE-2025-26519" upstream 816 | fi 817 | 818 | printf '\n' 819 | 820 | # ----- Clean Directories ----- # 821 | printf "\n-----\nclean\n-----\n\n" >>"$MLOG" 822 | mclean builds 823 | mclean toolchain 824 | mclean sysroot 825 | 826 | # set up dir structure 827 | printf "-----\ndir structure\n-----\n\n" >>"$MLOG" 828 | printf "${BLUEC}..${NORMALC} Creating directory structure...\n" 829 | mkdir -pv "$MSYSROOT" >>"$MLOG" 2>&1 830 | cd "$MSYSROOT" 831 | mkdir -pv \ 832 | bin \ 833 | lib \ 834 | include \ 835 | "$XTARGET/bin" >>"$MLOG" 2>&1 836 | ln -sfv . usr >>"$MLOG" 2>&1 837 | cd "$MSYSROOT/$XTARGET" 838 | ln -sfv ../lib lib >>"$MLOG" 2>&1 839 | ln -sfv ../include include >>"$MLOG" 2>&1 840 | 841 | printf '\n' 842 | 843 | # ----- Step 1: musl headers ----- # 844 | printf "\n-----\n*1) musl headers\n-----\n\n" >>"$MLOG" 845 | printf "${BLUEC}..${NORMALC} Preparing musl headers...\n" 846 | cd "$BLDDIR" 847 | cp -ar "$SRCDIR/musl/musl-$musl_ver" musl 848 | cd musl 849 | 850 | printf "${BLUEC}..${NORMALC} Installing musl headers...\n" 851 | $MAKE \ 852 | ARCH="$MARCH" \ 853 | prefix="" \ 854 | DESTDIR="$MSYSROOT" \ 855 | install-headers >>"$MLOG" 2>&1 856 | 857 | printf "${GREENC}=>${NORMALC} musl headers finished.\n\n" 858 | 859 | # ----- Step 2: cross-binutils ----- # 860 | printf "\n-----\n*2) cross-binutils\n-----\n\n" >>"$MLOG" 861 | printf "${BLUEC}..${NORMALC} Preparing cross-binutils...\n" 862 | cd "$BLDDIR" 863 | mkdir cross-binutils 864 | cd cross-binutils 865 | 866 | printf "${BLUEC}..${NORMALC} Configuring cross-binutils...\n" 867 | "$SRCDIR/binutils/binutils-$binutils_ver/configure" \ 868 | --prefix="" \ 869 | --exec-prefix="" \ 870 | --sbindir=/bin \ 871 | --libexecdir=/lib \ 872 | --datarootdir=/_tmp \ 873 | --target=$XTARGET \ 874 | --disable-multilib \ 875 | --enable-install-libiberty \ 876 | --enable-plugins \ 877 | --enable-deterministic-archives \ 878 | --enable-new-dtags \ 879 | --enable-relro \ 880 | --disable-default-execstack \ 881 | --enable-default-hash-style="sysv" \ 882 | --enable-initfini-array \ 883 | --disable-werror \ 884 | --disable-nls \ 885 | --disable-rpath \ 886 | --with-pic \ 887 | --with-mmap \ 888 | --with-sysroot=/ \ 889 | --with-build-sysroot=$MSYSROOT \ 890 | --with-pkgversion="mussel" >>"$MLOG" 2>&1 891 | 892 | printf "${BLUEC}..${NORMALC} Building cross-binutils...\n" 893 | $MAKE \ 894 | all-binutils \ 895 | all-gas \ 896 | all-ld >>"$MLOG" 2>&1 897 | 898 | printf "${BLUEC}..${NORMALC} Installing cross-binutils...\n" 899 | $MAKE \ 900 | DESTDIR="$MSYSROOT" \ 901 | install-strip-binutils \ 902 | install-strip-gas \ 903 | install-strip-ld >>"$MLOG" 2>&1 904 | 905 | printf "${GREENC}=>${NORMALC} cross-binutils finished.\n\n" 906 | 907 | # ----- Step 3: cross-gcc (compiler) ----- # 908 | printf "\n-----\n*3) cross-gcc (compiler)\n-----\n\n" >>"$MLOG" 909 | printf "${BLUEC}..${NORMALC} Preparing cross-gcc (compiler)...\n" 910 | cp -ar "$SRCDIR/gmp/gmp-$gmp_ver" "$SRCDIR/gcc/gcc-$gcc_ver/gmp" 911 | cp -ar "$SRCDIR/mpfr/mpfr-$mpfr_ver" "$SRCDIR/gcc/gcc-$gcc_ver/mpfr" 912 | cp -ar "$SRCDIR/mpc/mpc-$mpc_ver" "$SRCDIR/gcc/gcc-$gcc_ver/mpc" 913 | [ $ISL_SUPPORT = "yes" ] && 914 | cp -ar "$SRCDIR/isl/isl-$isl_ver" "$SRCDIR/gcc/gcc-$gcc_ver/isl" 915 | 916 | cd "$BLDDIR" 917 | mkdir cross-gcc 918 | cd cross-gcc 919 | 920 | printf "${BLUEC}..${NORMALC} Configuring cross-gcc (compiler)...\n" 921 | "$SRCDIR/gcc/gcc-$gcc_ver/configure" \ 922 | --prefix="" \ 923 | --exec-prefix="" \ 924 | --sbindir=/bin \ 925 | --libexecdir=/lib \ 926 | --datarootdir=/_tmp \ 927 | --target=$XTARGET \ 928 | --disable-bootstrap \ 929 | --enable-checking=release \ 930 | --disable-multilib \ 931 | --disable-fixed-point \ 932 | --enable-tls \ 933 | --enable-languages=c${ENABLE_CXX_YES:+,c++}${ENABLE_FORTRAN_YES:+,fortran} \ 934 | --disable-rpath \ 935 | --disable-nls \ 936 | --disable-gnu-indirect-function \ 937 | --enable-initfini-array \ 938 | --disable-gnu-unique-object \ 939 | --disable-linker-build-id \ 940 | --disable-libsanitizer \ 941 | --disable-libssp \ 942 | --enable-default-ssp \ 943 | --enable-link-serialization=1 \ 944 | --enable-host-pie \ 945 | --enable-host-bind-now \ 946 | --enable-default-pie \ 947 | --disable-cet \ 948 | --disable-werror \ 949 | --disable-symvers \ 950 | --disable-libstdcxx-pch \ 951 | --enable-clocale=generic \ 952 | --with-build-sysroot=$MSYSROOT \ 953 | --with-sysroot=/ \ 954 | --with-pkgversion="mussel" \ 955 | --with-pic \ 956 | --with-linker-hash-style="sysv" \ 957 | $XGCCARGS >>"$MLOG" 2>&1 958 | 959 | printf "${BLUEC}..${NORMALC} Building cross-gcc (compiler)...\n" 960 | mkdir -p "$MSYSROOT/usr/include" 961 | $MAKE \ 962 | all-gcc >>"$MLOG" 2>&1 963 | 964 | printf "${BLUEC}..${NORMALC} Building cross-gcc (libgcc-static)...\n" 965 | CFLAGS='-pipe -g0 -O0' \ 966 | CXXFLAGS='-pipe -g0 -O0' \ 967 | LDFLAGS=-Wl,-s \ 968 | $MAKE \ 969 | enable_shared=no \ 970 | all-target-libgcc >>"$MLOG" 2>&1 971 | 972 | printf "${BLUEC}..${NORMALC} Installing cross-gcc (compiler) and (libgcc-static)...\n" 973 | $MAKE \ 974 | DESTDIR="$MSYSROOT" \ 975 | install-strip-gcc \ 976 | install-strip-target-libgcc >>"$MLOG" 2>&1 977 | 978 | printf "${GREENC}=>${NORMALC} cross-gcc (compiler) and (libgcc-static) finished.\n\n" 979 | 980 | # ----- Step 4: musl ----- # 981 | printf "\n-----\n*4) musl\n-----\n\n" >>"$MLOG" 982 | printf "${BLUEC}..${NORMALC} Preparing musl...\n" 983 | cd "$BLDDIR/musl" 984 | 985 | printf "${BLUEC}..${NORMALC} Configuring musl...\n" 986 | ARCH=$MARCH \ 987 | CC=$XTARGET-gcc \ 988 | CROSS_COMPILE=$XTARGET- \ 989 | LIBCC="$MPREFIX/lib/gcc/$XTARGET/$gcc_ver/libgcc.a" \ 990 | ./configure \ 991 | --host=$XTARGET \ 992 | --prefix="" \ 993 | --disable-wrapper >>"$MLOG" 2>&1 994 | 995 | printf "${BLUEC}..${NORMALC} Building musl...\n" 996 | $MAKE \ 997 | AR="$XTARGET-ar" \ 998 | RANLIB="$XTARGET-ranlib" >>"$MLOG" 2>&1 999 | 1000 | printf "${BLUEC}..${NORMALC} Installing musl...\n" 1001 | $MAKE \ 1002 | AR="$XTARGET-ar" \ 1003 | RANLIB="$XTARGET-ranlib" \ 1004 | DESTDIR="$MSYSROOT" \ 1005 | install-libs >>"$MLOG" 2>&1 1006 | 1007 | rm -f "$MSYSROOT/lib/ld-musl-$MARCH.so.1" 1008 | cp -af "$MSYSROOT/usr/lib/libc.so" "$MSYSROOT/lib/ld-musl-$MARCH.so.1" >>"$MLOG" 2>&1 1009 | 1010 | printf "${GREENC}=>${NORMALC} musl finished.\n\n" 1011 | 1012 | # ----- Step 5: cross-gcc (libgcc-shared) ----- # 1013 | printf "\n-----\n*5) cross-gcc (libgcc-shared)\n-----\n\n" >>"$MLOG" 1014 | printf "${BLUEC}..${NORMALC} Preparing cross-gcc (libgcc-shared)...\n" 1015 | cd "$BLDDIR/cross-gcc" 1016 | 1017 | $MAKE \ 1018 | -C "$XTARGET/libgcc" distclean >>"$MLOG" 2>&1 1019 | 1020 | printf "${BLUEC}..${NORMALC} Building cross-gcc (libgcc-shared)...\n" 1021 | $MAKE \ 1022 | enable_shared=yes \ 1023 | all-target-libgcc >>"$MLOG" 2>&1 1024 | 1025 | printf "${BLUEC}..${NORMALC} Installing cross-gcc (libgcc-shared)...\n" 1026 | $MAKE \ 1027 | DESTDIR="$MSYSROOT" \ 1028 | install-strip-target-libgcc >>"$MLOG" 2>&1 1029 | 1030 | printf "${GREENC}=>${NORMALC} cross-gcc (libgcc-shared) finished.\n\n" 1031 | 1032 | # ----- [Optional C++ Support] Step 6: cross-gcc (libstdc++-v3) ----- # 1033 | if [ $CXX_SUPPORT = yes ]; then 1034 | printf "\n-----\n*6) cross-gcc (libstdc++-v3)\n-----\n\n" >>"$MLOG" 1035 | printf "${BLUEC}..${NORMALC} Building cross-gcc (libstdc++-v3)...\n" 1036 | cd "$BLDDIR/cross-gcc" 1037 | $MAKE \ 1038 | all-target-libstdc++-v3 >>"$MLOG" 2>&1 1039 | 1040 | printf "${BLUEC}..${NORMALC} Installing cross-gcc (libstdc++-v3)...\n" 1041 | $MAKE \ 1042 | DESTDIR="$MSYSROOT" \ 1043 | install-strip-target-libstdc++-v3 >>"$MLOG" 2>&1 1044 | 1045 | printf "${GREENC}=>${NORMALC} cross-gcc (libstdc++v3) finished.\n\n" 1046 | fi 1047 | 1048 | # ----- [Optional OpenMP Support] Step 7: cross-gcc (libgomp) ----- # 1049 | if [ $OPENMP_SUPPORT = yes ]; then 1050 | printf "\n-----\n*7) cross-gcc (libgomp)\n-----\n\n" >>"$MLOG" 1051 | printf "${BLUEC}..${NORMALC} Building cross-gcc (libgomp)...\n" 1052 | $MAKE \ 1053 | all-target-libgomp >>"$MLOG" 2>&1 1054 | 1055 | printf "${BLUEC}..${NORMALC} Installing cross-gcc (libgomp)...\n" 1056 | $MAKE \ 1057 | DESTDIR="$MSYSROOT" \ 1058 | install-strip-target-libgomp >>"$MLOG" 2>&1 1059 | 1060 | printf "${GREENC}=>${NORMALC} cross-gcc (libgomp) finished.\n\n" 1061 | fi 1062 | 1063 | # ----- [Optional Quadmath Support] Step 8: cross-gcc (libquadmath) ----- # 1064 | if [ $QUADMATH_SUPPORT = yes ]; then 1065 | printf "\n-----\n*8) cross-gcc (libquadmath)\n-----\n\n" >>"$MLOG" 1066 | printf "${BLUEC}..${NORMALC} Building cross-gcc (libquadmath)...\n" 1067 | cd "$BLDDIR/cross-gcc" 1068 | $MAKE \ 1069 | all-target-libquadmath >>"$MLOG" 2>&1 1070 | 1071 | printf "${BLUEC}..${NORMALC} Installing cross-gcc (libquadmath)...\n" 1072 | $MAKE \ 1073 | DESTDIR="$MSYSROOT" \ 1074 | install-strip-target-libquadmath >>"$MLOG" 2>&1 1075 | 1076 | printf "${GREENC}=>${NORMALC} cross-gcc (libquadmath) finished.\n\n" 1077 | fi 1078 | 1079 | # ----- [Optional Fortran Support] Step 9: cross-gcc (libgfortran) ----- # 1080 | if [ $FORTRAN_SUPPORT = yes ]; then 1081 | printf "\n-----\n*9) cross-gcc (libgfortran)\n-----\n\n" >>"$MLOG" 1082 | printf "${BLUEC}..${NORMALC} Building cross-gcc (libgfortran)...\n" 1083 | cd "$BLDDIR/cross-gcc" 1084 | $MAKE \ 1085 | all-target-libgfortran >>"$MLOG" 2>&1 1086 | 1087 | printf "${BLUEC}..${NORMALC} Installing cross-gcc (libgfortran)...\n" 1088 | $MAKE \ 1089 | DESTDIR="$MSYSROOT" \ 1090 | install-strip-target-libgfortran >>"$MLOG" 2>&1 1091 | 1092 | printf "${GREENC}=>${NORMALC} cross-gcc (libgfortran) finished.\n\n" 1093 | fi 1094 | 1095 | # ----- [Optional Linux Headers Support] Step 10: linux headers ----- # 1096 | if [ $LINUX_HEADERS_SUPPORT = yes ]; then 1097 | printf "\n-----\n*10) linux headers\n-----\n\n" >>"$MLOG" 1098 | printf "${BLUEC}..${NORMALC} Preparing linux headers...\n" 1099 | cd "$BLDDIR" 1100 | mkdir linux 1101 | 1102 | cd "$SRCDIR/linux/linux-$linux_ver" 1103 | 1104 | $MAKE \ 1105 | ARCH="$LARCH" \ 1106 | mrproper >>"$MLOG" 2>&1 1107 | 1108 | $MAKE \ 1109 | O="$BLDDIR/linux" \ 1110 | ARCH=$LARCH \ 1111 | headers >>"$MLOG" 2>&1 1112 | 1113 | printf "${BLUEC}..${NORMALC} Installing linux headers...\n" 1114 | find $BLDDIR/linux/usr/include ! -name '*.h' -type f -delete 1115 | cp -af $BLDDIR/linux/usr/include $MSYSROOT/usr 1116 | 1117 | printf "${GREENC}=>${NORMALC} linux headers finished.\n\n" 1118 | fi 1119 | 1120 | # ----- [Optional pkg-config Support] Step 11: pkgconf ----- # 1121 | if [ $PKG_CONFIG_SUPPORT = yes ]; then 1122 | printf "\n-----\n*11) pkgconf\n-----\n\n" >>"$MLOG" 1123 | printf "${BLUEC}..${NORMALC} Preparing pkgconf...\n" 1124 | cd "$BLDDIR" 1125 | mkdir pkgconf 1126 | cd pkgconf 1127 | 1128 | printf "${BLUEC}..${NORMALC} Configuring pkgconf...\n" 1129 | CFLAGS="$CFLAGS -fcommon" \ 1130 | "$SRCDIR/pkgconf/pkgconf-$pkgconf_ver/configure" \ 1131 | --prefix="$MPREFIX" \ 1132 | --enable-pic \ 1133 | --with-sysroot="$MSYSROOT" \ 1134 | --with-pkg-config-dir="$MSYSROOT/usr/lib/pkgconfig:$MSYSROOT/usr/share/pkgconfig" \ 1135 | --with-system-libdir="$MSYSROOT/usr/lib" \ 1136 | --with-system-includedir="$MSYSROOT/usr/include" >>"$MLOG" 2>&1 1137 | 1138 | printf "${BLUEC}..${NORMALC} Building pkgconf...\n" 1139 | $MAKE >>"$MLOG" 2>&1 1140 | 1141 | printf "${BLUEC}..${NORMALC} Installing pkgconf...\n" 1142 | $MAKE \ 1143 | install-strip >>"$MLOG" 2>&1 1144 | 1145 | ln -sv pkgconf "$MPREFIX/bin/pkg-config" >>"$MLOG" 2>&1 1146 | ln -sv pkgconf "$MPREFIX/bin/$XTARGET-pkgconf" >>"$MLOG" 2>&1 1147 | ln -sv pkgconf "$MPREFIX/bin/$XTARGET-pkg-config" >>"$MLOG" 2>&1 1148 | 1149 | printf "${GREENC}=>${NORMALC} pkgconf finished.\n\n" 1150 | fi 1151 | 1152 | # remove temp dir 1153 | rm -rf "$MSYSROOT/_tmp" @ >>"$MLOG" >&1 1154 | 1155 | # done! 1156 | printf "${GREENC}=>${NORMALC} Done! Enjoy your new ${XARCH} cross compiler targeting musl libc!\n" 1157 | printf "\nEnd Time: $(date)\n" >>"$MLOG" 2>&1 1158 | -------------------------------------------------------------------------------- /patches/gcc/glaucus/0001-pure64-for-aarch64.patch: -------------------------------------------------------------------------------- 1 | --- gcc/config/aarch64/t-aarch64-linux 2 | +++ gcc/config/aarch64/t-aarch64-linux 3 | @@ -22,7 +22,7 @@ 4 | LIB1ASMFUNCS = _aarch64_sync_cache_range 5 | 6 | AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be) 7 | -MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu) 8 | +MULTILIB_OSDIRNAMES = mabi.lp64=../lib 9 | MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu) 10 | 11 | -MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32) 12 | +MULTILIB_OSDIRNAMES += mabi.ilp32=../lib32 13 | -------------------------------------------------------------------------------- /patches/gcc/glaucus/0001-pure64-for-mips64.patch: -------------------------------------------------------------------------------- 1 | --- gcc/config/mips/mips.h 2 | +++ gcc/config/mips/mips.h 3 | @@ -3467,8 +3467,8 @@ 4 | #define STANDARD_STARTFILE_PREFIX_1 "/lib32/" 5 | #define STANDARD_STARTFILE_PREFIX_2 "/usr/lib32/" 6 | #elif MIPS_ABI_DEFAULT == ABI_64 7 | -#define STANDARD_STARTFILE_PREFIX_1 "/lib64/" 8 | -#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib64/" 9 | +#define STANDARD_STARTFILE_PREFIX_1 "/lib/" 10 | +#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/" 11 | #endif 12 | #endif 13 | 14 | --- gcc/config/mips/mti-linux.h 15 | +++ gcc/config/mips/mti-linux.h 16 | @@ -38,7 +38,7 @@ 17 | #define STARTFILE_PREFIX_SPEC \ 18 | "%{mabi=32: /usr/local/lib/ /lib/ /usr/lib/} \ 19 | %{mabi=n32: /usr/local/lib32/ /lib32/ /usr/lib32/} \ 20 | - %{mabi=64: /usr/local/lib64/ /lib64/ /usr/lib64/}" 21 | + %{mabi=64: /usr/local/lib/ /lib/ /usr/lib/}" 22 | 23 | #undef DRIVER_SELF_SPECS 24 | #define DRIVER_SELF_SPECS \ 25 | --- gcc/config/mips/t-img-linux 26 | +++ gcc/config/mips/t-img-linux 27 | @@ -28,11 +28,11 @@ 28 | MULTILIB_REQUIRED += mips64r6 29 | MULTILIB_OSDIRNAMES += mips64r6=!mips-r6-hard/lib32 30 | MULTILIB_REQUIRED += mips64r6/mabi=64 31 | -MULTILIB_OSDIRNAMES += mips64r6/mabi.64=!mips-r6-hard/lib64 32 | +MULTILIB_OSDIRNAMES += mips64r6/mabi.64=!mips-r6-hard/lib 33 | 34 | MULTILIB_REQUIRED += EL 35 | MULTILIB_OSDIRNAMES += EL=!mipsel-r6-hard/lib 36 | MULTILIB_REQUIRED += mips64r6/EL 37 | MULTILIB_OSDIRNAMES += mips64r6/EL=!mipsel-r6-hard/lib32 38 | MULTILIB_REQUIRED += mips64r6/mabi=64/EL 39 | -MULTILIB_OSDIRNAMES += mips64r6/mabi.64/EL=!mipsel-r6-hard/lib64 40 | +MULTILIB_OSDIRNAMES += mips64r6/mabi.64/EL=!mipsel-r6-hard/lib 41 | --- gcc/config/mips/t-irix6 42 | +++ gcc/config/mips/t-irix6 43 | @@ -1,4 +1,4 @@ 44 | MULTILIB_OPTIONS=mabi=n32/mabi=64 45 | MULTILIB_DIRNAMES=n32 64 46 | MULTILIB_MATCHES= 47 | -MULTILIB_OSDIRNAMES=../lib32 ../lib64 48 | +MULTILIB_OSDIRNAMES=../lib32 ../lib 49 | --- gcc/config/mips/t-linux64 50 | +++ gcc/config/mips/t-linux64 51 | @@ -35,11 +35,11 @@ 52 | MULTILIB_OSDIRNAMES = \ 53 | ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \ 54 | ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \ 55 | - ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT)) 56 | + ../lib$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT)) 57 | endif 58 | else 59 | MULTILIB_OSDIRNAMES = \ 60 | ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \ 61 | ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \ 62 | - ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT)) 63 | + ../lib$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT)) 64 | endif 65 | --- gcc/config/mips/t-mti-linux 66 | +++ gcc/config/mips/t-mti-linux 67 | @@ -28,56 +28,56 @@ 68 | MULTILIB_REQUIRED += mips64r2 69 | MULTILIB_OSDIRNAMES += mips64r2=!mips-r2-hard/lib32 70 | MULTILIB_REQUIRED += mips64r2/mabi=64 71 | -MULTILIB_OSDIRNAMES += mips64r2/mabi.64=!mips-r2-hard/lib64 72 | +MULTILIB_OSDIRNAMES += mips64r2/mabi.64=!mips-r2-hard/lib 73 | 74 | MULTILIB_REQUIRED += mnan=2008 75 | MULTILIB_OSDIRNAMES += mnan.2008=!mips-r2-hard-nan2008/lib 76 | MULTILIB_REQUIRED += mips64r2/mnan=2008 77 | MULTILIB_OSDIRNAMES += mips64r2/mnan.2008=!mips-r2-hard-nan2008/lib32 78 | MULTILIB_REQUIRED += mips64r2/mabi=64/mnan=2008 79 | -MULTILIB_OSDIRNAMES += mips64r2/mabi.64/mnan.2008=!mips-r2-hard-nan2008/lib64 80 | +MULTILIB_OSDIRNAMES += mips64r2/mabi.64/mnan.2008=!mips-r2-hard-nan2008/lib 81 | 82 | MULTILIB_REQUIRED += msoft-float 83 | MULTILIB_OSDIRNAMES += msoft-float=!mips-r2-soft/lib 84 | MULTILIB_REQUIRED += mips64r2/msoft-float 85 | MULTILIB_OSDIRNAMES += mips64r2/msoft-float=!mips-r2-soft/lib32 86 | MULTILIB_REQUIRED += mips64r2/mabi=64/msoft-float 87 | -MULTILIB_OSDIRNAMES += mips64r2/mabi.64/msoft-float=!mips-r2-soft/lib64 88 | +MULTILIB_OSDIRNAMES += mips64r2/mabi.64/msoft-float=!mips-r2-soft/lib 89 | 90 | #MULTILIB_REQUIRED += msoft-float/mnan=2008 91 | #MULTILIB_OSDIRNAMES += msoft-float/mnan.2008=!mips-r2-soft-nan2008/lib 92 | #MULTILIB_REQUIRED += mips64r2/msoft-float/mnan=2008 93 | #MULTILIB_OSDIRNAMES += mips64r2/msoft-float/mnan.2008=!mips-r2-soft-nan2008/lib32 94 | #MULTILIB_REQUIRED += mips64r2/mabi=64/msoft-float/mnan=2008 95 | -#MULTILIB_OSDIRNAMES += mips64r2/mabi.64/msoft-float/mnan.2008=!mips-r2-soft-nan2008/lib64 96 | +#MULTILIB_OSDIRNAMES += mips64r2/mabi.64/msoft-float/mnan.2008=!mips-r2-soft-nan2008/lib 97 | 98 | MULTILIB_REQUIRED += EL 99 | MULTILIB_OSDIRNAMES += EL=!mipsel-r2-hard/lib 100 | MULTILIB_REQUIRED += mips64r2/EL 101 | MULTILIB_OSDIRNAMES += mips64r2/EL=!mipsel-r2-hard/lib32 102 | MULTILIB_REQUIRED += mips64r2/mabi=64/EL 103 | -MULTILIB_OSDIRNAMES += mips64r2/mabi.64/EL=!mipsel-r2-hard/lib64 104 | +MULTILIB_OSDIRNAMES += mips64r2/mabi.64/EL=!mipsel-r2-hard/lib 105 | 106 | MULTILIB_REQUIRED += EL/mnan=2008 107 | MULTILIB_OSDIRNAMES += EL/mnan.2008=!mipsel-r2-hard-nan2008/lib 108 | MULTILIB_REQUIRED += mips64r2/EL/mnan=2008 109 | MULTILIB_OSDIRNAMES += mips64r2/EL/mnan.2008=!mipsel-r2-hard-nan2008/lib32 110 | MULTILIB_REQUIRED += mips64r2/mabi=64/EL/mnan=2008 111 | -MULTILIB_OSDIRNAMES += mips64r2/mabi.64/EL/mnan.2008=!mipsel-r2-hard-nan2008/lib64 112 | +MULTILIB_OSDIRNAMES += mips64r2/mabi.64/EL/mnan.2008=!mipsel-r2-hard-nan2008/lib 113 | 114 | MULTILIB_REQUIRED += EL/msoft-float 115 | MULTILIB_OSDIRNAMES += EL/msoft-float=!mipsel-r2-soft/lib 116 | MULTILIB_REQUIRED += mips64r2/EL/msoft-float 117 | MULTILIB_OSDIRNAMES += mips64r2/EL/msoft-float=!mipsel-r2-soft/lib32 118 | MULTILIB_REQUIRED += mips64r2/mabi=64/EL/msoft-float 119 | -MULTILIB_OSDIRNAMES += mips64r2/mabi.64/EL/msoft-float=!mipsel-r2-soft/lib64 120 | +MULTILIB_OSDIRNAMES += mips64r2/mabi.64/EL/msoft-float=!mipsel-r2-soft/lib 121 | 122 | #MULTILIB_REQUIRED += EL/msoft-float/mnan=2008 123 | #MULTILIB_OSDIRNAMES += EL/msoft-float/mnan.2008=!mipsel-r2-soft-nan2008/lib 124 | #MULTILIB_REQUIRED += mips64r2/EL/msoft-float/mnan=2008 125 | #MULTILIB_OSDIRNAMES += mips64r2/EL/msoft-float/mnan.2008=!mipsel-r2-soft-nan2008/lib32 126 | #MULTILIB_REQUIRED += mips64r2/mabi=64/EL/msoft-float/mnan=2008 127 | -#MULTILIB_OSDIRNAMES += mips64r2/mabi.64/EL/msoft-float/mnan.2008=!mipsel-r2-soft-nan2008/lib64 128 | +#MULTILIB_OSDIRNAMES += mips64r2/mabi.64/EL/msoft-float/mnan.2008=!mipsel-r2-soft-nan2008/lib 129 | 130 | # We will not include any 64 bit mips16 combinations. 131 | MULTILIB_REQUIRED += mips16 132 | @@ -123,28 +123,28 @@ 133 | MULTILIB_REQUIRED += mips64 134 | MULTILIB_OSDIRNAMES += mips64=!mips-r1-hard/lib32 135 | MULTILIB_REQUIRED += mips64/mabi=64 136 | -MULTILIB_OSDIRNAMES += mips64/mabi.64=!mips-r1-hard/lib64 137 | +MULTILIB_OSDIRNAMES += mips64/mabi.64=!mips-r1-hard/lib 138 | 139 | MULTILIB_REQUIRED += mips32/msoft-float 140 | MULTILIB_OSDIRNAMES += mips32/msoft-float=!mips-r1-soft/lib 141 | MULTILIB_REQUIRED += mips64/msoft-float 142 | MULTILIB_OSDIRNAMES += mips64/msoft-float=!mips-r1-soft/lib32 143 | MULTILIB_REQUIRED += mips64/mabi=64/msoft-float 144 | -MULTILIB_OSDIRNAMES += mips64/mabi.64/msoft-float=!mips-r1-soft/lib64 145 | +MULTILIB_OSDIRNAMES += mips64/mabi.64/msoft-float=!mips-r1-soft/lib 146 | 147 | MULTILIB_REQUIRED += mips32/EL 148 | MULTILIB_OSDIRNAMES += mips32/EL=!mipsel-r1-hard/lib 149 | MULTILIB_REQUIRED += mips64/EL 150 | MULTILIB_OSDIRNAMES += mips64/EL=!mipsel-r1-hard/lib32 151 | MULTILIB_REQUIRED += mips64/mabi=64/EL 152 | -MULTILIB_OSDIRNAMES += mips64/mabi.64/EL=!mipsel-r1-hard/lib64 153 | +MULTILIB_OSDIRNAMES += mips64/mabi.64/EL=!mipsel-r1-hard/lib 154 | 155 | MULTILIB_REQUIRED += mips32/EL/msoft-float 156 | MULTILIB_OSDIRNAMES += mips32/EL/msoft-float=!mipsel-r1-soft/lib 157 | MULTILIB_REQUIRED += mips64/EL/msoft-float 158 | MULTILIB_OSDIRNAMES += mips64/EL/msoft-float=!mipsel-r1-soft/lib32 159 | MULTILIB_REQUIRED += mips64/mabi=64/EL/msoft-float 160 | -MULTILIB_OSDIRNAMES += mips64/mabi.64/EL/msoft-float=!mipsel-r1-soft/lib64 161 | +MULTILIB_OSDIRNAMES += mips64/mabi.64/EL/msoft-float=!mipsel-r1-soft/lib 162 | 163 | # We will not include any 64 bit mips16 combinations. 164 | MULTILIB_REQUIRED += mips32/mips16 165 | --- gcc/config/mips/t-st 166 | +++ gcc/config/mips/t-st 167 | @@ -17,14 +17,14 @@ 168 | # . 169 | 170 | MULTILIB_OPTIONS = march=loongson2e/march=loongson2f mabi=n32/mabi=32/mabi=64 171 | -MULTILIB_DIRNAMES = 2e 2f lib32 lib lib64 172 | +MULTILIB_DIRNAMES = 2e 2f lib32 lib lib 173 | 174 | MULTILIB_OSDIRNAMES = march.loongson2e/mabi.n32=../lib32/2e 175 | MULTILIB_OSDIRNAMES += march.loongson2e/mabi.32=../lib/2e 176 | -MULTILIB_OSDIRNAMES += march.loongson2e/mabi.64=../lib64/2e 177 | +MULTILIB_OSDIRNAMES += march.loongson2e/mabi.64=../lib/2e 178 | MULTILIB_OSDIRNAMES += march.loongson2f/mabi.n32=../lib32/2f 179 | MULTILIB_OSDIRNAMES += march.loongson2f/mabi.32=../lib/2f 180 | -MULTILIB_OSDIRNAMES += march.loongson2f/mabi.64=../lib64/2f 181 | +MULTILIB_OSDIRNAMES += march.loongson2f/mabi.64=../lib/2f 182 | MULTILIB_OSDIRNAMES += mabi.n32=../lib32 183 | MULTILIB_OSDIRNAMES += mabi.32=../lib 184 | -MULTILIB_OSDIRNAMES += mabi.64=../lib64 185 | +MULTILIB_OSDIRNAMES += mabi.64=../lib 186 | -------------------------------------------------------------------------------- /patches/gcc/glaucus/0001-pure64-for-powerpc64.patch: -------------------------------------------------------------------------------- 1 | --- gcc/config/rs6000/t-linux 2 | +++ gcc/config/rs6000/t-linux 3 | @@ -2,7 +2,8 @@ 4 | # or soft-float. 5 | ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float))) 6 | ifneq (,$(findstring powerpc64,$(target))) 7 | -MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu) 8 | +MULTILIB_OSDIRNAMES := m64=../lib 9 | +MULTILIB_OSDIRNAMES += m32=../lib32 10 | else 11 | MULTIARCH_DIRNAME := $(call if_multiarch,powerpc-linux-gnu) 12 | endif 13 | @@ -10,7 +11,8 @@ 14 | MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME)) 15 | endif 16 | ifneq (,$(findstring powerpc64le,$(target))) 17 | -MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)) 18 | +MULTILIB_OSDIRNAMES := m64=../lib 19 | +MULTILIB_OSDIRNAMES += m32=../lib32 20 | endif 21 | endif 22 | 23 | --- gcc/config/rs6000/t-linux64 24 | +++ gcc/config/rs6000/t-linux64 25 | @@ -28,8 +28,8 @@ 26 | MULTILIB_OPTIONS := m64/m32 27 | MULTILIB_DIRNAMES := 64 32 28 | MULTILIB_EXTRA_OPTS := 29 | -MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu) 30 | -MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu) 31 | +MULTILIB_OSDIRNAMES := m64=../lib 32 | +MULTILIB_OSDIRNAMES += m32=../lib32 33 | 34 | rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.cc 35 | $(COMPILE) $< 36 | --- gcc/config/rs6000/t-linux64bele 37 | +++ gcc/config/rs6000/t-linux64bele 38 | @@ -2,6 +2,6 @@ 39 | 40 | MULTILIB_OPTIONS += mlittle 41 | MULTILIB_DIRNAMES += le 42 | -MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)))))) 43 | -MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES))) 44 | +MULTILIB_OSDIRNAMES = m64=../lib 45 | +MULTILIB_OSDIRNAMES+= m32=../lib32 46 | MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN} 47 | --- gcc/config/rs6000/t-linux64le 48 | +++ gcc/config/rs6000/t-linux64le 49 | @@ -1,3 +1,4 @@ 50 | #rs6000/t-linux64le 51 | 52 | -MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)) 53 | +MULTILIB_OSDIRNAMES := m64=../lib 54 | +MULTILIB_OSDIRNAMES += m32=../lib32 55 | --- gcc/config/rs6000/t-linux64lebe 56 | +++ gcc/config/rs6000/t-linux64lebe 57 | @@ -2,6 +2,6 @@ 58 | 59 | MULTILIB_OPTIONS += mbig 60 | MULTILIB_DIRNAMES += be 61 | -MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES)))))) 62 | -MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES))) 63 | +MULTILIB_OSDIRNAMES = m64=../lib 64 | +MULTILIB_OSDIRNAMES += m32=../lib32 65 | MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN} 66 | -------------------------------------------------------------------------------- /patches/gcc/glaucus/0001-pure64-for-riscv64.patch: -------------------------------------------------------------------------------- 1 | --- gcc/config/riscv/t-linux 2 | +++ gcc/config/riscv/t-linux 3 | @@ -1,5 +1,9 @@ 4 | # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/ 5 | -MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES))) 6 | +MULTILIB_OPTIONS := march=rv64gc 7 | +MULTILIB_DIRNAMES := rv64gc 8 | + 9 | +MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib,$(MULTILIB_DIRNAMES))) 10 | MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) 11 | +MULTILIB_MATCHES := march?rv64gc=march?rv64imafdc 12 | 13 | MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, ,$(target)))-linux-gnu) 14 | --- gcc/config/riscv/t-withmultilib 15 | +++ gcc/config/riscv/t-withmultilib 16 | @@ -1,6 +1,6 @@ 17 | comma=, 18 | MULTILIB_OPTIONS = $(subst lp64,mabi=lp64,$(subst ilp32,mabi=ilp32,$(subst rv,march=rv,$(subst $(comma), ,$(TM_MULTILIB_CONFIG))))) 19 | -MULTILIB_DIRNAMES = $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(subst $(comma), ,$(TM_MULTILIB_CONFIG)))) 20 | +MULTILIB_DIRNAMES = $(patsubst rv32%,lib32,$(patsubst rv64%,lib,$(subst $(comma), ,$(TM_MULTILIB_CONFIG)))) 21 | MULTILIB_OSDIRNAMES = $(subst lib,../lib,$(MULTILIB_DIRNAMES)) 22 | MULTILIB_REQUIRED = $(subst lp64,mabi=lp64,$(subst ilp32,mabi=ilp32,$(subst rv,march=rv,$(subst $(comma),/,$(TM_MULTILIB_CONFIG))))) 23 | MULTILIB_REUSE = 24 | -------------------------------------------------------------------------------- /patches/gcc/glaucus/0001-pure64-for-s390x.patch: -------------------------------------------------------------------------------- 1 | --- gcc/config/s390/t-linux64 2 | +++ gcc/config/s390/t-linux64 3 | @@ -7,5 +7,5 @@ 4 | 5 | MULTILIB_OPTIONS = m64/m31 6 | MULTILIB_DIRNAMES = 64 32 7 | -MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu) 8 | -MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu) 9 | +MULTILIB_OSDIRNAMES = ../lib 10 | +MULTILIB_OSDIRNAMES += ../lib32 11 | -------------------------------------------------------------------------------- /patches/gcc/glaucus/0001-pure64-for-x86-64.patch: -------------------------------------------------------------------------------- 1 | --- gcc/config/i386/t-linux64 2 | +++ gcc/config/i386/t-linux64 3 | @@ -33,6 +33,6 @@ 4 | comma=, 5 | MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG)) 6 | MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS))) 7 | -MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu) 8 | -MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu) 9 | -MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32) 10 | +MULTILIB_OSDIRNAMES = m64=../lib 11 | +MULTILIB_OSDIRNAMES+= m32=../lib32 12 | +MULTILIB_OSDIRNAMES+= mx32=../libx32 13 | -------------------------------------------------------------------------------- /patches/musl/upstream/CVE-2025-26519.patch: -------------------------------------------------------------------------------- 1 | Patch-Source: https://www.openwall.com/lists/musl/2025/02/13/1 2 | --- 3 | >From e5adcd97b5196e29991b524237381a0202a60659 Mon Sep 17 00:00:00 2001 4 | From: Rich Felker 5 | Date: Sun, 9 Feb 2025 10:07:19 -0500 6 | Subject: [PATCH] iconv: fix erroneous input validation in EUC-KR decoder 7 | 8 | as a result of incorrect bounds checking on the lead byte being 9 | decoded, certain invalid inputs which should produce an encoding 10 | error, such as "\xc8\x41", instead produced out-of-bounds loads from 11 | the ksc table. 12 | 13 | in a worst case, the loaded value may not be a valid unicode scalar 14 | value, in which case, if the output encoding was UTF-8, wctomb would 15 | return (size_t)-1, causing an overflow in the output pointer and 16 | remaining buffer size which could clobber memory outside of the output 17 | buffer. 18 | 19 | bug report was submitted in private by Nick Wellnhofer on account of 20 | potential security implications. 21 | --- 22 | src/locale/iconv.c | 2 +- 23 | 1 file changed, 1 insertion(+), 1 deletion(-) 24 | 25 | diff --git a/src/locale/iconv.c b/src/locale/iconv.c 26 | index 9605c8e9..008c93f0 100644 27 | --- a/src/locale/iconv.c 28 | +++ b/src/locale/iconv.c 29 | @@ -502,7 +502,7 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri 30 | if (c >= 93 || d >= 94) { 31 | c += (0xa1-0x81); 32 | d += 0xa1; 33 | - if (c >= 93 || c>=0xc6-0x81 && d>0x52) 34 | + if (c > 0xc6-0x81 || c==0xc6-0x81 && d>0x52) 35 | goto ilseq; 36 | if (d-'A'<26) d = d-'A'; 37 | else if (d-'a'<26) d = d-'a'+26; 38 | -- 39 | 2.21.0 40 | 41 | >From c47ad25ea3b484e10326f933e927c0bc8cded3da Mon Sep 17 00:00:00 2001 42 | From: Rich Felker 43 | Date: Wed, 12 Feb 2025 17:06:30 -0500 44 | Subject: [PATCH] iconv: harden UTF-8 output code path against input decoder 45 | bugs 46 | 47 | the UTF-8 output code was written assuming an invariant that iconv's 48 | decoders only emit valid Unicode Scalar Values which wctomb can encode 49 | successfully, thereby always returning a value between 1 and 4. 50 | 51 | if this invariant is not satisfied, wctomb returns (size_t)-1, and the 52 | subsequent adjustments to the output buffer pointer and remaining 53 | output byte count overflow, moving the output position backwards, 54 | potentially past the beginning of the buffer, without storing any 55 | bytes. 56 | --- 57 | src/locale/iconv.c | 4 ++++ 58 | 1 file changed, 4 insertions(+) 59 | 60 | diff --git a/src/locale/iconv.c b/src/locale/iconv.c 61 | index 008c93f0..52178950 100644 62 | --- a/src/locale/iconv.c 63 | +++ b/src/locale/iconv.c 64 | @@ -545,6 +545,10 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri 65 | if (*outb < k) goto toobig; 66 | memcpy(*out, tmp, k); 67 | } else k = wctomb_utf8(*out, c); 68 | + /* This failure condition should be unreachable, but 69 | + * is included to prevent decoder bugs from translating 70 | + * into advancement outside the output buffer range. */ 71 | + if (k>4) goto ilseq; 72 | *out += k; 73 | *outb -= k; 74 | break; 75 | -- 76 | 2.21.0 77 | 78 | 79 | --------------------------------------------------------------------------------