summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2013-03-14 16:56:48 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2013-03-15 09:55:28 +0000
commitdd3cd5b0b333d496ce036e46b31cb35e298c59cb (patch)
treeb6a8fff010a2ac043e28e1d178fbb511951da317
parent92a1094853dafe506c0333316117e4243d448d56 (diff)
downloadlinux-dd3cd5b0b333d496ce036e46b31cb35e298c59cb.tar.gz
Use MORPH_ARCH field to set target-specific flags
-rw-r--r--linux-api-headers.morph2
-rwxr-xr-xmorph-arch20
-rw-r--r--stage2-linux-api-headers.morph2
-rw-r--r--stage2-linux-api-headers.morph.yaml11
4 files changed, 23 insertions, 12 deletions
diff --git a/linux-api-headers.morph b/linux-api-headers.morph
index 0ec7d2eae2d7..7e9672eafa63 100644
--- a/linux-api-headers.morph
+++ b/linux-api-headers.morph
@@ -3,7 +3,7 @@
"kind": "chunk",
"install-commands": [
"make mrproper",
- "make INSTALL_HDR_PATH=dest headers_install",
+ "ARCH=$(./morph-arch) make INSTALL_HDR_PATH=dest headers_install",
"install -d \"$DESTDIR${PREFIX-/usr}/include\"",
"cp -r dest/include/* \"$DESTDIR/${PREFIX-/usr}/include\""
]
diff --git a/morph-arch b/morph-arch
new file mode 100755
index 000000000000..0252ce21edee
--- /dev/null
+++ b/morph-arch
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Get Linux ARCH from Morph architecture
+
+if [ -z "$MORPH_ARCH" ]; then
+ echo "Error: MORPH_ARCH is not set" >&2
+ exit 1
+fi
+
+case "$MORPH_ARCH" in
+ armv7b|armv7l)
+ echo arm ;;
+ x86_32)
+ echo i386 ;;
+ x86_64)
+ echo x86_64 ;;
+ *)
+ echo "Error: unsupported Morph architecture: $MORPH_ARCH" >&2
+ exit 1
+esac
diff --git a/stage2-linux-api-headers.morph b/stage2-linux-api-headers.morph
index 1fd0d1ec83f5..fc3f1a74fcfb 100644
--- a/stage2-linux-api-headers.morph
+++ b/stage2-linux-api-headers.morph
@@ -3,7 +3,7 @@
"kind": "chunk",
"install-commands": [
"make mrproper",
- "cpu=$(echo $TARGET | cut -d '-' -f 1)\ncase $cpu in\n \"\") echo \"Invalid target for stage 2: '$TARGET'\"; false ;;\n i?86) export ARCH=i386 ;;\n arm*) export ARCH=arm ;;\n *) export ARCH=\"$cpu\" ;;\nesac\nmake INSTALL_HDR_PATH=dest headers_install\n",
+ "export ARCH=$(./morph-arch)\nmake INSTALL_HDR_PATH=dest headers_install\n",
"install -d \"$DESTDIR${PREFIX-/usr}/include\"",
"cp -r dest/include/* \"$DESTDIR/${PREFIX-/usr}/include\""
]
diff --git a/stage2-linux-api-headers.morph.yaml b/stage2-linux-api-headers.morph.yaml
index 3259d45cda03..9703bbf8228e 100644
--- a/stage2-linux-api-headers.morph.yaml
+++ b/stage2-linux-api-headers.morph.yaml
@@ -4,17 +4,8 @@ kind: chunk
install-commands:
- make mrproper
- # There must be a better way to divine Linux architecture from GNU
- # machine triplet, but I don't know of it ...
- # FIXME: see what the major distros do!
- |
- cpu=$(echo $TARGET | cut -d '-' -f 1)
- case $cpu in
- "") echo "Invalid target for stage 2: '$TARGET'"; false ;;
- i?86) export ARCH=i386 ;;
- arm*) export ARCH=arm ;;
- *) export ARCH="$cpu" ;;
- esac
+ export ARCH=$(./morph-arch)
make INSTALL_HDR_PATH=dest headers_install
- install -d "$DESTDIR${PREFIX-/usr}/include"
- cp -r dest/include/* "$DESTDIR/${PREFIX-/usr}/include"