public
Created

  • Download Gist
baselayout-prefix-xxxx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id: baselayout-prefix-1.12.5-r6.ebuild 54930 2009-12-17 09:43:10Z mduft $
 
RESTRICT="mirror"
 
inherit eutils toolchain-funcs multilib prefix
 
DESCRIPTION="Baselayout and init scripts (eventually)"
HOMEPAGE="http://www.gentoo.org/"
SRC_URI="http://dev.gentoo.org/~grobian/distfiles/${P/-prefix/}.tar.bz2"
 
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86-linux"
IUSE="prefix-chaining"
DEPEND=">=sys-apps/portage-2.0.51"
RDEPEND=">=sys-libs/readline-5.0-r1
>=app-shells/bash-3.1_p7
>=sys-apps/coreutils-5.2.1
ppc-macos? ( sys-process/pidof-bsd )
x86-macos? ( sys-process/pidof-bsd )"
 
PROVIDE="virtual/baselayout"
 
S=${WORKDIR}/${P/-prefix}
 
src_unpack() {
unpack ${A}
 
epatch "${FILESDIR}"/${P/-prefix/}-prefix.patch
 
if use prefix-chaining; then
epatch "${FILESDIR}"/${P/-prefix/}-prefix-chaining.patch
epatch "${FILESDIR}"/${P/-prefix/}-prefix-chaining-pkgconfig.patch
epatch "${FILESDIR}"/${P/-prefix/}-prefix-chaining-recursion.patch
epatch "${FILESDIR}"/${P/-prefix/}-prefix-chaining-eprefix.patch
epatch "${FILESDIR}"/${P/-prefix/}-prefix-chaining-prompt.patch
 
# need to set the PKG_CONFIG_PATH globally for this prefix, when
# chaining is enabled, since pkg-config may not be installed locally,
# but still .pc files should be found for all RDEPENDable prefixes in
# the chain.
echo "PKG_CONFIG_PATH=\"${EPREFIX}/usr/lib/pkgconfig:${EPREFIX}/usr/share/pkgconfig\"" >> "${S}"/etc/env.d/00basic
fi
epatch "${FILESDIR}"/${P/-prefix/}-src.patch
epatch "${FILESDIR}"/${P/-prefix/}-sh.patch
# Next patch is to be applied on systems that don't have a pidof.
epatch "${FILESDIR}"/${P/-prefix/}-pidof.patch
# The consoletype application in this form will only work on Linux
[[ ${CHOST} == *-linux-* ]] || epatch "${FILESDIR}"/${P/-prefix/}-no-consoletype.patch
cd "${S}"
eprefixify \
etc/env.d/00basic \
etc/profile \
sbin/env-update.sh \
sbin/functions.sh \
sbin/runscript.sh \
src/runscript.c \
sbin/depscan.sh \
sbin/rc-daemon.sh \
sbin/rc-services.sh
# add the host OS MANPATH
echo 'MANPATH="/usr/share/man"' > etc/env.d/99basic || die "can't make file"
}
 
src_compile() {
local libdir="lib"
 
[[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
 
# doesn't compile on Darwin
make -C "${S}"/src \
CC="$(tc-getCC)" \
LD="$(tc-getCC) ${LDFLAGS}" \
CFLAGS="${CFLAGS}" \
LIBDIR="${libdir}" || die
}
 
src_install() {
local dir libdirs libdirs_env rcscripts_dir
 
dodir /etc
dodir /etc/env.d
dodir /etc/init.d # .keep file might mess up init.d stuff
 
libdirs=$(get_all_libdirs)
: ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
 
rcscripts_dir="/lib/rcscripts"
 
for dir in ${libdirs}; do
libdirs_env=${libdirs_env:+$libdirs_env:}/${dir}:/usr/${dir}:/usr/local/${dir}
[[ ${dir} == "lib" && ${SYMLINK_LIB} == "yes" ]] && continue
dodir /"${dir}"
dodir /usr/"${dir}"
dodir /usr/local/"${dir}"
done
 
# Ugly compatibility with stupid ebuilds and old profiles symlinks
if [[ ${SYMLINK_LIB} == "yes" ]] ; then
rm -r "${ED}"/{lib,usr/lib,usr/local/lib} &> /dev/null
dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /lib
dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/lib
dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/local/lib
fi
 
# FHS compatibility symlinks stuff
dosym /var/tmp /usr/tmp
 
# rc-scripts version for testing of features that *should* be present
echo "Gentoo Prefixed Base System version ${PV}" > ${ED}/etc/gentoo-release
 
# get the basic stuff in there
doenvd "${S}"/etc/env.d/* || die "doenvd"
 
# copy the profile
cp "${S}"/etc/profile "${ED}"/etc/profile
 
# Setup files in /sbin
#
cd "${S}"/sbin
into /
# These moved from /etc/init.d/ to /sbin to help newb systems
# from breaking
dosbin runscript.sh functions.sh
 
# Compat symlinks between /etc/init.d and /sbin
# (some stuff have hardcoded paths)
dosym ../../sbin/depscan.sh /etc/init.d/depscan.sh
dosym ../../sbin/runscript.sh /etc/init.d/runscript.sh
dosym ../../sbin/functions.sh /etc/init.d/functions.sh
 
# We can only install new, fast awk versions of scripts
# if 'build' or 'bootstrap' is not in USE. This will
# change if we have sys-apps/gawk-3.1.1-r1 or later in
# the build image ...
# if ! use build; then
# This is for new depscan.sh and env-update.sh
# written in awk
cd "${S}"/sbin
into /
dosbin depscan.sh
dosbin env-update.sh
insinto ${rcscripts_dir}/awk
doins "${S}"/src/awk/functions.awk
# fi
 
#
# Install baselayout utilities
#
local libdir="lib"
[[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
 
# doesn't compile on Darwin
cd "${S}"/src
make DESTDIR="${D}" LIBDIR="${libdir}" install || die
 
insinto ${rcscripts_dir}/sh
doins "${S}"/sbin/rc-*
}
 
pkg_postinst() {
# This is also written in src_install (so it's in CONTENTS), but
# write it here so that the new version is immediately in the file
# (without waiting for the user to do etc-update)
rm -f ${EROOT}/etc/._cfg????_gentoo-release
echo "Gentoo Prefix Base System version ${PV}" > ${EROOT}/etc/gentoo-release
 
echo
einfo "Please be sure to update all pending '._cfg*' files in /etc,"
einfo "else things might break! You can use 'etc-update'"
einfo "to accomplish this:"
einfo
einfo " # etc-update"
echo
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.