I spent some time to find out why the glibc macro patch couldn't work
and it seems it just had to be defined before other packages tried to
inherit glibc in base.scm. It seems to work now.
From 1f35b5a3d93811dadac33dbce1ff74a704760a21 Mon Sep 17 00:00:00 2001
From: phant0mas <manolis...@gmail.com>
Date: Mon, 21 Apr 2014 20:13:52 +0300
Subject: [PATCH] gnu: base: Added macro for choosing glibc for target system

* gnu/packages/base.scm (glibc/linux): Renamed glibc to glibc/linux
* gnu/packages/base.scm (glibc-for-target): Choose which glibc to use
* gnu/packages/base.scm (glibc): Added macro to choose glibc
---
 gnu/packages/base.scm | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index e6a2242..423c9c7 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <l...@gnu.org>
 ;;; Copyright © 2012 Nikita Karetnikov <nik...@karetnikov.org>
 ;;; Copyright © 2014 Mark H Weaver <m...@netris.org>
+;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis...@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -41,7 +42,8 @@
   #:use-module (guix utils)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
-  #:use-module (ice-9 match))
+  #:use-module (ice-9 match)
+  #:export (glibc))
 
 ;;; Commentary:
 ;;;
@@ -364,7 +366,7 @@ library for working with executable and object formats is also included.")
    (license gpl3+)
    (home-page "http://www.gnu.org/software/binutils/";)))
 
-(define-public glibc
+(define-public glibc/linux
   (package
    (name "glibc")
    (version "2.19")
@@ -508,6 +510,16 @@ with the Linux kernel.")
    (license lgpl2.0+)
    (home-page "http://www.gnu.org/software/libc/";)))
 
+(define (glibc-for-target target)
+  "Return the glibc for TARGET, glibc/linux for a linux host or
+glibc/hurd for a hurd host"
+  (match target
+    ("i686-pc-gnu" glibc/hurd)
+    (_ glibc/linux)))
+
+(define-syntax glibc
+  (identifier-syntax (glibc-for-target (or (%current-target-system) (%current-system)))))
+
 (define-public tzdata
   (package
     (name "tzdata")
-- 
1.9.2

Reply via email to