tools-musl: add experimental catalyst build scripts

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit is contained in:
Felix Janda 2014-05-22 22:23:34 +02:00 committed by Anthony G. Basile
parent aa85fa6e15
commit c59b194836
12 changed files with 184 additions and 0 deletions

6
tools-musl/catalyst/clean.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
# This just removes the temporary conf err and log
# files generated during a run
rm -f *conf *err *log

View file

@ -0,0 +1,15 @@
post_src_install() {
[[ $PN != musl ]] && return 0
local arch=$(basename "${D}"/lib/ld-musl-*.so.1)
mkdir "${D}"/usr/etc
cat > "${D}"/usr/etc/${arch%so.1}path <<EOF
/lib
/usr/lib
/usr/local/lib
/usr/lib/opengl/xorg-x11/lib
/usr/lib/gcc/x86_64-gentoo-linux-musl/4.7.3
/usr/x86_64-gentoo-linux-musl/lib
/usr/games/lib
EOF
}

View file

@ -0,0 +1,2 @@
CFLAGS="-Wl,-lintl"
LDFLAGS="-lintl"

View file

@ -0,0 +1 @@
MAKEOPTS=-j1

View file

@ -0,0 +1 @@
/usr/portage/profiles/hardened/linux/musl/amd64

View file

@ -0,0 +1,9 @@
dev-libs/glib libintl.conf
dev-libs/libelf libintl.conf
sys-apps/attr libintl.conf
sys-apps/kbd libintl.conf
sys-apps/man-db parallel.conf
sys-apps/net-tools libintl.conf
sys-fs/e2fsprogs libintl.conf
sys-fs/eudev libintl.conf
sys-process/procps libintl.conf

View file

@ -0,0 +1,2 @@
=sys-libs/musl-1.1.0 ~*
=sys-apps/getent-0 ~*

View file

@ -0,0 +1,3 @@
>sys-devel/gcc-4.7.3-r99
sys-apps/systemd
sys-fs/udev

View file

@ -0,0 +1 @@
=dev-libs/openssl-1.0.1g-r99::hardened-dev

View file

@ -0,0 +1 @@
sys-libs/musl nls

131
tools-musl/catalyst/run.sh Executable file
View file

@ -0,0 +1,131 @@
#!/bin/bash
source /etc/catalyst/catalyst.conf
mydate=`date +%Y%m%d`
undo_grsec() {
[[ -d /proc/sys/kernel/grsecurity ]] || return
for i in /proc/sys/kernel/grsecurity/chroot_* ; do
echo 0 > $i
done
}
prepare_confs() {
local arch=$1
local flavor=$2
for s in 1 2 3; do
local cstage=stage${s}
local p=$(( s - 1 ))
[[ $p == 0 ]] && p=3
local pstage=stage${p}
local parch="${arch}"
[[ "${arch}" == "i686" ]] && parch="x86"
local tarch="${arch}"
[[ "${arch}" == "amd64" ]] && tarch="x86_64"
cat stage-all.conf.template | \
sed -e "s:\(^version_stamp.*$\):\1-${mydate}:" \
-e "s:CSTAGE:${cstage}:g" \
-e "s:PSTAGE:${pstage}:g" \
-e "s:SARCH:${arch}:g" \
-e "s:PARCH:${parch}:g" \
-e "s:TARCH:${tarch}:g" \
-e "s:FLAVOR:${flavor}:g" \
-e "s:MYCATALYST:$(pwd):g" \
> stage${s}-${arch}-musl-${flavor}.conf
done
sed -i "/^chost/d" stage3-${arch}-musl-${flavor}.conf
}
banner() {
cat << EOF | tee -a zzz.log > stage$1-$2-musl-$3.log
************************************************************************
* stage$1-$2-musl-$3
************************************************************************"
EOF
}
do_stages() {
local arch=$1
local flavor=$2
for s in 1 2 3; do
local tgpath="${storedir}/builds/${flavor}/${arch}"
local target="stage${s}-${arch}-musl-${flavor}-${mydate}.tar.bz2"
local tglink="stage${s}-${arch}-musl-${flavor}.tar.bz2"
if [[ ! -f "${tgpath}/${tglink}" ]]; then
touch stage${s}-${arch}-musl-${flavor}.log
echo "!!! ${tglink} at ${tgpath} doesn't exist" \
| tee -a zzz.log \
> stage${s}-${arch}-musl-${flavor}.err
return 1
fi
banner ${s} ${arch} ${flavor}
catalyst -f stage${s}-${arch}-musl-${flavor}.conf \
| tee -a zzz.log \
> stage${s}-${arch}-musl-${flavor}.log \
2> stage${s}-${arch}-musl-${flavor}.err
if [[ -f "${tgpath}/${target}" ]]; then
rm -f "${tgpath}/${tglink}"
ln -s ${target} "${tgpath}/${tglink}"
else
echo "!!! ${target} was not generated" \
| tee -a zzz.log \
>stage${s}-${arch}-musl-${flavor}.err
return 1
fi
done
return 0
}
#
# approximate timings:
#
# catalyst -s current 3 minutes
# catalyst -f stage1 130 minutes
#
main() {
>zzz.log
undo_grsec
catalyst -s current | tee -a zzz.log >snapshot.log 2>snapshot.err
# for arch in amd64 i686; do
# for flavor in hardened vanilla; do
for arch in amd64; do
for flavor in vanilla; do
prepare_confs ${arch} ${flavor}
done
done
# for arch in amd64 i686; do
# for flavor in hardened vanilla; do
for arch in amd64; do
for flavor in vanilla; do
do_stages ${arch} ${flavor}
ret=$?
if [[ $? == 1 ]]; then
echo "FAILURE at ${arch} ${flavor}" | tee zzz.log
return 1
fi
done
done
}
main $1 &

View file

@ -0,0 +1,12 @@
subarch: SARCH
target: CSTAGE
version_stamp: musl-FLAVOR
rel_type: FLAVOR/SARCH
profile: hardened/linux/musl/PARCH
snapshot: current
source_subpath: FLAVOR/SARCH/PSTAGE-SARCH-musl-FLAVOR
chost: TARCH-gentoo-linux-musl
cflags: -O2 -pipe -fomit-frame-pointer
cxxflags: -O2 -pipe -fomit-frame-pointer
portage_confdir: MYCATALYST/portage.SARCH.FLAVOR
portage_overlay: /var/lib/layman/hardened-development