darwin-miscutils-11.ebuild 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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
  5. # from macOS 10.12
  6. MISC_VER=33
  7. SHELL_VER=198
  8. # from DT 8.1
  9. DEV_VER=63
  10. # from 10.7.4
  11. MD_VER=147 # 148 in 10.8 has no md, bug #428530
  12. DESCRIPTION="Miscellaneous commands used on macOS, Sierra 10.12"
  13. HOMEPAGE="https://www.opensource.apple.com/"
  14. SRC_URI="https://opensource.apple.com/tarballs/misc_cmds/misc_cmds-${MISC_VER}.tar.gz
  15. https://opensource.apple.com/tarballs/shell_cmds/shell_cmds-${SHELL_VER}.tar.gz
  16. https://opensource.apple.com/tarballs/developer_cmds/developer_cmds-${DEV_VER}.tar.gz
  17. https://opensource.apple.com/source/adv_cmds/adv_cmds-${MD_VER}/md/md.c -> adv_cmds-md-${MD_VER}.c
  18. https://opensource.apple.com/source/adv_cmds/adv_cmds-${MD_VER}/md/md.1 -> adv_cmds-md-${MD_VER}.1"
  19. LICENSE="BSD"
  20. SLOT="0"
  21. KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
  22. IUSE=""
  23. S=${WORKDIR}
  24. src_prepare() {
  25. cd "${S}"/shell_cmds-${SHELL_VER} || die
  26. eapply "${FILESDIR}"/${PN}-6-w64.patch
  27. mkdir -p "${S}"/adv_cmds-${MD_VER}/md || die
  28. cp "${DISTDIR}"/adv_cmds-md-${MD_VER}.c \
  29. "${S}"/adv_cmds-${MD_VER}/md/md.c || die
  30. cp "${DISTDIR}"/adv_cmds-md-${MD_VER}.1 \
  31. "${S}"/adv_cmds-${MD_VER}/md/md.1 || die
  32. eapply_user
  33. }
  34. src_compile() {
  35. local flags=(
  36. ${CFLAGS}
  37. -I.
  38. -D__FBSDID=__RCSID
  39. -Wsystem-headers
  40. -Du_int=uint32_t
  41. -include stdint.h
  42. ${LDFLAGS}
  43. )
  44. local TS=${S}/misc_cmds-${MISC_VER}
  45. # tsort is provided by coreutils
  46. for t in leave units calendar; do
  47. cd "${TS}/${t}"
  48. echo "in ${TS}/${t}:"
  49. echo "$(tc-getCC) ${flags[@]} -o ${t}" *.c
  50. $(tc-getCC) ${flags[@]} -o ${t} *.c || die "failed to compile $t"
  51. done
  52. # compile cal separately
  53. cd "${TS}/ncal"
  54. echo "in ${TS}/ncal:"
  55. echo "$(tc-getCC) ${flags[@]} -c calendar.c"
  56. $(tc-getCC) ${flags[@]} -c calendar.c || die "failed to compile cal"
  57. echo "$(tc-getCC) ${flags[@]} -c easter.c"
  58. $(tc-getCC) ${flags[@]} -c easter.c || die "failed to compile cal"
  59. echo "$(tc-getCC) ${flags[@]} -c ncal.c"
  60. $(tc-getCC) ${flags[@]} -c ncal.c || die "failed to compile cal"
  61. echo "$(tc-getCC) ${flags[@]} -o cal calendar.o easter.o ncal.o"
  62. $(tc-getCC) ${flags[@]} -o cal calendar.o easter.o ncal.o || die "failed to compile cal"
  63. TS=${S}/shell_cmds-${SHELL_VER}
  64. # only pick those tools not provided by coreutils, findutils
  65. for t in \
  66. apply getopt hexdump hostname jot kill killall \
  67. lastcomm renice script shlock time whereis;
  68. do
  69. echo "in ${TS}/${t}:"
  70. echo "$(tc-getCC) ${flags[@]} -o ${t} *.c"
  71. cd "${TS}/${t}"
  72. $(tc-getCC) ${flags[@]} -o ${t} *.c || die "failed to compile $t"
  73. done
  74. cd "${TS}/w"
  75. sed -i -e '/#include <libutil.h>/d' w.c || die
  76. echo "in ${TS}/w:"
  77. echo "$(tc-getCC) ${flags[@]} -DHAVE_UTMPX=1 -lresolv -o w *.c"
  78. $(tc-getCC) ${flags[@]} -DHAVE_UTMPX=1 -lresolv -o w *.c \
  79. || die "failed to compile w"
  80. TS=${S}/developer_cmds-${DEV_VER}
  81. # only pick those tools that do not conflict (no ctags and indent)
  82. # do not install lorder, mkdep and vgrind as they are a non-prefix-aware
  83. # shell scripts
  84. # don't install rpcgen, as it is heavily related to the OS it runs
  85. # on (and this is the Sierra version)
  86. for t in asa unifdef what ; do
  87. echo "in ${TS}/${t}:"
  88. cd "${TS}/${t}" || die
  89. echo "$(tc-getCC) ${flags[@]} -o ${t}" *.c
  90. $(tc-getCC) ${flags[@]} -o ${t} *.c || die "failed to compile $t"
  91. done
  92. # provide this one for gcc-apple
  93. TS=${S}/adv_cmds-${MD_VER}
  94. for t in md ; do
  95. echo "in ${TS}/${t}:"
  96. cd "${TS}/${t}" || die
  97. echo "$(tc-getCC) ${flags[@]} -o ${t}" *.c
  98. $(tc-getCC) ${flags[@]} -o ${t} *.c || die "failed to compile $t"
  99. done
  100. }
  101. src_install() {
  102. mkdir -p "${ED}"/bin
  103. mkdir -p "${ED}"/usr/bin
  104. local TS=${S}/misc_cmds-${MISC_VER}
  105. for t in leave units calendar ; do
  106. cp "${TS}/${t}/${t}" "${ED}"/usr/bin/
  107. doman "${TS}/${t}/${t}.1"
  108. done
  109. # copy cal separately
  110. cp "${TS}/ncal/cal" "${ED}"/usr/bin/
  111. dosym /usr/bin/cal /usr/bin/ncal
  112. doman "${TS}/ncal/ncal.1"
  113. dosym /usr/share/man/man1/ncal.1 /usr/share/man/man1/cal.1
  114. TS=${S}/shell_cmds-${SHELL_VER}
  115. for t in \
  116. apply getopt hexdump hostname jot killall lastcomm \
  117. renice script shlock time w whereis;
  118. do
  119. cp "${TS}/${t}/${t}" "${ED}"/usr/bin/
  120. [[ -f "${TS}/${t}/${t}.1" ]] && doman "${TS}/${t}/${t}.1"
  121. [[ -f "${TS}/${t}/${t}.8" ]] && doman "${TS}/${t}/${t}.8"
  122. done
  123. cp "${TS}/w/w" "${ED}"/usr/bin/uptime
  124. doman "${TS}/w/uptime.1"
  125. for t in hostname kill; do
  126. cp "${TS}/${t}/${t}" "${ED}"/bin/
  127. doman "${TS}/${t}/${t}.1"
  128. done
  129. TS=${S}/developer_cmds-${DEV_VER}
  130. for t in asa unifdef what ; do
  131. cp "${TS}/${t}/${t}" "${ED}"/usr/bin/
  132. doman "${TS}/${t}/${t}.1"
  133. done
  134. TS=${S}/adv_cmds-${MD_VER}
  135. for t in md ; do
  136. cp "${TS}/${t}/${t}" "${ED}"/usr/bin/
  137. doman "${TS}/${t}/${t}.1"
  138. done
  139. }