darwin-miscutils-8.ebuild 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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=27
  6. SHELL_VER=149
  7. DEV_VER=53.1
  8. DESCRIPTION="Miscellaneous commands used on Darwin/Mac OS X systems, Snow Leopard 10.6.3"
  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. # deal with OSX Lion and above
  22. cd "${S}"/developer_cmds-${DEV_VER}
  23. sed -i -e 's/getline/ugetline/g' unifdef/unifdef.c || die
  24. eapply_user
  25. }
  26. src_compile() {
  27. local flags=(
  28. ${CFLAGS}
  29. -I.
  30. -D__FBSDID=__RCSID
  31. -Wsystem-headers
  32. -Du_int=uint32_t
  33. -include stdint.h
  34. ${LDFLAGS}
  35. )
  36. local TS=${S}/misc_cmds-${MISC_VER}
  37. # tsort is provided by coreutils
  38. for t in leave units calendar; do
  39. cd "${TS}/${t}"
  40. echo "in ${TS}/${t}:"
  41. echo "$(tc-getCC) ${flags[@]} -o ${t}" *.c
  42. $(tc-getCC) ${flags[@]} -o ${t} *.c || die "failed to compile $t"
  43. done
  44. # compile cal separately
  45. cd "${TS}/ncal"
  46. echo "in ${TS}/ncal:"
  47. echo "$(tc-getCC) ${flags[@]} -c calendar.c"
  48. $(tc-getCC) ${flags[@]} -c calendar.c || die "failed to compile cal"
  49. echo "$(tc-getCC) ${flags[@]} -c easter.c"
  50. $(tc-getCC) ${flags[@]} -c easter.c || die "failed to compile cal"
  51. echo "$(tc-getCC) ${flags[@]} -c ncal.c"
  52. $(tc-getCC) ${flags[@]} -c ncal.c || die "failed to compile cal"
  53. echo "$(tc-getCC) ${flags[@]} -o cal calendar.o easter.o ncal.o"
  54. $(tc-getCC) ${flags[@]} -o cal calendar.o easter.o ncal.o || die "failed to compile cal"
  55. TS=${S}/shell_cmds-${SHELL_VER}
  56. # only pick those tools not provided by coreutils, findutils
  57. for t in \
  58. alias apply getopt hostname jot kill killall \
  59. lastcomm renice script shlock time whereis;
  60. do
  61. echo "in ${TS}/${t}:"
  62. echo "$(tc-getCC) ${flags[@]} -o ${t} ${t}.c"
  63. cd "${TS}/${t}"
  64. $(tc-getCC) ${flags[@]} -o ${t} ${t}.c || die "failed to compile $t"
  65. done
  66. cd "${TS}/w"
  67. sed -i -e '/#include <libutil.h>/d' w.c || die
  68. echo "in ${TS}/w:"
  69. echo "$(tc-getCC) ${flags[@]} -DHAVE_UTMPX=1 -lresolv -o w w.c pr_time.c proc_compare.c"
  70. $(tc-getCC) ${flags[@]} -DHAVE_UTMPX=1 -lresolv -o w w.c pr_time.c proc_compare.c \
  71. || die "failed to compile w"
  72. TS=${S}/developer_cmds-${DEV_VER}
  73. # only pick those tools that do not conflict (no ctags and indent)
  74. # do not install lorder, mkdep and vgrind as they are a non-prefix-aware
  75. # shell scripts
  76. # don't install rpcgen, as it is heavily related to the OS it runs
  77. # on (and this is the Snow Leopard version)
  78. for t in asa hexdump unifdef what ; do
  79. echo "in ${TS}/${t}:"
  80. cd "${TS}/${t}" || die
  81. echo "$(tc-getCC) ${flags[@]} -o ${t}" *.c
  82. $(tc-getCC) ${flags[@]} -o ${t} *.c || die "failed to compile $t"
  83. done
  84. }
  85. src_install() {
  86. mkdir -p "${ED}"/bin
  87. mkdir -p "${ED}"/usr/bin
  88. local TS=${S}/misc_cmds-${MISC_VER}
  89. for t in leave units calendar ; do
  90. cp "${TS}/${t}/${t}" "${ED}"/usr/bin/
  91. doman "${TS}/${t}/${t}.1"
  92. done
  93. # copy cal separately
  94. cp "${TS}/ncal/cal" "${ED}"/usr/bin/
  95. dosym /usr/bin/cal /usr/bin/ncal
  96. doman "${TS}/ncal/ncal.1"
  97. dosym /usr/share/man/man1/ncal.1 /usr/share/man/man1/cal.1
  98. TS=${S}/shell_cmds-${SHELL_VER}
  99. for t in \
  100. alias apply getopt jot killall lastcomm \
  101. renice script shlock time w whereis;
  102. do
  103. cp "${TS}/${t}/${t}" "${ED}"/usr/bin/
  104. [[ -f "${TS}/${t}/${t}.1" ]] && doman "${TS}/${t}/${t}.1"
  105. [[ -f "${TS}/${t}/${t}.8" ]] && doman "${TS}/${t}/${t}.8"
  106. done
  107. cp "${TS}/w/w" "${ED}"/usr/bin/uptime
  108. doman "${TS}/w/uptime.1"
  109. for t in hostname kill; do
  110. cp "${TS}/${t}/${t}" "${ED}"/bin/
  111. doman "${TS}/${t}/${t}.1"
  112. done
  113. TS=${S}/developer_cmds-${DEV_VER}
  114. for t in asa hexdump unifdef what ; do
  115. cp "${TS}/${t}/${t}" "${ED}"/usr/bin/
  116. doman "${TS}/${t}/${t}.1"
  117. done
  118. }