fte-20110708-r1.ebuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit eutils toolchain-funcs
  5. DESCRIPTION="Lightweight text-mode editor"
  6. HOMEPAGE="http://fte.sourceforge.net"
  7. SRC_URI="
  8. mirror://sourceforge/${PN}/${P}-src.zip
  9. mirror://sourceforge/${PN}/${P}-common.zip"
  10. LICENSE="|| ( GPL-2 Artistic )"
  11. SLOT="0"
  12. KEYWORDS="~alpha ~amd64 ~ppc -sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
  13. IUSE="gpm slang X"
  14. S="${WORKDIR}/${PN}"
  15. RDEPEND="
  16. sys-libs/ncurses:0=
  17. X? (
  18. x11-libs/libXdmcp
  19. x11-libs/libXau
  20. x11-libs/libX11
  21. x11-libs/libXpm
  22. )
  23. gpm? ( >=sys-libs/gpm-1.20 )"
  24. DEPEND="${RDEPEND}
  25. slang? ( >=sys-libs/slang-2.1.3 )
  26. app-arch/unzip"
  27. HTML_DOCS=( doc/. )
  28. set_targets() {
  29. export TARGETS=""
  30. use slang && TARGETS="${TARGETS} s${PN}"
  31. use X && TARGETS="${TARGETS} x${PN}"
  32. [[ ${CHOST} == *-linux-gnu* ]] \
  33. && TARGETS="${TARGETS} v${PN}" \
  34. || TARGETS="${TARGETS} n${PN}"
  35. }
  36. src_prepare() {
  37. default
  38. if [[ -e "${EPREFIX}"/usr/include/linux/keyboard.h ]]; then
  39. sed "${EPREFIX}"/usr/include/linux/keyboard.h \
  40. -e '/wait.h/d' > src/hacked_keyboard.h || die
  41. fi
  42. sed \
  43. -e "s:<linux/keyboard.h>:\"hacked_keyboard.h\":" \
  44. -i src/con_linux.cpp || die "sed keyboard"
  45. sed \
  46. -e 's:^OPTIMIZE:#&:g' \
  47. -e '/^LDFLAGS/s:=:+=:g' \
  48. -e 's:= g++:= $(CXX):g' \
  49. -i src/${PN}-unix.mak || die "sed CFLAGS, LDFLAGS, CC"
  50. ecvs_clean
  51. }
  52. src_configure() {
  53. set_targets
  54. sed \
  55. -e "s:@targets@:${TARGETS}:" \
  56. -e '/^XINCDIR =/c\XINCDIR =' \
  57. -e '/^XLIBDIR =/c\XLIBDIR = -lstdc++' \
  58. -e '/^SINCDIR =/c\SINCDIR = -I'"${EPREFIX}"'/usr/include/slang' \
  59. -i src/${PN}-unix.mak || die "sed targets"
  60. if ! use gpm; then
  61. sed \
  62. -e "s:#define USE_GPM://#define USE_GPM:" \
  63. -i src/con_linux.cpp || die "sed USE_GPM"
  64. sed \
  65. -e "s:-lgpm::" \
  66. -i src/fte-unix.mak || die "sed -lgpm"
  67. fi
  68. }
  69. src_compile() {
  70. local os="-DLINUX" # by now the default in makefile
  71. [[ ${CHOST} == *-interix* ]] && os=
  72. DEFFLAGS="PREFIX='${EPREFIX}'/usr CONFIGDIR='${EPREFIX}'/usr/share/${PN} \
  73. DEFAULT_FTE_CONFIG=../config/main.${PN} UOS=${os}"
  74. set_targets
  75. emake CXX="$(tc-getCXX)" OPTIMIZE="${CXXFLAGS}" "${DEFFLAGS}" TARGETS="${TARGETS}" all
  76. }
  77. src_install() {
  78. keepdir /etc/${PN}
  79. into /usr
  80. set_targets
  81. local i files="${TARGETS} c${PN}"
  82. for i in ${files}; do
  83. dobin src/${i}
  84. done
  85. dobin "${FILESDIR}/${PN}"
  86. einstalldocs
  87. insinto /usr/share/${PN}
  88. doins -r config/.
  89. }
  90. pkg_postinst() {
  91. ebegin "Compiling configuration"
  92. cd "${EPREFIX}"/usr/share/${PN} || die "missing configuration dir"
  93. "${EPREFIX}"/usr/bin/c${PN} main.${PN} "${EPREFIX}"/etc/${PN}/system.${PN}rc || die
  94. eend $?
  95. }