2008-03-02 15:56:15 +01:00
|
|
|
args : with args;
|
|
|
|
let
|
|
|
|
localDefs = with (builderDefs {src="";} null);
|
2008-03-02 19:33:54 +01:00
|
|
|
let
|
|
|
|
checkFlag = flag : lib.getAttr [flag] false args;
|
|
|
|
in
|
|
|
|
builderDefs {
|
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
|
|
|
|
(FullDepEntry
|
|
|
|
args.Install
|
|
|
|
(["doMake"]
|
|
|
|
++ (lib.getAttr ["extraInstallDeps"] [] args))
|
|
|
|
)
|
|
|
|
else FullDepEntry "" ["doMakeInstall"];
|
|
|
|
|
|
|
|
debPatch = FullDepEntry ((if args ? patch then ''
|
|
|
|
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"];
|
|
|
|
} args null; /* null is a terminator for sumArgs */
|
|
|
|
in with localDefs;
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = localDefs.name + "deb";
|
|
|
|
builder = writeScript (name + "-builder")
|
|
|
|
(textClosure localDefs ([debPatch] ++
|
2008-03-02 19:33:54 +01:00
|
|
|
(lib.optional (! (checkFlag "omitConfigure")) "doConfigure")
|
2008-03-02 15:56:15 +01:00
|
|
|
++ [doInstall doForceShare]));
|
|
|
|
inherit meta;
|
2008-03-02 19:33:54 +01:00
|
|
|
inherit src;
|
2008-03-02 15:56:15 +01:00
|
|
|
}
|