skawarePackages: factor out the common parts

Introduce a `skawarePackages.buildPackage` function that contains the
common setup, removing a lot of duplication.
In particular, we require that the build directory has to be empty
after the `fixupPhase`, to make sure every relevant file is moved to
the outputs.

A next step would be to deduplicate the `configureFlags` attributes
and only require a `skawareInputs` field.
This commit is contained in:
Profpatsch
2018-09-06 11:53:22 +02:00
parent 57b431590b
commit 0071ae1d4f
10 changed files with 228 additions and 223 deletions
+11 -28
View File
@@ -1,28 +1,18 @@
{ stdenv, fetchgit, skalibs }:
{ stdenv, skawarePackages }:
let
with skawarePackages;
buildPackage {
pname = "execline";
version = "2.5.0.1";
sha256 = "0d4gvixz7xja03hnwc2bf13xrgh1jq27ij4m1jlrpgrzhfpqz37q";
in stdenv.mkDerivation rec {
name = "execline-${version}";
src = fetchgit {
url = "git://git.skarnet.org/execline";
rev = "refs/tags/v${version}";
sha256 = "0d4gvixz7xja03hnwc2bf13xrgh1jq27ij4m1jlrpgrzhfpqz37q";
};
description = "A small scripting language, to be used in place of a shell in non-interactive scripts";
outputs = [ "bin" "lib" "dev" "doc" "out" ];
dontDisableStatic = true;
enableParallelBuilding = true;
# TODO: nsss support
configureFlags = [
"--enable-absolute-paths"
"--libdir=\${lib}/lib"
"--dynlibdir=\${lib}/lib"
"--bindir=\${bin}/bin"
@@ -31,22 +21,15 @@ in stdenv.mkDerivation rec {
"--with-include=${skalibs.dev}/include"
"--with-lib=${skalibs.lib}/lib"
"--with-dynlib=${skalibs.lib}/lib"
]
++ (if stdenv.isDarwin then [ "--disable-shared" ] else [ "--enable-shared" ])
++ (stdenv.lib.optional stdenv.isDarwin "--build=${stdenv.hostPlatform.system}");
];
postInstall = ''
mkdir -p $doc/share/doc/execline
# remove all execline executables from build directory
rm $(find -type f -mindepth 1 -maxdepth 1 -executable)
rm libexecline.*
mv doc $doc/share/doc/execline/html
mv examples $doc/share/doc/execline/examples
'';
meta = {
homepage = http://skarnet.org/software/execline/;
description = "A small scripting language, to be used in place of a shell in non-interactive scripts";
platforms = stdenv.lib.platforms.all;
license = stdenv.lib.licenses.isc;
maintainers = with stdenv.lib.maintainers; [ pmahoney Profpatsch ];
};
}