baselayout-prefix-1.12.5-r11.ebuild 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=3
  4. inherit eutils toolchain-funcs multilib prefix flag-o-matic user
  5. # baselayout-prefix-1.12.5.1694.tar.bz2
  6. PVER=1701
  7. DESCRIPTION="Baselayout for Gentoo Prefix installs"
  8. HOMEPAGE="https://prefix.gentoo.org/"
  9. SRC_URI="https://dev.gentoo.org/~grobian/distfiles/${P}.${PVER}.tar.bz2"
  10. LICENSE="GPL-2"
  11. SLOT="0"
  12. KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
  13. IUSE="prefix-chaining"
  14. DEPEND=">=sys-apps/portage-2.2.01"
  15. RDEPEND=">=sys-libs/readline-5.0-r1
  16. >=app-shells/bash-3.1_p7
  17. >=sys-apps/coreutils-5.2.1
  18. kernel_Darwin? ( sys-process/pidof-bsd )
  19. kernel_FreeBSD? ( sys-process/pidof-bsd )"
  20. S=${WORKDIR}/${P}.${PVER}
  21. src_prepare() {
  22. if use prefix-chaining; then
  23. epatch "${S}"/baselayout-1.12.5-prefix-chaining.patch
  24. # need to set the PKG_CONFIG_PATH globally for this prefix, when
  25. # chaining is enabled, since pkg-config may not be installed locally,
  26. # but still .pc files should be found for all RDEPENDable prefixes in
  27. # the chain.
  28. echo "PKG_CONFIG_PATH=\"${EPREFIX}/usr/lib/pkgconfig:${EPREFIX}/usr/share/pkgconfig\"" >> "${S}"/etc/env.d/00basic
  29. fi
  30. # The consoletype application in this form will only work on Linux
  31. [[ ${CHOST} == *-linux-* ]] || epatch "${FILESDIR}"/${P/-prefix/}-prefix-no-consoletype.patch
  32. cd "${S}"
  33. eprefixify \
  34. etc/env.d/00basic \
  35. etc/profile \
  36. sbin/env-update.sh \
  37. sbin/functions.sh \
  38. sbin/runscript.sh \
  39. src/runscript.c \
  40. sbin/depscan.sh \
  41. sbin/rc-daemon.sh \
  42. sbin/rc-services.sh
  43. # add the host OS MANPATH
  44. echo 'MANPATH="/usr/share/man"' > etc/env.d/99basic || die "can't make file"
  45. }
  46. src_configure() {
  47. cd gnulib || die
  48. default
  49. }
  50. src_compile() {
  51. # build gnulib first
  52. pushd gnulib > /dev/null || die
  53. emake || die "Cannot build gnulib"
  54. popd > /dev/null
  55. # use gnulib
  56. append-flags -I../gnulib -I../gnulib/gllib
  57. append-ldflags -L../gnulib/gllib
  58. append-libs gnu
  59. local libdir="lib"
  60. [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
  61. make -C "${S}"/src \
  62. CC="$(tc-getCC)" \
  63. LD="$(tc-getCC) ${LDFLAGS}" \
  64. CFLAGS="${CFLAGS}" \
  65. LIBDIR="${libdir}" || die
  66. }
  67. src_install() {
  68. local dir libdirs libdirs_env rcscripts_dir
  69. dodir /etc
  70. dodir /etc/env.d
  71. dodir /etc/init.d # .keep file might mess up init.d stuff
  72. libdirs=$(get_all_libdirs)
  73. : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
  74. rcscripts_dir="/lib/rcscripts"
  75. for dir in ${libdirs}; do
  76. libdirs_env=${libdirs_env:+$libdirs_env:}/${dir}:/usr/${dir}:/usr/local/${dir}
  77. [[ ${dir} == "lib" && ${SYMLINK_LIB} == "yes" ]] && continue
  78. dodir /"${dir}"
  79. dodir /usr/"${dir}"
  80. dodir /usr/local/"${dir}"
  81. done
  82. # Ugly compatibility with stupid ebuilds and old profiles symlinks
  83. if [[ ${SYMLINK_LIB} == "yes" ]] ; then
  84. rm -r "${ED}"/{lib,usr/lib,usr/local/lib} &> /dev/null
  85. dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /lib
  86. dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/lib
  87. dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/local/lib
  88. fi
  89. # FHS compatibility symlinks stuff
  90. dosym /var/tmp /usr/tmp
  91. # rc-scripts version for testing of features that *should* be present
  92. echo "Gentoo Prefix Base System version ${PV}" > ${ED}/etc/gentoo-release
  93. # get the basic stuff in there
  94. doenvd "${S}"/etc/env.d/* || die "doenvd"
  95. # copy the profile
  96. cp "${S}"/etc/profile "${ED}"/etc/profile
  97. # Setup files in /sbin
  98. #
  99. cd "${S}"/sbin
  100. into /
  101. # These moved from /etc/init.d/ to /sbin to help newb systems
  102. # from breaking
  103. dosbin runscript.sh functions.sh
  104. # Compat symlinks between /etc/init.d and /sbin
  105. # (some stuff have hardcoded paths)
  106. dosym ../../sbin/depscan.sh /etc/init.d/depscan.sh
  107. dosym ../../sbin/runscript.sh /etc/init.d/runscript.sh
  108. dosym ../../sbin/functions.sh /etc/init.d/functions.sh
  109. cd "${S}"/sbin
  110. into /
  111. dosbin depscan.sh
  112. dosbin env-update.sh
  113. insinto ${rcscripts_dir}/awk
  114. doins "${S}"/src/awk/functions.awk
  115. #
  116. # Install baselayout utilities
  117. #
  118. local libdir="lib"
  119. [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
  120. cd "${S}"/src
  121. make DESTDIR="${ED}" LIBDIR="${libdir}" install || die
  122. insinto ${rcscripts_dir}/sh
  123. doins "${S}"/sbin/rc-*
  124. }
  125. pkg_postinst() {
  126. if [[ ${EUID} == 0 ]] ; then
  127. # setup portage user, such that things that require root privs
  128. # don't fail, bug #321623
  129. enewgroup portage 250
  130. enewuser portage 250 -1 "${EPREFIX}"/var/tmp/portage portage
  131. fi
  132. # This is also written in src_install (so it's in CONTENTS), but
  133. # write it here so that the new version is immediately in the file
  134. # (without waiting for the user to do etc-update)
  135. rm -f "${EROOT}"/etc/._cfg????_gentoo-release
  136. echo "Gentoo Prefix Base System version ${PV}" > "${EROOT}"/etc/gentoo-release
  137. echo
  138. einfo "Please be sure to update all pending '._cfg*' files in /etc,"
  139. einfo "else things might break! You can use 'etc-update'"
  140. einfo "to accomplish this:"
  141. einfo
  142. einfo " # etc-update"
  143. echo
  144. }