mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-21 18:11:36 +01:00
Simplify build & update installation instructions (#437)
- "revert" the work done in #349. It turns out that this elaborate workaround to get statically built PIEs was only needed due to a bug in go, which got fixed in go 1.16. - Add an exception to the `-buildmode=pie` flag for OpenBSD, as discovered in #436 - Simplify & update README installation instructions (the Arch AUR package got deleted as it wasn't maintained, so we link to `gitea-tea-git` now.) Co-authored-by: Norwin <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/437 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
parent
a89f51f9ec
commit
a7d83ee416
19
Makefile
19
Makefile
@ -26,24 +26,20 @@ TEA_VERSION_TAG ?= $(shell sed 's/+/_/' <<< $(TEA_VERSION))
|
|||||||
TAGS ?=
|
TAGS ?=
|
||||||
LDFLAGS := -X "main.Version=$(TEA_VERSION)" -X "main.Tags=$(TAGS)" -s -w
|
LDFLAGS := -X "main.Version=$(TEA_VERSION)" -X "main.Tags=$(TAGS)" -s -w
|
||||||
|
|
||||||
ifeq ($(STATIC),true)
|
|
||||||
# NOTE: clean up this mess, when https://github.com/golang/go/issues/26492 is resolved
|
|
||||||
# static_build is a defacto standard tag used in go packages
|
|
||||||
TAGS := osusergo,netgo,static_build,$(TAGS)
|
|
||||||
LDFLAGS := $(LDFLAGS) -linkmode=external -extldflags "-static-pie" -X "main.Tags=$(TAGS)"
|
|
||||||
export CGO_ENABLED=1 # needed for linkmode=external
|
|
||||||
endif
|
|
||||||
|
|
||||||
# override to allow passing additional goflags via make CLI
|
# override to allow passing additional goflags via make CLI
|
||||||
override GOFLAGS := $(GOFLAGS) -mod=vendor -tags '$(TAGS)' -ldflags '$(LDFLAGS)'
|
override GOFLAGS := $(GOFLAGS) -mod=vendor -tags '$(TAGS)' -ldflags '$(LDFLAGS)'
|
||||||
|
|
||||||
PACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/)
|
PACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/)
|
||||||
SOURCES ?= $(shell find . -name "*.go" -type f)
|
SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||||
|
|
||||||
|
# OS specific vars.
|
||||||
ifeq ($(OS), Windows_NT)
|
ifeq ($(OS), Windows_NT)
|
||||||
EXECUTABLE := tea.exe
|
EXECUTABLE := tea.exe
|
||||||
else
|
else
|
||||||
EXECUTABLE := tea
|
EXECUTABLE := tea
|
||||||
|
ifneq ($(shell uname -s), OpenBSD)
|
||||||
|
override BUILDMODE := -buildmode=pie
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
@ -124,16 +120,13 @@ check: test
|
|||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: $(SOURCES)
|
install: $(SOURCES)
|
||||||
@echo "installing to $(GOPATH)/bin/$(EXECUTABLE)"
|
@echo "installing to $(GOPATH)/bin/$(EXECUTABLE)"
|
||||||
$(GO) install -v -buildmode=pie $(GOFLAGS)
|
$(GO) install -v $(BUILDMODE) $(GOFLAGS)
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: $(EXECUTABLE)
|
build: $(EXECUTABLE)
|
||||||
|
|
||||||
$(EXECUTABLE): $(SOURCES)
|
$(EXECUTABLE): $(SOURCES)
|
||||||
ifeq ($(STATIC),true)
|
$(GO) build $(BUILDMODE) $(GOFLAGS) -o $@
|
||||||
@echo "enabling static build, make sure you have glibc-static (or equivalent) installed"
|
|
||||||
endif
|
|
||||||
$(GO) build -buildmode=pie $(GOFLAGS) -o $@
|
|
||||||
|
|
||||||
.PHONY: build-image
|
.PHONY: build-image
|
||||||
build-image:
|
build-image:
|
||||||
|
29
README.md
29
README.md
@ -85,29 +85,32 @@ There are different ways to get `tea`:
|
|||||||
brew tap gitea/tap https://gitea.com/gitea/homebrew-gitea
|
brew tap gitea/tap https://gitea.com/gitea/homebrew-gitea
|
||||||
brew install tea
|
brew install tea
|
||||||
```
|
```
|
||||||
- arch linux ([gitea-tea](https://aur.archlinux.org/packages/gitea-tea), thirdparty)
|
- arch linux ([gitea-tea-git](https://aur.archlinux.org/packages/gitea-tea-git), thirdparty)
|
||||||
- alpine linux ([tea](https://pkgs.alpinelinux.org/packages?name=tea&branch=edge), thirdparty)
|
- alpine linux ([tea](https://pkgs.alpinelinux.org/packages?name=tea&branch=edge), thirdparty)
|
||||||
|
|
||||||
2. Use the prebuilt binaries from [dl.gitea.io](https://dl.gitea.io/tea/)
|
2. Use the prebuilt binaries from [dl.gitea.io](https://dl.gitea.io/tea/)
|
||||||
|
|
||||||
3. Install from source (go 1.13 or newer is required):
|
3. Install from source: [see *Compilation*](#compilation)
|
||||||
```sh
|
|
||||||
go get code.gitea.io/tea
|
|
||||||
go install code.gitea.io/tea
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Docker (thirdparty): [tgerczei/tea](https://hub.docker.com/r/tgerczei/tea)
|
4. Docker (thirdparty): [tgerczei/tea](https://hub.docker.com/r/tgerczei/tea)
|
||||||
|
|
||||||
## Compilation
|
## Compilation
|
||||||
|
|
||||||
Make sure you have installed a current go version.
|
Make sure you have a current go version installed (1.13 or newer).
|
||||||
To compile the sources yourself run the following:
|
|
||||||
|
|
||||||
```sh
|
- To compile the source yourself with the recommended flags & tags:
|
||||||
git clone https://gitea.com/gitea/tea.git
|
```sh
|
||||||
cd tea
|
git clone https://gitea.com/gitea/tea.git # or: tea clone gitea.com/gitea/tea ;)
|
||||||
make STATIC=true
|
cd tea
|
||||||
```
|
make
|
||||||
|
```
|
||||||
|
Note that GNU Make (gmake on OpenBSD) is required.
|
||||||
|
|
||||||
|
- For a quick installation without `git` & `make`:
|
||||||
|
```sh
|
||||||
|
go get code.gitea.io/tea
|
||||||
|
go install code.gitea.io/tea
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user