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)
29 # : attributes to be merged into meta
35 # File globs that can always be deleted
48 # File globs that should be moved to $doc
62 inherit pname version;
65 url = "https://skarnet.org/software/${pname}/${pname}-${version}.tar.gz";
73 assert (lib.assertMsg (!lib.elem "man" outputs) "If you pass `manpages` to `skawarePackages.buildPackage`, you cannot have a `man` output already!");
74 # insert as early as posible, but keep the first element
75 if lib.length outputs > 0
76 then [(lib.head outputs) "man"] ++ lib.tail outputs
79 dontDisableStatic = true;
80 enableParallelBuilding = true;
82 configureFlags = configureFlags ++ [
83 "--enable-absolute-paths"
84 # We assume every nix-based cross target has urandom.
85 # This might not hold for e.g. BSD.
86 "--with-sysdep-devurandom=yes"
87 (if stdenv.hostPlatform.isDarwin
88 then "--disable-shared"
89 else "--enable-shared")
91 # On darwin, the target triplet from -dumpmachine includes version number,
92 # but skarnet.org software uses the triplet to test binary compatibility.
93 # Explicitly setting target ensures code can be compiled against a skalibs
94 # binary built on a different version of darwin.
95 # http://www.skarnet.org/cgi-bin/archive.cgi?1:mss:623:heiodchokfjdkonfhdph
96 ++ (lib.optional stdenv.hostPlatform.isDarwin
97 "--build=${stdenv.hostPlatform.system}");
99 inherit postConfigure;
101 makeFlags = lib.optionals stdenv.cc.isClang [ "AR=${stdenv.cc.targetPrefix}ar" "RANLIB=${stdenv.cc.targetPrefix}ranlib" ];
103 # TODO(Profpatsch): ensure that there is always a $doc output!
105 echo "Cleaning & moving common files"
106 ${cleanPackaging.commonFileActions {
107 noiseFiles = commonNoiseFiles;
108 docFiles = commonMetaFiles;
109 }} $doc/share/doc/${pname}
111 ${if manpages == null
112 then ''echo "no manpages for this package"''
114 echo "copying manpages"
115 cp -vr ${manpages} $man
122 ${cleanPackaging.checkForRemainingFiles}
125 passthru = passthru // (if manpages == null then {} else { inherit manpages; });
128 homepage = "https://skarnet.org/software/${pname}/";
129 inherit broken description platforms;
130 license = lib.licenses.isc;
131 maintainers = with lib.maintainers;
132 [ pmahoney Profpatsch qyliss ] ++ maintainers;