gcompat-0.3.0.ebuild (1068B)
1 # Copyright 2018 Haelwenn (lanodan) Monnier <contact@hacktivis.me> 2 # Distributed under the terms of the GNU General Public License v2 3 4 EAPI=7 5 6 inherit multilib-minimal 7 8 DESCRIPTION="The GNU C Library compatibility layer for musl" 9 HOMEPAGE="https://code.foxkit.us/adelie/gcompat" 10 KEYWORDS="~x86 ~amd64" 11 LICENSE="UoI-NCSA" 12 SRC_URI="https://distfiles.adelielinux.org/source/gcompat/${P}.tar.xz" 13 SLOT="0" 14 15 get_loader_name() { 16 # Loosely based on Adélie APKBUILD 17 # TODO: Check against glibc’s logic 18 19 case "$ABI" in 20 x86) echo "ld-linux.so.2" ;; 21 amd64) echo "ld-linux-x86-64.so.2" ;; 22 arm*) echo "ld-linux-armhf.so.3" ;; 23 arm64) echo "ld-linux-aarch64.so.1" ;; 24 mips | powerpc | s390) echo "ld.so.1" ;; 25 esac 26 } 27 28 get_linker_path() { 29 local arch=$(ldd 2>&1 | sed -n '1s/^musl libc (\(.*\))$/\1/p') 30 echo "/lib/ld-musl-${arch}.so.1" 31 } 32 33 src_compile() { 34 emake \ 35 LINKER_PATH="$(get_linker_path)" \ 36 LOADER_NAME="$(get_loader_name)" 37 } 38 39 src_install() { 40 emake \ 41 LINKER_PATH="$(get_linker_path)" \ 42 LOADER_NAME="$(get_loader_name)" \ 43 DESTDIR="${D}" \ 44 install 45 }