10 # components built by this derivation other components depend on
14 # component specific extra dependencies
45 # These components are just tools and don't install a library
46 onlyExecutable = builtins.elem component [
52 stdenv.mkDerivation rec {
53 pname = "gnatcoll-${component}";
56 src = fetchFromGitHub {
60 sha256 = "1c39yg13faadg5mzpq3s83rn24npmpc4yjj0cvj7kqwpqxci4m55";
63 patches = lib.optionals (component == "sqlite") [
64 # fixes build of the static sqlite component
65 # when building against the system libsqlite3
66 # See https://github.com/AdaCore/gprbuild/issues/27#issuecomment-298444608
67 ./gnatcoll-db-sqlite-static-external.patch
70 # Link executables dynamically unless specified by the platform,
71 # as we usually do in nixpkgs where possible
72 postPatch = lib.optionalString (!stdenv.hostPlatform.isStatic) ''
73 for f in gnatcoll_db2ada/Makefile gnatinspect/Makefile; do
74 substituteInPlace "$f" --replace "=static" "=relocatable"
84 # Propagate since GPRbuild needs to find referenced .gpr files
85 # and other libraries to link against when static linking is used.
86 # For executables this is of course not relevant and we can reduce
87 # the closure size dramatically
88 ${if onlyExecutable then "buildInputs" else "propagatedBuildInputs"} = [
90 ] ++ libsFor."${component}" or [];
94 "PROCESSORS=$(NIX_BUILD_CORES)"
95 # confusingly, for gprbuild --target is autoconf --host
96 "TARGET=${stdenv.hostPlatform.config}"
97 "prefix=${placeholder "out"}"
98 ] ++ lib.optionals (component == "sqlite") [
99 # link against packaged, not vendored libsqlite3
100 "GNATCOLL_SQLITE=external"
104 description = "GNAT Components Collection - Database packages";
105 homepage = "https://github.com/AdaCore/gnatcoll-db";
106 license = licenses.gpl3Plus;
107 maintainers = [ maintainers.sternenseemann ];
108 platforms = platforms.all;