From d85382e41efbe3f3f9012a08851f93bb4919de65 Mon Sep 17 00:00:00 2001
From: Tristan Van Berkom <tristan.vanberkom@codethink.co.uk>
Date: Wed, 1 Feb 2017 20:37:29 +0900
Subject: Manual conversion of Baserock's build-essential stratum

This huge commit is a manual conversion, notes on what was
needed:

  o project.conf defines the arch specific stuff which was
    previously hardcoded into YBD, so the stage1 target and target
    etc are all defined by the build-essential project.conf

  o Direct and easy changes for git source representation

  o Added stage1.bst & stage2.bst "stacks", everything built in
    stage2 build-depends on stage1.bst, and the final build-essential
    products build-depend on stage2.bst (note build-depend means
    to depend _only_ for building, not propagated forward).

  o Instead of using host tools we build on the GNOME flatpak
    sdk/platform bundles

  o Some build-essential morph files use $(dirname $(pwd)) for a sysroot,
    which is weird, it means the morph files rely on building at one directory
    below the slash sysroot - in buildstream we build in /buildstream/build
    which is two - had to replace these with $(dirname $(dirname $(pwd))) instead

  o Remove the devices sections from the fhs-dirs elements, not allowed
    to create static device nodes in buildstream.
---
 build-essential/gcc.bst | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 build-essential/gcc.bst

(limited to 'build-essential/gcc.bst')

diff --git a/build-essential/gcc.bst b/build-essential/gcc.bst
new file mode 100644
index 00000000..56ca5d86
--- /dev/null
+++ b/build-essential/gcc.bst
@@ -0,0 +1,66 @@
+kind: manual
+
+sources:
+- kind: git
+  url: upstream:gcc-tarball
+  track: baserock/build-essential
+  ref: b3c9b176c1f10ebeff5700eb3760e9511f23fa06
+
+depends:
+- filename: build-essential/stage2.bst
+  type: build
+- build-essential/linux-api-headers.bst
+- build-essential/glibc.bst
+- build-essential/zlib.bst
+- build-essential/m4-tarball.bst
+
+environment:
+  PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+config:
+
+  configure-commands:
+  - mkdir o
+
+  # Configure flag notes:    
+  #   1. An attempt to stop anything going in %{prefix}/lib64 (which doesn't
+  #      fully work; we will need to hobble the multilib configuration in
+  #      config/i386/t-linux64 if we really want to kill /lib64).
+  #   2. Avoid having more than one copy of ZLib in use on the system
+  #   3. Multilib does not make sense in Baserock.
+  - |
+    case "%{bst-arch}" in
+        armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \
+                              --with-cpu=cortex-a9 \
+                              --with-tune=cortex-a9 \
+                              --with-fpu=vfpv3-d16 \
+                              --with-float=hard" ;;
+        armv7*)   ARCH_FLAGS="--with-arch=armv7-a" ;;
+    esac
+
+    cd o && ../configure                                        \
+              $ARCH_FLAGS                                       \
+              --prefix="%{prefix}"                              \
+      `# [1]` --libdir=%{prefix}/lib                            \
+              --disable-bootstrap                               \
+      `# [2]` --with-system-zlib                                \
+      `# [3]` --disable-multilib                                \
+              --enable-languages=c,c++,fortran
+
+  build-commands:
+  - |
+    case "%{bst-arch}" in
+        armv5*)   sed -i "s/--host=none/--host=armv5/" o/Makefile
+                  sed -i "s/--target=none/--target=armv5/" o/Makefile ;;
+        armv7*)   sed -i "s/--host=none/--host=armv7a/" o/Makefile
+                  sed -i "s/--target=none/--target=armv7a/" o/Makefile ;;
+    esac
+    cd o && make
+
+  install-commands:
+  - cd o && make DESTDIR="%{install-root}" install
+  - ln -s gcc "%{install-root}%{prefix}/bin/cc"
+  - |
+    for fortran_alias in f77 f90 f95; do
+      ln -s gfortran "%{install-root}%{prefix}/bin/$fortran_alias"
+    done
-- 
cgit v1.2.1

