2008-03-02 15:56:15 +01:00
|
|
|
args : with args;
|
|
|
|
let
|
2008-11-04 22:24:10 +01:00
|
|
|
localDefs = with (builderDefs.passthru.function {src="";});
|
2008-03-02 19:33:54 +01:00
|
|
|
let
|
2009-05-24 12:57:41 +02:00
|
|
|
checkFlag = flag : lib.attrByPath [flag] false args;
|
2008-03-02 19:33:54 +01:00
|
|
|
in
|
2008-11-04 22:24:10 +01:00
|
|
|
builderDefs.passthru.function ({
|
2008-03-02 15:56:15 +01:00
|
|
|
inherit src;
|
2008-03-02 19:33:54 +01:00
|
|
|
inherit checkFlag;
|
2008-03-02 15:56:15 +01:00
|
|
|
buildInputs = [];
|
|
|
|
configureFlags = [];
|
2008-03-02 19:33:54 +01:00
|
|
|
makeFlags = if (checkFlag "omitConfigure")
|
|
|
|
then [" PREFIX=$out "]
|
|
|
|
else [];
|
2008-03-02 15:56:15 +01:00
|
|
|
patch = null;
|
|
|
|
meta = {};
|
|
|
|
doInstall = if args ? Install then
|
2009-05-20 01:25:58 +02:00
|
|
|
(fullDepEntry
|
2008-03-02 15:56:15 +01:00
|
|
|
args.Install
|
|
|
|
(["doMake"]
|
2009-05-24 12:57:41 +02:00
|
|
|
++ (lib.attrByPath ["extraInstallDeps"] [] args))
|
2008-03-02 15:56:15 +01:00
|
|
|
)
|
2009-05-20 01:25:58 +02:00
|
|
|
else fullDepEntry "" ["doMakeInstall"];
|
2008-03-02 15:56:15 +01:00
|
|
|
|
2009-05-20 01:25:58 +02:00
|
|
|
debPatch = fullDepEntry ((if args ? patch then ''
|
2008-03-02 15:56:15 +01:00
|
|
|
gunzip < ${args.patch} | patch -Np1
|
|
|
|
'' else "")
|
|
|
|
+''
|
|
|
|
sed -e 's/-o root//' -i Makefile Makefile.in Makefile.new || true;
|
|
|
|
sed -e 's/-g root//' -i Makefile Makefile.in Makefile.new || true;
|
|
|
|
''
|
2008-03-02 19:33:54 +01:00
|
|
|
+(if (checkFlag "omitFilePatches") then "" else
|
|
|
|
''
|
|
|
|
if test -d debian/patches; then
|
|
|
|
for i in debian/patches/*; do
|
|
|
|
patch -Np0 -i $i;
|
|
|
|
done;
|
|
|
|
fi;
|
|
|
|
'')
|
2008-03-02 15:56:15 +01:00
|
|
|
+ (if args ? extraReplacements then
|
|
|
|
args.extraReplacements
|
|
|
|
else ""))["minInit" "doUnpack"];
|
2008-08-19 07:54:09 +02:00
|
|
|
} // args);
|
2008-03-02 15:56:15 +01:00
|
|
|
in with localDefs;
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = localDefs.name + "deb";
|
|
|
|
builder = writeScript (name + "-builder")
|
|
|
|
(textClosure localDefs ([debPatch] ++
|
2009-04-27 14:04:11 +02:00
|
|
|
(lib.optional (patches != []) "doPatch") ++
|
|
|
|
(lib.optional (! (checkFlag "omitConfigure")) "doConfigure") ++
|
|
|
|
[doInstall doForceShare]));
|
2008-03-02 15:56:15 +01:00
|
|
|
inherit meta;
|
2008-03-02 19:33:54 +01:00
|
|
|
inherit src;
|
2008-03-02 15:56:15 +01:00
|
|
|
}
|