On Sat, Dec 4, 2010 at 2:35 PM, Graham Percival
<[email protected]> wrote:
> Since GUB master still cannot build lilypond due to that target_cpu
> error, I've reverted my local tree back to
>    2a8f076a015ac06b37a7f86537cf47691e65e745
> which is the commit we used for 2.13.40.

Here's a new patch that you can use instead of the previous one.
(Since you've reverted it.) Please let me know how that works!

(BTW. Thanks to Neil for having made the definitions a bit more proper
and appropriate :-)

Cheers,
Valentin.
From bd4f7472964b56d57900bf30fbefcd7876fe9ae0 Mon Sep 17 00:00:00 2001
From: Valentin Villenave <[email protected]>
Date: Sun, 21 Nov 2010 18:50:29 +0100
Subject: [PATCH] GUB: add architecture compatibility check.

---
 gub/commands.py                  |    3 ++-
 gub/installer.py                 |    3 ++-
 sourcefiles/lilypond-sharhead.sh |   29 ++++++++++++++++++++++++++++-
 3 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/gub/commands.py b/gub/commands.py
index ade6f47..f867882 100644
--- a/gub/commands.py
+++ b/gub/commands.py
@@ -449,6 +449,7 @@ class CreateShar (SerializedCommand):
         shar_head = self.kwargs['shar_head']
         tarball = self.kwargs['tarball']
         version = self.kwargs['version']
+        target_cpu = self.kwargs['target_cpu']
 
         length = os.stat (tarball)[6]
         base_file = os.path.split (tarball)[1]
@@ -456,7 +457,7 @@ class CreateShar (SerializedCommand):
         header_length = 0
         _z = misc.compression_flag (tarball)
         header_length = len (script % locals ()) + 1
-        used_in_sharhead = '%(base_file)s %(name)s %(pretty_name)s %(version)s %(release)s %(header_length)s %(_z)s'
+        used_in_sharhead = '%(base_file)s %(name)s %(pretty_name)s %(version)s %(release)s %(header_length)s %(target_cpu)s %(_z)s'
         used_in_sharhead % locals ()
         loggedos.dump_file (logger, script % locals (), shar_file)
         loggedos.system (logger, 'cat %(tarball)s >> %(shar_file)s' % locals ())
diff --git a/gub/installer.py b/gub/installer.py
index f7cc38d..b67f098 100644
--- a/gub/installer.py
+++ b/gub/installer.py
@@ -451,7 +451,8 @@ class Shar (Linux_installer):
             shar_head = self.expand ('%(sourcefiledir)s/lilypond-sharhead.sh')
         tarball = self.expand (self.bundle_tarball)
         version = self.expand ('%(installer_version)s')
-        self.runner._execute (commands.CreateShar (name=name, pretty_name=pretty_name, release=release, shar_file=shar_file, shar_head=shar_head, tarball=tarball, version=version))
+        target_cpu = self.settings.target_cpu
+        self.runner._execute (commands.CreateShar (name=name, pretty_name=pretty_name, release=release, shar_file=shar_file, shar_head=shar_head, tarball=tarball, target_cpu=target_cpu, version=version))
 # hmm?
 #    @context.subst_method
     def installer_file (self):
diff --git a/sourcefiles/lilypond-sharhead.sh b/sourcefiles/lilypond-sharhead.sh
index d7945d7..f4a8d5b 100644
--- a/sourcefiles/lilypond-sharhead.sh
+++ b/sourcefiles/lilypond-sharhead.sh
@@ -5,6 +5,7 @@ root="$HOME"
 doc=no
 extract=no
 interactive=yes
+arch=$(uname -m)
 
 if test `id -u` = "0"; then
     root=/usr/local
@@ -60,18 +61,44 @@ done
 
 cat <<EOF
 
-%(name)s installer for version %(version)s release %(release)s.
+%(name)s installer for version %(version)s release %(release)s,
+%(target_cpu)s build.
 For a list of options, abort (^C) then do:
 sh $me --help
 
 EOF
 
+if test "$arch" != "%(target_cpu)s"; then
+    cat <<EOF
+
+Warning: this build is not optimized for your architecture;
+please install a ${arch} build instead.
+
+Press C to install the program anyway (not recommended),
+E to only extract the program files, or any other key to exit.
+EOF
+    read -sn1 input
+    case "$input" in
+	C)
+	  echo "Ignoring architecture incompatibility."
+	;;
+	E)
+	  extract=yes;
+	;;
+	*)
+	  exit 1
+	;;
+    esac
+fi
+
+
 if test "$extract" = "yes"; then
     echo "extracting %(base_file)s"
     tail -c+%(header_length)012d $0 > %(base_file)s
     exit 0
 fi
 
+
 if test "$interactive" = "yes"; then
     cat <<EOF
 
-- 
1.7.3.2

_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to