1{ lib, stdenv, fetchFromGitHub, cmake
2, enableShared ? !stdenv.hostPlatform.isStatic
3}:
4
5stdenv.mkDerivation rec {
6 pname = "gflags";
7 version = "2.2.2";
8
9 src = fetchFromGitHub {
10 owner = "gflags";
11 repo = "gflags";
12 rev = "v${version}";
13 sha256 = "147i3md3nxkjlrccqg4mq1kyzc7yrhvqv5902iibc7znkvzdvlp0";
14 };
15
16 nativeBuildInputs = [ cmake ];
17
18 # This isn't used by the build and breaks the CMake build on case-insensitive filesystems (e.g., on Darwin)
19 preConfigure = "rm BUILD";
20
21 cmakeFlags = [
22 "-DGFLAGS_BUILD_SHARED_LIBS=${if enableShared then "ON" else "OFF"}"
23 "-DGFLAGS_BUILD_STATIC_LIBS=ON"
24 ];
25
26 doCheck = false;
27
28 meta = with lib; {
29 description = "A C++ library that implements commandline flags processing";
30 longDescription = ''
31 The gflags package contains a C++ library that implements commandline flags processing.
32 As such it's a replacement for getopt().
33 It was owned by Google. google-gflags project has been renamed to gflags and maintained by new community.
34 '';
35 homepage = "https://gflags.github.io/gflags/";
36 license = licenses.bsd3;
37 maintainers = [ maintainers.linquize ];
38 platforms = platforms.all;
39 };
40}