Skip to content

Commit 49bb71d

Browse files
committed
detect x11
1 parent 365e115 commit 49bb71d

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@ else
1616
VERSION := $(BRANCH).$(GIT_COMMIT_HASH)
1717
DIRTY := "dev"
1818
endif
19+
# X11 support
20+
X11 := 0
21+
ifeq ($(shell go env GOOS),linux)
22+
ifeq ($(shell ldconfig -p | grep X11 || echo ""))
23+
X11 := 1
24+
endif
25+
endif
1926
LDFLAGS=--ldflags "-s -X github.com/SwissDataScienceCenter/renku-dev-utils/pkg/version.Version=$(VERSION) -X github.com/SwissDataScienceCenter/renku-dev-utils/pkg/version.VersionSuffix=$(DIRTY)"
27+
TAGS=
28+
ifeq ($(X11),1)
29+
TAGS=-tags=x11
30+
endif
2031

2132
.PHONY: all
2233
all: help
@@ -29,6 +40,7 @@ vars: ## Show the Makefile vars
2940
@echo GIT_TAG="'$(GIT_TAG)'"
3041
@echo VERSION="'$(VERSION)'"
3142
@echo DIRTY="'$(DIRTY)'"
43+
@echo X11="'$(X11)'"
3244

3345
.PHONY: rdu
3446
rdu: build/renku-dev-utils ## Build and install renku-dev-utils
@@ -38,7 +50,7 @@ rdu: build/renku-dev-utils ## Build and install renku-dev-utils
3850

3951
.PHONY: build/renku-dev-utils
4052
build/renku-dev-utils:
41-
go build -v -o build/ $(LDFLAGS)
53+
go build -v -o build/ $(TAGS) $(LDFLAGS)
4254

4355
# From the operator sdk Makefile
4456
# The help target prints out all targets with their descriptions organized
@@ -75,7 +87,7 @@ lint: ## Lint source files with `golangci-lint run`
7587

7688
.PHONY: test
7789
test: ## Run go tests
78-
go test -v ./...
90+
go test -v $(TAGS) ./...
7991

8092
##@ Code generation
8193

pkg/clipboard/clipboard.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !linux
1+
//go:build !linux || x11
22

33
package clipboard
44

pkg/clipboard/nox11.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build linux
1+
//go:build linux && !x11
22

33
package clipboard
44

0 commit comments

Comments
 (0)