File tree Expand file tree Collapse file tree 2 files changed +51
-25
lines changed Expand file tree Collapse file tree 2 files changed +51
-25
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,17 @@ ifeq ($(HAS_GO), yes)
47
47
CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS)
48
48
endif
49
49
50
+ CGO_ENABLED ?= 0
51
+ ifneq (,$(findstring sqlite,$(TAGS ) )$(findstring pam,$(TAGS ) ) )
52
+ CGO_ENABLED = 1
53
+ endif
54
+
55
+ STATIC ?=
56
+ EXTLDFLAGS ?=
57
+ ifneq ($(STATIC ) ,)
58
+ EXTLDFLAGS = -extldflags "-static"
59
+ endif
60
+
50
61
ifeq ($(GOOS ) ,windows)
51
62
IS_WINDOWS := yes
52
63
else ifeq ($(patsubst Windows%,Windows,$(OS)),Windows)
@@ -740,7 +751,10 @@ security-check:
740
751
go run $(GOVULNCHECK_PACKAGE ) -show color ./...
741
752
742
753
$(EXECUTABLE ) : $(GO_SOURCES ) $(TAGS_PREREQ )
743
- CGO_CFLAGS=" $( CGO_CFLAGS) " $(GO ) build $(GOFLAGS ) $(EXTRA_GOFLAGS ) -tags ' $(TAGS)' -ldflags ' -s -w $(LDFLAGS)' -o $@
754
+ ifneq ($(and $(STATIC ) ,$(findstring pam,$(TAGS ) ) ) ,)
755
+ $(error pam support set via TAGS doesn't support static builds)
756
+ endif
757
+ CGO_ENABLED="$(CGO_ENABLED)" CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(EXTLDFLAGS) $(LDFLAGS)' -o $@
744
758
745
759
.PHONY : release
746
760
release : frontend generate release-windows release-linux release-darwin release-freebsd release-copy release-compress vendor release-sources release-check
Original file line number Diff line number Diff line change 11
11
pkgs = nixpkgs . legacyPackages . ${ system } ;
12
12
in
13
13
{
14
- devShells . default = pkgs . mkShell {
15
- buildInputs = with pkgs ; [
16
- # generic
17
- git
18
- git-lfs
19
- gnumake
20
- gnused
21
- gnutar
22
- gzip
14
+ devShells . default =
15
+ with pkgs ;
16
+ let
17
+ # only bump toolchain versions here
18
+ go = go_1_24 ;
19
+ nodejs = nodejs_24 ;
20
+ python3 = python312 ;
21
+ in
22
+ pkgs . mkShell {
23
+ buildInputs = [
24
+ # generic
25
+ git
26
+ git-lfs
27
+ gnumake
28
+ gnused
29
+ gnutar
30
+ gzip
23
31
24
- # frontend
25
- nodejs_22
32
+ # frontend
33
+ nodejs
26
34
27
- # linting
28
- python312
29
- poetry
35
+ # linting
36
+ python3
37
+ poetry
30
38
31
- # backend
32
- go_1_24
33
- gofumpt
34
- sqlite
35
- ] ;
36
- shellHook = ''
37
- export GO="${ pkgs . go_1_24 } /bin/go"
38
- export GOROOT="${ pkgs . go_1_24 } /share/go"
39
- '' ;
40
- } ;
39
+ # backend
40
+ go
41
+ glibc . static
42
+ gofumpt
43
+ sqlite
44
+ ] ;
45
+ CFLAGS = "-I${ glibc . static . dev } /include" ;
46
+ LDFLAGS = "-L ${ glibc . static } /lib" ;
47
+ GO = "${ go } /bin/go" ;
48
+ GOROOT = "${ go } /share/go" ;
49
+
50
+ TAGS = "sqlite sqlite_unlock_notify" ;
51
+ STATIC = "true" ;
52
+ } ;
41
53
}
42
54
) ;
43
55
}
You can’t perform that action at this time.
0 commit comments