overlay/sys-kernel/recoveryinitramfs/recoveryinitramfs-2013.12.12.ebuild

341 lines
11 KiB
Bash
Raw Permalink Normal View History

# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
2013-10-29 18:26:14 +01:00
inherit eutils autotools
2013-12-12 21:30:29 +01:00
VERSION_MUSL_CROSS="ea98c70edb66"
2013-10-26 22:09:33 +02:00
VERSION_BINUTILS="2.23.2"
2013-10-29 18:26:14 +01:00
VERSION_GCC="4.7.3"
2013-12-12 21:30:29 +01:00
VERSION_LINUX="3.2.53"
2013-10-26 22:09:33 +02:00
VERSION_MUSL="0.9.14"
VERSION_ZLIB="1.2.8"
VERSION_TERMCAP="1.3.1"
VERSION_READLINE="6.2"
VERSION_ICONV="1.14"
VERSION_SFTPSERVER="0.1"
2013-12-12 21:30:29 +01:00
VERSION_DROPBEAR="2013.62"
2013-10-29 18:26:14 +01:00
VERSION_EXT2FSPROGS="1.42.8"
VERSION_XFSPROGS="3.1.11"
VERSION_JFSUTILS="1.1.15"
VERSION_BUSYBOX="1.20.2"
DESCRIPTION="Recovery Initramfs Overlay"
HOMEPAGE="http://sablink.disconnected-by-peer.at"
SRC_URI="https://bitbucket.org/GregorR/musl-cross/get/${VERSION_MUSL_CROSS}.zip
mirror://gnu/binutils/binutils-${VERSION_BINUTILS}.tar.bz2
2013-10-29 18:26:14 +01:00
mirror://gnu/gcc/gcc-${VERSION_GCC}/gcc-${VERSION_GCC}.tar.bz2
mirror://kernel/linux/kernel/v3.0/linux-${VERSION_LINUX}.tar.bz2
http://www.musl-libc.org/releases/musl-${VERSION_MUSL}.tar.gz
http://prdownloads.sourceforge.net/libpng/zlib-${VERSION_ZLIB}.tar.gz
2013-10-29 18:26:14 +01:00
http://ftp.gnu.org/gnu/termcap/termcap-${VERSION_TERMCAP}.tar.gz
http://www.catb.org/~esr/terminfo/termtypes.tc.gz
mirror://gnu/libiconv/libiconv-${VERSION_ICONV}.tar.gz
mirror://gnu/readline/readline-${VERSION_READLINE}.tar.gz
http://www.greenend.org.uk/rjk/sftpserver/sftpserver-${VERSION_SFTPSERVER}.tar.gz
2013-10-26 22:09:33 +02:00
https://matt.ucc.asn.au/dropbear/dropbear-${VERSION_DROPBEAR}.tar.bz2
2013-10-29 18:26:14 +01:00
http://sourceforge.net/projects/e2fsprogs/files/e2fsprogs/v${VERSION_EXT2FSPROGS}/e2fsprogs-libs-${VERSION_EXT2FSPROGS}.tar.gz
http://sourceforge.net/projects/e2fsprogs/files/e2fsprogs/v${VERSION_EXT2FSPROGS}/e2fsprogs-${VERSION_EXT2FSPROGS}.tar.gz
ftp://oss.sgi.com/projects/xfs/cmd_tars/xfsprogs-${VERSION_XFSPROGS}.tar.gz
http://jfs.sourceforge.net/project/pub/jfsutils-${VERSION_JFSUTILS}.tar.gz
mirror://gentoo/btrfs-progs-0.19.11.tar.bz2
http://ftp.kernel.org/pub/linux/kernel/people/jeffm/reiserfsprogs/v3.6.22/reiserfsprogs-3.6.22.tar.bz2
http://sourceforge.net/projects/reiser4/files/reiser4-utils/libaal/libaal-1.0.5.tar.gz
http://sourceforge.net/projects/reiser4/files/reiser4-utils/reiser4progs/reiser4progs-1.0.7.tar.gz
2013-10-29 18:26:14 +01:00
http://busybox.net/downloads/busybox-${VERSION_BUSYBOX}.tar.bz2
"
LICENSE="GPL-2 BSD"
SLOT="0"
KEYWORDS=""
IUSE=""
RESTRICT=""
DEPEND=""
RDEPEND="${DEPEND}"
S=${WORKDIR}
DDIR=${WORKDIR}/${PN}
IDIR=/usr/share/${PN}
2012-12-07 10:18:15 +01:00
pkg_setup() {
# This is just for initd so no need for the lib32 lib64 split
# so overwrite the LIBDIR_${ARCH} to lib
# Please keep this in future versions
export LIBDIR_${ARCH}="lib"
if [[ ${CHOST/-*/} = "armv5tel" ]]; then
MUSL_ARCH="arm"
elif [[ ${CHOST/-*/} = "armv6j" ]]; then
MUSL_ARCH="arm"
elif [[ ${CHOST/-*/} = "armv7a" ]]; then
MUSL_ARCH="arm"
elif [[ ${ARCH} = "x86" ]]; then
MUSL_ARCH="i386"
elif [[ ${ARCH} = "amd64" ]]; then
MUSL_ARCH="${CHOST/-*/}"
fi
}
src_prepare() {
# prepare croos toolchain
pushd ${WORKDIR}/GregorR-musl-cross-${VERSION_MUSL_CROSS}
2013-10-29 18:26:14 +01:00
sed -e "s/^GCC_VERSION=.*/GCC_VERSION=${VERSION_GCC}/" -i defs.sh
cd tarballs
ln -sf ${DISTDIR}/binutils-${VERSION_BINUTILS}.tar.bz2 .
ln -sf ${DISTDIR}/gcc-${VERSION_GCC}.tar.bz2 .
ln -sf ${DISTDIR}/linux-${VERSION_LINUX}.tar.bz2 .
ln -sf ${DISTDIR}/musl-${VERSION_MUSL}.tar.gz .
popd
2013-10-29 18:26:14 +01:00
# prepare in iconv
pushd ${WORKDIR}/libiconv-${VERSION_ICONV}
cp ../GregorR-musl-cross-${VERSION_MUSL_CROSS}/extra/config.sub build-aux/
cp ../GregorR-musl-cross-${VERSION_MUSL_CROSS}/extra/config.sub libcharset/build-aux/
popd
# nothing to prepare in zlib
#pushd ${WORKDIR}/zlib-${VERSION_ZLIB}
#popd
# prepare in termcap
2013-10-29 18:26:14 +01:00
pushd ${WORKDIR}/termcap-${VERSION_TERMCAP}
EPATCH_SOURCE="${FILESDIR}/termcap/${VERSION_TERMCAP}"
EPATCH_SUFFIX="patch"
epatch "${EPATCH_SOURCE}"
cp ${FILESDIR}/termcap/${VERSION_TERMCAP}/Makefile .
popd
# add redline patches
pushd ${WORKDIR}/readline-${VERSION_READLINE}
EPATCH_SOURCE="${FILESDIR}/readline/${VERSION_READLINE}"
EPATCH_SUFFIX="patch"
epatch "${EPATCH_SOURCE}"
cp ../GregorR-musl-cross-${VERSION_MUSL_CROSS}/extra/config.sub support/
2013-10-29 18:26:14 +01:00
#cp ../GregorR-musl-cross-${VERSION_MUSL_CROSS}/extra/config.sub support/config.guess
popd
# prepare in sftpserver
pushd ${WORKDIR}/sftpserver-${VERSION_SFTPSERVER}
cp ../GregorR-musl-cross-${VERSION_MUSL_CROSS}/extra/config.sub config.aux/
popd
# prepare in dropbear
pushd ${WORKDIR}/dropbear-${VERSION_DROPBEAR}
2012-12-07 10:18:15 +01:00
EPATCH_SOURCE="${FILESDIR}/dropbear/${VERSION_DROPBEAR}"
EPATCH_SUFFIX="patch"
epatch "${EPATCH_SOURCE}"
cp ../GregorR-musl-cross-${VERSION_MUSL_CROSS}/extra/config.sub .
popd
2013-10-29 18:26:14 +01:00
# prepare in e2fsprogs-libs
pushd ${WORKDIR}/e2fsprogs-libs-${VERSION_EXT2FSPROGS}
#EPATCH_SOURCE="${FILESDIR}/e2fsprogs-libs/${VERSION_EXT2FSPROGS}"
#EPATCH_SUFFIX="patch"
#epatch "${EPATCH_SOURCE}"
cp ../GregorR-musl-cross-${VERSION_MUSL_CROSS}/config.sub config/
popd
# prepare in e2fsprogs
pushd ${WORKDIR}/e2fsprogs-${VERSION_EXT2FSPROGS}
EPATCH_SOURCE="${FILESDIR}/e2fsprogs/${VERSION_EXT2FSPROGS}"
EPATCH_SUFFIX="patch"
epatch "${EPATCH_SOURCE}"
cp ../GregorR-musl-cross-${VERSION_MUSL_CROSS}/config.sub config/
popd
# prepare in xfsprogs
pushd ${WORKDIR}/xfsprogs-${VERSION_XFSPROGS}
EPATCH_SOURCE="${FILESDIR}/xfsprogs/${VERSION_XFSPROGS}"
EPATCH_SUFFIX="patch"
epatch "${EPATCH_SOURCE}"
cp ../GregorR-musl-cross-${VERSION_MUSL_CROSS}/config.sub .
sed -e "s!libdirsuffix=64!libdirsuffix=!g" -i configure
popd
# prepare in jfsutils
pushd ${WORKDIR}/jfsutils-${VERSION_JFSUTILS}
EPATCH_SOURCE="${FILESDIR}/jfsutils/${VERSION_JFSUTILS}"
EPATCH_SUFFIX="patch"
epatch "${EPATCH_SOURCE}"
cp ../GregorR-musl-cross-${VERSION_MUSL_CROSS}/config.sub .
eautoreconf
popd
}
src_compile() {
# configure compile install musl for later use
pushd ${WORKDIR}/GregorR-musl-cross-${VERSION_MUSL_CROSS}
echo "CC_BASE_PREFIX=${DDIR}" > config.sh
echo "MAKEFLAGS=${MAKEFLAGS}" >> config.sh
echo "ARCH=${CHOST/-*/}" >> config.sh
2013-10-29 18:26:14 +01:00
echo "LANG_CXX=no" >> config.sh
echo "GCC_VERSION=${VERSION_GCC}" >> config.sh
# echo "GCC_BUILTIN_PREREQS=yes" >> config.sh
2013-10-29 18:26:14 +01:00
echo "LINUX_HEADERS_VERSION=${VERSION_LINUX}" >> config.sh
./build.sh
# export all the overwrites for the followd compiles
export PATH="${DDIR}/bin:${DDIR}/${CHOST/-*/}-linux-musl/bin:$PATH"
export CC=${CHOST/-*/}-linux-musl-gcc
export CXX=${CHOST/-*/}-linux-musl-g++
export LD_LIBRARY_PATH="${DDIR}/lib:${DDIR}/${CHOST/-*/}-linux-musl/${CHOST/-*/}-linux-musl/lib64:${DDIR}/${CHOST/-*/}-linux-musl/${CHOST/-*/}-linux-musl/lib"
2012-12-07 10:18:15 +01:00
export LDFLAGS="-Wl,--as-needed -L${DDIR}/lib"
export CFLAGS="-Os -I${DDIR}/include"
export CPPFLAGS="-Os -I${DDIR}/include"
popd
# configure compile install musl libc for later use
pushd ${WORKDIR}/musl-${VERSION_MUSL}
./configure --prefix=${DDIR} --syslibdir=${DDIR}/lib --host=${CHOST/-*/}-linux-musl --build=${CHOST/-*/}-linux-musl
emake
emake install
2013-10-29 18:26:14 +01:00
mkdir -p "${DDIR}"/etc
echo "/lib" > "${DDIR}"/etc/ld-musl-${MUSL_ARCH}.path
rm ${DDIR}/lib/*.{a,la,py}
popd
# configure compile install zlib for later use
pushd ${WORKDIR}/zlib-${VERSION_ZLIB}
CC=${CHOST/-*/}-linux-musl-gcc ./configure --prefix=${DDIR} --shared
emake
2013-10-29 18:26:14 +01:00
emake install LDCONFIG=:
rm ${DDIR}/lib/*.{a,la}
popd
# configure compile install libiconv for later use
pushd ${WORKDIR}/libiconv-${VERSION_ICONV}
./configure --prefix="${DDIR}" --host="${CHOST/-*/}-linux-musl" --build="${CHOST/-*/}-linux-musl"
emake
emake install
2013-10-29 18:26:14 +01:00
rm ${DDIR}/lib/*.{a,la}
popd
# configure compile install termcap for later use
2013-10-29 18:26:14 +01:00
pushd ${WORKDIR}/termcap-${VERSION_TERMCAP}
emake CFLAGS="${CFLAGS} -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -I."
emake prefix="${DDIR}" install
rm ${DDIR}/lib/*.{a,la}
popd
# configure compile install readline for later use
pushd ${WORKDIR}/readline-${VERSION_READLINE}
LIBS="-ltermcap" ./configure --prefix="${DDIR}" --host="${CHOST/-*/}-linux-musl" --build="${CHOST/-*/}-linux-musl"
emake
emake install
2013-10-29 18:26:14 +01:00
rm ${DDIR}/lib/*.{a,la}
popd
# configure compile install sftpserver
pushd ${WORKDIR}/sftpserver-${VERSION_SFTPSERVER}
# great autodetect not working so overwrite libs to link
LIBS="-lreadline -liconv -ltermcap -lz" ./configure --prefix="${DDIR}" \
--enable-reversed-symlink --host="${CHOST/-*/}-linux-musl" --build="${CHOST/-*/}-linux-musl"
emake
emake install
# is not installed automatically
cp sftpclient "${DDIR}"/bin
2013-10-29 18:26:14 +01:00
rm ${DDIR}/lib/*.{a,la}
popd
# configure compile install dropbear wit all supported programms
pushd ${WORKDIR}/dropbear-${VERSION_DROPBEAR}
./configure --prefix="${DDIR}" --with-zlib="${DDIR}" --host="${CHOST/-*/}-linux-musl" --build="${CHOST/-*/}-linux-musl"
emake PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
emake PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" install
2013-10-29 18:26:14 +01:00
rm ${DDIR}/lib/*.{a,la}
popd
# configure compile install e2fsprogs-libs
pushd ${WORKDIR}/e2fsprogs-libs-${VERSION_EXT2FSPROGS}
QUOTA_CMT='#' ./configure --prefix="${DDIR}" --host="${CHOST/-*/}-linux-musl" --build="${CHOST/-*/}-linux-musl" --disable-quota --enable-elf-shlibs
emake
emake install LDCONFIG=:
rm ${DDIR}/lib/*.{a,la}
popd
2013-10-29 18:26:14 +01:00
# configure compile install e2fsprogs
pushd ${WORKDIR}/e2fsprogs-${VERSION_EXT2FSPROGS}
./configure --prefix="${DDIR}" --host="${CHOST/-*/}-linux-musl" --build="${CHOST/-*/}-linux-musl" --disable-quota --enable-elf-shlibs
emake
emake install LDCONFIG=:
rm ${DDIR}/lib/*.{a,la}
popd
# configure compile install xfsprogs
pushd ${WORKDIR}/xfsprogs-${VERSION_XFSPROGS}
./configure --prefix="${DDIR}" --host="${CHOST/-*/}-linux-musl" --build="${CHOST/-*/}-linux-musl"
emake
emake DIST_ROOT=${DDIR} prefix="/" install install-dev
rm ${DDIR}/lib/*.{a,la}
popd
# configure compile install jfsutils
pushd ${WORKDIR}/jfsutils-${VERSION_JFSUTILS}
./configure --prefix="${DDIR}" --host="${CHOST/-*/}-linux-musl" --build="${CHOST/-*/}-linux-musl"
emake
emake install
rm ${DDIR}/lib/*.{a,la}
popd
}
src_install() {
into "${IDIR}"
# install libc and dependencies
2013-10-29 18:26:14 +01:00
dolib.so "${DDIR}"/${CHOST/-*/}-linux-musl/${CHOST/-*/}-linux-musl/lib*/libgcc_s.so*
dolib.so "${DDIR}"/lib/libc.so
2013-10-29 18:26:14 +01:00
dolib.so "${DDIR}"/lib/ld-musl-*
insinto "${IDIR}"/etc
doins "${DDIR}"/etc/ld-musl-${MUSL_ARCH}.path
# install zlib
dolib.so "${DDIR}"/lib/libz.so*
# install termcap
dolib.so "${DDIR}"/lib/libtermcap.so*
insinto "${IDIR}"/etc
2013-10-29 18:26:14 +01:00
newins ${WORKDIR}/termtypes.tc termcap
# install readline
dolib.so "${DDIR}"/lib/libcharset.so*
dolib.so "${DDIR}"/lib/libhistory.so*
dolib.so "${DDIR}"/lib/libreadline.so*
2012-12-07 10:18:15 +01:00
insinto "${IDIR}"/lib
doins "${DDIR}"/lib/charset.alias
# install iconv
dolib.so "${DDIR}"/lib/libiconv.so*
dobin "${DDIR}"/bin/iconv
# install sftpserver and client
dobin "${DDIR}"/bin/sftpclient
exeinto "${IDIR}"/libexec
# dropbear expects sftp to be specialy named
newexe "${DDIR}"/libexec/gesftpserver sftp-server
# insatll dropbear
dobin "${DDIR}"/bin/{dbclient,dropbearconvert,dropbearkey,scp}
dosbin "${DDIR}"/sbin/dropbear
2013-10-29 18:26:14 +01:00
# install e2fsprogs
exeinto "${IDIR}"/lib
doexe "${DDIR}"/lib/e2initrd_helper
dolib.so "${DDIR}"/lib/{libblkid,libcom_err,libe2p,libext2fs,libss,libuuid}.so*
dobin "${DDIR}"/bin/{chattr,lsattr,uuidgen}
dosbin "${DDIR}"/sbin/{badblocks,blkid,dumpe2fs,e2freefrag,e2fsck,e2image,e2label,e2undo,e4defrag,filefrag,findfs,fsck,fsck.ext2,fsck.ext3,fsck.ext4,fsck.ext4dev,mke2fs,mkfs.ext2,mkfs.ext3,mkfs.ext4,mkfs.ext4dev,mklost+found}
dosbin "${DDIR}"/sbin/{resize2fs,tune2fs,uuidd}
insinto "${IDIR}"/etc
doins "${DDIR}"/etc/mke2fs.conf
# install xfsprogs
dolib.so "${DDIR}"/lib/{libdisk,libhandle,libxcmd,libxfs,libxlog}.so*
dosbin "${DDIR}"/sbin/{fsck.xfs,xfs_*}
}