Properly statically compile, without warnings; netgo,osusergo

pull/12/head
Philipp Heckel 2021-11-20 20:27:17 -05:00
parent ad057c12c0
commit bbbab8d2ef
2 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,7 @@ builds:
binary: ntfy binary: ntfy
env: env:
- CGO_ENABLED=1 # required for go-sqlite3 - CGO_ENABLED=1 # required for go-sqlite3
tags: [sqlite_omit_load_extension] tags: [sqlite_omit_load_extension,osusergo,netgo]
ldflags: ldflags:
- "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}" - "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}"
goos: [linux] goos: [linux]
@ -18,7 +18,7 @@ builds:
env: env:
- CGO_ENABLED=1 # required for go-sqlite3 - CGO_ENABLED=1 # required for go-sqlite3
- CC=arm-linux-gnueabi-gcc # apt install gcc-arm-linux-gnueabi - CC=arm-linux-gnueabi-gcc # apt install gcc-arm-linux-gnueabi
tags: [sqlite_omit_load_extension] tags: [sqlite_omit_load_extension,osusergo,netgo]
ldflags: ldflags:
- "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}" - "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}"
goos: [linux] goos: [linux]
@ -32,7 +32,7 @@ builds:
env: env:
- CGO_ENABLED=1 # required for go-sqlite3 - CGO_ENABLED=1 # required for go-sqlite3
- CC=aarch64-linux-gnu-gcc # apt install gcc-aarch64-linux-gnu - CC=aarch64-linux-gnu-gcc # apt install gcc-aarch64-linux-gnu
tags: [sqlite_omit_load_extension] tags: [sqlite_omit_load_extension,osusergo,netgo]
ldflags: ldflags:
- "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}" - "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}"
goos: [linux] goos: [linux]

View File

@ -103,7 +103,7 @@ build-simple: clean
export CGO_ENABLED=1 export CGO_ENABLED=1
$(GO) build \ $(GO) build \
-o dist/ntfy_linux_amd64/ntfy \ -o dist/ntfy_linux_amd64/ntfy \
-tags sqlite_omit_load_extension \ -tags sqlite_omit_load_extension,osusergo,netgo \
-ldflags \ -ldflags \
"-linkmode=external -extldflags=-static -s -w -X main.version=$(VERSION) -X main.commit=$(shell git rev-parse --short HEAD) -X main.date=$(shell date +%s)" "-linkmode=external -extldflags=-static -s -w -X main.version=$(VERSION) -X main.commit=$(shell git rev-parse --short HEAD) -X main.date=$(shell date +%s)"