commit:     c59b1948362b87aa5ca492109e5b148dd299bba9
Author:     Felix Janda <felix.janda <AT> posteo <DOT> de>
AuthorDate: Thu May 22 20:23:34 2014 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri May 23 01:22:52 2014 +0000
URL:        
http://git.overlays.gentoo.org/gitweb/?p=proj/releng.git;a=commit;h=c59b1948

tools-musl: add experimental catalyst build scripts

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

---
 tools-musl/catalyst/clean.sh                       |   6 +
 tools-musl/catalyst/portage.amd64.vanilla/bashrc   |  15 +++
 .../portage.amd64.vanilla/env/libintl.conf         |   2 +
 .../portage.amd64.vanilla/env/parallel.conf        |   1 +
 .../portage.amd64.vanilla/make.profile/parent      |   1 +
 .../catalyst/portage.amd64.vanilla/package.env     |   9 ++
 .../portage.amd64.vanilla/package.keywords         |   2 +
 .../catalyst/portage.amd64.vanilla/package.mask    |   3 +
 .../catalyst/portage.amd64.vanilla/package.unmask  |   1 +
 .../catalyst/portage.amd64.vanilla/package.use     |   1 +
 tools-musl/catalyst/run.sh                         | 131 +++++++++++++++++++++
 tools-musl/catalyst/stage-all.conf.template        |  12 ++
 12 files changed, 184 insertions(+)

diff --git a/tools-musl/catalyst/clean.sh b/tools-musl/catalyst/clean.sh
new file mode 100755
index 0000000..916c4eb
--- /dev/null
+++ b/tools-musl/catalyst/clean.sh
@@ -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

diff --git a/tools-musl/catalyst/portage.amd64.vanilla/bashrc 
b/tools-musl/catalyst/portage.amd64.vanilla/bashrc
new file mode 100644
index 0000000..dac928d
--- /dev/null
+++ b/tools-musl/catalyst/portage.amd64.vanilla/bashrc
@@ -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
+}

diff --git a/tools-musl/catalyst/portage.amd64.vanilla/env/libintl.conf 
b/tools-musl/catalyst/portage.amd64.vanilla/env/libintl.conf
new file mode 100644
index 0000000..06356b5
--- /dev/null
+++ b/tools-musl/catalyst/portage.amd64.vanilla/env/libintl.conf
@@ -0,0 +1,2 @@
+CFLAGS="-Wl,-lintl"
+LDFLAGS="-lintl"

diff --git a/tools-musl/catalyst/portage.amd64.vanilla/env/parallel.conf 
b/tools-musl/catalyst/portage.amd64.vanilla/env/parallel.conf
new file mode 100644
index 0000000..c67232a
--- /dev/null
+++ b/tools-musl/catalyst/portage.amd64.vanilla/env/parallel.conf
@@ -0,0 +1 @@
+MAKEOPTS=-j1

diff --git a/tools-musl/catalyst/portage.amd64.vanilla/make.profile/parent 
b/tools-musl/catalyst/portage.amd64.vanilla/make.profile/parent
new file mode 100644
index 0000000..d224f93
--- /dev/null
+++ b/tools-musl/catalyst/portage.amd64.vanilla/make.profile/parent
@@ -0,0 +1 @@
+/usr/portage/profiles/hardened/linux/musl/amd64

diff --git a/tools-musl/catalyst/portage.amd64.vanilla/package.env 
b/tools-musl/catalyst/portage.amd64.vanilla/package.env
new file mode 100644
index 0000000..3574877
--- /dev/null
+++ b/tools-musl/catalyst/portage.amd64.vanilla/package.env
@@ -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

diff --git a/tools-musl/catalyst/portage.amd64.vanilla/package.keywords 
b/tools-musl/catalyst/portage.amd64.vanilla/package.keywords
new file mode 100644
index 0000000..9a9769c
--- /dev/null
+++ b/tools-musl/catalyst/portage.amd64.vanilla/package.keywords
@@ -0,0 +1,2 @@
+=sys-libs/musl-1.1.0 ~*
+=sys-apps/getent-0 ~*

diff --git a/tools-musl/catalyst/portage.amd64.vanilla/package.mask 
b/tools-musl/catalyst/portage.amd64.vanilla/package.mask
new file mode 100644
index 0000000..794369e
--- /dev/null
+++ b/tools-musl/catalyst/portage.amd64.vanilla/package.mask
@@ -0,0 +1,3 @@
+>sys-devel/gcc-4.7.3-r99
+sys-apps/systemd
+sys-fs/udev

diff --git a/tools-musl/catalyst/portage.amd64.vanilla/package.unmask 
b/tools-musl/catalyst/portage.amd64.vanilla/package.unmask
new file mode 100644
index 0000000..6aabccd
--- /dev/null
+++ b/tools-musl/catalyst/portage.amd64.vanilla/package.unmask
@@ -0,0 +1 @@
+=dev-libs/openssl-1.0.1g-r99::hardened-dev

diff --git a/tools-musl/catalyst/portage.amd64.vanilla/package.use 
b/tools-musl/catalyst/portage.amd64.vanilla/package.use
new file mode 100644
index 0000000..4ef695a
--- /dev/null
+++ b/tools-musl/catalyst/portage.amd64.vanilla/package.use
@@ -0,0 +1 @@
+sys-libs/musl nls

diff --git a/tools-musl/catalyst/run.sh b/tools-musl/catalyst/run.sh
new file mode 100755
index 0000000..f72f925
--- /dev/null
+++ b/tools-musl/catalyst/run.sh
@@ -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 &

diff --git a/tools-musl/catalyst/stage-all.conf.template 
b/tools-musl/catalyst/stage-all.conf.template
new file mode 100644
index 0000000..6bc302b
--- /dev/null
+++ b/tools-musl/catalyst/stage-all.conf.template
@@ -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

Reply via email to