diff --git a/configure.ac b/configure.ac index fe5fa136..3e0bca31 100644 --- a/configure.ac +++ b/configure.ac @@ -14,6 +14,14 @@ AC_PREFIX_DEFAULT(/nix) AC_CANONICAL_HOST +# Construct a Nix system name (like "i686-linux"). +AC_MSG_CHECKING([for the canonical Nix system name]) +machine_name=`uname -m` +sys_name=`uname -s | tr [A-Z] [a-z]` +system="${machine_name}-${sys_name}" +AC_MSG_RESULT($system) +AC_SUBST(system) + AC_PROG_CC AC_PROG_CXX AC_PROG_RANLIB diff --git a/scripts/nix-prefetch-url.in b/scripts/nix-prefetch-url.in index 0873f5a8..05095568 100644 --- a/scripts/nix-prefetch-url.in +++ b/scripts/nix-prefetch-url.in @@ -25,7 +25,7 @@ rename $out, $out2; # Create a Nix expression. my $nixexpr = "(import @datadir@/nix/corepkgs/fetchurl) " . - "{url = $url; md5 = \"$hash\"; system = \"@host@\"}"; + "{url = $url; md5 = \"$hash\"; system = \"@system@\"}"; print "expr: $nixexpr\n"; diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in index 1453a46a..ded4281c 100644 --- a/scripts/nix-pull.in +++ b/scripts/nix-pull.in @@ -61,10 +61,10 @@ sub processURL { # Nix archive from the network. my $fetch = "(import @datadir@/nix/corepkgs/fetchurl) " . - "{url = $fullurl; md5 = \"$hash\"; system = \"@host@\"}"; + "{url = $fullurl; md5 = \"$hash\"; system = \"@system@\"}"; my $nixexpr = "((import @datadir@/nix/corepkgs/nar/unnar.nix) " . - "{narFile = ($fetch); outPath = \"$storepath\"; system = \"@host@\"}) "; + "{narFile = ($fetch); outPath = \"$storepath\"; system = \"@system@\"}) "; $fullexpr .= $nixexpr; # !!! O(n^2)? push @srcpaths, $storepath; diff --git a/scripts/nix-push.in b/scripts/nix-push.in index c1624d83..38afc7f7 100644 --- a/scripts/nix-push.in +++ b/scripts/nix-push.in @@ -45,7 +45,7 @@ foreach my $id (@ARGV) { my $nixexpr = "((import @datadir@/nix/corepkgs/nar/nar.nix) " . # !!! $path should be represented as a closure - "{path = \"$path\"; system = \"@host@\"}) "; + "{path = \"$path\"; system = \"@system@\"}) "; print NIX $nixexpr; } diff --git a/src/libstore/Makefile.am b/src/libstore/Makefile.am index 6605a76c..3e2777f6 100644 --- a/src/libstore/Makefile.am +++ b/src/libstore/Makefile.am @@ -6,5 +6,5 @@ libstore_a_SOURCES = \ globals.cc globals.hh db.cc db.hh \ references.cc references.hh pathlocks.cc pathlocks.hh -AM_CXXFLAGS = -DSYSTEM=\"@host@\" -Wall \ +AM_CXXFLAGS = -Wall \ -I.. -I../../externals/inst/include -I../libutil diff --git a/src/libutil/Makefile.am b/src/libutil/Makefile.am index 362a6e55..5d911186 100644 --- a/src/libutil/Makefile.am +++ b/src/libutil/Makefile.am @@ -3,7 +3,7 @@ noinst_LIBRARIES = libutil.a libutil_a_SOURCES = util.cc util.hh hash.cc hash.hh \ archive.cc archive.hh md5.c md5.h aterm.cc aterm.hh -AM_CXXFLAGS = -DSYSTEM=\"@host@\" -Wall -I.. -I../../externals/inst/include +AM_CXXFLAGS = -DSYSTEM=\"@system@\" -Wall -I.. -I../../externals/inst/include check_PROGRAMS = test-aterm diff --git a/substitute.mk b/substitute.mk index 1f09f73b..6557e496 100644 --- a/substitute.mk +++ b/substitute.mk @@ -5,7 +5,7 @@ -e "s^@sysconfdir\@^$(sysconfdir)^g" \ -e "s^@localstatedir\@^$(localstatedir)^g" \ -e "s^@datadir\@^$(datadir)^g" \ - -e "s^@host\@^$(host_triplet)^g" \ + -e "s^@system\@^$(system)^g" \ -e "s^@wget\@^$(wget)^g" \ < $< > $@ || rm $@ chmod +x $@