logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

gcompat-0.4.0.ebuild (1475B)


  1. # Copyright 2018-2020 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. inherit multilib-minimal flag-o-matic
  5. DESCRIPTION="The GNU C Library compatibility layer for musl"
  6. HOMEPAGE="https://code.foxkit.us/adelie/gcompat"
  7. KEYWORDS="~amd64 ~x86"
  8. LICENSE="UoI-NCSA"
  9. IUSE="libucontext obstack"
  10. SRC_URI="https://distfiles.adelielinux.org/source/${PN}/${P}.tar.xz"
  11. SLOT="0"
  12. DEPEND="
  13. libucontext? ( sys-libs/libucontext )
  14. obstack? ( sys-libs/obstack-standalone )
  15. "
  16. RDEPEND="${DEPEND}"
  17. get_loader_name() {
  18. # Loosely based on Adélie APKBUILD
  19. # TODO: Check against glibc’s logic
  20. case "$ABI" in
  21. x86) echo "ld-linux.so.2" ;;
  22. amd64) echo "ld-linux-x86-64.so.2" ;;
  23. arm*) echo "ld-linux-armhf.so.3" ;;
  24. arm64) echo "ld-linux-aarch64.so.1" ;;
  25. mips | powerpc | s390) echo "ld.so.1" ;;
  26. esac
  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. src_compile() {
  33. filter-flags "-Wl,--as-needed"
  34. emake \
  35. LINKER_PATH="$(get_linker_path)" \
  36. LOADER_NAME="$(get_loader_name)" \
  37. WITH_OBSTACK="$(usex obstack 'obstack-standalone' 'no')" \
  38. $(usex libucontext WITH_LIBUCONTEXT=yes '')
  39. }
  40. src_install() {
  41. emake \
  42. LINKER_PATH="$(get_linker_path)" \
  43. LOADER_NAME="$(get_loader_name)" \
  44. WITH_OBSTACK="$(usex obstack 'obstack-standalone' 'no')" \
  45. $(usex libucontext WITH_LIBUCONTEXT=yes '') \
  46. DESTDIR="${D}" \
  47. install
  48. }