mirror of
https://gitea.com/gitea/tea
synced 2024-11-23 00:12:05 +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 ?=
|
||||
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 GOFLAGS := $(GOFLAGS) -mod=vendor -tags '$(TAGS)' -ldflags '$(LDFLAGS)'
|
||||
|
||||
PACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/)
|
||||
SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||
|
||||
# OS specific vars.
|
||||
ifeq ($(OS), Windows_NT)
|
||||
EXECUTABLE := tea.exe
|
||||
else
|
||||
EXECUTABLE := tea
|
||||
ifneq ($(shell uname -s), OpenBSD)
|
||||
override BUILDMODE := -buildmode=pie
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
@ -124,16 +120,13 @@ check: test
|
||||
.PHONY: install
|
||||
install: $(SOURCES)
|
||||
@echo "installing to $(GOPATH)/bin/$(EXECUTABLE)"
|
||||
$(GO) install -v -buildmode=pie $(GOFLAGS)
|
||||
$(GO) install -v $(BUILDMODE) $(GOFLAGS)
|
||||
|
||||
.PHONY: build
|
||||
build: $(EXECUTABLE)
|
||||
|
||||
$(EXECUTABLE): $(SOURCES)
|
||||
ifeq ($(STATIC),true)
|
||||
@echo "enabling static build, make sure you have glibc-static (or equivalent) installed"
|
||||
endif
|
||||
$(GO) build -buildmode=pie $(GOFLAGS) -o $@
|
||||
$(GO) build $(BUILDMODE) $(GOFLAGS) -o $@
|
||||
|
||||
.PHONY: 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 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)
|
||||
|
||||
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):
|
||||
```sh
|
||||
go get code.gitea.io/tea
|
||||
go install code.gitea.io/tea
|
||||
```
|
||||
3. Install from source: [see *Compilation*](#compilation)
|
||||
|
||||
4. Docker (thirdparty): [tgerczei/tea](https://hub.docker.com/r/tgerczei/tea)
|
||||
|
||||
## Compilation
|
||||
|
||||
Make sure you have installed a current go version.
|
||||
To compile the sources yourself run the following:
|
||||
Make sure you have a current go version installed (1.13 or newer).
|
||||
|
||||
```sh
|
||||
git clone https://gitea.com/gitea/tea.git
|
||||
cd tea
|
||||
make STATIC=true
|
||||
```
|
||||
- To compile the source yourself with the recommended flags & tags:
|
||||
```sh
|
||||
git clone https://gitea.com/gitea/tea.git # or: tea clone gitea.com/gitea/tea ;)
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user