blink-9999.ebuild 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. # Copyright 1999-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit toolchain-funcs flag-o-matic prefix
  5. DESCRIPTION="Tiniest x86-64-linux emulator"
  6. HOMEPAGE="https://github.com/jart/blink"
  7. if [[ ${PV} == 9999 ]] ; then
  8. inherit git-r3
  9. EGIT_REPO_URI="https://github.com/jart/blink"
  10. KEYWORDS=""
  11. else
  12. SRC_URI="https://github.com/jart/blink/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
  13. KEYWORDS="~amd64 ~arm64 ~arm ~x86 ~mips ~ppc ~ppc64 ~s390"
  14. fi
  15. LICENSE="ISC"
  16. SLOT="0"
  17. BUILD_MODES=( tiny opt rel dbg cosmo prof cov asan ubsan tsan msan llvm llvm++ rel-llvm tiny-llvm )
  18. IUSE="cpu_flags_x86_mmxext +ancillary backtrace +bcd +bmi2 debug +disassembler +fork jit man +metal overlays +rom +sockets static strace test +threads +vfs +x87 ${BUILD_MODES[@]}"
  19. BDEPEND="
  20. test? ( app-emulation/qemu )
  21. >=sys-libs/zlib-1.2.13
  22. "
  23. REQUIRED_USE="
  24. ^^ ( ${BUILD_MODES[@]} )
  25. ^^ ( overlays vfs )
  26. jit? ( ^^ ( amd64 arm64 ) )
  27. debug? ( ^^ ( dbg asan msan ubsan tsan llvm llvm++ ) )
  28. "
  29. RESTRICT="
  30. !test? ( test )
  31. mirror
  32. "
  33. src_prepare() {
  34. # Unbundle zlib
  35. sed -e "/include third_party\/libz\/zlib\.mk.*$/d" -i Makefile || die "Sed failed."
  36. default
  37. }
  38. src_configure() {
  39. export HOSTCC=${BUILD_CC} CFLAGS_HOST="${BUILD_CFLAGS}" LDFLAGS_HOST="${BUILD_LDFLAGS}"
  40. if use llvm || use rel-llvm || use llvm++; then
  41. CC="${CHOST}-clang"
  42. append-cflags -stdlib=libc++ -lc++abi -I/usr/include/c++/v1
  43. fi
  44. filter-lto
  45. strip-unsupported-flags
  46. for bm in "${BUILD_MODES[@]}"; do
  47. if use ${bm}; then export m="${bm}"; break; fi
  48. done
  49. local myargs=(
  50. $(use_enable ancillary)
  51. $(use_enable backtrace)
  52. $(use_enable bcd)
  53. $(use_enable bmi2)
  54. $(use_enable disassembler)
  55. $(use_enable fork)
  56. $(use_enable jit)
  57. $(use_enable metal)
  58. $(use_enable overlays)
  59. $(use_enable rom)
  60. $(use_enable sockets)
  61. $(use_enable strace)
  62. $(usev static)
  63. $(use_enable threads)
  64. $(use_enable vfs)
  65. $(use_enable x87)
  66. $(use_enable cpu_flags_x86_mmxext mmx)
  67. --prefix="${EPREFIX}${sysroot}/usr"
  68. --posix
  69. --disable-nonposix
  70. )
  71. ./configure "${myargs[@]}"
  72. }
  73. src_test() {
  74. emake check check2 emulates
  75. }
  76. src_install() {
  77. insinto ${EPREFIX}/usr/bin
  78. dobin ./o/${m}/blink/blink ./o/${m}/blink/blinkenlights
  79. if use man; then
  80. doman ./blink/blink.1 ./blink/blinkenlights.1
  81. fi
  82. dodoc LICENSE* README*
  83. }