baselayout-prefix-1.12.14-r1.ebuild 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. # last part in e.g. 1.12.14.1704
  6. PVER=1709
  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-${PV}-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. cd "${S}"
  31. eprefixify \
  32. etc/env.d/00basic \
  33. etc/profile
  34. # add the host OS MANPATH
  35. echo 'MANPATH="/usr/share/man"' > etc/env.d/99basic || die "can't make file"
  36. # avoid a re-automake run
  37. touch -r gnulib/configure.ac gnulib/Makefile.in gnulib/aclocal.m4 || die
  38. }
  39. src_configure() {
  40. cd gnulib || die
  41. default
  42. }
  43. src_compile() {
  44. # build gnulib first
  45. pushd gnulib > /dev/null || die
  46. emake || die "Cannot build gnulib"
  47. popd > /dev/null
  48. # use gnulib (buildsystem doesn't respect cppflags)
  49. append-cflags -I../gnulib -I../gnulib/gllib
  50. append-ldflags -L../gnulib/gllib
  51. append-libs gnu
  52. local libdir="lib"
  53. [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
  54. }
  55. src_install() {
  56. local dir libdirs libdirs_env rcscripts_dir
  57. dodir /etc
  58. dodir /etc/env.d
  59. dodir /etc/init.d # .keep file might mess up init.d stuff
  60. libdirs=$(get_all_libdirs)
  61. : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
  62. rcscripts_dir="/lib/rcscripts"
  63. for dir in ${libdirs}; do
  64. libdirs_env=${libdirs_env:+$libdirs_env:}/${dir}:/usr/${dir}:/usr/local/${dir}
  65. [[ ${dir} == "lib" && ${SYMLINK_LIB} == "yes" ]] && continue
  66. dodir /"${dir}"
  67. dodir /usr/"${dir}"
  68. dodir /usr/local/"${dir}"
  69. done
  70. # Ugly compatibility with stupid ebuilds and old profiles symlinks
  71. if [[ ${SYMLINK_LIB} == "yes" ]] ; then
  72. rm -r "${ED}"/{lib,usr/lib,usr/local/lib} &> /dev/null
  73. dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /lib
  74. dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/lib
  75. dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/local/lib
  76. fi
  77. # FHS compatibility symlinks stuff
  78. dosym /var/tmp /usr/tmp
  79. # rc-scripts version for testing of features that *should* be present
  80. echo "Gentoo Prefix Base System version ${PV}" > ${ED}/etc/gentoo-release
  81. # get the basic stuff in there
  82. doenvd "${S}"/etc/env.d/* || die "doenvd"
  83. # copy the profile
  84. cp "${S}"/etc/profile "${ED}"/etc/profile
  85. # Setup files in /sbin
  86. #
  87. cd "${S}"/sbin
  88. into /
  89. # These moved from /etc/init.d/ to /sbin to help newb systems
  90. # from breaking
  91. #
  92. # Install baselayout utilities
  93. #
  94. local libdir="lib"
  95. [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
  96. }
  97. pkg_postinst() {
  98. if [[ ${EUID} == 0 ]] ; then
  99. # setup portage user, such that things that require root privs
  100. # don't fail, bug #321623
  101. enewgroup portage 250
  102. enewuser portage 250 -1 "${EPREFIX}"/var/tmp/portage portage
  103. fi
  104. # This is also written in src_install (so it's in CONTENTS), but
  105. # write it here so that the new version is immediately in the file
  106. # (without waiting for the user to do etc-update)
  107. rm -f "${EROOT}"/etc/._cfg????_gentoo-release
  108. echo "Gentoo Prefix Base System version ${PV}" > "${EROOT}"/etc/gentoo-release
  109. echo
  110. einfo "Please be sure to update all pending '._cfg*' files in /etc,"
  111. einfo "else things might break! You can use 'etc-update'"
  112. einfo "to accomplish this:"
  113. einfo
  114. einfo " # etc-update"
  115. echo
  116. }