slib-3.2.2.ebuild 4.0 KB

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