darwin-miscutils-9.ebuild 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="6"
  4. inherit toolchain-funcs eutils
  5. MISC_VER=31
  6. SHELL_VER=162
  7. DEV_VER=55
  8. DESCRIPTION="Miscellaneous commands used on Darwin/Mac OS X systems, Lion 10.7"
  9. HOMEPAGE="http://www.opensource.apple.com/"
  10. SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/misc_cmds-${MISC_VER}.tar.gz
  11. http://www.opensource.apple.com/darwinsource/tarballs/other/shell_cmds-${SHELL_VER}.tar.gz
  12. http://www.opensource.apple.com/darwinsource/tarballs/other/developer_cmds-${DEV_VER}.tar.gz"
  13. LICENSE="BSD"
  14. SLOT="0"
  15. KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
  16. IUSE=""
  17. S=${WORKDIR}
  18. src_prepare() {
  19. cd "${S}"/shell_cmds-${SHELL_VER}
  20. epatch "${FILESDIR}"/${PN}-6-w64.patch
  21. eapply_user
  22. }
  23. src_compile() {
  24. local flags=(
  25. ${CFLAGS}
  26. -I.
  27. -D__FBSDID=__RCSID
  28. -Wsystem-headers
  29. -Du_int=uint32_t
  30. -include stdint.h
  31. ${LDFLAGS}
  32. )
  33. local TS=${S}/misc_cmds-${MISC_VER}
  34. # tsort is provided by coreutils
  35. for t in leave units calendar; do
  36. cd "${TS}/${t}"
  37. echo "in ${TS}/${t}:"
  38. echo "$(tc-getCC) ${flags[@]} -o ${t}" *.c
  39. $(tc-getCC) ${flags[@]} -o ${t} *.c || die "failed to compile $t"
  40. done
  41. # compile cal separately
  42. cd "${TS}/ncal"
  43. echo "in ${TS}/ncal:"
  44. echo "$(tc-getCC) ${flags[@]} -c calendar.c"
  45. $(tc-getCC) ${flags[@]} -c calendar.c || die "failed to compile cal"
  46. echo "$(tc-getCC) ${flags[@]} -c easter.c"
  47. $(tc-getCC) ${flags[@]} -c easter.c || die "failed to compile cal"
  48. echo "$(tc-getCC) ${flags[@]} -c ncal.c"
  49. $(tc-getCC) ${flags[@]} -c ncal.c || die "failed to compile cal"
  50. echo "$(tc-getCC) ${flags[@]} -o cal calendar.o easter.o ncal.o"
  51. $(tc-getCC) ${flags[@]} -o cal calendar.o easter.o ncal.o || die "failed to compile cal"
  52. TS=${S}/shell_cmds-${SHELL_VER}
  53. # only pick those tools not provided by coreutils, findutils
  54. for t in \
  55. alias apply getopt hostname jot kill killall \
  56. lastcomm renice script shlock time whereis;
  57. do
  58. echo "in ${TS}/${t}:"
  59. echo "$(tc-getCC) ${flags[@]} -o ${t} ${t}.c"
  60. cd "${TS}/${t}"
  61. $(tc-getCC) ${flags[@]} -o ${t} ${t}.c || die "failed to compile $t"
  62. done
  63. cd "${TS}/w"
  64. sed -i -e '/#include <libutil.h>/d' w.c || die
  65. echo "in ${TS}/w:"
  66. echo "$(tc-getCC) ${flags[@]} -DHAVE_UTMPX=1 -lresolv -o w w.c pr_time.c proc_compare.c"
  67. $(tc-getCC) ${flags[@]} -DHAVE_UTMPX=1 -lresolv -o w w.c pr_time.c proc_compare.c \
  68. || die "failed to compile w"
  69. TS=${S}/developer_cmds-${DEV_VER}
  70. # only pick those tools that do not conflict (no ctags and indent)
  71. # do not install lorder, mkdep and vgrind as they are a non-prefix-aware
  72. # shell scripts
  73. # don't install rpcgen, as it is heavily related to the OS it runs
  74. # on (and this is the Snow Leopard version)
  75. for t in asa hexdump unifdef what ; do
  76. echo "in ${TS}/${t}:"
  77. cd "${TS}/${t}" || die
  78. echo "$(tc-getCC) ${flags[@]} -o ${t}" *.c
  79. $(tc-getCC) ${flags[@]} -o ${t} *.c || die "failed to compile $t"
  80. done
  81. }
  82. src_install() {
  83. mkdir -p "${ED}"/bin
  84. mkdir -p "${ED}"/usr/bin
  85. local TS=${S}/misc_cmds-${MISC_VER}
  86. for t in leave units calendar ; do
  87. cp "${TS}/${t}/${t}" "${ED}"/usr/bin/
  88. doman "${TS}/${t}/${t}.1"
  89. done
  90. # copy cal separately
  91. cp "${TS}/ncal/cal" "${ED}"/usr/bin/
  92. dosym /usr/bin/cal /usr/bin/ncal
  93. doman "${TS}/ncal/ncal.1"
  94. dosym /usr/share/man/man1/ncal.1 /usr/share/man/man1/cal.1
  95. TS=${S}/shell_cmds-${SHELL_VER}
  96. for t in \
  97. alias apply getopt jot killall lastcomm \
  98. renice script shlock time w whereis;
  99. do
  100. cp "${TS}/${t}/${t}" "${ED}"/usr/bin/
  101. [[ -f "${TS}/${t}/${t}.1" ]] && doman "${TS}/${t}/${t}.1"
  102. [[ -f "${TS}/${t}/${t}.8" ]] && doman "${TS}/${t}/${t}.8"
  103. done
  104. cp "${TS}/w/w" "${ED}"/usr/bin/uptime
  105. doman "${TS}/w/uptime.1"
  106. for t in hostname kill; do
  107. cp "${TS}/${t}/${t}" "${ED}"/bin/
  108. doman "${TS}/${t}/${t}.1"
  109. done
  110. TS=${S}/developer_cmds-${DEV_VER}
  111. for t in asa hexdump unifdef what ; do
  112. cp "${TS}/${t}/${t}" "${ED}"/usr/bin/
  113. doman "${TS}/${t}/${t}.1"
  114. done
  115. }