predict-2.2.3-r2.ebuild 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit autotools toolchain-funcs
  5. DEB_P=${PN}_${PV}
  6. DEB_PR=3.1
  7. DESCRIPTION="Satellite tracking and orbital prediction"
  8. HOMEPAGE="http://www.qsl.net/kd2bd/predict.html"
  9. SRC_URI="mirror://debian/pool/main/${PN:0:1}/${PN}/${DEB_P}.orig.tar.gz
  10. mirror://debian/pool/main/${PN:0:1}/${PN}/${DEB_P}-${DEB_PR}.diff.gz"
  11. LICENSE="GPL-2"
  12. SLOT="0"
  13. IUSE="doc gtk nls xforms xplanet"
  14. KEYWORDS="amd64 ~ppc x86 ~amd64-linux ~x86-linux"
  15. RDEPEND="sys-libs/ncurses:0=
  16. gtk? ( x11-libs/gtk+:2 )
  17. xforms? ( x11-libs/xforms )
  18. xplanet? ( x11-misc/xplanet[truetype] )"
  19. DEPEND="${RDEPEND}"
  20. PATCHES=(
  21. "${FILESDIR}"/"${P}"-earthtrack.patch
  22. "${WORKDIR}"/${DEB_P}-${DEB_PR}.diff
  23. )
  24. src_prepare() {
  25. default
  26. sed -i -e 's:predict\(.*\)/:predict-2.2.3\1/:g' \
  27. debian/patches/140*.diff || die
  28. sed -i -e 's:\(a\|b\)/:predict-2.2.3/:g' \
  29. debian/patches/180*.diff || die
  30. eapply debian/patches/.
  31. # fix some further array out of bounds errors
  32. sed -i -e "s/satname\[ 26/satname\[ 25/g" \
  33. clients/gsat-1.1.0/src/db.c || die
  34. sed -i -e "s/satname\[ 26/satname\[ 25/g" \
  35. clients/gsat-1.1.0/src/comms.c || die
  36. sed -i -e "s/output\[20\];/output[21];/" \
  37. utils/moontracker/moontracker.c || die
  38. # fix underlinking
  39. sed -i -e '/AC_OUTPUT/i \
  40. AC_SEARCH_LIBS([cos], [m]) \
  41. AC_SEARCH_LIBS([dlclose], [dl])' \
  42. -e 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' \
  43. -e 's/configure.in/configure.ac/' \
  44. clients/gsat-1.1.0/configure.in || die
  45. mv clients/gsat-1.1.0/configure.{in,ac} || die
  46. sed -i \
  47. -e 's/gcc/$(CC) $(CFLAGS) $(LDFLAGS)/g' \
  48. -e 's/-o/-lm -o/g' \
  49. clients/gsat-1.1.0/plugins/Makefile || die
  50. # fix the hardcoded /usr/lib
  51. PRED_DIR=/usr/$(get_libdir)/${PN}
  52. sed -i -e "s:/usr/lib/${PN}:${EPREFIX}/${PRED_DIR}:g" \
  53. predict.h vocalizer/vocalizer.c || die
  54. sed -i -e "s:/usr/lib:${EPREFIX}/usr/$(get_libdir):g" \
  55. clients/gsat-1.1.0/src/globals.h || die
  56. if use gtk; then
  57. cd "${S}"/clients/gsat-* || die
  58. rm config.sub missing || die
  59. eautoreconf
  60. fi
  61. }
  62. src_configure() {
  63. if use gtk; then
  64. cd "${S}"/clients/gsat-* || die
  65. econf $(use_enable nls)
  66. fi
  67. }
  68. src_compile() {
  69. # predict uses a ncurses based configure script
  70. # this is what it does if it was bash based ;)
  71. local COMPILER="$(tc-getCC) ${CFLAGS} ${LDFLAGS}"
  72. einfo "Compiling predict"
  73. ${COMPILER} predict.c -lm $($(tc-getPKG_CONFIG) --libs ncurses) -lpthread \
  74. -o predict || die "failed predict"
  75. einfo "Compiling predict-g1yyh"
  76. ${COMPILER} predict-g1yyh.c -lm $($(tc-getPKG_CONFIG) --libs ncurses) -lpthread -lmenu \
  77. -o predict-g1yyh || die "failed predict-g1yyh"
  78. einfo "Compiling vocalizer"
  79. ${COMPILER} vocalizer/vocalizer.c \
  80. -o vocalizer/vocalizer || die "failed vocalizer"
  81. local c
  82. for c in fodtrack geosat moontracker; do
  83. einfo "Compiling ${c}"
  84. cd "${S}"/utils/${c}* || die
  85. ${COMPILER} ${c}.c -lm -o ${c} || die "failed ${c}"
  86. done
  87. einfo "Compiling kep_reload"
  88. cd "${S}"/clients/kep_reload
  89. ${COMPILER} kep_reload.c \
  90. -o kep_reload || die "failed kep_reload"
  91. if use xplanet; then
  92. einfo "Compiling earthtrack"
  93. cd "${S}"/clients/earthtrack || die
  94. ${COMPILER} earthtrack.c \
  95. -lm -o earthtrack || die "failed earthtrack"
  96. fi
  97. if use xforms; then
  98. einfo "Compiling map"
  99. cd "${S}"/clients/map || die
  100. ${COMPILER} map.c map_cb.c map_main.c -lforms -lX11 -lm \
  101. -o map || die "Failed compiling map"
  102. fi
  103. if use gtk; then
  104. einfo "Compiling gsat"
  105. cd "${S}"/clients/gsat-* || die
  106. emake
  107. emake -C plugins
  108. fi
  109. }
  110. src_install() {
  111. dobin predict predict-g1yyh "${FILESDIR}"/predict-update
  112. dodoc CHANGES CREDITS HISTORY README NEWS debian/README.Debian
  113. doman docs/man/predict.1
  114. newman debian/predict-g1yyh.man predict-g1yyh.1
  115. insinto ${PRED_DIR}/default
  116. doins default/predict.*
  117. use doc && dodoc docs/pdf/predict.pdf
  118. cd "${S}"/vocalizer || die
  119. dobin vocalizer
  120. dosym ../../../bin/vocalizer ${PRED_DIR}/vocalizer/vocalizer
  121. insinto ${PRED_DIR}/vocalizer
  122. doins *.wav
  123. cd "${S}"/clients/kep_reload || die
  124. dobin kep_reload
  125. newdoc README README.kep_reload
  126. doman "${S}"/debian/kep_reload.1
  127. cd "${S}"/utils/fodtrack-0.1 || die
  128. insinto /etc
  129. doins fodtrack.conf
  130. doman fodtrack.conf.5 fodtrack.8
  131. dobin fodtrack
  132. newdoc README README.fodtrack
  133. cd "${S}"/utils/geosat || die
  134. dobin geosat
  135. newdoc README README.geosa
  136. newman "${S}"/debian/geosat.man geosat.1
  137. cd "${S}"/utils/moontracker || die
  138. dobin moontracker
  139. newdoc README README.moontracker
  140. doman "${S}"/debian/moontracker.1
  141. if use xplanet; then
  142. cd "${S}"/clients/earthtrack || die
  143. ln -s earthtrack earthtrack2 || die
  144. dobin earthtrack earthtrack2
  145. newdoc README README.earthtrack
  146. doman "${S}"/debian/earthtrack.1
  147. fi
  148. if use xforms; then
  149. cd "${S}"/clients/map || die
  150. newbin map predict-map
  151. newdoc CHANGES CHANGES.map
  152. newdoc README README.map
  153. doman "${S}"/debian/predict-map.1
  154. fi
  155. if use gtk; then
  156. cd "${S}"/clients/gsat-* || die
  157. exeinto /usr/$(get_libdir)/gsat/plugins
  158. doexe plugins/radio_{FT736,FT847,ICR10,print,test} plugins/rotor_{print,pictrack}
  159. dobin src/gsat
  160. doman "${S}"/debian/gsat.1
  161. local i
  162. for i in AUTHORS ChangeLog NEWS README Plugin_API; do
  163. newdoc ${i} ${i}.gsat
  164. done
  165. fi
  166. }
  167. pkg_postinst() {
  168. einfo "To use the clients the following line will"
  169. einfo "have to be inserted into /etc/services"
  170. einfo "predict 1210/udp"
  171. einfo "The port can be changed to anything"
  172. einfo "the name predict is what is needed to work"
  173. einfo "after that is set run 'predict -s'"
  174. einfo ""
  175. einfo "To get list of satellites run 'predict-update'"
  176. einfo "before running predict this script will also update"
  177. einfo "the list of satellites so they are up to date."
  178. }