mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
Added a new setup proposal, builder is no more derived from shell script (where edit=glibc rebuild), but is composed from a nix attribute set with strings and dependencies - so if you add a function, old expressions ignore it; collateral damage are packages in this style: Fastest Fourier Transform in the West, Audacity sound editor, Falling Sand game. Also added string equality that ignores dependencies to lib. Note that hasSuffixHack is now the more predictable version, but hasSuffix is left to remind us to fix the bug.
svn path=/nixpkgs/trunk/; revision=9549
This commit is contained in:
parent
ae7d316684
commit
d352d54b11
36
pkgs/applications/audio/audacity/default.nix
Normal file
36
pkgs/applications/audio/audacity/default.nix
Normal file
@ -0,0 +1,36 @@
|
||||
args: with args;
|
||||
with (builderDefs {
|
||||
src =
|
||||
fetchurl {
|
||||
url = mirror://sourceforge/audacity/audacity-src-1.3.3.tar.gz;
|
||||
sha256 = "17bjc2rnqspg1mbay4b1hhgg08iadapwf6w98gbv3r84rv1mhgls";
|
||||
};
|
||||
|
||||
buildInputs =[(wxGTK null) libogg libvorbis libsndfile libmad pkgconfig gtk
|
||||
gettext glib];
|
||||
} null);
|
||||
with stringsWithDeps;
|
||||
let
|
||||
postInstall = FullDepEntry ("
|
||||
old_rpath=$(patchelf --print-rpath \$out/bin/audacity);
|
||||
patchelf --set-rpath \$old_rpath:${gtk}/lib:${glib}/lib \$out/bin/audacity;
|
||||
") [minInit];
|
||||
preBuild = FullDepEntry ("
|
||||
sed -e '/\\/usr\\/local\\/lib\\/ladspa/awxGetApp()."+
|
||||
"AddUniquePathToPathList(wxGetenv(wxT(\"HOME\"))+"+
|
||||
"wxT(\"/.ladspa-plugins\"), pathList);'
|
||||
|
||||
") [minInit];
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "audacity-1.3.3";
|
||||
|
||||
builder = writeScript "audacity-1.3.3-builder"
|
||||
(textClosure [addInputs (doDump "0") (noDepEntry "echo \$PATH; ar --version") doConfigure preBuild doMakeInstall postInstall doForceShare]);
|
||||
|
||||
meta = {
|
||||
description = "
|
||||
Audacity sound editor.
|
||||
";
|
||||
};
|
||||
}
|
27
pkgs/applications/audio/ladspa-plugins/default.nix
Normal file
27
pkgs/applications/audio/ladspa-plugins/default.nix
Normal file
@ -0,0 +1,27 @@
|
||||
args: with args;
|
||||
with (builderDefs {
|
||||
src =
|
||||
fetchurl {
|
||||
url = http://plugin.org.uk/releases/0.4.15/swh-plugins-0.4.15.tar.gz;
|
||||
sha256 = "0h462s4mmqg4iw7zdsihnrmz2vjg0fd49qxw2a284bnryjjfhpnh";
|
||||
};
|
||||
buildInputs = [fftw ladspaH pkgconfig];
|
||||
configureFlags = [];
|
||||
} null);
|
||||
with stringsWithDeps;
|
||||
let
|
||||
postInstall = FullDepEntry ("
|
||||
ensureDir \$out/share/ladspa/
|
||||
ln -s \$out/lib/ladspa \$out/share/ladspa/lib
|
||||
") [minInit defEnsureDir];
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "swh-plugins-0.4.15";
|
||||
builder = writeScript "swh-plugins-0.4.15-builder"
|
||||
(textClosure [doConfigure doMakeInstall postInstall doForceShare]);
|
||||
meta = {
|
||||
description = "
|
||||
LADSPA format audio plugins.
|
||||
";
|
||||
};
|
||||
}
|
29
pkgs/applications/audio/ladspa-plugins/ladspah.nix
Normal file
29
pkgs/applications/audio/ladspa-plugins/ladspah.nix
Normal file
@ -0,0 +1,29 @@
|
||||
args: with args;
|
||||
with stringsWithDeps;
|
||||
let
|
||||
src =
|
||||
fetchurl {
|
||||
url = http://www.ladspa.org/ladspa_sdk/ladspa.h.txt;
|
||||
sha256 = "1b908csn85ng9sz5s5d1mqk711cmawain2z8px2ajngihdrynb67";
|
||||
};
|
||||
in
|
||||
with builderDefs {
|
||||
buildInputs = [];
|
||||
inherit src;
|
||||
} null;
|
||||
let
|
||||
copyFile = FullDepEntry ("
|
||||
ensureDir \$out/include
|
||||
cp ${src} \$out/include/ladspa.h
|
||||
") [minInit defEnsureDir];
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "ladspa.h";
|
||||
builder = writeScript "ladspa.h-builder"
|
||||
(textClosure [copyFile]);
|
||||
meta = {
|
||||
description = "
|
||||
LADSPA format audio plugins.
|
||||
";
|
||||
};
|
||||
}
|
@ -13,4 +13,5 @@ stdenv.mkDerivation {
|
||||
preBuild = "
|
||||
makeFlagsArray=(moduledir=$out/lib/compiz)
|
||||
";
|
||||
preConfigure = "touch m4/Makefile.in";
|
||||
}
|
||||
|
21
pkgs/development/libraries/fftw/default.nix
Normal file
21
pkgs/development/libraries/fftw/default.nix
Normal file
@ -0,0 +1,21 @@
|
||||
args : with args;
|
||||
with builderDefs {
|
||||
src =
|
||||
fetchurl {
|
||||
url = ftp://ftp.fftw.org/pub/fftw/fftw-3.1.2.tar.gz;
|
||||
sha256 = "1gr63hf5vvsg50b2xwqaxwpvs1y9g8l0sb91a38wpvr7zsbjxfg1";
|
||||
};
|
||||
buildInputs = [];
|
||||
configureFlags = ["--enable-float --enable-shared"];
|
||||
} null;
|
||||
with stringsWithDeps;
|
||||
stdenv.mkDerivation {
|
||||
name = "fftw-3.1.2";
|
||||
builder = writeScript "fftw-3.1.2-builder"
|
||||
(textClosure [doConfigure doMakeInstall doForceShare]);
|
||||
meta = {
|
||||
description = "
|
||||
Fastest Fourier Transform in the West library.
|
||||
";
|
||||
};
|
||||
}
|
36
pkgs/games/fsg/alt-builder.nix
Normal file
36
pkgs/games/fsg/alt-builder.nix
Normal file
@ -0,0 +1,36 @@
|
||||
args: with args;
|
||||
with (builderDefs
|
||||
{
|
||||
buildInputs =[(wxGTK null)];
|
||||
src =
|
||||
fetchurl {
|
||||
url = http://www.piettes.com/fallingsandgame/fsg-src-4.4.tar.gz;
|
||||
sha256 = "1756y01rkvd3f1pkj88jqh83fqcfl2fy0c48mcq53pjzln9ycv8c";
|
||||
};
|
||||
} null);
|
||||
with stringsWithDeps;
|
||||
let
|
||||
preBuild = FullDepEntry "
|
||||
sed -e '
|
||||
s@currentProbIndex != 100@0@;
|
||||
' -i MainFrame.cpp;
|
||||
" [minInit];
|
||||
|
||||
installPhase = FullDepEntry "
|
||||
ensureDir \$out/bin \$out/libexec;
|
||||
cp sand \$out/libexec;
|
||||
echo -e '#! /bin/sh\nLC_ALL=C '\$out'/libexec/sand \"$@\"' >\$out/bin/fsg;
|
||||
chmod a+x \$out/bin/fsg;
|
||||
" [minInit defEnsureDir];
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "fsg-4.4";
|
||||
builder = writeScript "fsg-4.4-builder"
|
||||
(textClosure [doUnpack addInputs preBuild doMake installPhase doForceShare]);
|
||||
|
||||
meta = {
|
||||
description = "
|
||||
Falling Sand Game - a cellular automata engine tuned towards the likes of Falling Sand.
|
||||
";
|
||||
};
|
||||
}
|
@ -95,6 +95,8 @@ rec {
|
||||
else if xs == [] || ys == [] then false
|
||||
else head xs == head ys && eqLists (tail xs) (tail ys);
|
||||
|
||||
# Workaround, but works in stable Nix now.
|
||||
eqStrings = a: b: (a+(substring 0 0 b)) == ((substring 0 0 a)+b);
|
||||
|
||||
# Determine whether a filename ends in the given suffix.
|
||||
hasSuffix = ext: fileName:
|
||||
@ -103,6 +105,7 @@ rec {
|
||||
in !(lessThan lenFileName lenExt) &&
|
||||
substring (sub lenFileName lenExt) lenFileName fileName == ext;
|
||||
|
||||
hasSuffixHack = a: b: hasSuffix (a+(substring 0 0 b)) ((substring 0 0 a)+b);
|
||||
|
||||
# Bring in a path as a source, filtering out all Subversion and CVS
|
||||
# directories, as well as backup files (*~).
|
||||
|
@ -4,6 +4,7 @@ args:
|
||||
let
|
||||
inherit (builtins)
|
||||
head tail isList;
|
||||
in
|
||||
rec {
|
||||
|
||||
/*
|
||||
@ -33,17 +34,15 @@ rec {
|
||||
if isList arg then
|
||||
textClosureDupList {text = ""; deps = arg;}
|
||||
else
|
||||
(if (arg ? deps) then
|
||||
map textClosureDupList arg.deps
|
||||
else [])
|
||||
++ [arg]
|
||||
(concatLists (map textClosureDupList arg.deps)) ++ [arg]
|
||||
);
|
||||
|
||||
textClosureList = arg: uniqList (textClosureDupList arg);
|
||||
textClosure = arg: concatStringsSep "
|
||||
" (textClosureList arg);
|
||||
textClosureList = arg:
|
||||
(map (x : x.text)
|
||||
(uniqList {inputList = textClosureDupList arg;}));
|
||||
textClosure = arg: concatStringsSep "\n" (textClosureList arg);
|
||||
|
||||
noDepEntry = text : {inherit text;};
|
||||
FullDepEntry = text : deps: {inherit text args;};
|
||||
noDepEntry = text : {inherit text;deps = [];};
|
||||
FullDepEntry = text : deps: {inherit text deps;};
|
||||
PackEntry = deps: {inherit deps; text="";};
|
||||
}
|
||||
|
@ -213,6 +213,14 @@ rec {
|
||||
abort (toString result))
|
||||
else x);
|
||||
|
||||
builderDefs = lib.sumArgs (import ./builder-defs.nix) {
|
||||
inherit stringsWithDeps lib stdenv writeScript;
|
||||
};
|
||||
|
||||
stringsWithDeps = import ../lib/strings-with-deps.nix {
|
||||
inherit stdenv lib;
|
||||
};
|
||||
|
||||
### STANDARD ENVIRONMENT
|
||||
|
||||
|
||||
@ -1605,6 +1613,10 @@ rec {
|
||||
inherit fetchurl stdenv;
|
||||
};
|
||||
|
||||
fftw = import ../development/libraries/fftw {
|
||||
inherit fetchurl stdenv builderDefs stringsWithDeps;
|
||||
};
|
||||
|
||||
|
||||
# commented out because it's using the new configuration style proposal which is unstable
|
||||
# needs some testing ..
|
||||
@ -3387,13 +3399,14 @@ rec {
|
||||
libstdcpp = gcc33.gcc;
|
||||
};
|
||||
|
||||
# audacity = import ../applications/audio/audacity {
|
||||
# inherit fetchurl libogg libvorbis libsndfile libmad
|
||||
# pkgconfig gettext;
|
||||
# inherit (gtkLibs) gtk glib;
|
||||
# wxGTK = wxGTK28;
|
||||
# stdenv = overrideGCC stdenv gcc41NPTL;
|
||||
# };
|
||||
audacity = import ../applications/audio/audacity {
|
||||
inherit fetchurl libogg libvorbis libsndfile libmad
|
||||
pkgconfig gettext;
|
||||
inherit (gtkLibs) gtk glib;
|
||||
wxGTK = wxGTK28deps;
|
||||
stdenv = overrideGCC stdenv gcc41NPTL;
|
||||
inherit builderDefs stringsWithDeps;
|
||||
};
|
||||
|
||||
batik = import ../applications/graphics/batik {
|
||||
inherit fetchurl stdenv unzip;
|
||||
@ -3691,6 +3704,14 @@ rec {
|
||||
inherit fetchurl stdenv ;
|
||||
};
|
||||
|
||||
ladspaH = import ../applications/audio/ladspa-plugins/ladspah.nix {
|
||||
inherit fetchurl stdenv builderDefs stringsWithDeps;
|
||||
};
|
||||
|
||||
ladspaPlugins = import ../applications/audio/ladspa-plugins {
|
||||
inherit fetchurl stdenv builderDefs stringsWithDeps fftw ladspaH pkgconfig;
|
||||
};
|
||||
|
||||
links = import ../applications/networking/browsers/links {
|
||||
inherit fetchurl stdenv;
|
||||
};
|
||||
@ -4122,6 +4143,15 @@ rec {
|
||||
wxGTK = wxGTK28deps {unicode = false;};
|
||||
};
|
||||
|
||||
fsgAltBuild = import ../games/fsg/alt-builder.nix {
|
||||
inherit stdenv fetchurl;
|
||||
wxGTK = wxGTK28deps {unicode = false;};
|
||||
stringsWithDeps = import ../lib/strings-with-deps.nix {
|
||||
inherit stdenv lib;
|
||||
};
|
||||
inherit builderDefs;
|
||||
};
|
||||
|
||||
gemrb = import ../games/gemrb {
|
||||
inherit fetchurl stdenv SDL openal freealut zlib libpng python;
|
||||
};
|
||||
|
157
pkgs/top-level/builder-defs.nix
Normal file
157
pkgs/top-level/builder-defs.nix
Normal file
@ -0,0 +1,157 @@
|
||||
args: with args; with stringsWithDeps; with lib;
|
||||
rec
|
||||
{
|
||||
inherit writeScript;
|
||||
|
||||
forceShare = if args ? forceShare then args.forceShare else ["man" "doc" "info"];
|
||||
|
||||
archiveType = s:
|
||||
(if hasSuffixHack ".tar" s then "tar"
|
||||
else if (hasSuffixHack ".tar.gz" s) || (hasSuffixHack ".tgz" s) then "tgz"
|
||||
else if (hasSuffixHack ".tar.bz2" s) || (hasSuffixHack ".tbz2" s) then "tbz2"
|
||||
else (abort "unknown archive type : ${s}"));
|
||||
|
||||
minInit = noDepEntry ("
|
||||
set -e
|
||||
NIX_GCC=${stdenv.gcc}
|
||||
export SHELL=${stdenv.shell}
|
||||
# Set up the initial path.
|
||||
PATH=
|
||||
for i in \$NIX_GCC ${toString stdenv.initialPath}; do
|
||||
PATH=\$PATH\${PATH:+:}\$i/bin
|
||||
done
|
||||
" + (if ((stdenv ? preHook) && (stdenv.preHook != null) &&
|
||||
((toString stdenv.preHook) != "")) then
|
||||
"
|
||||
param1=${stdenv.param1}
|
||||
param2=${stdenv.param2}
|
||||
param3=${stdenv.param3}
|
||||
param4=${stdenv.param4}
|
||||
param5=${stdenv.param5}
|
||||
source ${stdenv.preHook}
|
||||
|
||||
export TZ=UTC
|
||||
|
||||
prefix=${if args ? prefix then (toString args.prefix) else "\$out"}
|
||||
"
|
||||
else ""));
|
||||
|
||||
addInputs = FullDepEntry ("
|
||||
# Recursively find all build inputs.
|
||||
findInputs()
|
||||
{
|
||||
local pkg=\$1
|
||||
|
||||
case \$pkgs in
|
||||
*\\ \$pkg\\ *)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
pkgs=\"\$pkgs \$pkg \"
|
||||
|
||||
echo \$pkg
|
||||
if test -f \$pkg/nix-support/setup-hook; then
|
||||
source \$pkg/nix-support/setup-hook
|
||||
cat \$pkg/nix-support/setup-hook
|
||||
echo $PATH;
|
||||
fi
|
||||
|
||||
if test -f \$pkg/nix-support/propagated-build-inputs; then
|
||||
for i in \$(cat \$pkg/nix-support/propagated-build-inputs); do
|
||||
findInputs \$i
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
pkgs=\"\"
|
||||
for i in \$NIX_GCC ${toString buildInputs} ${toString
|
||||
(if (args ? propagatedBuildInputs) then
|
||||
args.propagatedBuildInputs else "")}; do
|
||||
findInputs \$i
|
||||
done
|
||||
|
||||
|
||||
# Set the relevant environment variables to point to the build inputs
|
||||
# found above.
|
||||
addToEnv()
|
||||
{
|
||||
local pkg=\$1
|
||||
"+
|
||||
(if !((args ? ignoreFailedInputs) && (args.ignoreFailedInputs == 1)) then "
|
||||
if [ -e \$1/nix-support/failed ]; then
|
||||
echo \"failed input \$1\" >&2
|
||||
fail
|
||||
fi
|
||||
" else "")
|
||||
+"
|
||||
if test -d \$1/bin; then
|
||||
export _PATH=\$_PATH\${_PATH:+:}\$1/bin
|
||||
fi
|
||||
|
||||
for i in \"\${envHooks[@]}\"; do
|
||||
\$i \$pkg
|
||||
done
|
||||
}
|
||||
|
||||
for i in \$pkgs; do
|
||||
addToEnv \$i
|
||||
done
|
||||
|
||||
|
||||
# Add the output as an rpath.
|
||||
if test \"\$NIX_NO_SELF_RPATH\" != \"1\"; then
|
||||
export NIX_LDFLAGS=\"-rpath \$out/lib \$NIX_LDFLAGS\"
|
||||
fi
|
||||
|
||||
PATH=\$_PATH\${_PATH:+:}\$PATH
|
||||
") [minInit];
|
||||
|
||||
defEnsureDir = FullDepEntry ("
|
||||
# Ensure that the given directories exists.
|
||||
ensureDir() {
|
||||
local dir
|
||||
for dir in \"\$@\"; do
|
||||
if ! test -x \"\$dir\"; then mkdir -p \"\$dir\"; fi
|
||||
done
|
||||
}
|
||||
") [minInit];
|
||||
|
||||
toSrcDir = s : FullDepEntry (if (archiveType s) == "tar" then "
|
||||
tar xvf ${s}
|
||||
cd \"\$(tar tf ${s} | head -1 | sed -e 's@/.*@@' )\"
|
||||
" else if (archiveType s) == "tgz" then "
|
||||
tar xvzf ${s}
|
||||
cd \"\$(tar tzf ${s} | head -1 | sed -e 's@/.*@@' )\"
|
||||
" else if (archiveType s) == "tbz2" then "
|
||||
tar xvjf ${s}
|
||||
cd \"\$(tar tjf ${s} | head -1 | sed -e 's@/.*@@' )\"
|
||||
" else (abort "unknown archive type : ${s}")) [minInit];
|
||||
|
||||
doConfigure = FullDepEntry ("
|
||||
./configure --prefix=\"\$prefix\" ${toString (getAttr ["configureFlags"] "" args)}
|
||||
") [minInit addInputs doUnpack];
|
||||
|
||||
doMake = FullDepEntry ("
|
||||
make ${toString (getAttr ["makeFlags"] "" args)}
|
||||
") [minInit addInputs doUnpack];
|
||||
|
||||
doUnpack = toSrcDir (toString src);
|
||||
|
||||
doMakeInstall = FullDepEntry ("
|
||||
make ${toString (getAttr ["makeFlags"] "" args)} "+
|
||||
"${toString (getAttr ["installFlags"] "" args)} install") [doMake];
|
||||
|
||||
doForceShare = FullDepEntry ("
|
||||
ensureDir \$prefix/share
|
||||
for d in ${toString forceShare}; do
|
||||
if [ -d \$prefix/\$d -a ! -d \$prefix/share/\$d ]; then
|
||||
mv -v \$prefix/\$d \$prefix/share
|
||||
ln -sv share/\$d \$prefix
|
||||
fi;
|
||||
done;
|
||||
") [minInit defEnsureDir];
|
||||
|
||||
doDump = n: noDepEntry "echo Dump number ${n}; set";
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user