2020-10-19 00:00:10 +02:00
|
|
|
APP := miniflux
|
2019-03-15 04:54:05 +01:00
|
|
|
DOCKER_IMAGE := miniflux/miniflux
|
2020-11-04 00:14:57 +01:00
|
|
|
VERSION := $(shell git describe --tags --abbrev=0)
|
2020-10-19 00:00:10 +02:00
|
|
|
COMMIT := $(shell git rev-parse --short HEAD)
|
|
|
|
BUILD_DATE := `date +%FT%T%z`
|
2023-08-11 04:46:45 +02:00
|
|
|
LD_FLAGS := "-s -w -X 'miniflux.app/v2/internal/version.Version=$(VERSION)' -X 'miniflux.app/v2/internal/version.Commit=$(COMMIT)' -X 'miniflux.app/v2/internal/version.BuildDate=$(BUILD_DATE)'"
|
2020-10-19 00:00:10 +02:00
|
|
|
PKG_LIST := $(shell go list ./... | grep -v /vendor/)
|
|
|
|
DB_URL := postgres://postgres:postgres@localhost/miniflux_test?sslmode=disable
|
2020-10-19 06:17:54 +02:00
|
|
|
DEB_IMG_ARCH := amd64
|
2017-11-20 06:10:04 +01:00
|
|
|
|
2019-10-22 04:10:17 +02:00
|
|
|
export PGPASSWORD := postgres
|
2018-12-28 22:58:01 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
.PHONY: \
|
2019-03-15 04:54:05 +01:00
|
|
|
miniflux \
|
2024-02-08 04:44:05 +01:00
|
|
|
miniflux-no-pie \
|
2019-03-15 04:54:05 +01:00
|
|
|
linux-amd64 \
|
2020-10-19 00:00:10 +02:00
|
|
|
linux-arm64 \
|
2019-03-15 04:54:05 +01:00
|
|
|
linux-armv7 \
|
|
|
|
linux-armv6 \
|
|
|
|
linux-armv5 \
|
|
|
|
linux-x86 \
|
|
|
|
darwin-amd64 \
|
2021-02-17 06:02:13 +01:00
|
|
|
darwin-arm64 \
|
2019-03-15 04:54:05 +01:00
|
|
|
freebsd-amd64 \
|
|
|
|
freebsd-x86 \
|
|
|
|
openbsd-amd64 \
|
|
|
|
openbsd-x86 \
|
|
|
|
netbsd-x86 \
|
|
|
|
netbsd-amd64 \
|
|
|
|
windows-amd64 \
|
|
|
|
windows-x86 \
|
|
|
|
build \
|
|
|
|
run \
|
|
|
|
clean \
|
|
|
|
test \
|
|
|
|
lint \
|
|
|
|
integration-test \
|
|
|
|
clean-integration-test \
|
2019-11-27 07:22:55 +01:00
|
|
|
docker-image \
|
2022-03-16 06:39:16 +01:00
|
|
|
docker-image-distroless \
|
2019-03-15 04:54:05 +01:00
|
|
|
docker-images \
|
2020-10-19 06:17:54 +02:00
|
|
|
rpm \
|
|
|
|
debian \
|
|
|
|
debian-packages
|
2018-12-02 20:09:06 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
miniflux:
|
2023-08-10 05:26:57 +02:00
|
|
|
@ CGO_ENABLED=0 go build -buildmode=pie -ldflags=$(LD_FLAGS) -o $(APP) main.go
|
2018-12-02 22:35:13 +01:00
|
|
|
|
2024-02-08 04:44:05 +01:00
|
|
|
miniflux-no-pie:
|
|
|
|
@ go build -ldflags=$(LD_FLAGS) -o $(APP) main.go
|
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
linux-amd64:
|
2023-02-26 01:25:01 +01:00
|
|
|
@ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2018-09-17 04:14:44 +02:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
linux-arm64:
|
2023-02-26 01:25:01 +01:00
|
|
|
@ CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2018-09-17 04:14:44 +02:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
linux-armv7:
|
2023-02-26 01:25:01 +01:00
|
|
|
@ CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2018-09-17 04:14:44 +02:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
linux-armv6:
|
2023-02-26 01:25:01 +01:00
|
|
|
@ CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2017-12-27 21:17:01 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
linux-armv5:
|
2023-02-26 01:25:01 +01:00
|
|
|
@ CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2017-11-20 06:10:04 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
darwin-amd64:
|
2022-10-18 11:08:53 +02:00
|
|
|
@ GOOS=darwin GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2018-03-19 04:44:13 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
darwin-arm64:
|
2022-10-18 11:08:53 +02:00
|
|
|
@ GOOS=darwin GOARCH=arm64 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2021-02-17 06:02:13 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
freebsd-amd64:
|
2023-02-26 01:25:01 +01:00
|
|
|
@ CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2018-10-24 04:29:50 +02:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
openbsd-amd64:
|
2022-10-18 11:08:53 +02:00
|
|
|
@ GOOS=openbsd GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2018-12-02 03:11:25 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
windows-amd64:
|
2022-10-18 11:08:53 +02:00
|
|
|
@ GOOS=windows GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2017-11-20 06:10:04 +01:00
|
|
|
|
2021-02-17 06:02:13 +01:00
|
|
|
build: linux-amd64 linux-arm64 linux-armv7 linux-armv6 linux-armv5 darwin-amd64 darwin-arm64 freebsd-amd64 openbsd-amd64 windows-amd64
|
2018-12-02 20:09:06 +01:00
|
|
|
|
2019-01-01 22:22:45 +01:00
|
|
|
# NOTE: unsupported targets
|
2021-02-19 06:33:29 +01:00
|
|
|
netbsd-amd64:
|
2023-02-26 01:25:01 +01:00
|
|
|
@ CGO_ENABLED=0 GOOS=netbsd GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2019-03-15 04:54:05 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
linux-x86:
|
2023-02-26 01:25:01 +01:00
|
|
|
@ CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2019-01-01 22:22:45 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
freebsd-x86:
|
2023-02-26 01:25:01 +01:00
|
|
|
@ CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2019-01-01 22:22:45 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
netbsd-x86:
|
2023-02-26 01:25:01 +01:00
|
|
|
@ CGO_ENABLED=0 GOOS=netbsd GOARCH=386 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2019-01-01 22:22:45 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
openbsd-x86:
|
2022-10-18 11:08:53 +02:00
|
|
|
@ GOOS=openbsd GOARCH=386 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2019-01-01 22:22:45 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
windows-x86:
|
2022-10-18 11:08:53 +02:00
|
|
|
@ GOOS=windows GOARCH=386 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go
|
2019-01-01 22:22:45 +01:00
|
|
|
|
2021-02-19 06:33:29 +01:00
|
|
|
run:
|
2023-07-31 00:33:56 +02:00
|
|
|
@ LOG_DATE_TIME=1 DEBUG=1 RUN_MIGRATIONS=1 CREATE_ADMIN=1 ADMIN_USERNAME=admin ADMIN_PASSWORD=test123 go run main.go
|
2017-11-20 06:10:04 +01:00
|
|
|
|
|
|
|
clean:
|
2020-10-19 06:17:54 +02:00
|
|
|
@ rm -f $(APP)-* $(APP) $(APP)*.rpm $(APP)*.deb
|
2017-11-20 06:10:04 +01:00
|
|
|
|
|
|
|
test:
|
2020-04-26 05:55:33 +02:00
|
|
|
go test -cover -race -count=1 ./...
|
2017-11-25 19:40:23 +01:00
|
|
|
|
2017-11-28 06:30:04 +01:00
|
|
|
lint:
|
2019-10-22 04:10:17 +02:00
|
|
|
golint -set_exit_status ${PKG_LIST}
|
2017-11-28 06:30:04 +01:00
|
|
|
|
2017-11-25 19:40:23 +01:00
|
|
|
integration-test:
|
|
|
|
psql -U postgres -c 'drop database if exists miniflux_test;'
|
|
|
|
psql -U postgres -c 'create database miniflux_test;'
|
2020-04-26 05:55:33 +02:00
|
|
|
go build -o miniflux-test main.go
|
2021-01-24 19:54:21 +01:00
|
|
|
|
|
|
|
DATABASE_URL=$(DB_URL) \
|
|
|
|
ADMIN_USERNAME=admin \
|
|
|
|
ADMIN_PASSWORD=test123 \
|
|
|
|
CREATE_ADMIN=1 \
|
|
|
|
RUN_MIGRATIONS=1 \
|
|
|
|
DEBUG=1 \
|
|
|
|
./miniflux-test >/tmp/miniflux.log 2>&1 & echo "$$!" > "/tmp/miniflux.pid"
|
|
|
|
|
|
|
|
while ! nc -z localhost 8080; do sleep 1; done
|
2023-08-11 04:46:45 +02:00
|
|
|
go test -v -tags=integration -count=1 miniflux.app/v2/internal/tests
|
2017-11-25 19:40:23 +01:00
|
|
|
|
|
|
|
clean-integration-test:
|
|
|
|
@ kill -9 `cat /tmp/miniflux.pid`
|
|
|
|
@ rm -f /tmp/miniflux.pid /tmp/miniflux.log
|
|
|
|
@ rm miniflux-test
|
|
|
|
@ psql -U postgres -c 'drop database if exists miniflux_test;'
|
2019-03-15 04:54:05 +01:00
|
|
|
|
2019-11-27 07:22:55 +01:00
|
|
|
docker-image:
|
2023-10-17 09:10:46 +02:00
|
|
|
docker build --pull -t $(DOCKER_IMAGE):$(VERSION) -f packaging/docker/alpine/Dockerfile .
|
2022-03-16 06:39:16 +01:00
|
|
|
|
|
|
|
docker-image-distroless:
|
|
|
|
docker build -t $(DOCKER_IMAGE):$(VERSION) -f packaging/docker/distroless/Dockerfile .
|
2019-11-27 07:22:55 +01:00
|
|
|
|
2019-03-15 04:54:05 +01:00
|
|
|
docker-images:
|
2020-10-19 00:00:10 +02:00
|
|
|
docker buildx build \
|
|
|
|
--platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 \
|
2022-03-16 06:39:16 +01:00
|
|
|
--file packaging/docker/alpine/Dockerfile \
|
2020-10-19 00:00:10 +02:00
|
|
|
--tag $(DOCKER_IMAGE):$(VERSION) \
|
|
|
|
--push .
|
2020-10-19 01:12:00 +02:00
|
|
|
|
|
|
|
rpm: clean
|
|
|
|
@ docker build \
|
|
|
|
-t miniflux-rpm-builder \
|
|
|
|
-f packaging/rpm/Dockerfile \
|
|
|
|
.
|
|
|
|
@ docker run --rm \
|
2020-10-19 06:17:54 +02:00
|
|
|
-v ${PWD}:/root/rpmbuild/RPMS/x86_64 miniflux-rpm-builder \
|
2020-10-19 01:12:00 +02:00
|
|
|
rpmbuild -bb --define "_miniflux_version $(VERSION)" /root/rpmbuild/SPECS/miniflux.spec
|
2020-10-19 06:17:54 +02:00
|
|
|
|
|
|
|
debian:
|
2022-07-31 00:56:26 +02:00
|
|
|
@ docker build --load \
|
2020-10-19 06:17:54 +02:00
|
|
|
--build-arg BASE_IMAGE_ARCH=$(DEB_IMG_ARCH) \
|
|
|
|
-t $(DEB_IMG_ARCH)/miniflux-deb-builder \
|
|
|
|
-f packaging/debian/Dockerfile \
|
|
|
|
.
|
|
|
|
@ docker run --rm \
|
|
|
|
-v ${PWD}:/pkg $(DEB_IMG_ARCH)/miniflux-deb-builder
|
|
|
|
|
|
|
|
debian-packages: clean
|
|
|
|
$(MAKE) debian DEB_IMG_ARCH=amd64
|
|
|
|
$(MAKE) debian DEB_IMG_ARCH=arm64v8
|
|
|
|
$(MAKE) debian DEB_IMG_ARCH=arm32v7
|