slib-3.2.1.ebuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. # Copyright 1999-2008 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. inherit versionator eutils
  4. #version magic thanks to masterdriverz and UberLord using bash array instead of tr
  5. trarr="0abcdefghi"
  6. MY_PV="$(get_version_component_range 1)${trarr:$(get_version_component_range 2):1}$(get_version_component_range 3)"
  7. MY_P=${PN}-${MY_PV}
  8. S=${WORKDIR}/${PN}
  9. DESCRIPTION="library providing functions for Scheme implementations"
  10. SRC_URI="http://swiss.csail.mit.edu/ftpdir/scm/${MY_P}.zip"
  11. HOMEPAGE="http://swiss.csail.mit.edu/~jaffer/SLIB"
  12. SLOT="0"
  13. LICENSE="public-domain BSD"
  14. KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~sparc ~x86"
  15. IUSE="" #test"
  16. #unzip for unpacking
  17. RDEPEND=""
  18. DEPEND="app-arch/unzip"
  19. # test? ( dev-scheme/scm )"
  20. INSTALL_DIR="/usr/share/slib/"
  21. src_unpack() {
  22. unpack ${A}; cd "${S}"
  23. # cp Makefile Makefile.old
  24. sed "s:prefix = /usr/local/:prefix = ${D}/usr/:" -i Makefile
  25. sed 's:libdir = $(exec_prefix)lib/:libdir = $(exec_prefix)share/:' -i Makefile
  26. sed 's:man1dir = $(prefix)man/:man1dir = $(prefix)/share/man/:' -i Makefile
  27. sed 's:infodir = $(prefix)info/:infodir = $(prefix)share/info/:' -i Makefile
  28. sed 's:echo SCHEME_LIBRARY_PATH=$(libslibdir) >> $(bindir)slib:echo SCHEME_LIBRARY_PATH=/usr/share/slib/ >> $(bindir)slib:' -i Makefile
  29. # diff -u Makefile.old Makefile
  30. sed 's:(lambda () "/usr/local/share/gambc/")):(lambda () "/usr/share/gambit")):' -i gambit.init
  31. }
  32. src_compile() {
  33. emake || die "make failed"
  34. }
  35. #slib needs scm for tests, but scm needs slib so we can't depend on it
  36. src_test() {
  37. if has_version dev-scheme/scm; then
  38. make test || die "Make test failed. See above for details."
  39. else
  40. einfo "Skipping test, because dev-scheme/scm is not installed."
  41. fi
  42. }
  43. src_install() {
  44. emake infoz || die "infoz failed"
  45. emake install || die "install failed"
  46. dodoc ANNOUNCE ChangeLog FAQ README
  47. dodir /usr/share/gambit/
  48. more_install
  49. }
  50. more_install() {
  51. dosym ${INSTALL_DIR} /usr/share/guile/slib # link from guile dir
  52. dosym ${INSTALL_DIR} /usr/lib/slib
  53. dodir /etc/env.d/ && echo "SCHEME_LIBRARY_PATH=\"${INSTALL_DIR}\"" > "${D}"/etc/env.d/50slib
  54. mkdir "${S}"/installers
  55. pushd installers; make_installers; popd
  56. dosbin installers/*
  57. }
  58. pkg_postinst() {
  59. [ "${ROOT}" == "/" ] && pkg_config
  60. }
  61. IMPLEMENTATIONS="bigloo drscheme elk gambit guile scm" # mit-scheme
  62. pkg_config() {
  63. for impl in ${IMPLEMENTATIONS}; do
  64. install_slib ${impl}
  65. # echo '(slib:report-version)' | slib ${impl}
  66. done
  67. }
  68. make_load_expression() {
  69. echo "(load \\\"${INSTALL_DIR}$1.init\\\")"
  70. }
  71. make_installers()
  72. {
  73. PROGRAM="(require 'new-catalog) (slib:report-version)"
  74. bigloo_install_command="bigloo -s -eval \"(begin "$(make_load_expression bigloo)" ${PROGRAM} (exit))\""
  75. drscheme_install_command="mzscheme -vme \"(begin $(make_load_expression mzscheme) ${PROGRAM})\""
  76. elk_install_command="echo \"$(make_load_expression elk) ${PROGRAM}\" | elk -l -"
  77. gambit_install_command="gambit-interpreter -e \"$(make_load_expression gambit) ${PROGRAM}\""
  78. # guile_install_command="guile -c \"$(make_load_expression guile) ${PROGRAM}\""
  79. guile_install_command="guile -c \"(use-modules (ice-9 slib)) ${PROGRAM}\""
  80. #variable names may not contain hyphens (-)
  81. mitscheme_install_command="echo \"(set! load/suppress-loading-message? #t) $(make_load_expression mitscheme) ${PROGRAM}\" | mit-scheme --batch-mode"
  82. echo ${mitscheme_install_command}
  83. scm_install_command="scm -e \"${PROGRAM}\""
  84. for impl in ${IMPLEMENTATIONS}; do
  85. command_var=${impl//-/}_install_command
  86. make_installer ${impl} "${!command_var}"
  87. done
  88. }
  89. make_installer() {
  90. echo $2 > install_slib_for_${1//-/}
  91. }
  92. install_slib() {
  93. if has_version dev-scheme/$1; then
  94. script=install_slib_for_${1//-/}
  95. einfo "Registering slib with $1..."
  96. # echo running: $(cat /usr/sbin/${script})
  97. $script
  98. else
  99. einfo "$1 not installed, not registering..."
  100. fi
  101. }