Wuodan0

dev-lang/peg-multimarkdown/peg-multimarkdown-9999.ebuild

Jun 12th, 2012
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. # Copyright 1999-2012 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: $
  4.  
  5. EAPI=0
  6.  
  7. # project is hosted on github.com, so git-2 is needed (git is deprecated)
  8. inherit git-2
  9.  
  10. DESCRIPTION="MMD is a superset of the Markdown syntax (more syntax features & output formats)"
  11. HOMEPAGE="http://http://fletcherpenney.net/multimarkdown"
  12. EGIT_REPO_URI="git://github.com/fletcher/peg-multimarkdown.git"
  13. SRC_URI=""
  14.  
  15. LICENSE="GPL-2"
  16. SLOT="0"
  17. KEYWORDS="~amd64"
  18.  
  19. # USE flags
  20. IUSE="test latex xslt"
  21.  
  22. # basic depenedencies
  23. DEPEND=""
  24. RDEPEND="${DEPEND}"
  25.  
  26. # conditional dependencies
  27. DEPEND="${DEPEND}
  28. test? ( dev-lang/perl app-text/htmltidy )"
  29. RDEPEND="${RDEPEND}
  30. latex? ( dev-lang/perl )
  31. xslt? ( dev-lang/perl )"
  32. if use test || use latex || use xslt ; then
  33. # we also need the sub-modules, this triggers it in git-2.eclass
  34. EGIT_HAS_SUBMODULES="Y"
  35. fi
  36.  
  37. # custom variables
  38. DESTINATION_DIR="usr/bin"
  39. SCRIPTS_LIST="mmd mmd2tex mmd2opml mmd2odf"
  40. # mmd2all mmd2pdf are excluded
  41.  
  42. src_test()
  43. {
  44. einfo "Now running tests for package ${PN}"
  45. einfo "It is considered \"normal\" for some tests to fails, but at least one should pass ..."
  46. # the Makefile does not have a check-target, but let's leave it in here
  47. for test_phase in check test mmd-test compat-test latex-test ; do
  48. # only run the latex test with latex use flag
  49. if [ "$test_phase" != "latex-test" ] || use latex ; then
  50. if emake -j1 $test_phase -n &> /dev/null; then
  51. einfo ">>> Test phase 2 [${test_phase}]: ${CATEGORY}/${PF}"
  52. if ! emake -j1 $test_phase; then
  53. hasq test $FEATURES && die "Make ${test_phase} failed. See above for details."
  54. hasq test $FEATURES || eerror "Make ${test_phase} failed. See above for details."
  55. fi
  56. fi
  57. fi
  58. done
  59. einfo "Done running tests for package ${PN}"
  60. }
  61.  
  62. src_install()
  63. {
  64. insinto ${DESTINATION_DIR}
  65. einfo "Installing multimarkdown to ${ROOT}${DESTINATION_DIR}/multimarkdown ..."
  66. dobin multimarkdown || die "Install failed"
  67. exeinto ${DESTINATION_DIR}
  68. for file in ${SCRIPTS_LIST}; do
  69. einfo "Installing ${file} to ${ROOT}${DESTINATION_DIR}/${file} ..."
  70. doexe scripts/${file} || ewarn "Installation of script ${file} failed!"
  71. done
  72. }
  73.  
  74. pkg_postinst()
  75. {
  76. ewarn "This ebuild is in alpha state!"
  77. ewarn "Use it at your own risk ..."
  78. elog "May the moon shine upon you ..."
  79. }
  80.  
  81. pkg_config()
  82. {
  83. # these messages seem not to go to normal log, einfo does the same, does it?
  84. elog "Starting configuration of ${PN}"
  85. # check if binary executable was installed
  86. if [ ! -x "${ROOT}${DESTINATION_DIR}/multimarkdown" ]; then
  87. ewarn "Installation of ${PN} failed"
  88. ewarn "Missing executable in ${ROOT}${DESTINATION_DIR}/multimarkdown"
  89. die "Previus installation of ${PN} failed"
  90. else
  91. einfo "multimarkdown binary installed in ${ROOT}${DESTINATION_DIR}/multimarkdown, displaying version"
  92. einfo "*** version start"
  93. einfo `${ROOT}${DESTINATION_DIR}/multimarkdown -v`
  94. einfo "*** version end"
  95. fi
  96. # check for the extra scripts
  97. einfo "${PN} comes with some extra scripts. They are not necessary for the programm itself, but serve as shortcuts, see http://fletcherpenney.net/multimarkdown/use/"
  98. einfo "You will now be asked if you want to keep these scripts or not:"
  99. for file in mmd mmd2tex mmd2opml mmd2odf; do
  100. if [ ! -x "${ROOT}${DESTINATION_DIR}/${file}" ]; then
  101. elog "${file} not found in ${ROOT}${DESTINATION_DIR}/${file}, it was previously removed."
  102. else
  103. # this seems to be bash4 syntax
  104. elog "${file} found in ${ROOT}${DESTINATION_DIR}/${file}."
  105. read -e -p "Do you want to keep the script at ${ROOT}${DESTINATION_DIR}/${file} [Y/n]?" -i "Y" keep_script
  106. if [ "${keep_script}" == "n" ]; then
  107. rm ${ROOT}${DESTINATION_DIR}/${file}
  108. elog "Removed script at ${ROOT}${DESTINATION_DIR}/${file}"
  109. fi
  110. fi
  111. done
  112. elog "Ending configuration of ${PN}"
  113. }
  114.  
  115. pkg_info()
  116. {
  117. ${ROOT}${DESTINATION_DIR}/multimarkdown -v
  118. }
Advertisement
Add Comment
Please, Sign In to add comment