mirror of https://github.com/gogs/gogs.git
Produce a position independent executable (#4011)
* Produce a position independent executable * Add OS detection to the main Makefile so we don't apply -pie on OS Xpull/3335/merge
parent
84f28fc5d6
commit
263203ec28
5
Makefile
5
Makefile
|
@ -5,8 +5,13 @@ DATA_FILES := $(shell find conf | sed 's/ /\\ /g')
|
||||||
LESS_FILES := $(wildcard public/less/gogs.less public/less/_*.less)
|
LESS_FILES := $(wildcard public/less/gogs.less public/less/_*.less)
|
||||||
GENERATED := modules/bindata/bindata.go public/css/gogs.css
|
GENERATED := modules/bindata/bindata.go public/css/gogs.css
|
||||||
|
|
||||||
|
OS := $(shell uname)
|
||||||
|
|
||||||
TAGS = ""
|
TAGS = ""
|
||||||
BUILD_FLAGS = "-v"
|
BUILD_FLAGS = "-v"
|
||||||
|
ifeq ($(OS),Linux)
|
||||||
|
BUILD_FLAGS += " -buildmode=pie"
|
||||||
|
endif
|
||||||
|
|
||||||
RELEASE_ROOT = "release"
|
RELEASE_ROOT = "release"
|
||||||
RELEASE_GOGS = "release/gogs"
|
RELEASE_GOGS = "release/gogs"
|
||||||
|
|
|
@ -5,7 +5,7 @@ outPath=./output_$outPlattform_$outArch
|
||||||
rm -rf $outPath
|
rm -rf $outPath
|
||||||
mkdir $outPath
|
mkdir $outPath
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=$outPlattform GOARCH=$outArch go build ../gogs.go
|
CGO_ENABLED=0 GOOS=$outPlattform GOARCH=$outArch go build -buildmode=pie ../gogs.go
|
||||||
chmod +x gogs
|
chmod +x gogs
|
||||||
mv gogs $outPath/
|
mv gogs $outPath/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue