1 { lib, stdenv, cleanPackaging, fetchurl }:
8 , sha256 ? lib.fakeSha256
14 , platforms ? lib.platforms.all
16 , outputs ? [ "bin" "lib" "dev" "doc" "out" ]
17 # TODO(Profpatsch): automatically infer most of these
21 , postConfigure ? null
22 # mostly for moving and deleting files from the build directory
27 # : passthru arguments (e.g. tests)
34 # File globs that can always be deleted
47 # File globs that should be moved to $doc
61 inherit pname version;
64 url = "https://skarnet.org/software/${pname}/${pname}-${version}.tar.gz";
72 assert (lib.assertMsg (!lib.elem "man" outputs) "If you pass `manpages` to `skawarePackages.buildPackage`, you cannot have a `man` output already!");
73 # insert as early as posible, but keep the first element
74 if lib.length outputs > 0
75 then [(lib.head outputs) "man"] ++ lib.tail outputs
78 dontDisableStatic = true;
79 enableParallelBuilding = true;
81 configureFlags = configureFlags ++ [
82 "--enable-absolute-paths"
83 # We assume every nix-based cross target has urandom.
84 # This might not hold for e.g. BSD.
85 "--with-sysdep-devurandom=yes"
87 then "--disable-shared"
88 else "--enable-shared")
90 # On darwin, the target triplet from -dumpmachine includes version number,
91 # but skarnet.org software uses the triplet to test binary compatibility.
92 # Explicitly setting target ensures code can be compiled against a skalibs
93 # binary built on a different version of darwin.
94 # http://www.skarnet.org/cgi-bin/archive.cgi?1:mss:623:heiodchokfjdkonfhdph
95 ++ (lib.optional stdenv.isDarwin
96 "--build=${stdenv.hostPlatform.system}");
98 inherit postConfigure;
100 makeFlags = lib.optionals stdenv.cc.isClang [ "AR=${stdenv.cc.targetPrefix}ar" "RANLIB=${stdenv.cc.targetPrefix}ranlib" ];
102 # TODO(Profpatsch): ensure that there is always a $doc output!
104 echo "Cleaning & moving common files"
105 ${cleanPackaging.commonFileActions {
106 noiseFiles = commonNoiseFiles;
107 docFiles = commonMetaFiles;
108 }} $doc/share/doc/${pname}
110 ${if manpages == null
111 then ''echo "no manpages for this package"''
113 echo "copying manpages"
114 cp -vr ${manpages} $man
121 ${cleanPackaging.checkForRemainingFiles}
124 passthru = passthru // (if manpages == null then {} else { inherit manpages; });
127 homepage = "https://skarnet.org/software/${pname}/";
128 inherit description platforms;
129 license = lib.licenses.isc;
130 maintainers = with lib.maintainers;
131 [ pmahoney Profpatsch qyliss ] ++ maintainers;