forked from lix-project/lix
* Descriptors now have a "system" field specifying the platform that
the build or run action should be perfomed on. This ensures that descriptors have different hashes on different platforms.
This commit is contained in:
parent
9d2f128252
commit
2dc84e5569
13
src/Makefile
13
src/Makefile
|
@ -1,2 +1,13 @@
|
||||||
|
all: nix nix-instantiate
|
||||||
|
|
||||||
|
SYSTEM = $(shell ./config.guess)
|
||||||
|
|
||||||
nix: nix.cc
|
nix: nix.cc
|
||||||
g++ -g -Wall -o nix nix.cc -ldb_cxx-4
|
g++ -g -Wall -o nix nix.cc -ldb_cxx-4 -DSYSTEM=\"$(SYSTEM)\"
|
||||||
|
|
||||||
|
nix-instantiate: nix-instantiate.in
|
||||||
|
sed "s/@SYSTEM@/$(SYSTEM)/" < $^ > $@
|
||||||
|
chmod +x $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o nix nix-instantiate
|
||||||
|
|
1400
src/config.guess
vendored
Executable file
1400
src/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load diff
|
@ -4,6 +4,8 @@ use strict;
|
||||||
use FileHandle;
|
use FileHandle;
|
||||||
use File::Spec;
|
use File::Spec;
|
||||||
|
|
||||||
|
my $system = "@SYSTEM@";
|
||||||
|
|
||||||
my $outdir = File::Spec->rel2abs($ARGV[0]);
|
my $outdir = File::Spec->rel2abs($ARGV[0]);
|
||||||
my $netdir = File::Spec->rel2abs($ARGV[1]);
|
my $netdir = File::Spec->rel2abs($ARGV[1]);
|
||||||
|
|
||||||
|
@ -49,6 +51,8 @@ sub convert {
|
||||||
open $IN, "< $descr" or die "cannot open $descr";
|
open $IN, "< $descr" or die "cannot open $descr";
|
||||||
open $OUT, "> $outfile" or die "cannot create $outfile";
|
open $OUT, "> $outfile" or die "cannot create $outfile";
|
||||||
|
|
||||||
|
print $OUT "system : $system\n";
|
||||||
|
|
||||||
while (<$IN>) {
|
while (<$IN>) {
|
||||||
chomp;
|
chomp;
|
||||||
|
|
67
src/nix.cc
67
src/nix.cc
|
@ -34,6 +34,9 @@ static string dbfile = PKGINFO_PATH;
|
||||||
static string pkgHome = "/pkg";
|
static string pkgHome = "/pkg";
|
||||||
|
|
||||||
|
|
||||||
|
static string thisSystem = SYSTEM;
|
||||||
|
|
||||||
|
|
||||||
class Error : public exception
|
class Error : public exception
|
||||||
{
|
{
|
||||||
string err;
|
string err;
|
||||||
|
@ -177,22 +180,12 @@ string makeRef(string filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct Dep
|
typedef pair<string, string> Param;
|
||||||
{
|
typedef list<Param> Params;
|
||||||
string name;
|
|
||||||
string ref;
|
|
||||||
Dep(string _name, string _ref)
|
|
||||||
{
|
|
||||||
name = _name;
|
|
||||||
ref = _ref;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef list<Dep> DepList;
|
|
||||||
|
|
||||||
|
|
||||||
void readPkgDescr(const string & pkgfile,
|
void readPkgDescr(const string & pkgfile,
|
||||||
DepList & pkgImports, DepList & fileImports)
|
Params & pkgImports, Params & fileImports, Params & arguments)
|
||||||
{
|
{
|
||||||
ifstream file;
|
ifstream file;
|
||||||
file.exceptions(ios::badbit);
|
file.exceptions(ios::badbit);
|
||||||
|
@ -212,12 +205,14 @@ void readPkgDescr(const string & pkgfile,
|
||||||
string name, op, ref;
|
string name, op, ref;
|
||||||
str >> name >> op >> ref;
|
str >> name >> op >> ref;
|
||||||
|
|
||||||
|
if (op == "<-") {
|
||||||
checkRef(ref);
|
checkRef(ref);
|
||||||
|
pkgImports.push_back(Param(name, ref));
|
||||||
if (op == "<-")
|
} else if (op == "=") {
|
||||||
pkgImports.push_back(Dep(name, ref));
|
checkRef(ref);
|
||||||
else if (op == "=")
|
fileImports.push_back(Param(name, ref));
|
||||||
fileImports.push_back(Dep(name, ref));
|
} else if (op == ":")
|
||||||
|
arguments.push_back(Param(name, ref));
|
||||||
else throw Error("invalid operator " + op);
|
else throw Error("invalid operator " + op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,37 +238,51 @@ void fetchDeps(string hash, Environment & env)
|
||||||
throw Error("file " + pkgfile + " is stale");
|
throw Error("file " + pkgfile + " is stale");
|
||||||
|
|
||||||
/* Read the package description file. */
|
/* Read the package description file. */
|
||||||
DepList pkgImports, fileImports;
|
Params pkgImports, fileImports, arguments;
|
||||||
readPkgDescr(pkgfile, pkgImports, fileImports);
|
readPkgDescr(pkgfile, pkgImports, fileImports, arguments);
|
||||||
|
|
||||||
/* Recursively fetch all the dependencies, filling in the
|
/* Recursively fetch all the dependencies, filling in the
|
||||||
environment as we go along. */
|
environment as we go along. */
|
||||||
for (DepList::iterator it = pkgImports.begin();
|
for (Params::iterator it = pkgImports.begin();
|
||||||
it != pkgImports.end(); it++)
|
it != pkgImports.end(); it++)
|
||||||
{
|
{
|
||||||
cerr << "fetching package dependency "
|
cerr << "fetching package dependency "
|
||||||
<< it->name << " <- " << it->ref
|
<< it->first << " <- " << it->second
|
||||||
<< endl;
|
<< endl;
|
||||||
env[it->name] = getPkg(it->ref);
|
env[it->first] = getPkg(it->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (DepList::iterator it = fileImports.begin();
|
for (Params::iterator it = fileImports.begin();
|
||||||
it != fileImports.end(); it++)
|
it != fileImports.end(); it++)
|
||||||
{
|
{
|
||||||
cerr << "fetching file dependency "
|
cerr << "fetching file dependency "
|
||||||
<< it->name << " = " << it->ref
|
<< it->first << " = " << it->second
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
string file;
|
string file;
|
||||||
|
|
||||||
if (!queryDB(dbRefs, it->ref, file))
|
if (!queryDB(dbRefs, it->second, file))
|
||||||
throw Error("unknown file " + it->ref);
|
throw Error("unknown file " + it->second);
|
||||||
|
|
||||||
if (makeRef(file) != it->ref)
|
if (makeRef(file) != it->second)
|
||||||
throw Error("file " + file + " is stale");
|
throw Error("file " + file + " is stale");
|
||||||
|
|
||||||
env[it->name] = file;
|
env[it->first] = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string buildSystem;
|
||||||
|
|
||||||
|
for (Params::iterator it = arguments.begin();
|
||||||
|
it != arguments.end(); it++)
|
||||||
|
{
|
||||||
|
env[it->first] = it->second;
|
||||||
|
if (it->first == "system")
|
||||||
|
buildSystem = it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buildSystem != thisSystem)
|
||||||
|
throw Error("descriptor requires a `" + buildSystem +
|
||||||
|
"' but I am a `" + thisSystem + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
id : aterm-2.0
|
||||||
|
|
||||||
# Original sources.
|
# Original sources.
|
||||||
src = url(http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.tar.gz)
|
src = url(http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.tar.gz)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
id : atk-1.2.0
|
||||||
|
|
||||||
pkgconfig <- ./pkgconfig-0.15.0.nix
|
pkgconfig <- ./pkgconfig-0.15.0.nix
|
||||||
glib <- ./glib-2.2.1.nix
|
glib <- ./glib-2.2.1.nix
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
id : glib-2.2.1
|
||||||
|
|
||||||
pkgconfig <- ./pkgconfig-0.15.0.nix
|
pkgconfig <- ./pkgconfig-0.15.0.nix
|
||||||
|
|
||||||
src = url(ftp://ftp.gtk.org/pub/gtk/v2.2/glib-2.2.1.tar.bz2)
|
src = url(ftp://ftp.gtk.org/pub/gtk/v2.2/glib-2.2.1.tar.bz2)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
id : gnet-1.1.8
|
||||||
|
|
||||||
pkgconfig <- ./pkgconfig-0.15.0.nix
|
pkgconfig <- ./pkgconfig-0.15.0.nix
|
||||||
glib <- ./glib-2.2.1.nix
|
glib <- ./glib-2.2.1.nix
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
id : gtk+-2.2.1
|
||||||
|
|
||||||
pkgconfig <- ./pkgconfig-0.15.0.nix
|
pkgconfig <- ./pkgconfig-0.15.0.nix
|
||||||
glib <- ./glib-2.2.1.nix
|
glib <- ./glib-2.2.1.nix
|
||||||
atk <- ./atk-1.2.0.nix
|
atk <- ./atk-1.2.0.nix
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
id : gtkspell-2.0.2
|
||||||
|
|
||||||
pkgconfig <- ./pkgconfig-0.15.0.nix
|
pkgconfig <- ./pkgconfig-0.15.0.nix
|
||||||
glib <- ./glib-2.2.1.nix
|
glib <- ./glib-2.2.1.nix
|
||||||
atk <- ./atk-1.2.0.nix
|
atk <- ./atk-1.2.0.nix
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
id : pan-0.13.4
|
||||||
|
|
||||||
pkgconfig <- ./pkgconfig-0.15.0.nix
|
pkgconfig <- ./pkgconfig-0.15.0.nix
|
||||||
glib <- ./glib-2.2.1.nix
|
glib <- ./glib-2.2.1.nix
|
||||||
atk <- ./atk-1.2.0.nix
|
atk <- ./atk-1.2.0.nix
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
id : pan-0.13.91-run
|
||||||
|
|
||||||
pan <- ./pan-0.13.91.nix
|
pan <- ./pan-0.13.91.nix
|
||||||
|
|
||||||
glib <- ./glib-2.2.1.nix
|
glib <- ./glib-2.2.1.nix
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
id : pan-0.13.91-run
|
||||||
|
|
||||||
pkgconfig <- ./pkgconfig-0.15.0.nix
|
pkgconfig <- ./pkgconfig-0.15.0.nix
|
||||||
glib <- ./glib-2.2.1.nix
|
glib <- ./glib-2.2.1.nix
|
||||||
atk <- ./atk-1.2.0.nix
|
atk <- ./atk-1.2.0.nix
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
id : pango-1.2.1
|
||||||
|
|
||||||
pkgconfig <- ./pkgconfig-0.15.0.nix
|
pkgconfig <- ./pkgconfig-0.15.0.nix
|
||||||
glib <- ./glib-2.2.1.nix
|
glib <- ./glib-2.2.1.nix
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
id : pkgconfig-0.15.0
|
||||||
|
|
||||||
src = url(http://www.freedesktop.org/software/pkgconfig/releases/pkgconfig-0.15.0.tar.gz)
|
src = url(http://www.freedesktop.org/software/pkgconfig/releases/pkgconfig-0.15.0.tar.gz)
|
||||||
|
|
||||||
build = ../build/pkgconfig-build.sh
|
build = ../build/pkgconfig-build.sh
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
id : pspell-.12.2
|
||||||
|
|
||||||
src = url(http://unc.dl.sourceforge.net/sourceforge/pspell/pspell-.12.2.tar.gz)
|
src = url(http://unc.dl.sourceforge.net/sourceforge/pspell/pspell-.12.2.tar.gz)
|
||||||
|
|
||||||
build = ../build/pspell-build.sh
|
build = ../build/pspell-build.sh
|
||||||
|
|
Loading…
Reference in a new issue