Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/control/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,23 @@ def get_build_tags(benv):
tags.append("pprof")
else:
tags.append("release")
if is_server_build(benv):
print("Building server go binary: adding 'server' build tag")
tags.append("server")
return f"-tags {','.join(tags)}"


def is_server_build(benv):
"""Check if the go-lang binary being built is a server binary."""
env = benv.get("ENV")
if env is None:
return False
ld_flags = env.get("CGO_LDFLAGS")
if ld_flags is None:
return False
return "-ldaos_common_pmem" in ld_flags


def is_release_build(benv):
"Check whether this build is for release."
return benv.get("BUILD_TYPE") == "release"
Expand Down
5 changes: 4 additions & 1 deletion src/control/cmd/daos/util.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2021-2024 Intel Corporation.
// (C) Copyright 2026 Hewlett Packard Enterprise Development LP
// (C) Copyright 2025 Google LLC
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -29,7 +30,9 @@ import (
// NB: There should only be one set of CFLAGS/LDFLAGS definitions
// for the whole package!
#cgo CFLAGS: -I${SRCDIR}/../../../utils
#cgo LDFLAGS: -lgurt -lcart -ldaos -ldaos_common -lduns -ldfs -luuid -ldaos_cmd_hdlrs
#cgo LDFLAGS: -lgurt -lcart -ldaos -lduns -ldfs -luuid -ldaos_cmd_hdlrs
#cgo !server LDFLAGS: -ldaos_common
#cgo server LDFLAGS: -ldaos_common_pmem

#include "util.h"

Expand Down
5 changes: 4 additions & 1 deletion src/control/lib/daos/api/api.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2024 Intel Corporation.
// (C) Copyright 2026 Hewlett Packard Enterprise Development LP
// (C) Copyright 2025 Google LLC
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
Expand All @@ -16,7 +17,9 @@ import (
/*
#include <daos.h>

#cgo LDFLAGS: -lcart -lgurt -ldaos -ldaos_common
#cgo LDFLAGS: -lcart -lgurt -ldaos
#cgo !server LDFLAGS: -ldaos_common
#cgo server LDFLAGS: -ldaos_common_pmem
*/
import "C"

Expand Down
4 changes: 3 additions & 1 deletion src/control/lib/daos/api/container.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2025 Google LLC
// (C) Copyright 2026 Hewlett Packard Enterprise Development LP
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand Down Expand Up @@ -27,7 +28,8 @@ import (

#include "util.h"

#cgo LDFLAGS: -ldaos_common
#cgo !server LDFLAGS: -ldaos_common
#cgo server LDFLAGS: -ldaos_common_pmem
*/
import "C"

Expand Down
4 changes: 3 additions & 1 deletion src/control/lib/daos/api/handle.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2025 Google LLC
// (C) Copyright 2026 Hewlett Packard Enterprise Development LP
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand All @@ -19,7 +20,8 @@ import (
/*
#include <daos.h>

#cgo LDFLAGS: -ldaos_common
#cgo !server LDFLAGS: -ldaos_common
#cgo server LDFLAGS: -ldaos_common_pmem
*/
import "C"

Expand Down
5 changes: 4 additions & 1 deletion src/control/lib/daos/api/libdaos.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2024 Intel Corporation.
// (C) Copyright 2026 Hewlett Packard Enterprise Development LP
// (C) Copyright 2025 Google LLC
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
Expand All @@ -15,7 +16,9 @@ package api
#include <daos/agent.h>
#include <daos/pool.h>

#cgo LDFLAGS: -lcart -lgurt -ldaos -ldaos_common
#cgo LDFLAGS: -lcart -lgurt -ldaos
#cgo !server LDFLAGS: -ldaos_common
#cgo server LDFLAGS: -ldaos_common_pmem
*/
import "C"
import "unsafe"
Expand Down
5 changes: 4 additions & 1 deletion src/control/lib/daos/api/system.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2024 Intel Corporation.
// (C) Copyright 2026 Hewlett Packard Enterprise Development LP
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand All @@ -19,7 +20,9 @@ import (
/*
#include <daos_mgmt.h>

#cgo LDFLAGS: -lcart -lgurt -ldaos -ldaos_common
#cgo LDFLAGS: -lcart -lgurt -ldaos
#cgo !server LDFLAGS: -ldaos_common
#cgo server LDFLAGS: -ldaos_common_pmem
*/
import "C"

Expand Down
4 changes: 3 additions & 1 deletion src/control/lib/daos/container.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2024 Intel Corporation.
// (C) Copyright 2026 Hewlett Packard Enterprise Development LP
// (C) Copyright 2025 Google LLC
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
Expand All @@ -22,7 +23,8 @@ import (
#include <daos_cont.h>
#include <daos/common.h>

#cgo LDFLAGS: -ldaos_common
#cgo !server LDFLAGS: -ldaos_common
#cgo server LDFLAGS: -ldaos_common_pmem
*/
import "C"

Expand Down
6 changes: 4 additions & 2 deletions src/control/lib/daos/container_property.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// (C) Copyright 2021-2023 Intel Corporation.
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
// (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP
// (C) Copyright 2025 Google LLC
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -46,7 +46,9 @@ daos_prop_co_status_val(uint32_t status, uint32_t flag, uint32_t ver)
return DAOS_PROP_CO_STATUS_VAL(status, flag, ver);
}

#cgo LDFLAGS: -ldaos_common -lgurt -lcart
#cgo LDFLAGS: -lgurt -lcart
#cgo !server LDFLAGS: -ldaos_common
#cgo server LDFLAGS: -ldaos_common_pmem
*/
import "C"

Expand Down
6 changes: 4 additions & 2 deletions src/control/lib/daos/pool_property.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// (C) Copyright 2021-2023 Intel Corporation.
// (C) Copyright 2025 Google LLC
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP
// (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand Down Expand Up @@ -30,7 +30,9 @@ import (
#include <daos/pool_map.h>
#include <daos_srv/control.h>

#cgo LDFLAGS: -ldaos_common -lgurt -lcart
#cgo LDFLAGS: -lgurt -lcart
#cgo !server LDFLAGS: -ldaos_common
#cgo server LDFLAGS: -ldaos_common_pmem
*/
import "C"

Expand Down
Loading