baselayout-prefix-1.12.14.ebuild 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. # The consoletype application in this form will only work on Linux
  31. [[ ${CHOST} == *-linux-* ]] || epatch "${FILESDIR}"/baselayout-1.12.5-prefix-no-consoletype.patch
  32. cd "${S}"
  33. eprefixify \
  34. etc/env.d/00basic \
  35. etc/profile \
  36. sbin/functions.sh \
  37. sbin/runscript.sh \
  38. src/runscript.c \
  39. sbin/depscan.sh \
  40. sbin/rc-daemon.sh \
  41. sbin/rc-services.sh
  42. # add the host OS MANPATH
  43. echo 'MANPATH="/usr/share/man"' > etc/env.d/99basic || die "can't make file"
  44. # avoid a re-automake run
  45. touch -r gnulib/configure.ac gnulib/Makefile.in gnulib/aclocal.m4 || die
  46. }
  47. src_configure() {
  48. cd gnulib || die
  49. default
  50. }
  51. src_compile() {
  52. # build gnulib first
  53. pushd gnulib > /dev/null || die
  54. emake || die "Cannot build gnulib"
  55. popd > /dev/null
  56. # use gnulib (buildsystem doesn't respect cppflags)
  57. append-cflags -I../gnulib -I../gnulib/gllib
  58. append-ldflags -L../gnulib/gllib
  59. append-libs gnu
  60. local libdir="lib"
  61. [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
  62. # CFLAGS in LD for #370695
  63. make -C "${S}"/src \
  64. CC="$(tc-getCC)" \
  65. LD="$(tc-getCC) ${CFLAGS} ${LDFLAGS}" \
  66. CFLAGS="${CFLAGS}" \
  67. LIBDIR="${libdir}" || die
  68. }
  69. src_install() {
  70. local dir libdirs libdirs_env rcscripts_dir
  71. dodir /etc
  72. dodir /etc/env.d
  73. dodir /etc/init.d # .keep file might mess up init.d stuff
  74. libdirs=$(get_all_libdirs)
  75. : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
  76. rcscripts_dir="/lib/rcscripts"
  77. for dir in ${libdirs}; do
  78. libdirs_env=${libdirs_env:+$libdirs_env:}/${dir}:/usr/${dir}:/usr/local/${dir}
  79. [[ ${dir} == "lib" && ${SYMLINK_LIB} == "yes" ]] && continue
  80. dodir /"${dir}"
  81. dodir /usr/"${dir}"
  82. dodir /usr/local/"${dir}"
  83. done
  84. # Ugly compatibility with stupid ebuilds and old profiles symlinks
  85. if [[ ${SYMLINK_LIB} == "yes" ]] ; then
  86. rm -r "${ED}"/{lib,usr/lib,usr/local/lib} &> /dev/null
  87. dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /lib
  88. dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/lib
  89. dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/local/lib
  90. fi
  91. # FHS compatibility symlinks stuff
  92. dosym /var/tmp /usr/tmp
  93. # rc-scripts version for testing of features that *should* be present
  94. echo "Gentoo Prefix Base System version ${PV}" > ${ED}/etc/gentoo-release
  95. # get the basic stuff in there
  96. doenvd "${S}"/etc/env.d/* || die "doenvd"
  97. # copy the profile
  98. cp "${S}"/etc/profile "${ED}"/etc/profile
  99. # Setup files in /sbin
  100. #
  101. cd "${S}"/sbin
  102. into /
  103. # These moved from /etc/init.d/ to /sbin to help newb systems
  104. # from breaking
  105. dosbin runscript.sh functions.sh
  106. # Compat symlinks between /etc/init.d and /sbin
  107. # (some stuff have hardcoded paths)
  108. dosym ../../sbin/depscan.sh /etc/init.d/depscan.sh
  109. dosym ../../sbin/runscript.sh /etc/init.d/runscript.sh
  110. dosym ../../sbin/functions.sh /etc/init.d/functions.sh
  111. cd "${S}"/sbin
  112. into /
  113. dosbin depscan.sh
  114. insinto ${rcscripts_dir}/awk
  115. doins "${S}"/src/awk/functions.awk
  116. #
  117. # Install baselayout utilities
  118. #
  119. local libdir="lib"
  120. [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
  121. cd "${S}"/src
  122. make DESTDIR="${ED}" LIBDIR="${libdir}" install || die
  123. insinto ${rcscripts_dir}/sh
  124. doins "${S}"/sbin/rc-*
  125. }
  126. pkg_postinst() {
  127. if [[ ${EUID} == 0 ]] ; then
  128. # setup portage user, such that things that require root privs
  129. # don't fail, bug #321623
  130. enewgroup portage 250
  131. enewuser portage 250 -1 "${EPREFIX}"/var/tmp/portage portage
  132. fi
  133. # This is also written in src_install (so it's in CONTENTS), but
  134. # write it here so that the new version is immediately in the file
  135. # (without waiting for the user to do etc-update)
  136. rm -f "${EROOT}"/etc/._cfg????_gentoo-release
  137. echo "Gentoo Prefix Base System version ${PV}" > "${EROOT}"/etc/gentoo-release
  138. echo
  139. einfo "Please be sure to update all pending '._cfg*' files in /etc,"
  140. einfo "else things might break! You can use 'etc-update'"
  141. einfo "to accomplish this:"
  142. einfo
  143. einfo " # etc-update"
  144. echo
  145. }