2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, buildPackages, fetchurl, pkg-config, pcre, libxml2, zlib, bzip2, which, file
|
2020-04-24 23:36:52 +00:00
|
|
|
, openssl, enableMagnet ? false, lua5_1 ? null
|
|
|
|
, enableMysql ? false, libmysqlclient ? null
|
|
|
|
, enableLdap ? false, openldap ? null
|
|
|
|
, enableWebDAV ? false, sqlite ? null, libuuid ? null
|
|
|
|
, enableExtendedAttrs ? false, attr ? null
|
|
|
|
, perl
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert enableMagnet -> lua5_1 != null;
|
|
|
|
assert enableMysql -> libmysqlclient != null;
|
|
|
|
assert enableLdap -> openldap != null;
|
|
|
|
assert enableWebDAV -> sqlite != null;
|
|
|
|
assert enableWebDAV -> libuuid != null;
|
|
|
|
assert enableExtendedAttrs -> attr != null;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-02-13 14:23:35 +00:00
|
|
|
name = "lighttpd-1.4.59";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://download.lighttpd.net/lighttpd/releases-1.4.x/${name}.tar.xz";
|
2021-02-13 14:23:35 +00:00
|
|
|
sha256 = "sha256-+5U9snPa7wjttuICVWyuij0H7tYIHJa9mQPblX0QhNU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs tests
|
|
|
|
# Linux sandbox has an empty hostname and not /etc/hosts, which fails some tests
|
|
|
|
sed -ire '/[$]self->{HOSTNAME} *=/i if(length($name)==0) { $name = "127.0.0.1" }' tests/LightyTest.pm
|
|
|
|
'';
|
|
|
|
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ pcre pcre.dev libxml2 zlib bzip2 which file openssl ]
|
2021-01-15 22:18:51 +00:00
|
|
|
++ lib.optional enableMagnet lua5_1
|
|
|
|
++ lib.optional enableMysql libmysqlclient
|
|
|
|
++ lib.optional enableLdap openldap
|
|
|
|
++ lib.optional enableWebDAV sqlite
|
|
|
|
++ lib.optional enableWebDAV libuuid;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configureFlags = [ "--with-openssl" ]
|
2021-01-15 22:18:51 +00:00
|
|
|
++ lib.optional enableMagnet "--with-lua"
|
|
|
|
++ lib.optional enableMysql "--with-mysql"
|
|
|
|
++ lib.optional enableLdap "--with-ldap"
|
|
|
|
++ lib.optional enableWebDAV "--with-webdav-props"
|
|
|
|
++ lib.optional enableWebDAV "--with-webdav-locks"
|
|
|
|
++ lib.optional enableExtendedAttrs "--with-attr";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
export PATH=$PATH:${pcre.dev}/bin
|
|
|
|
sed -i "s:/usr/bin/file:${file}/bin/file:g" configure
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkInputs = [ perl ];
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p "$out/share/lighttpd/doc/config"
|
|
|
|
cp -vr doc/config "$out/share/lighttpd/doc/"
|
|
|
|
# Remove files that references needless store paths (dependency bloat)
|
|
|
|
rm "$out/share/lighttpd/doc/config/Makefile"*
|
|
|
|
rm "$out/share/lighttpd/doc/config/conf.d/Makefile"*
|
|
|
|
rm "$out/share/lighttpd/doc/config/vhosts.d/Makefile"*
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Lightweight high-performance web server";
|
|
|
|
homepage = "http://www.lighttpd.net/";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = lib.licenses.bsd3;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
maintainers = [ maintainers.bjornfor ];
|
|
|
|
};
|
|
|
|
}
|