changeset 5399:385af1bd3996

bin/build-architecture: new frontend.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Fri, 24 Jul 2009 13:54:22 +0200
parents c0fa29ff8674
children d93c380086a2
files bin/build-architecture gub/build_platform.py
diffstat 2 files changed, 49 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/build-architecture	Fri Jul 24 13:54:22 2009 +0200
@@ -0,0 +1,46 @@
+#! /usr/bin/env python
+
+"""
+    Copyright (c) 2005--2008
+    Jan Nieuwenhuizen <janneke@gnu.org>
+    Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2, or (at your option)
+    any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+"""
+
+def argv0_relocation ():
+    import os, sys
+    bindir = os.path.dirname (sys.argv[0])
+    prefix = os.path.dirname (bindir)
+    if not prefix:
+        prefix = bindir + '/..'
+    sys.path.insert (0, prefix)
+
+argv0_relocation ()
+
+from gub import build_platform
+from gub.syntax import printf
+
+def main ():
+    #try:
+    if 1:
+        printf (build_platform.architecture ())
+    #except:
+    if 1:
+        # On failure printf (empty line for use in makefile's $(shell ).)
+        printf ()
+
+if __name__ == '__main__':
+    main ()
--- a/gub/build_platform.py	Fri Jul 24 13:53:58 2009 +0200
+++ b/gub/build_platform.py	Fri Jul 24 13:54:22 2009 +0200
@@ -40,6 +40,9 @@
         m = plain_uname_machine ()
     return m
 
+def architecture ():
+    return plain_machine ().replace ('-gnu', '')
+
 def machine ():
     try:
         return gcc_machine ()