2
0
mirror of https://github.com/miguelmota/cointop synced 2024-11-10 13:10:26 +00:00
cointop/Makefile

272 lines
6.5 KiB
Makefile
Raw Normal View History

2019-04-22 03:20:33 +00:00
VERSION = $$(git describe --abbrev=0 --tags)
2019-12-31 19:44:45 +00:00
VERSION_DATE = $$(git log -1 --pretty='%ad' --date=format:'%Y-%m-%d' $(VERSION))
2019-04-23 07:36:51 +00:00
COMMIT_REV = $$(git rev-list -n 1 $(VERSION))
2019-04-22 03:20:33 +00:00
all: build
version:
@echo $(VERSION)
2019-04-23 07:36:51 +00:00
commit_rev:
@echo $(COMMIT_REV)
start:
2018-05-08 01:48:27 +00:00
go run main.go
2020-05-23 08:43:47 +00:00
deps-clean:
2019-12-31 02:08:13 +00:00
go clean -modcache
rm -rf vendor
2020-05-23 08:43:47 +00:00
deps-download:
2019-12-31 02:08:13 +00:00
GO111MODULE=on go mod download
2018-12-26 23:04:02 +00:00
GO111MODULE=on go mod vendor
2020-05-23 08:43:47 +00:00
deps: deps-clean deps-download
2019-06-10 02:43:24 +00:00
vendor: deps
debug:
DEBUG=1 go run main.go
2021-02-21 05:11:27 +00:00
.PHONY: build
2019-04-22 02:39:07 +00:00
build:
2020-08-04 07:07:53 +00:00
go build -ldflags "-X github.com/miguelmota/cointop/cointop.version=$(VERSION)" -o bin/cointop main.go
2019-04-22 02:39:07 +00:00
# http://macappstore.org/upx
2020-05-23 08:43:47 +00:00
build-mac: clean-mac
2020-08-04 07:07:53 +00:00
env GOARCH=amd64 go build -ldflags "-s -w -X github.com/miguelmota/cointop/cointop.version=$(VERSION)" -o bin/macos/cointop && upx bin/macos/cointop
2018-04-27 18:32:26 +00:00
2020-05-23 08:43:47 +00:00
build-linux: clean-linux
2020-08-04 07:07:53 +00:00
env GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X github.com/miguelmota/cointop/cointop.version=$(VERSION)" -o bin/linux/cointop && upx bin/linux/cointop
2018-05-11 08:20:08 +00:00
2020-05-23 08:43:47 +00:00
build-multiple: clean
2020-08-04 07:07:53 +00:00
env GOARCH=amd64 go build -ldflags "-s -w -X github.com/miguelmota/cointop/cointop.version=$(VERSION)" -o bin/cointop64 && upx bin/cointop64 && \
env GOARCH=386 go build -ldflags "-s -w -X github.com/miguelmota/cointop/cointop.version=$(VERSION)" -o bin/cointop32 && upx bin/cointop32
2020-08-22 05:27:40 +00:00
install: build
sudo mv bin/cointop /usr/local/bin
uninstall:
sudo rm /usr/local/bin/cointop
2020-05-23 08:43:47 +00:00
clean-mac:
2018-05-11 08:44:32 +00:00
go clean && \
rm -rf bin/mac
2020-05-23 08:43:47 +00:00
clean-linux:
2018-05-11 08:44:32 +00:00
go clean && \
rm -rf bin/linux
clean:
go clean && \
2018-04-27 18:32:26 +00:00
rm -rf bin/
2021-02-21 05:11:27 +00:00
.PHONY: docs
docs:
(cd docs && hugo)
docs-server:
(cd docs && hugo serve -p 8080)
docs-deploy: docs
netlify deploy --prod
test:
go test ./...
2020-05-23 08:43:47 +00:00
cointop-test:
2018-04-28 00:07:13 +00:00
go run main.go -test
2020-05-23 08:43:47 +00:00
cointop-version:
2018-12-31 23:30:23 +00:00
go run main.go -version
2020-05-23 08:43:47 +00:00
cointop-clean:
2018-12-31 23:30:23 +00:00
go run main.go -clean
2020-05-23 08:43:47 +00:00
cointop-reset:
2018-12-31 23:30:23 +00:00
go run main.go -reset
2020-05-23 08:43:47 +00:00
snap-clean:
snapcraft clean
2018-05-08 08:00:17 +00:00
rm -f cointop_*.snap
2020-08-25 06:54:49 +00:00
rm -f cointop_*.tar.bz2
2020-05-23 08:43:47 +00:00
snap-stage:
2019-12-26 03:04:52 +00:00
# https://github.com/elopio/go/issues/2
2020-08-05 06:27:22 +00:00
mv go.mod go.mod~ ;GO111MODULE=off GOFLAGS="-ldflags=-s -ldflags=-w -ldflags=-X=github.com/miguelmota/cointop/cointop.version=$(VERSION)" snapcraft stage; mv go.mod~ go.mod
2019-12-26 03:04:52 +00:00
2020-05-23 08:43:47 +00:00
snap-install:
2019-12-26 03:04:52 +00:00
sudo apt install snapd
sudo snap install snapcraft --classic
2021-03-10 10:21:03 +00:00
sudo snap install core20
2020-08-25 06:54:49 +00:00
snap-install-arch:
yay -S snapd
sudo snap install snapcraft --classic
sudo ln -s /var/lib/snapd/snap /snap # enable classic snap support
sudo snap install hello-world
snap-install-local:
sudo snap install --dangerous cointop_master_amd64.snap
2020-05-23 08:43:47 +00:00
snap-build: snap-clean snap-stage
snapcraft snap
2020-05-23 08:43:47 +00:00
snap-deploy:
snapcraft push cointop_*.snap --release stable
2020-05-23 08:43:47 +00:00
snap-remove:
snap remove cointop
2018-04-26 23:19:19 +00:00
2020-05-23 08:43:47 +00:00
snap-build-and-deploy: snap-build snap-deploy snap-clean
2018-06-23 09:12:22 +00:00
@echo "done"
2020-05-23 08:43:47 +00:00
snap: snap-build-and-deploy
2019-06-02 05:04:42 +00:00
2020-05-23 08:43:47 +00:00
flatpak-build:
2018-05-11 09:04:08 +00:00
flatpak-builder --force-clean build-dir com.github.miguelmota.Cointop.json
2020-05-23 08:43:47 +00:00
flatpak-run-test:
2018-05-11 09:04:08 +00:00
flatpak-builder --run build-dir com.github.miguelmota.Cointop.json cointop
2020-05-23 08:43:47 +00:00
flatpak-repo:
2018-05-11 09:04:08 +00:00
flatpak-builder --repo=repo --force-clean build-dir com.github.miguelmota.Cointop.json
2020-08-25 06:54:49 +00:00
flatpak-add-repo:
2018-05-11 09:55:01 +00:00
flatpak --user remote-add --no-gpg-verify cointop-repo repo
2020-08-25 06:54:49 +00:00
flatpak-add-flathub:
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
2020-05-23 08:43:47 +00:00
flatpak-remove:
2018-05-11 10:12:30 +00:00
flatpak --user remote-delete cointop-repo
2020-05-23 08:43:47 +00:00
flatpak-install:
2018-05-11 09:55:01 +00:00
flatpak --user install cointop-repo com.github.miguelmota.Cointop
2020-08-25 06:54:49 +00:00
flatpak-install-local:
flatpak-builder --force-clean --install --install-deps-from=flathub --user build-dir com.github.miguelmota.Cointop.json
2020-05-23 08:43:47 +00:00
flatpak-run:
2018-05-11 09:55:01 +00:00
flatpak run com.github.miguelmota.Cointop
2018-05-11 09:04:08 +00:00
2020-05-23 08:43:47 +00:00
flatpak-update-version:
2019-12-31 19:44:45 +00:00
xmlstarlet ed --inplace -u '/component/releases/release/@version' -v $(VERSION) .flathub/com.github.miguelmota.Cointop.appdata.xml
xmlstarlet ed --inplace -u '/component/releases/release/@date' -v $(VERSION_DATE) .flathub/com.github.miguelmota.Cointop.appdata.xml
2020-05-23 08:43:47 +00:00
rpm-install-deps:
2018-06-23 09:46:17 +00:00
sudo dnf install -y rpm-build
sudo dnf install -y dnf-plugins-core
2020-05-23 08:43:47 +00:00
rpm-cp-specs:
2018-06-23 09:47:47 +00:00
cp .rpm/cointop.spec ~/rpmbuild/SPECS/
2018-05-21 08:23:39 +00:00
2020-05-23 08:43:47 +00:00
rpm-build:
2020-08-05 20:21:20 +00:00
rpmbuild --nodeps -ba ~/rpmbuild/SPECS/cointop.spec
2018-05-21 17:18:00 +00:00
2020-05-23 08:43:47 +00:00
rpm-lint:
2018-05-21 17:18:00 +00:00
rpmlint ~/rpmbuild/SPECS/cointop.spec
2018-05-21 08:23:39 +00:00
2020-05-23 08:43:47 +00:00
rpm-dirs:
2020-01-03 09:39:55 +00:00
mkdir -p ~/rpmbuild
2018-06-23 09:46:17 +00:00
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
2020-01-03 09:39:55 +00:00
chmod -R a+rwx ~/rpmbuild
2018-06-23 09:46:17 +00:00
2020-05-23 08:43:47 +00:00
rpm-download:
2018-12-26 08:00:12 +00:00
wget https://github.com/miguelmota/cointop/archive/$(VERSION).tar.gz -O ~/rpmbuild/SOURCES/$(VERSION).tar.gz
2018-06-23 10:00:53 +00:00
2020-05-23 08:43:47 +00:00
copr-install-cli:
2018-06-23 09:46:17 +00:00
sudo dnf install -y copr-cli
2018-05-21 08:45:05 +00:00
2020-08-05 20:21:20 +00:00
copr-deps: copr-install-cli rpm-install-deps
2020-05-23 08:43:47 +00:00
copr-create-project:
2018-05-21 08:23:39 +00:00
copr-cli create cointop --chroot fedora-rawhide-x86_64
2020-05-23 08:43:47 +00:00
copr-build:
2018-05-21 08:23:39 +00:00
copr-cli build cointop ~/rpmbuild/SRPMS/cointop-*.rpm
2018-06-23 10:00:53 +00:00
rm -rf ~/rpmbuild/SRPMS/cointop-*.rpm
2018-05-21 08:23:39 +00:00
2020-08-05 20:21:20 +00:00
.PHONY: copr
copr: rpm-dirs rpm-cp-specs rpm-download rpm-build copr-build
2019-04-22 03:20:33 +00:00
2020-05-23 08:43:47 +00:00
brew-clean: brew-remove
2018-04-27 18:32:26 +00:00
brew cleanup --force cointop
brew prune
2020-05-23 08:43:47 +00:00
brew-remove:
2018-04-27 18:32:26 +00:00
brew uninstall --force cointop
2018-04-26 23:19:19 +00:00
2020-05-23 08:43:47 +00:00
brew-build: brew-remove
2018-04-26 23:19:19 +00:00
brew install --build-from-source cointop.rb
2018-04-27 18:32:26 +00:00
2020-05-23 08:43:47 +00:00
brew-audit:
2018-04-27 18:32:26 +00:00
brew audit --strict cointop.rb
2018-04-27 19:09:34 +00:00
2020-05-23 08:43:47 +00:00
brew-test:
2018-05-16 01:56:26 +00:00
brew test cointop.rb
2020-05-23 08:43:47 +00:00
brew-tap:
2018-06-08 00:46:20 +00:00
brew tap cointop/cointop https://github.com/miguelmota/cointop
2020-05-23 08:43:47 +00:00
brew-untap:
2018-06-08 00:46:20 +00:00
brew untap cointop/cointop
2020-05-23 08:43:47 +00:00
git-rm-large:
2018-04-27 19:09:34 +00:00
java -jar bfg.jar --strip-blobs-bigger-than 200K .
2020-05-23 08:43:47 +00:00
git-repack:
2018-04-27 19:09:34 +00:00
git reflog expire --expire=now --all
git fsck --full --unreachable
git repack -A -d
git gc --aggressive --prune=now
2018-05-21 07:42:32 +00:00
release:
rm -rf dist
2019-11-18 06:06:38 +00:00
VERSION=$(VERSION) goreleaser
2020-05-25 21:32:44 +00:00
docker-build:
2020-08-05 16:13:18 +00:00
docker build --build-arg VERSION=$(VERSION) -t cointop/cointop .
2020-05-25 21:32:44 +00:00
docker-run:
docker run -it cointop/cointop
docker-push:
docker push cointop/cointop:latest
2020-08-03 02:52:24 +00:00
docker-build-and-push: docker-build docker-push
2020-08-03 02:52:24 +00:00
docker-run-ssh:
2021-03-27 00:22:19 +00:00
docker run -p 2222:22 -v ~/.ssh/demo:/keys -v ~/.cache/cointop:/tmp/cointop_config --entrypoint cointop -it cointop/cointop server -k /keys/id_rsa
2020-12-21 06:05:14 +00:00
2021-03-17 06:18:44 +00:00
ssh-server:
go run cmd/cointop/cointop.go server -p 2222
ssh-client:
ssh localhost -p 2222
2020-12-21 06:05:14 +00:00
mp3:
cat <(printf "package notifier\nfunc Mp3() string {\nreturn \`" "") <(xxd -p media/notification.mp3 | tr -d "\n") <(printf "\`\n}" "") > pkg/notifier/mp3.go
2021-03-27 00:22:19 +00:00
pkg2appimage-install:
wget -c https://github.com/$(wget -q https://github.com/AppImage/pkg2appimage/releases -O - | grep "pkg2appimage-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)
chmod +x pkg2appimage-*.AppImage
appimage-clean-workspace:
rm -rf .appimage_workspace
appimage-clean: appimage-clean-workspace
rm -rf *.AppImage
.PHONY: appimage
appimage: appimage-clean-workspace
( \
mkdir -p .appimage_workspace && \
mkdir -p dist/appimage && \
cd .appimage_workspace && \
../pkg2appimage-*.AppImage ../.appimage/cointop.yml && \
cp out/cointop-*.AppImage ../dist/appimage/ \
)
appimage-run:
./dist/appimage/cointop-*.AppImage