PEAR-PEAR-1.10.3-r1.ebuild 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. MY_PN="${PN/PEAR-/}"
  5. MY_P="${MY_PN}-${PV}"
  6. DESCRIPTION="PEAR Base System"
  7. HOMEPAGE="http://pear.php.net/package/${MY_PN}"
  8. SRC_URI="http://pear.php.net/get/${MY_P}.tgz"
  9. LICENSE="MIT"
  10. KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
  11. SLOT="0"
  12. IUSE=""
  13. DEPEND=""
  14. RDEPEND="dev-lang/php:*[cli,xml,zlib]
  15. >=dev-php/PEAR-Archive_Tar-1.4.0
  16. >=dev-php/PEAR-Console_Getopt-1.4.1
  17. >=dev-php/PEAR-Structures_Graph-1.1.0
  18. >=dev-php/PEAR-XML_Util-1.3.0"
  19. S="${WORKDIR}/${MY_P}"
  20. PATCHES=( "${FILESDIR}/gentoo-libtool-mismatch-fix-v2.patch" )
  21. pkg_setup() {
  22. [[ -z "${PEAR_CACHEDIR}" ]] && PEAR_CACHEDIR="${EPREFIX}/var/cache/pear"
  23. [[ -z "${PEAR_DOWNLOADDIR}" ]] && PEAR_DOWNLOADDIR="${EPREFIX}/var/tmp/pear"
  24. [[ -z "${PEAR_TEMPDIR}" ]] && PEAR_TEMPDIR="${EPREFIX}/tmp"
  25. elog
  26. elog "cache_dir is set to: ${PEAR_CACHEDIR}"
  27. elog "download_dir is set to: ${PEAR_DOWNLOADDIR}"
  28. elog "temp_dir is set to: ${PEAR_TEMPDIR}"
  29. elog
  30. elog "If you want to change the above values, you need to set"
  31. elog "PEAR_CACHEDIR, PEAR_DOWNLOADDIR and PEAR_TEMPDIR variable(s)"
  32. elog "accordingly in /etc/portage/make.conf and re-emerge ${PN}."
  33. elog
  34. }
  35. src_install() {
  36. insinto /usr/share/php
  37. doins -r PEAR/
  38. doins -r OS/
  39. doins PEAR.php System.php
  40. doins scripts/pearcmd.php
  41. doins scripts/peclcmd.php
  42. newbin scripts/pear.sh pear
  43. newbin scripts/peardev.sh peardev
  44. newbin scripts/pecl.sh pecl
  45. # adjust some scripts for current version
  46. [[ -z "${PEAR}" ]] && PEAR="${PV}"
  47. for i in pearcmd.php peclcmd.php ; do
  48. sed "s:@pear_version@:${PEAR}:g" -i "${D}/usr/share/php/${i}" \
  49. || die "failed to sed pear_version"
  50. done
  51. for i in pear peardev pecl ; do
  52. sed "s:@bin_dir@:${EPREFIX}/usr/bin:g" -i "${D}/usr/bin/${i}" \
  53. || die "failed to sed @bin_dir@ in ${i}"
  54. sed "s:@php_dir@:${EPREFIX}/usr/share/php:g" -i "${D}/usr/bin/${i}" \
  55. || die "failed to sed @php_dir@ in ${i}"
  56. done
  57. sed "s:-d output_buffering=1:-d output_buffering=1 -d memory_limit=32M:g" \
  58. -i "${D}/usr/bin/pear" \
  59. || die "failed to set PHP ini values in pear executable"
  60. sed "s:@package_version@:${PEAR}:g" \
  61. -i "${D}/usr/share/php/PEAR/Command/Package.php" \
  62. || die "failed to sed @package_version@"
  63. sed "s:@PEAR-VER@:${PEAR}:g" \
  64. -i "${D}/usr/share/php/PEAR/Dependency2.php" \
  65. || die "failed to sed @PEAR-VER@ in Dependency2.php"
  66. sed "s:@PEAR-VER@:${PEAR}:g" \
  67. -i "${D}/usr/share/php/PEAR/PackageFile/Parser/v1.php" \
  68. || die "failed to sed @PEAR-VER@ in v1.php"
  69. sed "s:@PEAR-VER@:${PEAR}:g" \
  70. -i "${D}/usr/share/php/PEAR/PackageFile/Parser/v2.php" \
  71. || die "failed to sed @PEAR-VER@ in v2.php"
  72. # finalize install
  73. insinto /etc
  74. newins "${FILESDIR}"/pear.conf-r2 pear.conf
  75. sed "s|s:PHPCLILEN:\"PHPCLI\"|s:${#PHPCLI}:\"${PHPCLI}\"|g" \
  76. -i "${D}/etc/pear.conf" \
  77. || die "failed to sed PHPCLILEN in pear.conf"
  78. sed "s|s:CACHEDIRLEN:\"CACHEDIR\"|s:${#PEAR_CACHEDIR}:\"${PEAR_CACHEDIR}\"|g" \
  79. -i "${D}/etc/pear.conf" \
  80. || die "failed to sed CACHEDIRLEN in pear.conf"
  81. sed "s|s:DOWNLOADDIRLEN:\"DOWNLOADDIR\"|s:${#PEAR_DOWNLOADDIR}:\"${PEAR_DOWNLOADDIR}\"|g" \
  82. -i "${D}/etc/pear.conf" \
  83. || die "failed to sed DOWNLOADDIRLEN in pear.conf"
  84. sed "s|s:TEMPDIRLEN:\"TEMPDIR\"|s:${#PEAR_TEMPDIR}:\"${PEAR_TEMPDIR}\"|g" \
  85. -i "${D}/etc/pear.conf" \
  86. || die "failed to sed TEMPDIRLEN in pear.conf"
  87. # Change the paths for eprefix!
  88. sed "s|s:19:\"/usr/share/php/docs\"|s:$(( ${#EPREFIX}+19 )):\"${EPREFIX}/usr/share/php/docs\"|g" \
  89. -i "${D}/etc/pear.conf" \
  90. || die "failed to sed the docs path (prefix) in pear.conf"
  91. sed "s|s:19:\"/usr/share/php/data\"|s:$(( ${#EPREFIX}+19 )):\"${EPREFIX}/usr/share/php/data\"|g" \
  92. -i "${D}/etc/pear.conf" \
  93. || die "failed to sed the data path (prefix) in pear.conf"
  94. sed "s|s:20:\"/usr/share/php/tests\"|s:$(( ${#EPREFIX}+20 )):\"${EPREFIX}/usr/share/php/tests\"|g" \
  95. -i "${D}/etc/pear.conf" \
  96. || die "failed to sed the tests path (prefix) in pear.conf"
  97. sed "s|s:14:\"/usr/share/php\"|s:$(( ${#EPREFIX}+14 )):\"${EPREFIX}/usr/share/php\"|g" \
  98. -i "${D}/etc/pear.conf" \
  99. || die "failed to sed the PHP include path (prefix) in pear.conf"
  100. sed "s|s:8:\"/usr/bin\"|s:$(( ${#EPREFIX}+8 )):\"${EPREFIX}/usr/bin\"|g" \
  101. -i "${D}/etc/pear.conf" \
  102. || die "failed to sed the bin path (prefix) in pear.conf"
  103. [[ "${PEAR_TEMPDIR}" != "/tmp" ]] && keepdir "${PEAR_TEMPDIR#${EPREFIX}}"
  104. keepdir "${PEAR_CACHEDIR#${EPREFIX}}"
  105. diropts -m1777
  106. keepdir "${PEAR_DOWNLOADDIR#${EPREFIX}}"
  107. insinto /usr/share/php/.packagexml
  108. newins "${WORKDIR}/package.xml" "${MY_P}.xml"
  109. }
  110. pkg_postinst() {
  111. pear clear-cache || die "failed to clear PEAR cache"
  112. # Update PEAR/PECL channels as needed, add new ones to the list if needed
  113. elog "Updating PEAR/PECL channels"
  114. local pearchans="pear.php.net pecl.php.net pear.phing.info "
  115. pearchans+="pear.symfony-project.com"
  116. for chan in ${pearchans} ; do
  117. # The first command may fail if, for example, the channels have
  118. # already been initialized.
  119. pear channel-discover ${chan}
  120. pear channel-update ${chan} || die "failed to update channels: ${chan}"
  121. done
  122. # Register the package from the package.xml file
  123. # It is not critical to complete so only warn on failure
  124. if [[ -f "${EROOT}usr/share/php/.packagexml/${MY_P}.xml" ]] ; then
  125. "${EROOT}usr/bin/peardev" install -nrO --force \
  126. "${EROOT}usr/share/php/.packagexml/${MY_P}.xml" 2> /dev/null \
  127. || ewarn "Failed to insert package into local PEAR database"
  128. fi
  129. }
  130. pkg_prerm() {
  131. # Uninstall known dependency
  132. "${EROOT}usr/bin/peardev" uninstall -nrO "pear.php.net/PEAR"
  133. }