mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-10-28 13:49:56 -04:00
Build as PIE
This commit is contained in:
1 parent
0aa9fc0bda
commit
c8abca2912
4 files changed
+9
-9
No files matched your search
@@ -41,7 +41,7 @@ build() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# compile binary
|
# compile binary
|
||||||
CGO_ENABLED=0 go build -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go
|
CGO_ENABLED=0 go build -buildmode=pie -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ build() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# compile binary
|
# compile binary
|
||||||
CGO_ENABLED=0 go build -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go
|
CGO_ENABLED=0 go build -buildmode=pie -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
create_release_binaries() {
|
create_release_binaries() {
|
||||||
printf '\nGenerating release binaries...\n'
|
printf '\nGenerating release binaries...\n'
|
||||||
cd ..
|
cd ..
|
||||||
GOOS=linux CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-linux-x86_64_v2 -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
GOOS=linux CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-linux-x86_64_v2 -buildmode=pie -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
||||||
GOOS=linux CGO_ENABLED=0 GOARCH=arm64 GOARM64=v8.0 CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.0 -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
GOOS=linux CGO_ENABLED=0 GOARCH=arm64 GOARM64=v8.0 CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.0 -buildmode=pie -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
||||||
GOOS=linux CGO_ENABLED=0 GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.7+crypto -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
GOOS=linux CGO_ENABLED=0 GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.7+crypto -buildmode=pie -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
||||||
GOOS=windows CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-windows-x86_64_v2.exe -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
GOOS=windows CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-windows-x86_64_v2.exe -buildmode=pie -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
||||||
GOOS=windows CGO_ENABLED=0 GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-windows-arm64v8.7+crypto.exe -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
GOOS=windows CGO_ENABLED=0 GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-windows-arm64v8.7+crypto.exe -buildmode=pie -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
||||||
cd ./packaging
|
cd ./packaging
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
## Building
|
## Building
|
||||||
Official binaries are stripped of debug info for size and built without CGO (except for distribution packages) for portability, as follows:
|
Official binaries are built without CGO (for portability), built position-independent (for security, allows [ASLR](https://en.wikipedia.org/wiki/Address_space_layout_randomization)), and stripped of debug info (for size reduction), as follows:
|
||||||
```
|
```
|
||||||
CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
CGO_ENABLED=0 go build -buildmode=pie -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go
|
||||||
```
|
```
|
||||||
|
|
||||||
Additionally, some custom build tags can be used to create different binaries. The following tags are not used in official builds:
|
Additionally, some custom build tags can be used to create different binaries. The following tags are not used in official builds:
|
||||||
|
|||||||
Reference in new issue
Block a user