aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/platform.cc
blob: f2c023c8295d860104afd9de560f3e8ded01f6cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include "local-store.hh"
#include "build/local-derivation-goal.hh"

#if __linux__
#include "platform/linux.hh"
#elif __APPLE__
#include "platform/darwin.hh"
#elif __FreeBSD__
#include "platform/freebsd.hh"
#else
#include "platform/fallback.hh"
#endif

namespace nix {
std::shared_ptr<LocalStore> LocalStore::makeLocalStore(const Params & params)
{
#if __linux__
    return std::shared_ptr<LocalStore>(new LinuxLocalStore(params));
#elif __APPLE__
    return std::shared_ptr<LocalStore>(new DarwinLocalStore(params));
#elif __FreeBSD__
    return std::shared_ptr<LocalStore>(new FreeBSDLocalStore(params));
#else
    return std::shared_ptr<LocalStore>(new FallbackLocalStore(params));
#endif
}

std::shared_ptr<LocalDerivationGoal> LocalDerivationGoal::makeLocalDerivationGoal(
    const StorePath & drvPath,
    const OutputsSpec & wantedOutputs,
    Worker & worker,
    bool isDependency,
    BuildMode buildMode
)
{
#if __linux__
    return std::make_shared<LinuxLocalDerivationGoal>(drvPath, wantedOutputs, worker, isDependency, buildMode);
#elif __APPLE__
    return std::make_shared<DarwinLocalDerivationGoal>(drvPath, wantedOutputs, worker, isDependency, buildMode);
#elif __FreeBSD__
    return std::make_shared<FreeBSDLocalDerivationGoal>(drvPath, wantedOutputs, worker, isDependency, buildMode);
#else
    return std::make_shared<FallbackLocalDerivationGoal>(drvPath, wantedOutputs, worker, isDependency, buildMode);
#endif
}

std::shared_ptr<LocalDerivationGoal> LocalDerivationGoal::makeLocalDerivationGoal(
    const StorePath & drvPath,
    const BasicDerivation & drv,
    const OutputsSpec & wantedOutputs,
    Worker & worker,
    bool isDependency,
    BuildMode buildMode
)
{
#if __linux__
    return std::make_shared<LinuxLocalDerivationGoal>(
        drvPath, drv, wantedOutputs, worker, isDependency, buildMode
    );
#elif __APPLE__
    return std::make_shared<DarwinLocalDerivationGoal>(
        drvPath, drv, wantedOutputs, worker, isDependency, buildMode
    );
#elif __FreeBSD__
    return std::make_shared<FreeBSDLocalDerivationGoal>(
        drvPath, drv, wantedOutputs, worker, isDependency, buildMode
    );
#else
    return std::make_shared<FallbackLocalDerivationGoal>(
        drvPath, drv, wantedOutputs, worker, isDependency, buildMode
    );
#endif
}
}